Regression testing: fixes

src/x509.c: wolfssl_x509_name_entry_set() ne->object is freed if call to
wolfSSL_OBJ_nid2obj_ex() fails. Always assign directly back to
ne->object.

wolfcrypt/test/test.c: aes_ctr_test() doesn't need AES decrypt
./configure '--disable-shared' '--enable-cryptonly'
'CFLAGS=-DNO_AES_DECRYPT' '--disable-aescbc' '--disable-aesofb'
'--disable-aescfb' '--disable-aesgcm' '--disable-aesccm'
'--enable-aesctr' '--disable-aesxts' '--disable-aeseax'

tests/api.c: test_X509_STORE_InvalidCa() only defined when !NO_RSA
./configure '--disable-shared' '--enable-opensslall' '--disable-rsa'

tests/api.c: test_wolfSSL_GENERAL_NAME_print() free ridObj if not
assigned into gn.
This commit is contained in:
Sean Parkinson
2024-12-20 09:25:03 +10:00
parent 65fc8f8d77
commit b7c1e1cf35
3 changed files with 6 additions and 9 deletions

View File

@ -12667,15 +12667,9 @@ err:
static void wolfssl_x509_name_entry_set(WOLFSSL_X509_NAME_ENTRY* ne, static void wolfssl_x509_name_entry_set(WOLFSSL_X509_NAME_ENTRY* ne,
int nid, int type, const unsigned char *data, int dataSz) int nid, int type, const unsigned char *data, int dataSz)
{ {
WOLFSSL_ASN1_OBJECT* object;
ne->nid = nid; ne->nid = nid;
/* Reuse the object if already available. */ /* Reuse the object if already available. */
object = wolfSSL_OBJ_nid2obj_ex(nid, ne->object); ne->object = wolfSSL_OBJ_nid2obj_ex(nid, ne->object);
if (object != NULL) {
/* Set the object when no error. */
ne->object = object;
}
if (ne->value == NULL) { if (ne->value == NULL) {
ne->value = wolfSSL_ASN1_STRING_type_new(type); ne->value = wolfSSL_ASN1_STRING_type_new(type);
} }

View File

@ -72825,6 +72825,9 @@ static int test_wolfSSL_GENERAL_NAME_print(void)
wolfSSL_ASN1_STRING_free(gn->d.ia5); wolfSSL_ASN1_STRING_free(gn->d.ia5);
gn->d.registeredID = ridObj; gn->d.registeredID = ridObj;
} }
else {
wolfSSL_ASN1_OBJECT_free(ridObj);
}
ExpectIntEQ(GENERAL_NAME_print(out, gn), 1); ExpectIntEQ(GENERAL_NAME_print(out, gn), 1);
XMEMSET(outbuf,0,sizeof(outbuf)); XMEMSET(outbuf,0,sizeof(outbuf));
ExpectIntGT(BIO_read(out, outbuf, sizeof(outbuf)), 0); ExpectIntGT(BIO_read(out, outbuf, sizeof(outbuf)), 0);
@ -100778,7 +100781,7 @@ TEST_CASE testCases[] = {
TEST_DECL(test_wolfSSL_X509_STORE_CTX), TEST_DECL(test_wolfSSL_X509_STORE_CTX),
TEST_DECL(test_wolfSSL_X509_STORE_CTX_ex), TEST_DECL(test_wolfSSL_X509_STORE_CTX_ex),
TEST_DECL(test_X509_STORE_untrusted), TEST_DECL(test_X509_STORE_untrusted),
#if defined(OPENSSL_ALL) #if defined(OPENSSL_ALL) && !defined(NO_RSA)
TEST_DECL(test_X509_STORE_InvalidCa), TEST_DECL(test_X509_STORE_InvalidCa),
#endif #endif
TEST_DECL(test_wolfSSL_X509_STORE_CTX_trusted_stack_cleanup), TEST_DECL(test_wolfSSL_X509_STORE_CTX_trusted_stack_cleanup),

View File

@ -12861,7 +12861,7 @@ static wc_test_ret_t aes_cbc_oneshot_test(void)
} }
#endif #endif
#if defined(WOLFSSL_AES_COUNTER) && defined(HAVE_AES_DECRYPT) #if defined(WOLFSSL_AES_COUNTER)
WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_ctr_test(void) WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_ctr_test(void)
{ {
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC) #if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)