From 471407d0a2ca00e98231e7382368eb0d481aed81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 18 Aug 2025 14:05:32 +0200 Subject: [PATCH 1/3] CRACEN: Avoid "unused function" for RSA helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Change cracen_ffkey_write_sz and cracen_ffkey_write functions from static to static inline to avoid "unused functions" warning when these are not used See sdk-nrf PR-22619 for details ref: NCSDK-28901 Signed-off-by: Frank Audun Kvamtrø --- .../nrf_security/src/drivers/cracen/cracenpsa/src/rsa_key.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/rsa_key.h b/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/rsa_key.h index 7d911bbb5911..2bea2aa1c16e 100644 --- a/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/rsa_key.h +++ b/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/rsa_key.h @@ -12,7 +12,7 @@ #include /** Write the sizes of the elements of a RSA key. */ -static void cracen_ffkey_write_sz(const struct cracen_rsa_key *key, int *sizes) +static inline void cracen_ffkey_write_sz(const struct cracen_rsa_key *key, int *sizes) { int slotidx = 0; int i = 0; @@ -29,7 +29,7 @@ static void cracen_ffkey_write_sz(const struct cracen_rsa_key *key, int *sizes) } /** Write the elements of a RSA key into the input slots. */ -static void cracen_ffkey_write(const struct cracen_rsa_key *key, struct sx_pk_slot *inputs) +static inline void cracen_ffkey_write(const struct cracen_rsa_key *key, struct sx_pk_slot *inputs) { int slotidx = 0; int i = 0; From 17373b8b44017831f02162e68d11a55409d0e2a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 18 Aug 2025 14:11:28 +0200 Subject: [PATCH 2/3] CRACEN: Avoid "unused function" for cracen_aead_update_internal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Add __maybe_unused to cracen_aead_update_internal to try to turn off -Wno-unused-function in nrf_security. This function is __maybe_unused because some usages of AEAD is single shot. Note that there is no configuration to signal whether you support only single shot AEAD in PSA crypto (only PSA_WANT_ALG_CCM, PSA_WANT_ALG_GCM etc.) See sdk-nrf PR-22619 for details ref: NCSDK-28901 Signed-off-by: Frank Audun Kvamtrø --- subsys/nrf_security/src/drivers/cracen/cracenpsa/src/aead.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/aead.c b/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/aead.c index e03603d3b8c2..ee4e08b5e8a3 100644 --- a/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/aead.c +++ b/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/aead.c @@ -414,7 +414,7 @@ psa_status_t cracen_aead_set_lengths(cracen_aead_operation_t *operation, size_t #endif } -static psa_status_t cracen_aead_update_internal(cracen_aead_operation_t *operation, +static __maybe_unused psa_status_t cracen_aead_update_internal(cracen_aead_operation_t *operation, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length, bool is_ad_update) From 70f1c21fb0860084ad498e8f56bb490bc280850c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 18 Aug 2025 14:32:18 +0200 Subject: [PATCH 3/3] CRACEN: Add static inline for sx_handle_nested_error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Was only "inline" before, and it has been reported that this raises warnings when building with -O0 under certain ref: NCSDK-28901 Signed-off-by: Frank Audun Kvamtrø --- .../src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/internal.h b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/internal.h index e18cae023618..da0d0efd7ccf 100644 --- a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/internal.h +++ b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/internal.h @@ -178,7 +178,7 @@ struct sxcmmask { * @return Return the nested error if it is not SX_OK, otherwise return * the original error code. */ -inline int sx_handle_nested_error(int nested_err, int err) +static inline int sx_handle_nested_error(int nested_err, int err) { return nested_err ? nested_err != SX_OK : err; }