Skip to content

Commit 80ba723

Browse files
Merge pull request #9943 from philljj/fix_evp_set_iv_length
evp: check ivLen in wolfSSL_EVP_CIPHER_CTX_set_iv_length.
2 parents 67abcc6 + 77b6f53 commit 80ba723

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

wolfcrypt/src/evp.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8449,10 +8449,15 @@ void wolfSSL_EVP_init(void)
84498449
int ivLen)
84508450
{
84518451
WOLFSSL_ENTER("wolfSSL_EVP_CIPHER_CTX_set_iv_length");
8452-
if (ctx)
8453-
ctx->ivSz= ivLen;
8454-
else
8452+
if (ctx == NULL) {
8453+
return WOLFSSL_FAILURE;
8454+
}
8455+
8456+
if (ivLen < 0 || ivLen > (int) sizeof(ctx->iv)) {
84558457
return WOLFSSL_FAILURE;
8458+
}
8459+
8460+
ctx->ivSz = ivLen;
84568461

84578462
return WOLFSSL_SUCCESS;
84588463
}

0 commit comments

Comments
 (0)