Skip to content

Commit e1ec0c1

Browse files
committed
Add WOLFSSL_KEY_GEN guard for RSA test and balance wolfSSL_Init refcount in serial-0 tests
1 parent 3a2b3e6 commit e1ec0c1

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

tests/api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21391,7 +21391,7 @@ static int test_MakeCertWith0Ser(void)
2139121391
EXPECT_DECLS;
2139221392
#if defined(WOLFSSL_CERT_REQ) && !defined(NO_ASN_TIME) && \
2139321393
defined(WOLFSSL_CERT_GEN) && !defined(NO_RSA) && \
21394-
defined(WOLFSSL_ASN_TEMPLATE)
21394+
defined(WOLFSSL_KEY_GEN) && defined(WOLFSSL_ASN_TEMPLATE)
2139521395
Cert cert;
2139621396
DecodedCert decodedCert;
2139721397
byte der[FOURK_BUF];

tests/api/test_asn.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,9 @@ int test_SerialNumber0_RootCA(void)
10731073
wolfSSL_CertManagerFree(cm);
10741074
cm = NULL;
10751075
}
1076+
/* Balance the wolfSSL_Init refcount incremented by internal
1077+
* wolfSSL_CTX_new_ex calls in CertManagerLoadCA/Verify. */
1078+
wolfSSL_Cleanup();
10761079

10771080
/* Test 4: Self-signed non-CA certificate with serial 0 should be rejected */
10781081
ExpectNotNull(cm = wolfSSL_CertManagerNew());
@@ -1083,6 +1086,7 @@ int test_SerialNumber0_RootCA(void)
10831086
wolfSSL_CertManagerFree(cm);
10841087
cm = NULL;
10851088
}
1089+
wolfSSL_Cleanup();
10861090
#endif /* !WOLFSSL_NO_ASN_STRICT && !WOLFSSL_PYTHON &&
10871091
!WOLFSSL_ASN_ALLOW_0_SERIAL &&
10881092
!WOLFSSL_TEST_APPLE_NATIVE_CERT_VALIDATION */

0 commit comments

Comments
 (0)