From 4caa88e19f2edac6f9d8c9f5b20c4e6fd04855f3 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Mon, 6 Feb 2023 08:50:35 -0600 Subject: [PATCH] Cleanup client-tls-resume and add new apps to git ignore --- .gitignore | 4 +++- tls/client-tls-resume.c | 12 ++++++++++-- tls/client-tls13-resume.c | 4 ++-- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index d6b55809a..f51789a4b 100644 --- a/.gitignore +++ b/.gitignore @@ -55,12 +55,14 @@ android/wolfssljni-ndk-sample/proguard-project.txt /dtls/client-dtls-shared /dtls/client-dtls /dtls/client-udp +/dtls/client-dtls13 /dtls/server-dtls-callback /dtls/server-dtls-ipv6 /dtls/server-dtls-nonblocking /dtls/server-dtls-threaded /dtls/server-dtls /dtls/server-udp +/dtls/server-dtls13 /psk/client-psk-bio-custom /psk/client-psk-nonblocking @@ -106,7 +108,7 @@ android/wolfssljni-ndk-sample/proguard-project.txt /tls/server-tls-uart /tls/server-tls-verifycallback /tls/server-tls-writedup - +/tls/server-tls-poll-perf crypto/3des/3des-file-encrypt diff --git a/tls/client-tls-resume.c b/tls/client-tls-resume.c index 02e118142..bdfe37e25 100644 --- a/tls/client-tls-resume.c +++ b/tls/client-tls-resume.c @@ -63,6 +63,9 @@ int main(int argc, char** argv) return 0; } +#ifdef DEBUG_WOLFSSL + wolfSSL_Debugging_ON(); +#endif /* Initialize wolfSSL */ @@ -174,11 +177,13 @@ int main(int argc, char** argv) /* Save the session */ - session = wolfSSL_get_session(ssl); + session = wolfSSL_get1_session(ssl); /* Close the socket */ wolfSSL_free(ssl); + ssl = NULL; close(sockfd); + sockfd = SOCKET_INVALID; @@ -197,7 +202,8 @@ int main(int argc, char** argv) /* Set up to resume the session */ if ((ret = wolfSSL_set_session(sslRes, session)) != WOLFSSL_SUCCESS) { - fprintf(stderr, "ERROR: failed to set session\n"); + fprintf(stderr, "Failed to set session, make sure session ticket " + "(--enable-session-ticket) is enabled\n"); goto exit; } @@ -275,6 +281,8 @@ int main(int argc, char** argv) /* Cleanup and return */ if (ssl) wolfSSL_free(ssl); /* Free the wolfSSL object */ + if (sslRes) + wolfSSL_free(sslRes); /* Free the wolfSSL object */ #ifdef OPENSSL_EXTRA if (session) wolfSSL_SESSION_free(session); diff --git a/tls/client-tls13-resume.c b/tls/client-tls13-resume.c index c9b9d23f1..16e952f94 100644 --- a/tls/client-tls13-resume.c +++ b/tls/client-tls13-resume.c @@ -312,8 +312,8 @@ int main(int argc, char** argv) /* Set up to resume the session */ if ((ret = wolfSSL_set_session(sslRes, session)) != WOLFSSL_SUCCESS) { - fprintf(stderr, "Failed to set session, make sure session tickets " - "(--enable-session ticket) is enabled\n"); + fprintf(stderr, "Failed to set session, make sure session ticket " + "(--enable-session-ticket) is enabled\n"); /*goto exit;*/ /* not fatal */ }