From 81231f33f0bd31c3c8d962d54cef82a1571bd46e Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 11 May 2021 19:18:28 +0100 Subject: [PATCH] Return invalid argument for unsupported algorithm Signed-off-by: Paul Elliott --- library/psa_crypto.c | 4 ++-- tests/suites/test_suite_psa_crypto.data | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/psa_crypto.c b/library/psa_crypto.c index ee7ac90ca..4a83b09c9 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -3244,7 +3244,7 @@ psa_status_t psa_aead_encrypt_setup( psa_aead_operation_t *operation, if( !PSA_ALG_IS_AEAD( alg ) || PSA_ALG_IS_WILDCARD( alg ) ) { - status = PSA_ERROR_NOT_SUPPORTED; + status = PSA_ERROR_INVALID_ARGUMENT; goto exit; } @@ -3309,7 +3309,7 @@ psa_status_t psa_aead_decrypt_setup( psa_aead_operation_t *operation, if( !PSA_ALG_IS_AEAD( alg ) || PSA_ALG_IS_WILDCARD( alg ) ) { - status = PSA_ERROR_NOT_SUPPORTED; + status = PSA_ERROR_INVALID_ARGUMENT; goto exit; } diff --git a/tests/suites/test_suite_psa_crypto.data b/tests/suites/test_suite_psa_crypto.data index 8a85edd10..177d688e3 100644 --- a/tests/suites/test_suite_psa_crypto.data +++ b/tests/suites/test_suite_psa_crypto.data @@ -2432,11 +2432,11 @@ aead_multipart_decrypt:PSA_KEY_TYPE_CHACHA20:"808182838485868788898a8b8c8d8e8f90 PSA Multipart AEAD encrypt/decrypt: invalid algorithm (CTR) depends_on:MBEDTLS_AES_C:MBEDTLS_GCM_C -aead_multipart_encrypt_decrypt:PSA_KEY_TYPE_AES:"D7828D13B2B0BDC325A76236DF93CC6B":PSA_ALG_CTR:"000102030405060708090A0B0C0D0E0F":"":-1:"":-1:PSA_ERROR_NOT_SUPPORTED +aead_multipart_encrypt_decrypt:PSA_KEY_TYPE_AES:"D7828D13B2B0BDC325A76236DF93CC6B":PSA_ALG_CTR:"000102030405060708090A0B0C0D0E0F":"":-1:"":-1:PSA_ERROR_INVALID_ARGUMENT PSA Multipart AEAD encrypt/decrypt: invalid algorithm (ChaCha20) depends_on:MBEDTLS_CHACHA20_C -aead_multipart_encrypt_decrypt:PSA_KEY_TYPE_CHACHA20:"808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f":PSA_ALG_STREAM_CIPHER:"":"":-1:"":-1:PSA_ERROR_NOT_SUPPORTED +aead_multipart_encrypt_decrypt:PSA_KEY_TYPE_CHACHA20:"808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f":PSA_ALG_STREAM_CIPHER:"":"":-1:"":-1:PSA_ERROR_INVALID_ARGUMENT PSA signature size: RSA keypair, 1024 bits, PKCS#1 v1.5 raw depends_on:PSA_WANT_ALG_RSA_PKCS1V15_SIGN:PSA_WANT_KEY_TYPE_RSA_KEY_PAIR