RSA PSS Fix

1. Change the utility function in wc_encrypt that returns the size of a
   hash to initialize the size to HASH_TYPE_E, like the other utility
   functions.
2. When getting the hash size returns an error, RSA-PSS verify inline
   should return a BAD_FUNC_ARG error.
This commit is contained in:
John Safranek
2020-10-24 13:06:42 -07:00
parent 3f5620089e
commit f5f883597e
2 changed files with 2 additions and 2 deletions

View File

@@ -3472,7 +3472,7 @@ int wc_RsaPSS_VerifyCheckInline(byte* in, word32 inLen, byte** out,
hLen = wc_HashGetDigestSize(hash);
if (hLen < 0)
return hLen;
return BAD_FUNC_ARG;
if ((word32)hLen != digestLen)
return BAD_FUNC_ARG;

View File

@@ -374,7 +374,7 @@ int wc_CryptKey(const char* password, int passwordSz, byte* salt,
int saltSz, int iterations, int id, byte* input,
int length, int version, byte* cbcIv, int enc, int shaOid)
{
int typeH;
int typeH = WC_HASH_TYPE_NONE;
int derivedLen = 0;
int ret = 0;
#ifdef WOLFSSL_SMALL_STACK