Fix unit test coverity defect in test_wc_PKCS7_SetAESKeyWrapUnwrapCb()

This commit is contained in:
Josh Holtrop
2025-07-30 10:37:28 -04:00
parent a1e2ba2cd3
commit ccb463dd1d
2 changed files with 41 additions and 38 deletions

View File

@@ -18229,6 +18229,11 @@ static int test_wc_PKCS7_SetAESKeyWrapUnwrapCb(void)
WC_RNG rng;
#endif
#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,
@@ -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
}

View File

@@ -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)