Skip to content
Merged
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
15 changes: 7 additions & 8 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -11262,15 +11262,14 @@ static int test_wc_Arc4SetKey (void)
/* Test bad args. */
if (ret == 0) {
ret = wc_Arc4SetKey(NULL, (byte*)key, keyLen);
if (ret == BAD_FUNC_ARG) {
ret = wc_Arc4SetKey(&arc, NULL, keyLen);
}
if (ret == BAD_FUNC_ARG) {
/* Exits normally if keyLen is incorrect. */
ret = wc_Arc4SetKey(&arc, (byte*)key, 0);
} else {
if (ret == BAD_FUNC_ARG)
ret = wc_Arc4SetKey(&arc, NULL, keyLen); /* NULL key */
if (ret == BAD_FUNC_ARG)
ret = wc_Arc4SetKey(&arc, (byte*)key, 0); /* length == 0 */
if (ret == BAD_FUNC_ARG)
ret = WOLFSSL_ERROR_NONE;
else
ret = WOLFSSL_FATAL_ERROR;
}
} /* END test bad args. */

printf(resultFmt, ret == 0 ? passed : failed);
Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/arc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ int wc_Arc4SetKey(Arc4* arc4, const byte* key, word32 length)
word32 i;
word32 keyIndex = 0, stateIndex = 0;

if (arc4 == NULL || key == NULL) {
if (arc4 == NULL || key == NULL || length == 0) {
return BAD_FUNC_ARG;
}

Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/pwdbased.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ int wc_scrypt(byte* output, const byte* passwd, int passLen,
if (blockSize > 8)
return BAD_FUNC_ARG;

if (cost < 1 || cost >= 128 * blockSize / 8)
if (cost < 1 || cost >= 128 * blockSize / 8 || parallel < 1 || dkLen < 1)
return BAD_FUNC_ARG;

bSz = 128 * blockSize;
Expand Down