add missing psa_cipher_abort( operation )

This commit is contained in:
Moran Peker 2018-05-31 14:06:17 +03:00 committed by itayzafrir
parent 70531163a9
commit ae382791fb

View File

@ -1356,6 +1356,7 @@ static psa_status_t psa_cipher_setup(psa_cipher_operation_t *operation,
mode = MBEDTLS_PADDING_NONE;
break;
default:
psa_cipher_abort( operation );
return( PSA_ERROR_INVALID_ARGUMENT );
}
ret = mbedtls_cipher_set_padding_mode( &operation->ctx.cipher, mode );
@ -1430,9 +1431,7 @@ psa_status_t psa_encrypt_set_iv(psa_cipher_operation_t *operation,
return( PSA_ERROR_BAD_STATE );
if( iv_length != operation->iv_size )
{
if( ( ( operation->alg ) & PSA_ALG_ARC4 ) == PSA_ALG_ARC4 )
return( PSA_ERROR_BAD_STATE );
else
psa_cipher_abort( operation );
return( PSA_ERROR_INVALID_ARGUMENT );
}
ret = mbedtls_cipher_set_iv( &operation->ctx.cipher, iv, iv_length );