mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-10 07:36:28 -04:00
Fix crypt_and_hash decrypt issue when used with stream cipher
crypt_and_hash decryption fails when used with a stream cipher mode of operation due to the input not being multiple of block size, this only applies to block cipher modes and not stream ciphers.This change exempts CTR, CFB & OFB modes from this check. Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
This commit is contained in:
parent
8eaf2d2ac9
commit
6eb4626e3f
@ -409,6 +409,9 @@ int main(int argc, char *argv[])
|
|||||||
* Check the file size.
|
* Check the file size.
|
||||||
*/
|
*/
|
||||||
if (cipher_info->mode != MBEDTLS_MODE_GCM &&
|
if (cipher_info->mode != MBEDTLS_MODE_GCM &&
|
||||||
|
cipher_info->mode != MBEDTLS_MODE_CTR &&
|
||||||
|
cipher_info->mode != MBEDTLS_MODE_CFB &&
|
||||||
|
cipher_info->mode != MBEDTLS_MODE_OFB &&
|
||||||
((filesize - mbedtls_md_get_size(md_info)) %
|
((filesize - mbedtls_md_get_size(md_info)) %
|
||||||
mbedtls_cipher_get_block_size(&cipher_ctx)) != 0) {
|
mbedtls_cipher_get_block_size(&cipher_ctx)) != 0) {
|
||||||
mbedtls_fprintf(stderr, "File content not a multiple of the block size (%u).\n",
|
mbedtls_fprintf(stderr, "File content not a multiple of the block size (%u).\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user