From e665466a807bb8a7bb255e46f41733aabbeb5ee4 Mon Sep 17 00:00:00 2001 From: Przemek Stekiel Date: Wed, 20 Apr 2022 09:14:51 +0200 Subject: [PATCH] derive_output test: add other key type value 11 to handle raw key type Signed-off-by: Przemek Stekiel --- tests/suites/test_suite_psa_crypto.data | 2 +- tests/suites/test_suite_psa_crypto.function | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/suites/test_suite_psa_crypto.data b/tests/suites/test_suite_psa_crypto.data index 4f685e6a8e..e0fa90e610 100644 --- a/tests/suites/test_suite_psa_crypto.data +++ b/tests/suites/test_suite_psa_crypto.data @@ -5450,7 +5450,7 @@ derive_output:PSA_ALG_KEY_AGREEMENT(PSA_ALG_ECDH, PSA_ALG_TLS12_PSK_TO_MS(PSA_AL PSA key derivation: TLS 1.2 Mix-PSK-to-MS, other key is raw data depends_on:PSA_WANT_ALG_SHA_256:PSA_WANT_ALG_TLS12_PSK_TO_MS -derive_output:PSA_ALG_TLS12_PSK_TO_MS(PSA_ALG_SHA_256):PSA_KEY_DERIVATION_INPUT_SEED:"5bc0b19b4a8b24b07afe7ec65c471e94a7d518fcef06c3574315255c52afe21b5bc0b19b872b9b26508458f03603744d575f463a11ae7f1b090c012606fd3e9f":PSA_SUCCESS:PSA_KEY_DERIVATION_INPUT_OTHER_SECRET:"c4eb02cb10175ab8a33aeeb068ba23df08206b0e":PSA_ERROR_INVALID_ARGUMENT:PSA_KEY_DERIVATION_INPUT_SECRET:"01020304":PSA_SUCCESS:PSA_KEY_DERIVATION_INPUT_LABEL:"6d617374657220736563726574":PSA_SUCCESS:"":48:"2d6cba7ad474ac3dfcc01516ed7161a9b00c2e8a35b3e921b9eb09b546a54c98491b21d1baafb659c9094b760144ea1f":"":1:1:0 +derive_output:PSA_ALG_TLS12_PSK_TO_MS(PSA_ALG_SHA_256):PSA_KEY_DERIVATION_INPUT_SEED:"5bc0b19b4a8b24b07afe7ec65c471e94a7d518fcef06c3574315255c52afe21b5bc0b19b872b9b26508458f03603744d575f463a11ae7f1b090c012606fd3e9f":PSA_SUCCESS:PSA_KEY_DERIVATION_INPUT_OTHER_SECRET:"c4eb02cb10175ab8a33aeeb068ba23df08206b0e":PSA_ERROR_INVALID_ARGUMENT:PSA_KEY_DERIVATION_INPUT_SECRET:"01020304":PSA_SUCCESS:PSA_KEY_DERIVATION_INPUT_LABEL:"6d617374657220736563726574":PSA_SUCCESS:"":48:"2d6cba7ad474ac3dfcc01516ed7161a9b00c2e8a35b3e921b9eb09b546a54c98491b21d1baafb659c9094b760144ea1f":"":11:1:0 PSA key derivation: TLS 1.2 Mix-PSK-to-MS, output key not permitted depends_on:PSA_WANT_ALG_SHA_256:PSA_WANT_ALG_TLS12_PSK_TO_MS diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function index accd4b3612..45f2c67108 100644 --- a/tests/suites/test_suite_psa_crypto.function +++ b/tests/suites/test_suite_psa_crypto.function @@ -6998,13 +6998,14 @@ void derive_output( int alg_arg, inputs[i]->len ), statuses[i] ); break; - case 1: // input key + case 1: // input key, type DERIVE + case 11: // input key, type RAW psa_set_key_usage_flags( &attributes2, PSA_KEY_USAGE_DERIVE ); psa_set_key_algorithm( &attributes2, alg ); psa_set_key_type( &attributes2, PSA_KEY_TYPE_DERIVE ); // other secret of type RAW_DATA passed with input_key - if( statuses[i] == PSA_ERROR_INVALID_ARGUMENT ) + if( other_key_input_type == 11 ) psa_set_key_type( &attributes2, PSA_KEY_TYPE_RAW_DATA ); PSA_ASSERT( psa_import_key( &attributes2,