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>
diff --git a/library/psa_crypto_driver_wrappers.c b/library/psa_crypto_driver_wrappers.c
index 1e17435..0a7960c 100644
--- a/library/psa_crypto_driver_wrappers.c
+++ b/library/psa_crypto_driver_wrappers.c
@@ -1316,8 +1316,7 @@
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 @@
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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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 @@
#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 */