Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup client-tls-resume and add new apps to git ignore #368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions tls/client-tls-resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ int main(int argc, char** argv)
return 0;
}

#ifdef DEBUG_WOLFSSL
wolfSSL_Debugging_ON();
#endif


/* Initialize wolfSSL */
Expand Down Expand Up @@ -174,11 +177,13 @@ int main(int argc, char** argv)


/* Save the session */
session = wolfSSL_get_session(ssl);
session = wolfSSL_get1_session(ssl);
julek-wolfssl marked this conversation as resolved.
Show resolved Hide resolved

/* Close the socket */
wolfSSL_free(ssl);
ssl = NULL;
close(sockfd);
sockfd = SOCKET_INVALID;



Expand All @@ -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;
}

Expand Down Expand Up @@ -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);
Comment on lines 286 to 288
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be guarded. Using get1 means that the session always has to be free'd.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a NULL check. So if wolfSSL_get1_session failed, then wouldn't need to free, right?

Expand Down
4 changes: 2 additions & 2 deletions tls/client-tls13-resume.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}

Expand Down