Lines Matching refs:dtls

153   coap_dtls_context_t dtls;
466 coap_dtls_context_t *dtls =
469 int r = HMAC_Init_ex(dtls->cookie_hmac, NULL, 0, NULL, NULL);
470 r &= HMAC_Update(dtls->cookie_hmac,
473 r &= HMAC_Update(dtls->cookie_hmac,
476 r &= HMAC_Final(dtls->cookie_hmac, cookie, cookie_len);
844 context->dtls.ctx = SSL_CTX_new(DTLS_method());
845 if (!context->dtls.ctx)
847 SSL_CTX_set_min_proto_version(context->dtls.ctx, DTLS1_2_VERSION);
848 SSL_CTX_set_app_data(context->dtls.ctx, &context->dtls);
849 SSL_CTX_set_read_ahead(context->dtls.ctx, 1);
850 coap_set_user_prefs(context->dtls.ctx);
857 context->dtls.cookie_hmac = HMAC_CTX_new();
858 if (!HMAC_Init_ex(context->dtls.cookie_hmac, cookie_secret, (int)sizeof(cookie_secret),
861 SSL_CTX_set_cookie_generate_cb(context->dtls.ctx, coap_dtls_generate_cookie);
862 SSL_CTX_set_cookie_verify_cb(context->dtls.ctx, coap_dtls_verify_cookie);
863 SSL_CTX_set_info_callback(context->dtls.ctx, coap_dtls_info_callback);
864 SSL_CTX_set_options(context->dtls.ctx, SSL_OP_NO_QUERY_MTU);
866 SSL_CTX_set_options(context->dtls.ctx, SSL_OP_LEGACY_SERVER_CONNECT);
868 context->dtls.meth = BIO_meth_new(BIO_TYPE_DGRAM, "coapdgram");
869 if (!context->dtls.meth)
871 context->dtls.bio_addr = BIO_ADDR_new();
872 if (!context->dtls.bio_addr)
874 BIO_meth_set_write(context->dtls.meth, coap_dgram_write);
875 BIO_meth_set_read(context->dtls.meth, coap_dgram_read);
876 BIO_meth_set_puts(context->dtls.meth, coap_dgram_puts);
877 BIO_meth_set_ctrl(context->dtls.meth, coap_dgram_ctrl);
878 BIO_meth_set_create(context->dtls.meth, coap_dgram_create);
879 BIO_meth_set_destroy(context->dtls.meth, coap_dgram_destroy);
921 SSL_CTX_set_psk_server_callback(o_context->dtls.ctx,
931 SSL_CTX_use_psk_identity_hint(o_context->dtls.ctx, hint);
938 SSL_CTX_set_tlsext_servername_arg(o_context->dtls.ctx,
940 SSL_CTX_set_tlsext_servername_callback(o_context->dtls.ctx,
949 SSL_CTX_set_client_hello_cb(o_context->dtls.ctx,
960 if (!o_context->dtls.ssl) {
962 o_context->dtls.ssl = SSL_new(o_context->dtls.ctx);
963 if (!o_context->dtls.ssl)
965 bio = BIO_new(o_context->dtls.meth);
967 SSL_free(o_context->dtls.ssl);
968 o_context->dtls.ssl = NULL;
971 SSL_set_bio(o_context->dtls.ssl, bio, bio);
972 SSL_set_app_data(o_context->dtls.ssl, NULL);
973 SSL_set_options(o_context->dtls.ssl, SSL_OP_COOKIE_EXCHANGE);
974 SSL_set_mtu(o_context->dtls.ssl, COAP_DEFAULT_MTU);
993 if (!o_context->dtls.ssl) {
995 o_context->dtls.ssl = SSL_new(o_context->dtls.ctx);
996 if (!o_context->dtls.ssl)
998 bio = BIO_new(o_context->dtls.meth);
1000 SSL_free(o_context->dtls.ssl);
1001 o_context->dtls.ssl = NULL;
1004 SSL_set_bio(o_context->dtls.ssl, bio, bio);
1005 SSL_set_app_data(o_context->dtls.ssl, NULL);
1006 SSL_set_options(o_context->dtls.ssl, SSL_OP_COOKIE_EXCHANGE);
1007 SSL_set_mtu(o_context->dtls.ssl, COAP_DEFAULT_MTU);
2153 SSL_CTX_set_app_data(ctx, &context->dtls);
2251 SSL_CTX_set_app_data(ctx, &o_context->dtls);
2658 if (context->dtls.ctx) {
2661 if (!setup_pki_server(context->dtls.ctx, setup_data))
2676 SSL_CTX_set_tlsext_servername_arg(context->dtls.ctx, &context->setup_data);
2677 SSL_CTX_set_tlsext_servername_callback(context->dtls.ctx,
2680 SSL_CTX_set_client_hello_cb(context->dtls.ctx,
2721 if (!context->dtls.ssl) {
2723 context->dtls.ssl = SSL_new(context->dtls.ctx);
2724 if (!context->dtls.ssl)
2726 bio = BIO_new(context->dtls.meth);
2728 SSL_free(context->dtls.ssl);
2729 context->dtls.ssl = NULL;
2732 SSL_set_bio(context->dtls.ssl, bio, bio);
2733 SSL_set_app_data(context->dtls.ssl, NULL);
2734 SSL_set_options(context->dtls.ssl, SSL_OP_COOKIE_EXCHANGE);
2735 SSL_set_mtu(context->dtls.ssl, COAP_DEFAULT_MTU);
2748 if (context->dtls.ctx) {
2749 if (!SSL_CTX_load_verify_locations(context->dtls.ctx, ca_file, ca_dir)) {
2780 if (context->dtls.ssl)
2781 SSL_free(context->dtls.ssl);
2782 if (context->dtls.ctx)
2783 SSL_CTX_free(context->dtls.ctx);
2784 if (context->dtls.cookie_hmac)
2785 HMAC_CTX_free(context->dtls.cookie_hmac);
2786 if (context->dtls.meth)
2787 BIO_meth_free(context->dtls.meth);
2788 if (context->dtls.bio_addr)
2789 BIO_ADDR_free(context->dtls.bio_addr);
2821 coap_dtls_context_t *dtls = &((coap_openssl_context_t *)session->context->dtls_context)->dtls;
2825 nssl = SSL_new(dtls->ctx);
2828 nbio = BIO_new(dtls->meth);
2835 ssl = dtls->ssl;
2836 dtls->ssl = nssl;
2963 coap_dtls_context_t *dtls = &context->dtls;
2965 ssl = SSL_new(dtls->ctx);
2968 bio = BIO_new(dtls->meth);
3064 coap_log_debug("* %s: dtls: sent %4d bytes\n",
3067 coap_log_debug("* %s: dtls: sent %4d of %4zd bytes\n",
3116 coap_dtls_context_t *dtls = &((coap_openssl_context_t *)session->context->dtls_context)->dtls;
3120 SSL_set_mtu(dtls->ssl, (long)session->mtu);
3121 ssl_data = (coap_ssl_data *)BIO_get_data(SSL_get_rbio(dtls->ssl));
3130 r = DTLSv1_listen(dtls->ssl, dtls->bio_addr);
3132 int err = SSL_get_error(dtls->ssl, r);
3214 coap_log_debug("* %s: dtls: recv %4d bytes\n",