Addressing PR comments

This commit is contained in:
Andras Fekete
2023-02-08 16:35:03 -05:00
parent 5b36d5235c
commit 767c282c1d
2 changed files with 9 additions and 8 deletions

View File

@@ -15424,14 +15424,7 @@ static int ConfirmSignature(SignatureCtx* sigCtx,
ERROR_OUT(MEMORY_E, exit_cs); ERROR_OUT(MEMORY_E, exit_cs);
} }
#endif #endif
if((ret = mp_init(r)) != 0) { if ((ret = mp_init_multi(r, s, NULL, NULL, NULL, NULL)) != MP_OKAY) {
WOLFSSL_MSG("Variable ('r') initialization error");
WOLFSSL_ERROR_VERBOSE(ret);
goto exit_cs;
}
if((ret = mp_init(s)) != 0) {
WOLFSSL_MSG("Variable ('s') initialization error");
WOLFSSL_ERROR_VERBOSE(ret);
goto exit_cs; goto exit_cs;
} }

View File

@@ -4035,6 +4035,7 @@ int wc_RsaPSS_CheckPadding_ex2(const byte* in, word32 inSz, byte* sig,
} }
} }
#ifdef WOLFSSL_PSS_LONG_SALT
/* if long salt is larger then default maximum buffer then allocate a buffer */ /* if long salt is larger then default maximum buffer then allocate a buffer */
if (ret == 0 && sizeof(sigCheckBuf) < (RSA_PSS_PAD_SZ + inSz + saltLen)) { if (ret == 0 && sizeof(sigCheckBuf) < (RSA_PSS_PAD_SZ + inSz + saltLen)) {
sigCheck = (byte*)XMALLOC(RSA_PSS_PAD_SZ + inSz + saltLen, heap, sigCheck = (byte*)XMALLOC(RSA_PSS_PAD_SZ + inSz + saltLen, heap,
@@ -4043,6 +4044,11 @@ int wc_RsaPSS_CheckPadding_ex2(const byte* in, word32 inSz, byte* sig,
ret = MEMORY_E; ret = MEMORY_E;
} }
} }
#else
if (ret == 0 && sizeof(sigCheckBuf) < (RSA_PSS_PAD_SZ + inSz + saltLen)) {
ret = BUFFER_E;
}
#endif
/* Exp Hash = HASH(8 * 0x00 | Message Hash | Salt) */ /* Exp Hash = HASH(8 * 0x00 | Message Hash | Salt) */
if (ret == 0) { if (ret == 0) {
@@ -4059,9 +4065,11 @@ int wc_RsaPSS_CheckPadding_ex2(const byte* in, word32 inSz, byte* sig,
} }
} }
#ifdef WOLFSSL_PSS_LONG_SALT
if (sigCheck != NULL && sigCheck != sigCheckBuf) { if (sigCheck != NULL && sigCheck != sigCheckBuf) {
XFREE(sigCheck, heap, DYNAMIC_TYPE_RSA_BUFFER); XFREE(sigCheck, heap, DYNAMIC_TYPE_RSA_BUFFER);
} }
#endif
(void)heap; /* unused if memory is disabled */ (void)heap; /* unused if memory is disabled */
return ret; return ret;