diff --git a/wolfcrypt/src/rsa.c b/wolfcrypt/src/rsa.c index 085cc4302..743c6644e 100644 --- a/wolfcrypt/src/rsa.c +++ b/wolfcrypt/src/rsa.c @@ -657,8 +657,8 @@ static int wc_RsaUnPad_OAEP(byte *pkcsBlock, unsigned int pkcsBlockLen, /* done with use of tmp buffer */ XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER); - /* advance idx to index of PS and msg separator */ - idx = hLen + 2 + hLen; + /* advance idx to index of PS and msg separator, account for PS size of 0*/ + idx = hLen + 1 + hLen; while (idx < pkcsBlockLen && pkcsBlock[idx] == 0) {idx++;} /* create hash of label for comparision with hash sent */