From 3da499b639a3f64b03634a096465491c50d07604 Mon Sep 17 00:00:00 2001 From: ichishino Date: Tue, 19 Dec 2023 15:27:39 +0900 Subject: [PATCH] fix dtls example --- examples/dtls_client/main.c | 28 ---------------------------- examples/dtls_server/main.c | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 28 deletions(-) diff --git a/examples/dtls_client/main.c b/examples/dtls_client/main.c index 3a5e94a..46b3279 100644 --- a/examples/dtls_client/main.c +++ b/examples/dtls_client/main.c @@ -111,28 +111,6 @@ app_on_tls_handshake( } #ifdef CO_USE_TLS - -#ifndef CO_USE_WOLFSSL -// TODO -int -app_on_tls_verify_cookie( - SSL* ssl, - const unsigned char* cookie, - unsigned int cookie_len -) -{ - (void)ssl; - (void)cookie; - (void)cookie_len; - - printf("cookie: %*.*s\n", - cookie_len, cookie_len, (char*)cookie); - - // ok - return 1; -} -#endif - int app_on_tls_verify_peer( int preverify_ok, @@ -145,7 +123,6 @@ app_on_tls_verify_peer( // ok return 1; } - #endif @@ -169,11 +146,6 @@ app_tls_setup( SSL_CTX_set_verify( ssl_ctx, SSL_VERIFY_PEER, app_on_tls_verify_peer); - #ifndef CO_USE_WOLFSSL - // TODO - SSL_CTX_set_cookie_verify_cb(ssl_ctx, app_on_tls_verify_cookie); - #endif - tls_ctx->ssl_ctx = ssl_ctx; #endif diff --git a/examples/dtls_server/main.c b/examples/dtls_server/main.c index 08e9e12..0a5f976 100644 --- a/examples/dtls_server/main.c +++ b/examples/dtls_server/main.c @@ -165,6 +165,7 @@ app_on_tls_handshake( #ifdef CO_USE_TLS #ifndef CO_USE_WOLFSSL + // TODO int app_on_tls_generate_cookie( @@ -180,6 +181,22 @@ app_on_tls_generate_cookie( return 1; } + +// TODO +int +app_on_tls_verify_cookie( + SSL* ssl, + const unsigned char* cookie, + unsigned int cookie_len +) +{ + (void)ssl; + (void)cookie; + (void)cookie_len; + + return 1; +} + #endif #endif @@ -226,6 +243,8 @@ app_tls_setup( // TODO SSL_CTX_set_cookie_generate_cb( ssl_ctx, app_on_tls_generate_cookie); + SSL_CTX_set_cookie_verify_cb( + ssl_ctx, app_on_tls_verify_cookie); #endif tls_ctx->ssl_ctx = ssl_ctx;