From a36dee5ae161f042d8efd9c96c847ea3982adad6 Mon Sep 17 00:00:00 2001 From: Jonathan Nilsen Date: Wed, 8 Jan 2025 17:17:51 +0100 Subject: [PATCH] sdfw_services: psa_crypto: use new tags for pointer-to-const members This lets the server loosen the required permissions when validating pointers-to-const parameters so that only read permissions are required for these. Note that this CDDL update is not backwards compatible, and the service version is bumped to 2. Ref: NCSDK-31182 Signed-off-by: Jonathan Nilsen --- .../sdfw_services/services/psa_crypto/Kconfig | 2 +- .../psa_crypto/psa_crypto_service.cddl | 106 ++++---- .../psa_crypto_service_decode.c | 214 ++++++++------- .../psa_crypto_service_encode.c | 253 ++++++++++-------- 4 files changed, 323 insertions(+), 252 deletions(-) diff --git a/subsys/sdfw_services/services/psa_crypto/Kconfig b/subsys/sdfw_services/services/psa_crypto/Kconfig index f7460f929813..a2ad068e85f5 100644 --- a/subsys/sdfw_services/services/psa_crypto/Kconfig +++ b/subsys/sdfw_services/services/psa_crypto/Kconfig @@ -7,7 +7,7 @@ service_name = PSA_CRYPTO service_default_enabled = n service_id = 0x71 -service_version = 1 +service_version = 2 service_buffer_size = 128 service_name_str = PSA Crypto rsource "../Kconfig.template.service" diff --git a/subsys/sdfw_services/services/psa_crypto/psa_crypto_service.cddl b/subsys/sdfw_services/services/psa_crypto/psa_crypto_service.cddl index b3f40a61f89a..94597f48ae27 100644 --- a/subsys/sdfw_services/services/psa_crypto/psa_crypto_service.cddl +++ b/subsys/sdfw_services/services/psa_crypto/psa_crypto_service.cddl @@ -9,6 +9,12 @@ ptr_attr = #6.32772(uint) ptr_key = #6.32773(uint) ptr_uint = #6.32774(uint) ptr_cipher = #6.32775(uint) +ptr_const_buf = #6.32776(uint) +ptr_const_attr = #6.32777(uint) +ptr_const_key = #6.32778(uint) +ptr_const_uint = #6.32779(uint) +ptr_const_cipher = #6.32780(uint) + psa_crypto_init_req = ( @@ -34,7 +40,7 @@ psa_purge_key_req = ( psa_copy_key_req = ( 14, source_key: uint, - p_attributes: ptr_attr, + p_attributes: ptr_const_attr, p_target_key: ptr_key, ) @@ -45,8 +51,8 @@ psa_destroy_key_req = ( psa_import_key_req = ( 16, - p_attributes: ptr_attr, - p_data: ptr_buf, + p_attributes: ptr_const_attr, + p_data: ptr_const_buf, data_length: buf_len, p_key: ptr_key, ) @@ -70,7 +76,7 @@ psa_export_public_key_req = ( psa_hash_compute_req = ( 19, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_hash: ptr_buf, hash_size: buf_len, @@ -80,9 +86,9 @@ psa_hash_compute_req = ( psa_hash_compare_req = ( 20, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, - p_hash: ptr_buf, + p_hash: ptr_const_buf, hash_length: buf_len, ) @@ -95,7 +101,7 @@ psa_hash_setup_req = ( psa_hash_update_req = ( 22, p_handle: ptr_uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, ) @@ -110,7 +116,7 @@ psa_hash_finish_req = ( psa_hash_verify_req = ( 24, p_handle: ptr_uint, - p_hash: ptr_buf, + p_hash: ptr_const_buf, hash_length: buf_len, ) @@ -129,7 +135,7 @@ psa_mac_compute_req = ( 27, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_mac: ptr_buf, mac_size: buf_len, @@ -140,9 +146,9 @@ psa_mac_verify_req = ( 28, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, - p_mac: ptr_buf, + p_mac: ptr_const_buf, mac_length: buf_len, ) @@ -163,7 +169,7 @@ psa_mac_verify_setup_req = ( psa_mac_update_req = ( 31, p_handle: ptr_uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, ) @@ -178,7 +184,7 @@ psa_mac_sign_finish_req = ( psa_mac_verify_finish_req = ( 33, p_handle: ptr_uint, - p_mac: ptr_buf, + p_mac: ptr_const_buf, mac_length: buf_len, ) @@ -191,7 +197,7 @@ psa_cipher_encrypt_req = ( 35, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -202,7 +208,7 @@ psa_cipher_decrypt_req = ( 36, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -234,14 +240,14 @@ psa_cipher_generate_iv_req = ( psa_cipher_set_iv_req = ( 40, p_handle: ptr_uint, - p_iv: ptr_buf, + p_iv: ptr_const_buf, iv_length: buf_len, ) psa_cipher_update_req = ( 41, p_handle: ptr_uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -265,11 +271,11 @@ psa_aead_encrypt_req = ( 44, key: uint, alg: uint, - p_nonce: ptr_buf, + p_nonce: ptr_const_buf, nonce_length: buf_len, - p_additional_data: ptr_buf, + p_additional_data: ptr_const_buf, additional_data_length: buf_len, - p_plaintext: ptr_buf, + p_plaintext: ptr_const_buf, plaintext_length: buf_len, p_ciphertext: ptr_buf, ciphertext_size: buf_len, @@ -280,11 +286,11 @@ psa_aead_decrypt_req = ( 45, key: uint, alg: uint, - p_nonce: ptr_buf, + p_nonce: ptr_const_buf, nonce_length: buf_len, - p_additional_data: ptr_buf, + p_additional_data: ptr_const_buf, additional_data_length: buf_len, - p_ciphertext: ptr_buf, + p_ciphertext: ptr_const_buf, ciphertext_length: buf_len, p_plaintext: ptr_buf, plaintext_size: buf_len, @@ -316,28 +322,28 @@ psa_aead_generate_nonce_req = ( psa_aead_set_nonce_req = ( 49, p_handle: ptr_uint, - p_nonce: ptr_buf, + p_nonce: ptr_const_buf, nonce_length: buf_len, ) psa_aead_set_lengths_req = ( 50, p_handle: ptr_uint, - ad_length: buf_len, - plaintext_length: buf_len, + ad_length: uint, + plaintext_length: uint, ) psa_aead_update_ad_req = ( 51, p_handle: ptr_uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, ) psa_aead_update_req = ( 52, p_handle: ptr_uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -361,7 +367,7 @@ psa_aead_verify_req = ( p_plaintext: ptr_buf, plaintext_size: buf_len, p_plaintext_length: ptr_uint, - p_tag: ptr_buf, + p_tag: ptr_const_buf, tag_length: buf_len, ) @@ -374,7 +380,7 @@ psa_sign_message_req = ( 56, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, p_signature: ptr_buf, signature_size: buf_len, @@ -385,9 +391,9 @@ psa_verify_message_req = ( 57, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, - p_signature: ptr_buf, + p_signature: ptr_const_buf, signature_length: buf_len, ) @@ -395,7 +401,7 @@ psa_sign_hash_req = ( 58, key: uint, alg: uint, - p_hash: ptr_buf, + p_hash: ptr_const_buf, hash_length: buf_len, p_signature: ptr_buf, signature_size: buf_len, @@ -406,9 +412,9 @@ psa_verify_hash_req = ( 59, key: uint, alg: uint, - p_hash: ptr_buf, + p_hash: ptr_const_buf, hash_length: buf_len, - p_signature: ptr_buf, + p_signature: ptr_const_buf, signature_length: buf_len, ) @@ -416,9 +422,9 @@ psa_asymmetric_encrypt_req = ( 60, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, - p_salt: ptr_buf, + p_salt: ptr_const_buf, salt_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -429,9 +435,9 @@ psa_asymmetric_decrypt_req = ( 61, key: uint, alg: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, - p_salt: ptr_buf, + p_salt: ptr_const_buf, salt_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -460,7 +466,7 @@ psa_key_derivation_input_bytes_req = ( 65, p_handle: ptr_uint, step: uint, - p_data: ptr_buf, + p_data: ptr_const_buf, data_length: buf_len, ) @@ -483,7 +489,7 @@ psa_key_derivation_key_agreement_req = ( p_handle: ptr_uint, step: uint, private_key: uint, - p_peer_key: ptr_buf, + p_peer_key: ptr_const_buf, peer_key_length: buf_len, ) @@ -496,7 +502,7 @@ psa_key_derivation_output_bytes_req = ( psa_key_derivation_output_key_req = ( 70, - p_attributes: ptr_attr, + p_attributes: ptr_const_attr, p_handle: ptr_uint, p_key: ptr_key, ) @@ -510,7 +516,7 @@ psa_raw_key_agreement_req = ( 72, alg: uint, private_key: uint, - p_peer_key: ptr_buf, + p_peer_key: ptr_const_buf, peer_key_length: buf_len, p_output: ptr_buf, output_size: buf_len, @@ -525,7 +531,7 @@ psa_generate_random_req = ( psa_generate_key_req = ( 74, - p_attributes: ptr_attr, + p_attributes: ptr_const_attr, p_key: ptr_key, ) @@ -533,7 +539,7 @@ psa_pake_setup_req = ( 79, p_handle: ptr_uint, password_key: uint, - p_cipher_suite: ptr_cipher, + p_cipher_suite: ptr_const_cipher, ) psa_pake_set_role_req = ( @@ -545,21 +551,21 @@ psa_pake_set_role_req = ( psa_pake_set_user_req = ( 81, p_handle: ptr_uint, - p_user_id: ptr_buf, + p_user_id: ptr_const_buf, user_id_len: buf_len, ) psa_pake_set_peer_req = ( 82, p_handle: ptr_uint, - p_peer_id: ptr_buf, + p_peer_id: ptr_const_buf, peer_id_len: buf_len, ) psa_pake_set_context_req = ( 83, p_handle: ptr_uint, - p_context: ptr_buf, + p_context: ptr_const_buf, context_len: buf_len, ) @@ -576,14 +582,14 @@ psa_pake_input_req = ( 85, p_handle: ptr_uint, step: uint, - p_input: ptr_buf, + p_input: ptr_const_buf, input_length: buf_len, ) psa_pake_get_shared_key_req = ( 86, p_handle: ptr_uint, - p_attributes: ptr_attr, + p_attributes: ptr_const_attr, p_key: ptr_key, ) diff --git a/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_decode.c b/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_decode.c index d6bce2120c32..e8294ae59f46 100644 --- a/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_decode.c +++ b/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_decode.c @@ -39,12 +39,14 @@ static bool decode_psa_get_key_attributes_req(zcbor_state_t *state, static bool decode_psa_reset_key_attributes_req(zcbor_state_t *state, struct psa_reset_key_attributes_req *result); static bool decode_psa_purge_key_req(zcbor_state_t *state, struct psa_purge_key_req *result); +static bool decode_ptr_const_attr(zcbor_state_t *state, uint32_t *result); static bool decode_ptr_key(zcbor_state_t *state, uint32_t *result); static bool decode_psa_copy_key_req(zcbor_state_t *state, struct psa_copy_key_req *result); static bool decode_psa_destroy_key_req(zcbor_state_t *state, struct psa_destroy_key_req *result); -static bool decode_ptr_buf(zcbor_state_t *state, uint32_t *result); +static bool decode_ptr_const_buf(zcbor_state_t *state, uint32_t *result); static bool decode_buf_len(zcbor_state_t *state, uint32_t *result); static bool decode_psa_import_key_req(zcbor_state_t *state, struct psa_import_key_req *result); +static bool decode_ptr_buf(zcbor_state_t *state, uint32_t *result); static bool decode_ptr_uint(zcbor_state_t *state, uint32_t *result); static bool decode_psa_export_key_req(zcbor_state_t *state, struct psa_export_key_req *result); static bool decode_psa_export_public_key_req(zcbor_state_t *state, @@ -146,7 +148,7 @@ static bool decode_psa_raw_key_agreement_req(zcbor_state_t *state, static bool decode_psa_generate_random_req(zcbor_state_t *state, struct psa_generate_random_req *result); static bool decode_psa_generate_key_req(zcbor_state_t *state, struct psa_generate_key_req *result); -static bool decode_ptr_cipher(zcbor_state_t *state, uint32_t *result); +static bool decode_ptr_const_cipher(zcbor_state_t *state, uint32_t *result); static bool decode_psa_pake_setup_req(zcbor_state_t *state, struct psa_pake_setup_req *result); static bool decode_psa_pake_set_role_req(zcbor_state_t *state, struct psa_pake_set_role_req *result); @@ -212,6 +214,16 @@ static bool decode_psa_purge_key_req(zcbor_state_t *state, struct psa_purge_key_ return res; } +static bool decode_ptr_const_attr(zcbor_state_t *state, uint32_t *result) +{ + zcbor_log("%s\r\n", __func__); + + bool res = ((zcbor_tag_expect(state, 32777) && (zcbor_uint32_decode(state, (&(*result)))))); + + log_result(state, res, __func__); + return res; +} + static bool decode_ptr_key(zcbor_state_t *state, uint32_t *result) { zcbor_log("%s\r\n", __func__); @@ -226,10 +238,11 @@ static bool decode_psa_copy_key_req(zcbor_state_t *state, struct psa_copy_key_re { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_expect(state, (14)))) && - ((zcbor_uint32_decode(state, (&(*result).psa_copy_key_req_source_key)))) && - ((decode_ptr_attr(state, (&(*result).psa_copy_key_req_p_attributes)))) && - ((decode_ptr_key(state, (&(*result).psa_copy_key_req_p_target_key))))))); + bool res = + (((((zcbor_uint32_expect(state, (14)))) && + ((zcbor_uint32_decode(state, (&(*result).psa_copy_key_req_source_key)))) && + ((decode_ptr_const_attr(state, (&(*result).psa_copy_key_req_p_attributes)))) && + ((decode_ptr_key(state, (&(*result).psa_copy_key_req_p_target_key))))))); log_result(state, res, __func__); return res; @@ -246,11 +259,11 @@ static bool decode_psa_destroy_key_req(zcbor_state_t *state, struct psa_destroy_ return res; } -static bool decode_ptr_buf(zcbor_state_t *state, uint32_t *result) +static bool decode_ptr_const_buf(zcbor_state_t *state, uint32_t *result) { zcbor_log("%s\r\n", __func__); - bool res = ((zcbor_tag_expect(state, 32770) && (zcbor_uint32_decode(state, (&(*result)))))); + bool res = ((zcbor_tag_expect(state, 32776) && (zcbor_uint32_decode(state, (&(*result)))))); log_result(state, res, __func__); return res; @@ -270,11 +283,22 @@ static bool decode_psa_import_key_req(zcbor_state_t *state, struct psa_import_ke { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_expect(state, (16)))) && - ((decode_ptr_attr(state, (&(*result).psa_import_key_req_p_attributes)))) && - ((decode_ptr_buf(state, (&(*result).psa_import_key_req_p_data)))) && - ((decode_buf_len(state, (&(*result).psa_import_key_req_data_length)))) && - ((decode_ptr_key(state, (&(*result).psa_import_key_req_p_key))))))); + bool res = + (((((zcbor_uint32_expect(state, (16)))) && + ((decode_ptr_const_attr(state, (&(*result).psa_import_key_req_p_attributes)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_import_key_req_p_data)))) && + ((decode_buf_len(state, (&(*result).psa_import_key_req_data_length)))) && + ((decode_ptr_key(state, (&(*result).psa_import_key_req_p_key))))))); + + log_result(state, res, __func__); + return res; +} + +static bool decode_ptr_buf(zcbor_state_t *state, uint32_t *result) +{ + zcbor_log("%s\r\n", __func__); + + bool res = ((zcbor_tag_expect(state, 32770) && (zcbor_uint32_decode(state, (&(*result)))))); log_result(state, res, __func__); return res; @@ -327,7 +351,7 @@ static bool decode_psa_hash_compute_req(zcbor_state_t *state, struct psa_hash_co bool res = (((((zcbor_uint32_expect(state, (19)))) && ((zcbor_uint32_decode(state, (&(*result).psa_hash_compute_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_hash_compute_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_hash_compute_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_hash_compute_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_hash_compute_req_p_hash)))) && ((decode_buf_len(state, (&(*result).psa_hash_compute_req_hash_size)))) && @@ -343,9 +367,9 @@ static bool decode_psa_hash_compare_req(zcbor_state_t *state, struct psa_hash_co bool res = (((((zcbor_uint32_expect(state, (20)))) && ((zcbor_uint32_decode(state, (&(*result).psa_hash_compare_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_hash_compare_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_hash_compare_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_hash_compare_req_input_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_hash_compare_req_p_hash)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_hash_compare_req_p_hash)))) && ((decode_buf_len(state, (&(*result).psa_hash_compare_req_hash_length))))))); log_result(state, res, __func__); @@ -370,7 +394,7 @@ static bool decode_psa_hash_update_req(zcbor_state_t *state, struct psa_hash_upd bool res = (((((zcbor_uint32_expect(state, (22)))) && ((decode_ptr_uint(state, (&(*result).psa_hash_update_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_hash_update_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_hash_update_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_hash_update_req_input_length))))))); log_result(state, res, __func__); @@ -397,7 +421,7 @@ static bool decode_psa_hash_verify_req(zcbor_state_t *state, struct psa_hash_ver bool res = (((((zcbor_uint32_expect(state, (24)))) && ((decode_ptr_uint(state, (&(*result).psa_hash_verify_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_hash_verify_req_p_hash)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_hash_verify_req_p_hash)))) && ((decode_buf_len(state, (&(*result).psa_hash_verify_req_hash_length))))))); log_result(state, res, __func__); @@ -434,7 +458,7 @@ static bool decode_psa_mac_compute_req(zcbor_state_t *state, struct psa_mac_comp bool res = (((((zcbor_uint32_expect(state, (27)))) && ((zcbor_uint32_decode(state, (&(*result).psa_mac_compute_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_mac_compute_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_mac_compute_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_mac_compute_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_mac_compute_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_mac_compute_req_p_mac)))) && ((decode_buf_len(state, (&(*result).psa_mac_compute_req_mac_size)))) && @@ -451,9 +475,9 @@ static bool decode_psa_mac_verify_req(zcbor_state_t *state, struct psa_mac_verif bool res = (((((zcbor_uint32_expect(state, (28)))) && ((zcbor_uint32_decode(state, (&(*result).psa_mac_verify_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_mac_verify_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_mac_verify_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_mac_verify_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_mac_verify_req_input_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_mac_verify_req_p_mac)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_mac_verify_req_p_mac)))) && ((decode_buf_len(state, (&(*result).psa_mac_verify_req_mac_length))))))); log_result(state, res, __func__); @@ -494,7 +518,7 @@ static bool decode_psa_mac_update_req(zcbor_state_t *state, struct psa_mac_updat bool res = (((((zcbor_uint32_expect(state, (31)))) && ((decode_ptr_uint(state, (&(*result).psa_mac_update_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_mac_update_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_mac_update_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_mac_update_req_input_length))))))); log_result(state, res, __func__); @@ -525,7 +549,7 @@ static bool decode_psa_mac_verify_finish_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_expect(state, (33)))) && ((decode_ptr_uint(state, (&(*result).psa_mac_verify_finish_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_mac_verify_finish_req_p_mac)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_mac_verify_finish_req_p_mac)))) && ((decode_buf_len(state, (&(*result).psa_mac_verify_finish_req_mac_length))))))); log_result(state, res, __func__); @@ -552,7 +576,7 @@ static bool decode_psa_cipher_encrypt_req(zcbor_state_t *state, (((zcbor_uint32_expect(state, (35)))) && ((zcbor_uint32_decode(state, (&(*result).psa_cipher_encrypt_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_cipher_encrypt_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_cipher_encrypt_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_cipher_encrypt_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_cipher_encrypt_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_cipher_encrypt_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_cipher_encrypt_req_output_size)))) && @@ -571,7 +595,7 @@ static bool decode_psa_cipher_decrypt_req(zcbor_state_t *state, (((zcbor_uint32_expect(state, (36)))) && ((zcbor_uint32_decode(state, (&(*result).psa_cipher_decrypt_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_cipher_decrypt_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_cipher_decrypt_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_cipher_decrypt_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_cipher_decrypt_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_cipher_decrypt_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_cipher_decrypt_req_output_size)))) && @@ -633,7 +657,7 @@ static bool decode_psa_cipher_set_iv_req(zcbor_state_t *state, struct psa_cipher bool res = (((((zcbor_uint32_expect(state, (40)))) && ((decode_ptr_uint(state, (&(*result).psa_cipher_set_iv_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_cipher_set_iv_req_p_iv)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_cipher_set_iv_req_p_iv)))) && ((decode_buf_len(state, (&(*result).psa_cipher_set_iv_req_iv_length))))))); log_result(state, res, __func__); @@ -647,7 +671,7 @@ static bool decode_psa_cipher_update_req(zcbor_state_t *state, struct psa_cipher bool res = (( (((zcbor_uint32_expect(state, (41)))) && ((decode_ptr_uint(state, (&(*result).psa_cipher_update_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_cipher_update_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_cipher_update_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_cipher_update_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_cipher_update_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_cipher_update_req_output_size)))) && @@ -691,12 +715,13 @@ static bool decode_psa_aead_encrypt_req(zcbor_state_t *state, struct psa_aead_en (((((zcbor_uint32_expect(state, (44)))) && ((zcbor_uint32_decode(state, (&(*result).psa_aead_encrypt_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_aead_encrypt_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_encrypt_req_p_nonce)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_encrypt_req_p_nonce)))) && ((decode_buf_len(state, (&(*result).psa_aead_encrypt_req_nonce_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_encrypt_req_p_additional_data)))) && + ((decode_ptr_const_buf(state, + (&(*result).psa_aead_encrypt_req_p_additional_data)))) && ((decode_buf_len(state, (&(*result).psa_aead_encrypt_req_additional_data_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_encrypt_req_p_plaintext)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_encrypt_req_p_plaintext)))) && ((decode_buf_len(state, (&(*result).psa_aead_encrypt_req_plaintext_length)))) && ((decode_ptr_buf(state, (&(*result).psa_aead_encrypt_req_p_ciphertext)))) && ((decode_buf_len(state, (&(*result).psa_aead_encrypt_req_ciphertext_size)))) && @@ -715,12 +740,13 @@ static bool decode_psa_aead_decrypt_req(zcbor_state_t *state, struct psa_aead_de ((zcbor_uint32_expect(state, (45)))) && ((zcbor_uint32_decode(state, (&(*result).psa_aead_decrypt_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_aead_decrypt_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_decrypt_req_p_nonce)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_decrypt_req_p_nonce)))) && ((decode_buf_len(state, (&(*result).psa_aead_decrypt_req_nonce_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_decrypt_req_p_additional_data)))) && + ((decode_ptr_const_buf(state, + (&(*result).psa_aead_decrypt_req_p_additional_data)))) && ((decode_buf_len(state, (&(*result).psa_aead_decrypt_req_additional_data_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_decrypt_req_p_ciphertext)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_decrypt_req_p_ciphertext)))) && ((decode_buf_len(state, (&(*result).psa_aead_decrypt_req_ciphertext_length)))) && ((decode_ptr_buf(state, (&(*result).psa_aead_decrypt_req_p_plaintext)))) && ((decode_buf_len(state, (&(*result).psa_aead_decrypt_req_plaintext_size)))) && @@ -785,7 +811,7 @@ static bool decode_psa_aead_set_nonce_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_expect(state, (49)))) && ((decode_ptr_uint(state, (&(*result).psa_aead_set_nonce_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_set_nonce_req_p_nonce)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_set_nonce_req_p_nonce)))) && ((decode_buf_len(state, (&(*result).psa_aead_set_nonce_req_nonce_length))))))); log_result(state, res, __func__); @@ -797,10 +823,11 @@ static bool decode_psa_aead_set_lengths_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_expect(state, (50)))) && - ((decode_ptr_uint(state, (&(*result).psa_aead_set_lengths_req_p_handle)))) && - ((decode_buf_len(state, (&(*result).psa_aead_set_lengths_req_ad_length)))) && - ((decode_buf_len(state, + bool res = (( + (((zcbor_uint32_expect(state, (50)))) && + ((decode_ptr_uint(state, (&(*result).psa_aead_set_lengths_req_p_handle)))) && + ((zcbor_uint32_decode(state, (&(*result).psa_aead_set_lengths_req_ad_length)))) && + ((zcbor_uint32_decode(state, (&(*result).psa_aead_set_lengths_req_plaintext_length))))))); log_result(state, res, __func__); @@ -815,7 +842,7 @@ static bool decode_psa_aead_update_ad_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_expect(state, (51)))) && ((decode_ptr_uint(state, (&(*result).psa_aead_update_ad_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_update_ad_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_update_ad_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_aead_update_ad_req_input_length))))))); log_result(state, res, __func__); @@ -829,7 +856,7 @@ static bool decode_psa_aead_update_req(zcbor_state_t *state, struct psa_aead_upd bool res = (((((zcbor_uint32_expect(state, (52)))) && ((decode_ptr_uint(state, (&(*result).psa_aead_update_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_update_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_update_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_aead_update_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_aead_update_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_aead_update_req_output_size)))) && @@ -867,7 +894,7 @@ static bool decode_psa_aead_verify_req(zcbor_state_t *state, struct psa_aead_ver ((decode_ptr_buf(state, (&(*result).psa_aead_verify_req_p_plaintext)))) && ((decode_buf_len(state, (&(*result).psa_aead_verify_req_plaintext_size)))) && ((decode_ptr_uint(state, (&(*result).psa_aead_verify_req_p_plaintext_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_aead_verify_req_p_tag)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_aead_verify_req_p_tag)))) && ((decode_buf_len(state, (&(*result).psa_aead_verify_req_tag_length))))))); log_result(state, res, __func__); @@ -893,7 +920,7 @@ static bool decode_psa_sign_message_req(zcbor_state_t *state, struct psa_sign_me ((zcbor_uint32_expect(state, (56)))) && ((zcbor_uint32_decode(state, (&(*result).psa_sign_message_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_sign_message_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_sign_message_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_sign_message_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_sign_message_req_input_length)))) && ((decode_ptr_buf(state, (&(*result).psa_sign_message_req_p_signature)))) && ((decode_buf_len(state, (&(*result).psa_sign_message_req_signature_size)))) && @@ -912,9 +939,9 @@ static bool decode_psa_verify_message_req(zcbor_state_t *state, (((zcbor_uint32_expect(state, (57)))) && ((zcbor_uint32_decode(state, (&(*result).psa_verify_message_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_verify_message_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_verify_message_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_verify_message_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_verify_message_req_input_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_verify_message_req_p_signature)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_verify_message_req_p_signature)))) && ((decode_buf_len(state, (&(*result).psa_verify_message_req_signature_length))))))); log_result(state, res, __func__); @@ -929,7 +956,7 @@ static bool decode_psa_sign_hash_req(zcbor_state_t *state, struct psa_sign_hash_ (((((zcbor_uint32_expect(state, (58)))) && ((zcbor_uint32_decode(state, (&(*result).psa_sign_hash_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_sign_hash_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_sign_hash_req_p_hash)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_sign_hash_req_p_hash)))) && ((decode_buf_len(state, (&(*result).psa_sign_hash_req_hash_length)))) && ((decode_ptr_buf(state, (&(*result).psa_sign_hash_req_p_signature)))) && ((decode_buf_len(state, (&(*result).psa_sign_hash_req_signature_size)))) && @@ -947,9 +974,9 @@ static bool decode_psa_verify_hash_req(zcbor_state_t *state, struct psa_verify_h (((((zcbor_uint32_expect(state, (59)))) && ((zcbor_uint32_decode(state, (&(*result).psa_verify_hash_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_verify_hash_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_verify_hash_req_p_hash)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_verify_hash_req_p_hash)))) && ((decode_buf_len(state, (&(*result).psa_verify_hash_req_hash_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_verify_hash_req_p_signature)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_verify_hash_req_p_signature)))) && ((decode_buf_len(state, (&(*result).psa_verify_hash_req_signature_length))))))); log_result(state, res, __func__); @@ -965,9 +992,9 @@ static bool decode_psa_asymmetric_encrypt_req(zcbor_state_t *state, (((zcbor_uint32_expect(state, (60)))) && ((zcbor_uint32_decode(state, (&(*result).psa_asymmetric_encrypt_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_asymmetric_encrypt_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_asymmetric_encrypt_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_asymmetric_encrypt_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_asymmetric_encrypt_req_input_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_asymmetric_encrypt_req_p_salt)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_asymmetric_encrypt_req_p_salt)))) && ((decode_buf_len(state, (&(*result).psa_asymmetric_encrypt_req_salt_length)))) && ((decode_ptr_buf(state, (&(*result).psa_asymmetric_encrypt_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_asymmetric_encrypt_req_output_size)))) && @@ -987,9 +1014,9 @@ static bool decode_psa_asymmetric_decrypt_req(zcbor_state_t *state, (((zcbor_uint32_expect(state, (61)))) && ((zcbor_uint32_decode(state, (&(*result).psa_asymmetric_decrypt_req_key)))) && ((zcbor_uint32_decode(state, (&(*result).psa_asymmetric_decrypt_req_alg)))) && - ((decode_ptr_buf(state, (&(*result).psa_asymmetric_decrypt_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_asymmetric_decrypt_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_asymmetric_decrypt_req_input_length)))) && - ((decode_ptr_buf(state, (&(*result).psa_asymmetric_decrypt_req_p_salt)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_asymmetric_decrypt_req_p_salt)))) && ((decode_buf_len(state, (&(*result).psa_asymmetric_decrypt_req_salt_length)))) && ((decode_ptr_buf(state, (&(*result).psa_asymmetric_decrypt_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_asymmetric_decrypt_req_output_size)))) && @@ -1054,15 +1081,16 @@ decode_psa_key_derivation_input_bytes_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = ((( - ((zcbor_uint32_expect(state, (65)))) && - ((decode_ptr_uint(state, - (&(*result).psa_key_derivation_input_bytes_req_p_handle)))) && - ((zcbor_uint32_decode(state, - (&(*result).psa_key_derivation_input_bytes_req_step)))) && - ((decode_ptr_buf(state, (&(*result).psa_key_derivation_input_bytes_req_p_data)))) && - ((decode_buf_len(state, - (&(*result).psa_key_derivation_input_bytes_req_data_length))))))); + bool res = + (((((zcbor_uint32_expect(state, (65)))) && + ((decode_ptr_uint(state, + (&(*result).psa_key_derivation_input_bytes_req_p_handle)))) && + ((zcbor_uint32_decode(state, + (&(*result).psa_key_derivation_input_bytes_req_step)))) && + ((decode_ptr_const_buf( + state, (&(*result).psa_key_derivation_input_bytes_req_p_data)))) && + ((decode_buf_len( + state, (&(*result).psa_key_derivation_input_bytes_req_data_length))))))); log_result(state, res, __func__); return res; @@ -1118,8 +1146,8 @@ decode_psa_key_derivation_key_agreement_req(zcbor_state_t *state, (&(*result).psa_key_derivation_key_agreement_req_step)))) && ((zcbor_uint32_decode( state, (&(*result).psa_key_derivation_key_agreement_req_private_key)))) && - ((decode_ptr_buf(state, - (&(*result).psa_key_derivation_key_agreement_req_p_peer_key)))) && + ((decode_ptr_const_buf( + state, (&(*result).psa_key_derivation_key_agreement_req_p_peer_key)))) && ((decode_buf_len( state, (&(*result).psa_key_derivation_key_agreement_req_peer_key_length))))))); @@ -1155,8 +1183,8 @@ decode_psa_key_derivation_output_key_req(zcbor_state_t *state, bool res = (( (((zcbor_uint32_expect(state, (70)))) && - ((decode_ptr_attr(state, - (&(*result).psa_key_derivation_output_key_req_p_attributes)))) && + ((decode_ptr_const_attr( + state, (&(*result).psa_key_derivation_output_key_req_p_attributes)))) && ((decode_ptr_uint(state, (&(*result).psa_key_derivation_output_key_req_p_handle)))) && ((decode_ptr_key(state, (&(*result).psa_key_derivation_output_key_req_p_key))))))); @@ -1188,7 +1216,8 @@ static bool decode_psa_raw_key_agreement_req(zcbor_state_t *state, ((zcbor_uint32_decode(state, (&(*result).psa_raw_key_agreement_req_alg)))) && ((zcbor_uint32_decode(state, (&(*result).psa_raw_key_agreement_req_private_key)))) && - ((decode_ptr_buf(state, (&(*result).psa_raw_key_agreement_req_p_peer_key)))) && + ((decode_ptr_const_buf(state, + (&(*result).psa_raw_key_agreement_req_p_peer_key)))) && ((decode_buf_len(state, (&(*result).psa_raw_key_agreement_req_peer_key_length)))) && ((decode_ptr_buf(state, (&(*result).psa_raw_key_agreement_req_p_output)))) && ((decode_buf_len(state, (&(*result).psa_raw_key_agreement_req_output_size)))) && @@ -1217,19 +1246,20 @@ static bool decode_psa_generate_key_req(zcbor_state_t *state, struct psa_generat { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_expect(state, (74)))) && - ((decode_ptr_attr(state, (&(*result).psa_generate_key_req_p_attributes)))) && - ((decode_ptr_key(state, (&(*result).psa_generate_key_req_p_key))))))); + bool res = (( + (((zcbor_uint32_expect(state, (74)))) && + ((decode_ptr_const_attr(state, (&(*result).psa_generate_key_req_p_attributes)))) && + ((decode_ptr_key(state, (&(*result).psa_generate_key_req_p_key))))))); log_result(state, res, __func__); return res; } -static bool decode_ptr_cipher(zcbor_state_t *state, uint32_t *result) +static bool decode_ptr_const_cipher(zcbor_state_t *state, uint32_t *result) { zcbor_log("%s\r\n", __func__); - bool res = ((zcbor_tag_expect(state, 32775) && (zcbor_uint32_decode(state, (&(*result)))))); + bool res = ((zcbor_tag_expect(state, 32780) && (zcbor_uint32_decode(state, (&(*result)))))); log_result(state, res, __func__); return res; @@ -1243,7 +1273,8 @@ static bool decode_psa_pake_setup_req(zcbor_state_t *state, struct psa_pake_setu (((((zcbor_uint32_expect(state, (79)))) && ((decode_ptr_uint(state, (&(*result).psa_pake_setup_req_p_handle)))) && ((zcbor_uint32_decode(state, (&(*result).psa_pake_setup_req_password_key)))) && - ((decode_ptr_cipher(state, (&(*result).psa_pake_setup_req_p_cipher_suite))))))); + ((decode_ptr_const_cipher(state, + (&(*result).psa_pake_setup_req_p_cipher_suite))))))); log_result(state, res, __func__); return res; @@ -1265,10 +1296,11 @@ static bool decode_psa_pake_set_user_req(zcbor_state_t *state, struct psa_pake_s { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_expect(state, (81)))) && - ((decode_ptr_uint(state, (&(*result).psa_pake_set_user_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_pake_set_user_req_p_user_id)))) && - ((decode_buf_len(state, (&(*result).psa_pake_set_user_req_user_id_len))))))); + bool res = + (((((zcbor_uint32_expect(state, (81)))) && + ((decode_ptr_uint(state, (&(*result).psa_pake_set_user_req_p_handle)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_pake_set_user_req_p_user_id)))) && + ((decode_buf_len(state, (&(*result).psa_pake_set_user_req_user_id_len))))))); log_result(state, res, __func__); return res; @@ -1278,10 +1310,11 @@ static bool decode_psa_pake_set_peer_req(zcbor_state_t *state, struct psa_pake_s { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_expect(state, (82)))) && - ((decode_ptr_uint(state, (&(*result).psa_pake_set_peer_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_pake_set_peer_req_p_peer_id)))) && - ((decode_buf_len(state, (&(*result).psa_pake_set_peer_req_peer_id_len))))))); + bool res = + (((((zcbor_uint32_expect(state, (82)))) && + ((decode_ptr_uint(state, (&(*result).psa_pake_set_peer_req_p_handle)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_pake_set_peer_req_p_peer_id)))) && + ((decode_buf_len(state, (&(*result).psa_pake_set_peer_req_peer_id_len))))))); log_result(state, res, __func__); return res; @@ -1292,11 +1325,11 @@ static bool decode_psa_pake_set_context_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = - (((((zcbor_uint32_expect(state, (83)))) && - ((decode_ptr_uint(state, (&(*result).psa_pake_set_context_req_p_handle)))) && - ((decode_ptr_buf(state, (&(*result).psa_pake_set_context_req_p_context)))) && - ((decode_buf_len(state, (&(*result).psa_pake_set_context_req_context_len))))))); + bool res = (( + (((zcbor_uint32_expect(state, (83)))) && + ((decode_ptr_uint(state, (&(*result).psa_pake_set_context_req_p_handle)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_pake_set_context_req_p_context)))) && + ((decode_buf_len(state, (&(*result).psa_pake_set_context_req_context_len))))))); log_result(state, res, __func__); return res; @@ -1325,7 +1358,7 @@ static bool decode_psa_pake_input_req(zcbor_state_t *state, struct psa_pake_inpu bool res = (((((zcbor_uint32_expect(state, (85)))) && ((decode_ptr_uint(state, (&(*result).psa_pake_input_req_p_handle)))) && ((zcbor_uint32_decode(state, (&(*result).psa_pake_input_req_step)))) && - ((decode_ptr_buf(state, (&(*result).psa_pake_input_req_p_input)))) && + ((decode_ptr_const_buf(state, (&(*result).psa_pake_input_req_p_input)))) && ((decode_buf_len(state, (&(*result).psa_pake_input_req_input_length))))))); log_result(state, res, __func__); @@ -1337,11 +1370,12 @@ static bool decode_psa_pake_get_shared_key_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = ((( - ((zcbor_uint32_expect(state, (86)))) && - ((decode_ptr_uint(state, (&(*result).psa_pake_get_shared_key_req_p_handle)))) && - ((decode_ptr_attr(state, (&(*result).psa_pake_get_shared_key_req_p_attributes)))) && - ((decode_ptr_key(state, (&(*result).psa_pake_get_shared_key_req_p_key))))))); + bool res = + (((((zcbor_uint32_expect(state, (86)))) && + ((decode_ptr_uint(state, (&(*result).psa_pake_get_shared_key_req_p_handle)))) && + ((decode_ptr_const_attr( + state, (&(*result).psa_pake_get_shared_key_req_p_attributes)))) && + ((decode_ptr_key(state, (&(*result).psa_pake_get_shared_key_req_p_key))))))); log_result(state, res, __func__); return res; diff --git a/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_encode.c b/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_encode.c index b1d3eac738bf..848db05fb0b8 100644 --- a/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_encode.c +++ b/subsys/sdfw_services/services/psa_crypto/zcbor_generated/psa_crypto_service_encode.c @@ -39,13 +39,15 @@ static bool encode_psa_get_key_attributes_req(zcbor_state_t *state, static bool encode_psa_reset_key_attributes_req(zcbor_state_t *state, const struct psa_reset_key_attributes_req *input); static bool encode_psa_purge_key_req(zcbor_state_t *state, const struct psa_purge_key_req *input); +static bool encode_ptr_const_attr(zcbor_state_t *state, const uint32_t *input); static bool encode_ptr_key(zcbor_state_t *state, const uint32_t *input); static bool encode_psa_copy_key_req(zcbor_state_t *state, const struct psa_copy_key_req *input); static bool encode_psa_destroy_key_req(zcbor_state_t *state, const struct psa_destroy_key_req *input); -static bool encode_ptr_buf(zcbor_state_t *state, const uint32_t *input); +static bool encode_ptr_const_buf(zcbor_state_t *state, const uint32_t *input); static bool encode_buf_len(zcbor_state_t *state, const uint32_t *input); static bool encode_psa_import_key_req(zcbor_state_t *state, const struct psa_import_key_req *input); +static bool encode_ptr_buf(zcbor_state_t *state, const uint32_t *input); static bool encode_ptr_uint(zcbor_state_t *state, const uint32_t *input); static bool encode_psa_export_key_req(zcbor_state_t *state, const struct psa_export_key_req *input); static bool encode_psa_export_public_key_req(zcbor_state_t *state, @@ -160,7 +162,7 @@ static bool encode_psa_generate_random_req(zcbor_state_t *state, const struct psa_generate_random_req *input); static bool encode_psa_generate_key_req(zcbor_state_t *state, const struct psa_generate_key_req *input); -static bool encode_ptr_cipher(zcbor_state_t *state, const uint32_t *input); +static bool encode_ptr_const_cipher(zcbor_state_t *state, const uint32_t *input); static bool encode_psa_pake_setup_req(zcbor_state_t *state, const struct psa_pake_setup_req *input); static bool encode_psa_pake_set_role_req(zcbor_state_t *state, const struct psa_pake_set_role_req *input); @@ -227,6 +229,16 @@ static bool encode_psa_purge_key_req(zcbor_state_t *state, const struct psa_purg return res; } +static bool encode_ptr_const_attr(zcbor_state_t *state, const uint32_t *input) +{ + zcbor_log("%s\r\n", __func__); + + bool res = ((zcbor_tag_put(state, 32777) && (zcbor_uint32_encode(state, (&(*input)))))); + + log_result(state, res, __func__); + return res; +} + static bool encode_ptr_key(zcbor_state_t *state, const uint32_t *input) { zcbor_log("%s\r\n", __func__); @@ -243,7 +255,7 @@ static bool encode_psa_copy_key_req(zcbor_state_t *state, const struct psa_copy_ bool res = (((((zcbor_uint32_put(state, (14)))) && ((zcbor_uint32_encode(state, (&(*input).psa_copy_key_req_source_key)))) && - ((encode_ptr_attr(state, (&(*input).psa_copy_key_req_p_attributes)))) && + ((encode_ptr_const_attr(state, (&(*input).psa_copy_key_req_p_attributes)))) && ((encode_ptr_key(state, (&(*input).psa_copy_key_req_p_target_key))))))); log_result(state, res, __func__); @@ -262,11 +274,11 @@ static bool encode_psa_destroy_key_req(zcbor_state_t *state, return res; } -static bool encode_ptr_buf(zcbor_state_t *state, const uint32_t *input) +static bool encode_ptr_const_buf(zcbor_state_t *state, const uint32_t *input) { zcbor_log("%s\r\n", __func__); - bool res = ((zcbor_tag_put(state, 32770) && (zcbor_uint32_encode(state, (&(*input)))))); + bool res = ((zcbor_tag_put(state, 32776) && (zcbor_uint32_encode(state, (&(*input)))))); log_result(state, res, __func__); return res; @@ -286,11 +298,22 @@ static bool encode_psa_import_key_req(zcbor_state_t *state, const struct psa_imp { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_put(state, (16)))) && - ((encode_ptr_attr(state, (&(*input).psa_import_key_req_p_attributes)))) && - ((encode_ptr_buf(state, (&(*input).psa_import_key_req_p_data)))) && - ((encode_buf_len(state, (&(*input).psa_import_key_req_data_length)))) && - ((encode_ptr_key(state, (&(*input).psa_import_key_req_p_key))))))); + bool res = + (((((zcbor_uint32_put(state, (16)))) && + ((encode_ptr_const_attr(state, (&(*input).psa_import_key_req_p_attributes)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_import_key_req_p_data)))) && + ((encode_buf_len(state, (&(*input).psa_import_key_req_data_length)))) && + ((encode_ptr_key(state, (&(*input).psa_import_key_req_p_key))))))); + + log_result(state, res, __func__); + return res; +} + +static bool encode_ptr_buf(zcbor_state_t *state, const uint32_t *input) +{ + zcbor_log("%s\r\n", __func__); + + bool res = ((zcbor_tag_put(state, 32770) && (zcbor_uint32_encode(state, (&(*input)))))); log_result(state, res, __func__); return res; @@ -343,7 +366,7 @@ static bool encode_psa_hash_compute_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (19)))) && ((zcbor_uint32_encode(state, (&(*input).psa_hash_compute_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_hash_compute_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_hash_compute_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_hash_compute_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_hash_compute_req_p_hash)))) && ((encode_buf_len(state, (&(*input).psa_hash_compute_req_hash_size)))) && @@ -360,9 +383,9 @@ static bool encode_psa_hash_compare_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (20)))) && ((zcbor_uint32_encode(state, (&(*input).psa_hash_compare_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_hash_compare_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_hash_compare_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_hash_compare_req_input_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_hash_compare_req_p_hash)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_hash_compare_req_p_hash)))) && ((encode_buf_len(state, (&(*input).psa_hash_compare_req_hash_length))))))); log_result(state, res, __func__); @@ -388,7 +411,7 @@ static bool encode_psa_hash_update_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (22)))) && ((encode_ptr_uint(state, (&(*input).psa_hash_update_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_hash_update_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_hash_update_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_hash_update_req_input_length))))))); log_result(state, res, __func__); @@ -417,7 +440,7 @@ static bool encode_psa_hash_verify_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (24)))) && ((encode_ptr_uint(state, (&(*input).psa_hash_verify_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_hash_verify_req_p_hash)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_hash_verify_req_p_hash)))) && ((encode_buf_len(state, (&(*input).psa_hash_verify_req_hash_length))))))); log_result(state, res, __func__); @@ -455,7 +478,7 @@ static bool encode_psa_mac_compute_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (27)))) && ((zcbor_uint32_encode(state, (&(*input).psa_mac_compute_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_mac_compute_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_mac_compute_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_mac_compute_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_mac_compute_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_mac_compute_req_p_mac)))) && ((encode_buf_len(state, (&(*input).psa_mac_compute_req_mac_size)))) && @@ -472,9 +495,9 @@ static bool encode_psa_mac_verify_req(zcbor_state_t *state, const struct psa_mac bool res = (((((zcbor_uint32_put(state, (28)))) && ((zcbor_uint32_encode(state, (&(*input).psa_mac_verify_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_mac_verify_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_mac_verify_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_mac_verify_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_mac_verify_req_input_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_mac_verify_req_p_mac)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_mac_verify_req_p_mac)))) && ((encode_buf_len(state, (&(*input).psa_mac_verify_req_mac_length))))))); log_result(state, res, __func__); @@ -515,7 +538,7 @@ static bool encode_psa_mac_update_req(zcbor_state_t *state, const struct psa_mac bool res = (((((zcbor_uint32_put(state, (31)))) && ((encode_ptr_uint(state, (&(*input).psa_mac_update_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_mac_update_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_mac_update_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_mac_update_req_input_length))))))); log_result(state, res, __func__); @@ -546,7 +569,7 @@ static bool encode_psa_mac_verify_finish_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (33)))) && ((encode_ptr_uint(state, (&(*input).psa_mac_verify_finish_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_mac_verify_finish_req_p_mac)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_mac_verify_finish_req_p_mac)))) && ((encode_buf_len(state, (&(*input).psa_mac_verify_finish_req_mac_length))))))); log_result(state, res, __func__); @@ -573,7 +596,7 @@ static bool encode_psa_cipher_encrypt_req(zcbor_state_t *state, (((zcbor_uint32_put(state, (35)))) && ((zcbor_uint32_encode(state, (&(*input).psa_cipher_encrypt_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_cipher_encrypt_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_cipher_encrypt_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_cipher_encrypt_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_cipher_encrypt_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_cipher_encrypt_req_p_output)))) && ((encode_buf_len(state, (&(*input).psa_cipher_encrypt_req_output_size)))) && @@ -592,7 +615,7 @@ static bool encode_psa_cipher_decrypt_req(zcbor_state_t *state, (((zcbor_uint32_put(state, (36)))) && ((zcbor_uint32_encode(state, (&(*input).psa_cipher_decrypt_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_cipher_decrypt_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_cipher_decrypt_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_cipher_decrypt_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_cipher_decrypt_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_cipher_decrypt_req_p_output)))) && ((encode_buf_len(state, (&(*input).psa_cipher_decrypt_req_output_size)))) && @@ -655,7 +678,7 @@ static bool encode_psa_cipher_set_iv_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (40)))) && ((encode_ptr_uint(state, (&(*input).psa_cipher_set_iv_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_cipher_set_iv_req_p_iv)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_cipher_set_iv_req_p_iv)))) && ((encode_buf_len(state, (&(*input).psa_cipher_set_iv_req_iv_length))))))); log_result(state, res, __func__); @@ -670,7 +693,7 @@ static bool encode_psa_cipher_update_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (41)))) && ((encode_ptr_uint(state, (&(*input).psa_cipher_update_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_cipher_update_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_cipher_update_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_cipher_update_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_cipher_update_req_p_output)))) && ((encode_buf_len(state, (&(*input).psa_cipher_update_req_output_size)))) && @@ -717,12 +740,13 @@ static bool encode_psa_aead_encrypt_req(zcbor_state_t *state, ((zcbor_uint32_put(state, (44)))) && ((zcbor_uint32_encode(state, (&(*input).psa_aead_encrypt_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_aead_encrypt_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_encrypt_req_p_nonce)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_encrypt_req_p_nonce)))) && ((encode_buf_len(state, (&(*input).psa_aead_encrypt_req_nonce_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_encrypt_req_p_additional_data)))) && + ((encode_ptr_const_buf(state, + (&(*input).psa_aead_encrypt_req_p_additional_data)))) && ((encode_buf_len(state, (&(*input).psa_aead_encrypt_req_additional_data_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_encrypt_req_p_plaintext)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_encrypt_req_p_plaintext)))) && ((encode_buf_len(state, (&(*input).psa_aead_encrypt_req_plaintext_length)))) && ((encode_ptr_buf(state, (&(*input).psa_aead_encrypt_req_p_ciphertext)))) && ((encode_buf_len(state, (&(*input).psa_aead_encrypt_req_ciphertext_size)))) && @@ -741,12 +765,13 @@ static bool encode_psa_aead_decrypt_req(zcbor_state_t *state, (((zcbor_uint32_put(state, (45)))) && ((zcbor_uint32_encode(state, (&(*input).psa_aead_decrypt_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_aead_decrypt_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_decrypt_req_p_nonce)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_decrypt_req_p_nonce)))) && ((encode_buf_len(state, (&(*input).psa_aead_decrypt_req_nonce_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_decrypt_req_p_additional_data)))) && + ((encode_ptr_const_buf(state, + (&(*input).psa_aead_decrypt_req_p_additional_data)))) && ((encode_buf_len(state, (&(*input).psa_aead_decrypt_req_additional_data_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_decrypt_req_p_ciphertext)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_decrypt_req_p_ciphertext)))) && ((encode_buf_len(state, (&(*input).psa_aead_decrypt_req_ciphertext_length)))) && ((encode_ptr_buf(state, (&(*input).psa_aead_decrypt_req_p_plaintext)))) && ((encode_buf_len(state, (&(*input).psa_aead_decrypt_req_plaintext_size)))) && @@ -808,7 +833,7 @@ static bool encode_psa_aead_set_nonce_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (49)))) && ((encode_ptr_uint(state, (&(*input).psa_aead_set_nonce_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_set_nonce_req_p_nonce)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_set_nonce_req_p_nonce)))) && ((encode_buf_len(state, (&(*input).psa_aead_set_nonce_req_nonce_length))))))); log_result(state, res, __func__); @@ -820,11 +845,12 @@ static bool encode_psa_aead_set_lengths_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = ((( - ((zcbor_uint32_put(state, (50)))) && - ((encode_ptr_uint(state, (&(*input).psa_aead_set_lengths_req_p_handle)))) && - ((encode_buf_len(state, (&(*input).psa_aead_set_lengths_req_ad_length)))) && - ((encode_buf_len(state, (&(*input).psa_aead_set_lengths_req_plaintext_length))))))); + bool res = + (((((zcbor_uint32_put(state, (50)))) && + ((encode_ptr_uint(state, (&(*input).psa_aead_set_lengths_req_p_handle)))) && + ((zcbor_uint32_encode(state, (&(*input).psa_aead_set_lengths_req_ad_length)))) && + ((zcbor_uint32_encode( + state, (&(*input).psa_aead_set_lengths_req_plaintext_length))))))); log_result(state, res, __func__); return res; @@ -837,7 +863,7 @@ static bool encode_psa_aead_update_ad_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (51)))) && ((encode_ptr_uint(state, (&(*input).psa_aead_update_ad_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_update_ad_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_update_ad_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_aead_update_ad_req_input_length))))))); log_result(state, res, __func__); @@ -852,7 +878,7 @@ static bool encode_psa_aead_update_req(zcbor_state_t *state, bool res = (((((zcbor_uint32_put(state, (52)))) && ((encode_ptr_uint(state, (&(*input).psa_aead_update_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_update_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_update_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_aead_update_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_aead_update_req_p_output)))) && ((encode_buf_len(state, (&(*input).psa_aead_update_req_output_size)))) && @@ -892,7 +918,7 @@ static bool encode_psa_aead_verify_req(zcbor_state_t *state, ((encode_ptr_buf(state, (&(*input).psa_aead_verify_req_p_plaintext)))) && ((encode_buf_len(state, (&(*input).psa_aead_verify_req_plaintext_size)))) && ((encode_ptr_uint(state, (&(*input).psa_aead_verify_req_p_plaintext_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_aead_verify_req_p_tag)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_aead_verify_req_p_tag)))) && ((encode_buf_len(state, (&(*input).psa_aead_verify_req_tag_length))))))); log_result(state, res, __func__); @@ -919,7 +945,7 @@ static bool encode_psa_sign_message_req(zcbor_state_t *state, (((zcbor_uint32_put(state, (56)))) && ((zcbor_uint32_encode(state, (&(*input).psa_sign_message_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_sign_message_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_sign_message_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_sign_message_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_sign_message_req_input_length)))) && ((encode_ptr_buf(state, (&(*input).psa_sign_message_req_p_signature)))) && ((encode_buf_len(state, (&(*input).psa_sign_message_req_signature_size)))) && @@ -938,9 +964,9 @@ static bool encode_psa_verify_message_req(zcbor_state_t *state, (((zcbor_uint32_put(state, (57)))) && ((zcbor_uint32_encode(state, (&(*input).psa_verify_message_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_verify_message_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_verify_message_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_verify_message_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_verify_message_req_input_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_verify_message_req_p_signature)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_verify_message_req_p_signature)))) && ((encode_buf_len(state, (&(*input).psa_verify_message_req_signature_length))))))); log_result(state, res, __func__); @@ -955,7 +981,7 @@ static bool encode_psa_sign_hash_req(zcbor_state_t *state, const struct psa_sign (((((zcbor_uint32_put(state, (58)))) && ((zcbor_uint32_encode(state, (&(*input).psa_sign_hash_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_sign_hash_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_sign_hash_req_p_hash)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_sign_hash_req_p_hash)))) && ((encode_buf_len(state, (&(*input).psa_sign_hash_req_hash_length)))) && ((encode_ptr_buf(state, (&(*input).psa_sign_hash_req_p_signature)))) && ((encode_buf_len(state, (&(*input).psa_sign_hash_req_signature_size)))) && @@ -974,9 +1000,9 @@ static bool encode_psa_verify_hash_req(zcbor_state_t *state, (((((zcbor_uint32_put(state, (59)))) && ((zcbor_uint32_encode(state, (&(*input).psa_verify_hash_req_key)))) && ((zcbor_uint32_encode(state, (&(*input).psa_verify_hash_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_verify_hash_req_p_hash)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_verify_hash_req_p_hash)))) && ((encode_buf_len(state, (&(*input).psa_verify_hash_req_hash_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_verify_hash_req_p_signature)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_verify_hash_req_p_signature)))) && ((encode_buf_len(state, (&(*input).psa_verify_hash_req_signature_length))))))); log_result(state, res, __func__); @@ -988,18 +1014,18 @@ static bool encode_psa_asymmetric_encrypt_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = - (((((zcbor_uint32_put(state, (60)))) && - ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_encrypt_req_key)))) && - ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_encrypt_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_asymmetric_encrypt_req_p_input)))) && - ((encode_buf_len(state, (&(*input).psa_asymmetric_encrypt_req_input_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_asymmetric_encrypt_req_p_salt)))) && - ((encode_buf_len(state, (&(*input).psa_asymmetric_encrypt_req_salt_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_asymmetric_encrypt_req_p_output)))) && - ((encode_buf_len(state, (&(*input).psa_asymmetric_encrypt_req_output_size)))) && - ((encode_ptr_uint(state, - (&(*input).psa_asymmetric_encrypt_req_p_output_length))))))); + bool res = (( + (((zcbor_uint32_put(state, (60)))) && + ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_encrypt_req_key)))) && + ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_encrypt_req_alg)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_asymmetric_encrypt_req_p_input)))) && + ((encode_buf_len(state, (&(*input).psa_asymmetric_encrypt_req_input_length)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_asymmetric_encrypt_req_p_salt)))) && + ((encode_buf_len(state, (&(*input).psa_asymmetric_encrypt_req_salt_length)))) && + ((encode_ptr_buf(state, (&(*input).psa_asymmetric_encrypt_req_p_output)))) && + ((encode_buf_len(state, (&(*input).psa_asymmetric_encrypt_req_output_size)))) && + ((encode_ptr_uint(state, + (&(*input).psa_asymmetric_encrypt_req_p_output_length))))))); log_result(state, res, __func__); return res; @@ -1010,18 +1036,18 @@ static bool encode_psa_asymmetric_decrypt_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = - (((((zcbor_uint32_put(state, (61)))) && - ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_decrypt_req_key)))) && - ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_decrypt_req_alg)))) && - ((encode_ptr_buf(state, (&(*input).psa_asymmetric_decrypt_req_p_input)))) && - ((encode_buf_len(state, (&(*input).psa_asymmetric_decrypt_req_input_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_asymmetric_decrypt_req_p_salt)))) && - ((encode_buf_len(state, (&(*input).psa_asymmetric_decrypt_req_salt_length)))) && - ((encode_ptr_buf(state, (&(*input).psa_asymmetric_decrypt_req_p_output)))) && - ((encode_buf_len(state, (&(*input).psa_asymmetric_decrypt_req_output_size)))) && - ((encode_ptr_uint(state, - (&(*input).psa_asymmetric_decrypt_req_p_output_length))))))); + bool res = (( + (((zcbor_uint32_put(state, (61)))) && + ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_decrypt_req_key)))) && + ((zcbor_uint32_encode(state, (&(*input).psa_asymmetric_decrypt_req_alg)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_asymmetric_decrypt_req_p_input)))) && + ((encode_buf_len(state, (&(*input).psa_asymmetric_decrypt_req_input_length)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_asymmetric_decrypt_req_p_salt)))) && + ((encode_buf_len(state, (&(*input).psa_asymmetric_decrypt_req_salt_length)))) && + ((encode_ptr_buf(state, (&(*input).psa_asymmetric_decrypt_req_p_output)))) && + ((encode_buf_len(state, (&(*input).psa_asymmetric_decrypt_req_output_size)))) && + ((encode_ptr_uint(state, + (&(*input).psa_asymmetric_decrypt_req_p_output_length))))))); log_result(state, res, __func__); return res; @@ -1080,15 +1106,16 @@ encode_psa_key_derivation_input_bytes_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = (( - (((zcbor_uint32_put(state, (65)))) && - ((encode_ptr_uint(state, - (&(*input).psa_key_derivation_input_bytes_req_p_handle)))) && - ((zcbor_uint32_encode(state, - (&(*input).psa_key_derivation_input_bytes_req_step)))) && - ((encode_ptr_buf(state, (&(*input).psa_key_derivation_input_bytes_req_p_data)))) && - ((encode_buf_len(state, - (&(*input).psa_key_derivation_input_bytes_req_data_length))))))); + bool res = + (((((zcbor_uint32_put(state, (65)))) && + ((encode_ptr_uint(state, + (&(*input).psa_key_derivation_input_bytes_req_p_handle)))) && + ((zcbor_uint32_encode(state, + (&(*input).psa_key_derivation_input_bytes_req_step)))) && + ((encode_ptr_const_buf( + state, (&(*input).psa_key_derivation_input_bytes_req_p_data)))) && + ((encode_buf_len( + state, (&(*input).psa_key_derivation_input_bytes_req_data_length))))))); log_result(state, res, __func__); return res; @@ -1140,7 +1167,7 @@ static bool encode_psa_key_derivation_key_agreement_req( (&(*input).psa_key_derivation_key_agreement_req_step)))) && ((zcbor_uint32_encode( state, (&(*input).psa_key_derivation_key_agreement_req_private_key)))) && - ((encode_ptr_buf( + ((encode_ptr_const_buf( state, (&(*input).psa_key_derivation_key_agreement_req_p_peer_key)))) && ((encode_buf_len( state, @@ -1177,8 +1204,8 @@ encode_psa_key_derivation_output_key_req(zcbor_state_t *state, bool res = (( (((zcbor_uint32_put(state, (70)))) && - ((encode_ptr_attr(state, - (&(*input).psa_key_derivation_output_key_req_p_attributes)))) && + ((encode_ptr_const_attr( + state, (&(*input).psa_key_derivation_output_key_req_p_attributes)))) && ((encode_ptr_uint(state, (&(*input).psa_key_derivation_output_key_req_p_handle)))) && ((encode_ptr_key(state, (&(*input).psa_key_derivation_output_key_req_p_key))))))); @@ -1209,7 +1236,7 @@ static bool encode_psa_raw_key_agreement_req(zcbor_state_t *state, ((zcbor_uint32_put(state, (72)))) && ((zcbor_uint32_encode(state, (&(*input).psa_raw_key_agreement_req_alg)))) && ((zcbor_uint32_encode(state, (&(*input).psa_raw_key_agreement_req_private_key)))) && - ((encode_ptr_buf(state, (&(*input).psa_raw_key_agreement_req_p_peer_key)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_raw_key_agreement_req_p_peer_key)))) && ((encode_buf_len(state, (&(*input).psa_raw_key_agreement_req_peer_key_length)))) && ((encode_ptr_buf(state, (&(*input).psa_raw_key_agreement_req_p_output)))) && ((encode_buf_len(state, (&(*input).psa_raw_key_agreement_req_output_size)))) && @@ -1238,19 +1265,20 @@ static bool encode_psa_generate_key_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_put(state, (74)))) && - ((encode_ptr_attr(state, (&(*input).psa_generate_key_req_p_attributes)))) && - ((encode_ptr_key(state, (&(*input).psa_generate_key_req_p_key))))))); + bool res = (( + (((zcbor_uint32_put(state, (74)))) && + ((encode_ptr_const_attr(state, (&(*input).psa_generate_key_req_p_attributes)))) && + ((encode_ptr_key(state, (&(*input).psa_generate_key_req_p_key))))))); log_result(state, res, __func__); return res; } -static bool encode_ptr_cipher(zcbor_state_t *state, const uint32_t *input) +static bool encode_ptr_const_cipher(zcbor_state_t *state, const uint32_t *input) { zcbor_log("%s\r\n", __func__); - bool res = ((zcbor_tag_put(state, 32775) && (zcbor_uint32_encode(state, (&(*input)))))); + bool res = ((zcbor_tag_put(state, 32780) && (zcbor_uint32_encode(state, (&(*input)))))); log_result(state, res, __func__); return res; @@ -1260,11 +1288,11 @@ static bool encode_psa_pake_setup_req(zcbor_state_t *state, const struct psa_pak { zcbor_log("%s\r\n", __func__); - bool res = - (((((zcbor_uint32_put(state, (79)))) && - ((encode_ptr_uint(state, (&(*input).psa_pake_setup_req_p_handle)))) && - ((zcbor_uint32_encode(state, (&(*input).psa_pake_setup_req_password_key)))) && - ((encode_ptr_cipher(state, (&(*input).psa_pake_setup_req_p_cipher_suite))))))); + bool res = (((((zcbor_uint32_put(state, (79)))) && + ((encode_ptr_uint(state, (&(*input).psa_pake_setup_req_p_handle)))) && + ((zcbor_uint32_encode(state, (&(*input).psa_pake_setup_req_password_key)))) && + ((encode_ptr_const_cipher(state, + (&(*input).psa_pake_setup_req_p_cipher_suite))))))); log_result(state, res, __func__); return res; @@ -1288,10 +1316,11 @@ static bool encode_psa_pake_set_user_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_put(state, (81)))) && - ((encode_ptr_uint(state, (&(*input).psa_pake_set_user_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_pake_set_user_req_p_user_id)))) && - ((encode_buf_len(state, (&(*input).psa_pake_set_user_req_user_id_len))))))); + bool res = + (((((zcbor_uint32_put(state, (81)))) && + ((encode_ptr_uint(state, (&(*input).psa_pake_set_user_req_p_handle)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_pake_set_user_req_p_user_id)))) && + ((encode_buf_len(state, (&(*input).psa_pake_set_user_req_user_id_len))))))); log_result(state, res, __func__); return res; @@ -1302,10 +1331,11 @@ static bool encode_psa_pake_set_peer_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = (((((zcbor_uint32_put(state, (82)))) && - ((encode_ptr_uint(state, (&(*input).psa_pake_set_peer_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_pake_set_peer_req_p_peer_id)))) && - ((encode_buf_len(state, (&(*input).psa_pake_set_peer_req_peer_id_len))))))); + bool res = + (((((zcbor_uint32_put(state, (82)))) && + ((encode_ptr_uint(state, (&(*input).psa_pake_set_peer_req_p_handle)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_pake_set_peer_req_p_peer_id)))) && + ((encode_buf_len(state, (&(*input).psa_pake_set_peer_req_peer_id_len))))))); log_result(state, res, __func__); return res; @@ -1316,11 +1346,11 @@ static bool encode_psa_pake_set_context_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = - (((((zcbor_uint32_put(state, (83)))) && - ((encode_ptr_uint(state, (&(*input).psa_pake_set_context_req_p_handle)))) && - ((encode_ptr_buf(state, (&(*input).psa_pake_set_context_req_p_context)))) && - ((encode_buf_len(state, (&(*input).psa_pake_set_context_req_context_len))))))); + bool res = (( + (((zcbor_uint32_put(state, (83)))) && + ((encode_ptr_uint(state, (&(*input).psa_pake_set_context_req_p_handle)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_pake_set_context_req_p_context)))) && + ((encode_buf_len(state, (&(*input).psa_pake_set_context_req_context_len))))))); log_result(state, res, __func__); return res; @@ -1350,7 +1380,7 @@ static bool encode_psa_pake_input_req(zcbor_state_t *state, const struct psa_pak bool res = (((((zcbor_uint32_put(state, (85)))) && ((encode_ptr_uint(state, (&(*input).psa_pake_input_req_p_handle)))) && ((zcbor_uint32_encode(state, (&(*input).psa_pake_input_req_step)))) && - ((encode_ptr_buf(state, (&(*input).psa_pake_input_req_p_input)))) && + ((encode_ptr_const_buf(state, (&(*input).psa_pake_input_req_p_input)))) && ((encode_buf_len(state, (&(*input).psa_pake_input_req_input_length))))))); log_result(state, res, __func__); @@ -1362,11 +1392,12 @@ static bool encode_psa_pake_get_shared_key_req(zcbor_state_t *state, { zcbor_log("%s\r\n", __func__); - bool res = (( - (((zcbor_uint32_put(state, (86)))) && - ((encode_ptr_uint(state, (&(*input).psa_pake_get_shared_key_req_p_handle)))) && - ((encode_ptr_attr(state, (&(*input).psa_pake_get_shared_key_req_p_attributes)))) && - ((encode_ptr_key(state, (&(*input).psa_pake_get_shared_key_req_p_key))))))); + bool res = + (((((zcbor_uint32_put(state, (86)))) && + ((encode_ptr_uint(state, (&(*input).psa_pake_get_shared_key_req_p_handle)))) && + ((encode_ptr_const_attr( + state, (&(*input).psa_pake_get_shared_key_req_p_attributes)))) && + ((encode_ptr_key(state, (&(*input).psa_pake_get_shared_key_req_p_key))))))); log_result(state, res, __func__); return res;