Skip to content

Commit a4d0f61

Browse files
committed
Fix EVP Cipher AES CFB1 byte length
1 parent cc42ecf commit a4d0f61

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
@@ -9100,10 +9100,15 @@ void wolfSSL_EVP_init(void)
91009100
case WC_AES_192_CFB1_TYPE:
91019101
case WC_AES_256_CFB1_TYPE:
91029102
WOLFSSL_MSG("AES CFB1");
9103-
if (ctx->enc)
9104-
ret = wc_AesCfb1Encrypt(&ctx->cipher.aes, dst, src, len);
9103+
if (len > WOLFSSL_MAX_32BIT / WOLFSSL_BIT_SIZE) {
9104+
ret = BAD_FUNC_ARG;
9105+
}
9106+
else if (ctx->enc)
9107+
ret = wc_AesCfb1Encrypt(&ctx->cipher.aes, dst, src,
9108+
len * WOLFSSL_BIT_SIZE);
91059109
else
9106-
ret = wc_AesCfb1Decrypt(&ctx->cipher.aes, dst, src, len);
9110+
ret = wc_AesCfb1Decrypt(&ctx->cipher.aes, dst, src,
9111+
len * WOLFSSL_BIT_SIZE);
91079112
if (ret == 0)
91089113
ret = (int)len;
91099114
break;

0 commit comments

Comments
 (0)