Fix transparent driver wrappers

Remove spurious "not supported" returns, and fix same issue that was
encountered with internal implementations - operation needs to be
marked as a type even if the initial call fails, otherwise cleanup won't
get done.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
Paul Elliott 2021-04-28 16:44:37 +01:00
parent 7bc45ebf13
commit fe5480a4c2

View file

@ -1316,8 +1316,7 @@ psa_status_t psa_driver_wrapper_aead_encrypt_setup(
key_buffer, key_buffer_size,
alg );
/* Declared with fallback == true */
if( status == PSA_SUCCESS )
operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID;
operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID;
if( status != PSA_ERROR_NOT_SUPPORTED )
return( status );
@ -1367,8 +1366,7 @@ psa_status_t psa_driver_wrapper_aead_decrypt_setup(
key_buffer, key_buffer_size,
alg );
/* Declared with fallback == true */
if( status == PSA_SUCCESS )
operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID;
operation->id = PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID;
if( status != PSA_ERROR_NOT_SUPPORTED )
return( status );
@ -1410,7 +1408,6 @@ psa_status_t psa_driver_wrapper_aead_set_nonce(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_set_nonce(
operation, nonce, nonce_length ) );
@ -1442,7 +1439,6 @@ psa_status_t psa_driver_wrapper_aead_set_lengths(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_set_lengths(
operation, ad_length, plaintext_length ) );
@ -1474,7 +1470,6 @@ psa_status_t psa_driver_wrapper_aead_update_ad(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_update_ad(
operation, input, input_length ) );
@ -1510,7 +1505,6 @@ psa_status_t psa_driver_wrapper_aead_update(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_update(
operation, input, input_length, output, output_size,
output_length ) );
@ -1551,7 +1545,6 @@ psa_status_t psa_driver_wrapper_aead_finish(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_finish(
operation, ciphertext, ciphertext_size,
ciphertext_length, tag, tag_size, tag_length ) );
@ -1592,7 +1585,6 @@ psa_status_t psa_driver_wrapper_aead_verify(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_verify(
operation, plaintext, plaintext_size,
plaintext_length, tag, tag_length ) );
@ -1626,7 +1618,6 @@ psa_status_t psa_driver_wrapper_aead_abort(
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
#if defined(PSA_CRYPTO_DRIVER_TEST)
case PSA_CRYPTO_TRANSPARENT_TEST_DRIVER_ID:
return( PSA_ERROR_NOT_SUPPORTED );
return( test_transparent_aead_abort( operation ) );
/* Add cases for opaque driver here */