From f5f883597e49efeec188be83f34277ee6a3f3a78 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Sat, 24 Oct 2020 13:06:42 -0700 Subject: [PATCH] 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. --- wolfcrypt/src/rsa.c | 2 +- wolfcrypt/src/wc_encrypt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index faa403173..a77a32099 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -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; diff --git a/wolfcrypt/src/wc_encrypt.c b/wolfcrypt/src/wc_encrypt.c index 39dbeec5a..7afc032b5 100644 --- a/wolfcrypt/src/wc_encrypt.c +++ b/wolfcrypt/src/wc_encrypt.c @@ -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