Skip to content

Commit 2b83953

Browse files
committed
Fix for QAT RNG to allow zero length. Resolves PSS test case where wc_RNG_GenerateBlock is called for saltLen == 0.
1 parent 308893a commit 2b83953

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

wolfcrypt/src/port/intel/quickassist.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3343,10 +3343,15 @@ int IntelQaDrbg(WC_ASYNC_DEV* dev, byte* rngBuf, word32 rngSz)
33433343
CpaFlatBuffer* pOut = NULL;
33443344
word32 idx = 0, gen = 0;
33453345

3346-
if (dev == NULL || rngBuf == NULL || rngSz == 0) {
3346+
if (dev == NULL || rngBuf == NULL) {
33473347
return BAD_FUNC_ARG;
33483348
}
33493349

3350+
/* This function can be called with rngSz == 0 */
3351+
if (rngSz == 0) {
3352+
return 0; /* no data to get */
3353+
}
3354+
33503355
#ifdef QAT_DEBUG
33513356
printf("IntelQaDrbg: dev %p, buf %p, sz %d\n", dev, rngBuf, rngSz);
33523357
#endif

0 commit comments

Comments
 (0)