mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
Fix unit test coverity defect in test_wc_PKCS7_SetAESKeyWrapUnwrapCb()
This commit is contained in:
15
tests/api.c
15
tests/api.c
@@ -18229,8 +18229,13 @@ static int test_wc_PKCS7_SetAESKeyWrapUnwrapCb(void)
|
||||
WC_RNG rng;
|
||||
#endif
|
||||
|
||||
/* Load test certs */
|
||||
#ifdef USE_CERT_BUFFERS_256
|
||||
#ifdef ECC_TIMING_RESISTANT
|
||||
XMEMSET(&rng, 0, sizeof(WC_RNG));
|
||||
ExpectIntEQ(wc_InitRng(&rng), 0);
|
||||
#endif
|
||||
|
||||
/* Load test certs */
|
||||
#ifdef USE_CERT_BUFFERS_256
|
||||
ExpectNotNull(eccCert = (byte*)XMALLOC(TWOK_BUF, HEAP_HINT,
|
||||
DYNAMIC_TYPE_TMP_BUFFER));
|
||||
/* Init buffer. */
|
||||
@@ -18244,7 +18249,7 @@ static int test_wc_PKCS7_SetAESKeyWrapUnwrapCb(void)
|
||||
if (eccPrivKey != NULL) {
|
||||
XMEMCPY(eccPrivKey, ecc_clikey_der_256, eccPrivKeySz);
|
||||
}
|
||||
#else /* File system. */
|
||||
#else /* File system. */
|
||||
ExpectTrue((certFile = XFOPEN(eccClientCert, "rb")) != XBADFILE);
|
||||
eccCertSz = (word32)FOURK_BUF;
|
||||
ExpectNotNull(eccCert = (byte*)XMALLOC(FOURK_BUF, HEAP_HINT,
|
||||
@@ -18263,7 +18268,7 @@ static int test_wc_PKCS7_SetAESKeyWrapUnwrapCb(void)
|
||||
if (keyFile != XBADFILE) {
|
||||
XFCLOSE(keyFile);
|
||||
}
|
||||
#endif /* USE_CERT_BUFFERS_256 */
|
||||
#endif /* USE_CERT_BUFFERS_256 */
|
||||
|
||||
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
|
||||
ExpectIntEQ(wc_PKCS7_InitWithCert(pkcs7, eccCert, eccCertSz), 0);
|
||||
@@ -18279,8 +18284,6 @@ static int test_wc_PKCS7_SetAESKeyWrapUnwrapCb(void)
|
||||
pkcs7->singleCert = eccCert;
|
||||
pkcs7->singleCertSz = (word32)eccCertSz;
|
||||
#ifdef ECC_TIMING_RESISTANT
|
||||
XMEMSET(&rng, 0, sizeof(WC_RNG));
|
||||
ExpectIntEQ(wc_InitRng(&rng), 0);
|
||||
pkcs7->rng = &rng;
|
||||
#endif
|
||||
}
|
||||
|
@@ -16513,7 +16513,7 @@ static int ValidateGmtime(struct tm* inTime)
|
||||
#if !defined(NO_ASN_TIME) && !defined(USER_TIME) && \
|
||||
!defined(TIME_OVERRIDES) && (defined(OPENSSL_EXTRA) || defined(HAVE_PKCS7))
|
||||
/* Set current time string, either UTC or GeneralizedTime.
|
||||
* (void*) tm should be a pointer to time_t, output is placed in buf.
|
||||
* (void*) currTime should be a pointer to time_t, output is placed in buf.
|
||||
*
|
||||
* Return time string length placed in buf on success, negative on error */
|
||||
int GetAsnTimeString(void* currTime, byte* buf, word32 len)
|
||||
|
Reference in New Issue
Block a user