Skip to content

Commit 9711070

Browse files
authored
Merge pull request #7430 from jpbland1/check-session-setup
Add `wolfSSL_SessionIsSetup`
2 parents 3381774 + 804cf1c commit 9711070

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/ssl_sess.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl)
283283
return sess;
284284
}
285285

286+
/* session is a private struct, return if it is setup or not */
287+
WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session)
288+
{
289+
if (session != NULL)
290+
return session->isSetup;
291+
return 0;
292+
}
286293

287294
/*
288295
* Sets the session object to use when establishing a TLS/SSL session using

tests/api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47260,6 +47260,7 @@ static int test_wolfSSL_SESSION(void)
4726047260

4726147261
ExpectPtrNE((sess = wolfSSL_get1_session(ssl)), NULL); /* ref count 1 */
4726247262
ExpectPtrNE((sess_copy = wolfSSL_get1_session(ssl)), NULL); /* ref count 2 */
47263+
ExpectIntEQ(wolfSSL_SessionIsSetup(sess), 1);
4726347264
#ifdef HAVE_EXT_CACHE
4726447265
ExpectPtrEq(sess, sess_copy); /* they should be the same pointer but without
4726547266
* HAVE_EXT_CACHE we get new objects each time */

wolfssl/ssl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ WOLFSSL_API const char* wolfSSL_SESSION_CIPHER_get_name(const WOLFSSL_SESSION*
16961696
WOLFSSL_API const char* wolfSSL_get_cipher(WOLFSSL* ssl);
16971697
WOLFSSL_API void wolfSSL_sk_CIPHER_free(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk);
16981698
WOLFSSL_API WOLFSSL_SESSION* wolfSSL_get1_session(WOLFSSL* ssl);
1699+
WOLFSSL_API int wolfSSL_SessionIsSetup(WOLFSSL_SESSION* session);
16991700

17001701
WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new(void);
17011702
WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_new_ex(void* heap);

0 commit comments

Comments
 (0)