mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-05 19:35:48 +03:00
Merge pull request #8066 from paul-elliott-arm/aes_memcpy_iv_fix
Fix potential corruption of IV for AES CBC with zero length
This commit is contained in:
3
ChangeLog.d/fix-aes-cbc-iv-corruption
Normal file
3
ChangeLog.d/fix-aes-cbc-iv-corruption
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Bugfix
|
||||||
|
* Fix a potential corruption of the passed-in IV when mbedtls_aes_crypt_cbc()
|
||||||
|
is called with zero length and padlock is not enabled.
|
@@ -1094,6 +1094,11 @@ int mbedtls_aes_crypt_cbc(mbedtls_aes_context *ctx,
|
|||||||
return MBEDTLS_ERR_AES_BAD_INPUT_DATA;
|
return MBEDTLS_ERR_AES_BAD_INPUT_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Nothing to do if length is zero. */
|
||||||
|
if (length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (length % 16) {
|
if (length % 16) {
|
||||||
return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
|
return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user