mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
psa: Disallow use of invalid hash contexts
If a hash context has not been set up, fail with PSA_ERROR_BAD_STATE as documented in crypto.h and the PSA Crypto specification.
This commit is contained in:
@ -1502,8 +1502,7 @@ psa_status_t psa_hash_update( psa_hash_operation_t *operation,
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = MBEDTLS_ERR_MD_BAD_INPUT_DATA;
|
||||
break;
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
|
||||
if( ret != 0 )
|
||||
@ -1575,8 +1574,7 @@ psa_status_t psa_hash_finish( psa_hash_operation_t *operation,
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ret = MBEDTLS_ERR_MD_BAD_INPUT_DATA;
|
||||
break;
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
}
|
||||
status = mbedtls_to_psa_error( ret );
|
||||
|
||||
|
Reference in New Issue
Block a user