mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 03:34:39 +02:00
Merge pull request #7431 from lealem47/aes_cfb
Fix for AES-CFB1 encrypt/decrypt on size (8*x-1) bits
This commit is contained in:
@@ -11870,7 +11870,7 @@ static WARN_UNUSED_RESULT int wc_AesFeedbackCFB1(
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
if (bit > 0 && bit < 7) {
|
||||
if (bit >= 0 && bit < 7) {
|
||||
out[0] = cur;
|
||||
}
|
||||
}
|
||||
|
@@ -9209,6 +9209,11 @@ EVP_TEST_END:
|
||||
{
|
||||
0xC0
|
||||
};
|
||||
|
||||
WOLFSSL_SMALL_STACK_STATIC const byte cipher1_7bit[] =
|
||||
{
|
||||
0x1C
|
||||
};
|
||||
#endif /* WOLFSSL_AES_128 */
|
||||
#ifdef WOLFSSL_AES_192
|
||||
WOLFSSL_SMALL_STACK_STATIC const byte iv2[] = {
|
||||
@@ -9309,6 +9314,15 @@ EVP_TEST_END:
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
#endif /* HAVE_AES_DECRYPT */
|
||||
|
||||
XMEMSET(cipher, 0, sizeof(cipher));
|
||||
ret = wc_AesCfb1Encrypt(enc, cipher, msg1, 7);
|
||||
|
||||
if (ret != 0)
|
||||
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
|
||||
|
||||
if (cipher[0] != cipher1_7bit[0])
|
||||
ERROR_OUT(WC_TEST_RET_ENC_NC, out);
|
||||
|
||||
#ifdef OPENSSL_EXTRA
|
||||
ret = wc_AesSetKey(enc, key1, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
if (ret != 0)
|
||||
|
Reference in New Issue
Block a user