Return BAD_INPUT error for CCM context's erroneous state

Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
Mateusz Starzyk 2021-09-02 11:50:38 +02:00
parent 7251eda6ff
commit 64f0b5f454

View file

@ -263,7 +263,7 @@ int mbedtls_ccm_update_ad( mbedtls_ccm_context *ctx,
if( ctx->state & CCM_STATE__ERROR )
{
return ret;
return MBEDTLS_ERR_CCM_BAD_INPUT;
}
if( ctx->add_len > 0 && add_len > 0 )
@ -339,7 +339,7 @@ int mbedtls_ccm_update( mbedtls_ccm_context *ctx,
if( ctx->state & CCM_STATE__ERROR )
{
return MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
return MBEDTLS_ERR_CCM_BAD_INPUT;
}
if( ctx->processed + input_len > ctx->plaintext_len )