1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

psa: Disallow use of invalid cipher contexts

Ensure that when doing cipher operations out of order,
PSA_ERROR_BAD_STATE is returned as documented in crypto.h and the PSA
Crypto specification.
This commit is contained in:
Jaeden Amero
2019-02-15 14:12:05 +00:00
parent 252ef28dac
commit ab43997f44
3 changed files with 171 additions and 0 deletions

View File

@ -3073,6 +3073,12 @@ psa_status_t psa_cipher_update( psa_cipher_operation_t *operation,
psa_status_t status;
int ret;
size_t expected_output_size;
if( operation->alg == 0 )
{
return( PSA_ERROR_BAD_STATE );
}
if( ! PSA_ALG_IS_STREAM_CIPHER( operation->alg ) )
{
/* Take the unprocessed partial block left over from previous