diff --git a/api-tests/dev_apis/crypto/common/test_crypto_common.c b/api-tests/dev_apis/crypto/common/test_crypto_common.c index 470d2b9e..dc7dbf00 100644 --- a/api-tests/dev_apis/crypto/common/test_crypto_common.c +++ b/api-tests/dev_apis/crypto/common/test_crypto_common.c @@ -522,6 +522,18 @@ const uint8_t additional_data[] = { 0x40, 0xa2, 0x7c, 0x1d, 0x1e, 0x23, 0xea, 0x3d, 0xbe, 0x80, 0x56, 0xb2, 0x77, 0x48, 0x61, 0xa4, 0xa2, 0x01, 0xcc, 0xe4, 0x9f, 0x19, 0x99, 0x7d, 0x19, 0x20, 0x6d, 0x8c, 0x8a, 0x34, 0x39, 0x51}; +const uint8_t ccm_star_no_tag_key_data[] = { +0x90, 0x92, 0x9a, 0x4b, 0x0a, 0xc6, 0x5b, 0x35, 0x0a, 0xd1, 0x59, 0x16, 0x11, 0xfe, 0x48, 0x29}; + +const uint8_t ccm_star_no_tag_plaintext[] = {0x4b, 0xfe, 0x4e, 0x35, 0x78, 0x4f, 0x0a, 0x65, 0xb5, +0x45, 0x47, 0x7e, 0x5e, 0x2f, 0x4b, 0xae, 0x0e, 0x1e, 0x6f, 0xa7, 0x17, 0xea, 0xf2, 0xcb}; + +const uint8_t ccm_star_no_tag_iv[] = {0x5a, 0x8a, 0xa4, 0x85, 0xc3, 0x16, 0xe9, 0x40, 0x3a, 0xff, +0x85, 0x9f, 0xbb}; + +const uint8_t ccm_star_no_tag_ciphertext[] = {0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, 0x72, +0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, 0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97}; + const uint8_t plaintext[] = { 0x45, 0x35, 0xd1, 0x2b, 0x43, 0x77, 0x92, 0x8a, 0x7c, 0x0a, 0x61, 0xc9, 0xf8, 0x25, 0xa4, 0x86, diff --git a/api-tests/dev_apis/crypto/common/test_crypto_common.h b/api-tests/dev_apis/crypto/common/test_crypto_common.h index 45326cb1..5e4c507d 100644 --- a/api-tests/dev_apis/crypto/common/test_crypto_common.h +++ b/api-tests/dev_apis/crypto/common/test_crypto_common.h @@ -135,6 +135,11 @@ extern uint8_t expected_output[BUFFER_SIZE]; extern void crypto_common_exit_action(void); +extern const uint8_t ccm_star_no_tag_iv[]; +extern const uint8_t ccm_star_no_tag_plaintext[]; +extern const uint8_t ccm_star_no_tag_ciphertext[]; +extern const uint8_t ccm_star_no_tag_key_data[]; + #ifdef ARCH_TEST_FFDHE2048 extern const uint8_t ffdh_key_data_2048[]; extern const uint8_t ffdh_peer_key_data_2048[]; diff --git a/api-tests/dev_apis/crypto/test_c037/test_data.h b/api-tests/dev_apis/crypto/test_c037/test_data.h index f7a935cc..cbd3748c 100644 --- a/api-tests/dev_apis/crypto/test_c037/test_data.h +++ b/api-tests/dev_apis/crypto/test_c037/test_data.h @@ -154,6 +154,25 @@ static const test_data check1[] = { .expected_status = PSA_SUCCESS }, #endif +#ifdef ARCH_TEST_CCM_STAR_NO_TAG +{ + .test_desc = "Test psa_cipher_finish - Encrypt - CCM* No tag\n", + .type = PSA_KEY_TYPE_AES, + .data = ccm_star_no_tag_key_data, + .data_length = AES_16B_KEY_SIZE, + .usage_flags = PSA_KEY_USAGE_ENCRYPT, + .alg = PSA_ALG_CCM_STAR_NO_TAG, + .iv = ccm_star_no_tag_iv, + .iv_length = 13, + .input = ccm_star_no_tag_plaintext, + .input_length = 24, + .output = expected_output, + .output_size = BUFFER_SIZE, + .expected_output = ccm_star_no_tag_ciphertext, + .expected_output_length = 24, + .expected_status = PSA_SUCCESS +}, +#endif #endif #ifdef ARCH_TEST_CBC_NO_PADDING diff --git a/api-tests/dev_apis/crypto/test_c050/test_data.h b/api-tests/dev_apis/crypto/test_c050/test_data.h index 5a8abfb0..8e1e014d 100644 --- a/api-tests/dev_apis/crypto/test_c050/test_data.h +++ b/api-tests/dev_apis/crypto/test_c050/test_data.h @@ -103,6 +103,16 @@ static const test_data check1[] = { 0xb2, 0xbd}, 31, PSA_SUCCESS }, #endif + +#ifdef ARCH_TEST_CCM_STAR_NO_TAG +{"Test psa_cipher_encrypt - Encrypt - CCM_STAR_NO_TAG\n", PSA_KEY_TYPE_AES, +{0x90, 0x92, 0x9a, 0x4b, 0x0a, 0xc6, 0x5b, 0x35, 0x0a, 0xd1, 0x59, 0x16, 0x11, 0xfe, 0x48, 0x29}, +AES_16B_KEY_SIZE, PSA_KEY_USAGE_ENCRYPT, PSA_ALG_CCM_STAR_NO_TAG, +{0x4b, 0xfe, 0x4e, 0x35, 0x78, 0x4f, 0x0a, 0x65, 0xb5, 0x45, 0x47, 0x7e, 0x5e, 0x2f, 0x4b, 0xae, +0x0e, 0x1e, 0x6f, 0xa7, 0x17, 0xea, 0xf2, 0xcb}, 24, PSA_CIPHER_ENCRYPT_OUTPUT_MAX_SIZE(24), +{0xa1, 0x6a, 0x2e, 0x74, 0x1f, 0x1c, 0xd9, 0x71, 0x72, 0x85, 0xb6, 0xd8, 0x82, 0xc1, 0xfc, 0x53, +0x65, 0x5e, 0x97, 0x73, 0x76, 0x1a, 0xd6, 0x97}, 37, PSA_SUCCESS}, +#endif #endif #ifdef ARCH_TEST_CBC_NO_PADDING diff --git a/api-tests/platform/targets/tgt_dev_apis_tfm_nrf54l_common/nspe/pal_crypto_config.h b/api-tests/platform/targets/tgt_dev_apis_tfm_nrf54l_common/nspe/pal_crypto_config.h index 40b9cc9a..8787fc11 100644 --- a/api-tests/platform/targets/tgt_dev_apis_tfm_nrf54l_common/nspe/pal_crypto_config.h +++ b/api-tests/platform/targets/tgt_dev_apis_tfm_nrf54l_common/nspe/pal_crypto_config.h @@ -326,6 +326,17 @@ */ #define ARCH_TEST_CCM +/** + * \def ARCH_TEST_CCM_STAR_NO_TAG + * + * Enable the CCM* mode with a zero-length authentication field, i.e. + * confidentiality without authenticity (IEEE P802.15-4/0537r2). PSA exposes + * this as the cipher algorithm PSA_ALG_CCM_STAR_NO_TAG. + * + * Requires: ARCH_TEST_AES + */ +#define ARCH_TEST_CCM_STAR_NO_TAG + /** * \def ARCH_TEST_GCM *