Skip to content

Commit

Permalink
Merge pull request #7430 from jpbland1/check-session-setup
Browse files Browse the repository at this point in the history
Add `wolfSSL_SessionIsSetup`
  • Loading branch information
douzzer committed May 7, 2024
2 parents 3381774 + 804cf1c commit 9711070
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/ssl_sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,13 @@ WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl)
return sess;
}

/* session is a private struct, return if it is setup or not */
WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session)
{
if (session != NULL)
return session->isSetup;
return 0;
}

/*
* Sets the session object to use when establishing a TLS/SSL session using
Expand Down
1 change: 1 addition & 0 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -47260,6 +47260,7 @@ static int test_wolfSSL_SESSION(void)

ExpectPtrNE((sess = wolfSSL_get1_session(ssl)), NULL); /* ref count 1 */
ExpectPtrNE((sess_copy = wolfSSL_get1_session(ssl)), NULL); /* ref count 2 */
ExpectIntEQ(wolfSSL_SessionIsSetup(sess), 1);
#ifdef HAVE_EXT_CACHE
ExpectPtrEq(sess, sess_copy); /* they should be the same pointer but without
* HAVE_EXT_CACHE we get new objects each time */
Expand Down
1 change: 1 addition & 0 deletions wolfssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1696,6 +1696,7 @@ WOLFSSL_API const char* wolfSSL_SESSION_CIPHER_get_name(const WOLFSSL_SESSION*
WOLFSSL_API const char* wolfSSL_get_cipher(WOLFSSL* ssl);
WOLFSSL_API void wolfSSL_sk_CIPHER_free(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk);
WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl);
WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session);

WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new(void);
WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new_ex(void* heap);
Expand Down

0 comments on commit 9711070

Please sign in to comment.