mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-26 01:15:37 +00:00
test: psa driver wrapper: Add cipher_encrypt negative testing
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
a833169914
commit
3563210c10
|
@ -872,6 +872,26 @@ void cipher_entry_points( int alg_arg, int key_type_arg,
|
|||
PSA_ASSERT( psa_import_key( &attributes, key_data->x, key_data->len,
|
||||
&key ) );
|
||||
|
||||
/*
|
||||
* Test encrypt failure
|
||||
* First test that if we don't force a driver error, encryption is
|
||||
* successfull, then force driver error.
|
||||
*/
|
||||
status = psa_cipher_encrypt(
|
||||
key, alg, input->x, input->len,
|
||||
output, output_buffer_size, &function_output_length );
|
||||
TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
|
||||
TEST_EQUAL( status, PSA_SUCCESS );
|
||||
mbedtls_test_driver_cipher_hooks.hits = 0;
|
||||
|
||||
mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
|
||||
status = psa_cipher_encrypt(
|
||||
key, alg, input->x, input->len,
|
||||
output, output_buffer_size, &function_output_length );
|
||||
TEST_EQUAL( mbedtls_test_driver_cipher_hooks.hits, 1 );
|
||||
TEST_EQUAL( status, PSA_ERROR_GENERIC_ERROR );
|
||||
mbedtls_test_driver_cipher_hooks.hits = 0;
|
||||
|
||||
/* Test setup call, encrypt */
|
||||
mbedtls_test_driver_cipher_hooks.forced_status = PSA_ERROR_GENERIC_ERROR;
|
||||
status = psa_cipher_encrypt_setup( &operation, key, alg );
|
||||
|
|
Loading…
Reference in a new issue