mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-03 20:54:41 +02:00
add test for get0 session peer certificate
This commit is contained in:
committed by
Eric Blankenhorn
parent
653235cd57
commit
49def96998
@@ -13465,7 +13465,7 @@ WOLFSSL_X509* wolfSSL_SESSION_get0_peer(WOLFSSL_SESSION* session)
|
|||||||
WOLFSSL_MSG("bad count found");
|
WOLFSSL_MSG("bad count found");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return wolfSSL_get_chain_X509(&session->chain, count - 1);
|
return wolfSSL_get_chain_X509(&session->chain, 0);
|
||||||
}
|
}
|
||||||
WOLFSSL_MSG("No session passed in");
|
WOLFSSL_MSG("No session passed in");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
14
tests/api.c
14
tests/api.c
@@ -24305,6 +24305,20 @@ static void test_wolfSSL_SESSION(void)
|
|||||||
fdOpenSession(Task_self());
|
fdOpenSession(Task_self());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SESSION_CERTS)
|
||||||
|
{
|
||||||
|
X509 *x509;
|
||||||
|
char buf[30];
|
||||||
|
int bufSz;
|
||||||
|
|
||||||
|
AssertNotNull(x509 = SSL_SESSION_get0_peer(sess));
|
||||||
|
AssertIntEQ((bufSz = X509_NAME_get_text_by_NID(
|
||||||
|
X509_get_subject_name(x509), NID_organizationalUnitName,
|
||||||
|
buf, sizeof(buf))), 7);
|
||||||
|
AssertIntEQ(XMEMCMP(buf, "Support", bufSz), 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
AssertNotNull(sess_copy = wolfSSL_SESSION_dup(sess));
|
AssertNotNull(sess_copy = wolfSSL_SESSION_dup(sess));
|
||||||
wolfSSL_SESSION_free(sess_copy);
|
wolfSSL_SESSION_free(sess_copy);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user