Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/api/test_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,10 @@ int test_wc_RsaPublicEncryptDecrypt(void)
ExpectIntGE(wc_RsaPrivateDecrypt(cipher, cipherLenResult, plain, plainLen,
&key), 0);
ExpectIntEQ(XMEMCMP(plain, inStr, plainLen), 0);
/* Pass bad args - tested in another testing function.*/

/* Pass bad args - additionally tested in another testing function.*/
ExpectIntEQ(wc_RsaPrivateDecrypt(cipher, cipherLenResult, plain, inLen - 1,
&key), RSA_BUFFER_E);

WC_FREE_VAR(in, NULL);
WC_FREE_VAR(plain, NULL);
Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -3638,7 +3638,7 @@ static int RsaPrivateDecryptEx(const byte* in, word32 inLen, byte* out,
word32 j;
int start = (int)((size_t)pad - (size_t)key->data);

for (j = 0; j < key->dataLen; j++) {
for (j = 0; j < key->dataLen && i < outLen; j++) {
signed char c;
out[i] = key->data[j];
c = (signed char)ctMaskGTE((int)j, start);
Expand Down