mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01:00
Fix off-by-one in iv_off check and add tests
This commit is contained in:
parent
5b89c09273
commit
e55e103bfe
2 changed files with 16 additions and 2 deletions
|
|
@ -1298,7 +1298,7 @@ int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
|
|||
|
||||
n = *iv_off;
|
||||
|
||||
if( n > 16 )
|
||||
if( n > 15 )
|
||||
return( MBEDTLS_ERR_AES_BAD_INPUT_DATA );
|
||||
|
||||
if( mode == MBEDTLS_AES_DECRYPT )
|
||||
|
|
@ -1394,7 +1394,7 @@ int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
|
|||
|
||||
n = *iv_off;
|
||||
|
||||
if( n > 16 )
|
||||
if( n > 15 )
|
||||
return( MBEDTLS_ERR_AES_BAD_INPUT_DATA );
|
||||
|
||||
while( length-- )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue