Skip to content

Commit b6138a7

Browse files
AntonZmanordicjm
authored andcommitted
nrf_security: CRACEN: Update PSA_NEED_ KConfig options format
KConfig options used by Cracen updated to have "PSA_NEED_" format instead of "CONFIG_PSA_NEED_". Signed-off-by: Anton Zyma <[email protected]>
1 parent 6fd94b3 commit b6138a7

File tree

4 files changed

+36
-36
lines changed

4 files changed

+36
-36
lines changed

subsys/nrf_security/src/drivers/cracen/cracenpsa/include/cracen_psa_primitives.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ typedef struct cracen_spake2p_operation cracen_spake2p_operation_t;
390390
struct cracen_pake_operation {
391391
psa_algorithm_t alg;
392392
union {
393-
#ifdef CONFIG_PSA_NEED_CRACEN_SRP_6
393+
#ifdef PSA_NEED_CRACEN_SRP_6
394394
cracen_srp_operation_t cracen_srp_ctx;
395-
#endif /* CONFIG_PSA_NEED_CRACEN_SRP_6 */
396-
#ifdef CONFIG_PSA_NEED_CRACEN_ECJPAKE
395+
#endif /* PSA_NEED_CRACEN_SRP_6 */
396+
#ifdef PSA_NEED_CRACEN_ECJPAKE
397397
cracen_jpake_operation_t cracen_jpake_ctx;
398-
#endif /* CONFIG_PSA_NEED_CRACEN_ECJPAKE */
399-
#ifdef CONFIG_PSA_NEED_CRACEN_SPAKE2P
398+
#endif /* PSA_NEED_CRACEN_ECJPAKE */
399+
#ifdef PSA_NEED_CRACEN_SPAKE2P
400400
cracen_spake2p_operation_t cracen_spake2p_ctx;
401-
#endif /* CONFIG_PSA_NEED_CRACEN_SPAKE2P */
401+
#endif /* PSA_NEED_CRACEN_SPAKE2P */
402402
uint8_t _unused;
403403
};
404404
};

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/cipher.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "cracen_psa_primitives.h"
2525

26-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
26+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
2727
#include <cracen_sw_aes_ctr.h>
2828
#endif
2929

@@ -288,7 +288,7 @@ psa_status_t cracen_cipher_encrypt(const psa_key_attributes_t *attributes,
288288
cracen_cipher_operation_t operation = {0};
289289
*output_length = 0;
290290

291-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
291+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
292292
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
293293
if (alg == PSA_ALG_CTR) {
294294
if (output_size < input_length) {
@@ -364,7 +364,7 @@ psa_status_t cracen_cipher_decrypt(const psa_key_attributes_t *attributes,
364364
const size_t iv_size = (alg == PSA_ALG_STREAM_CIPHER) ? 12 : SX_BLKCIPHER_IV_SZ;
365365
*output_length = 0;
366366

367-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
367+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
368368
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
369369
if (alg == PSA_ALG_CTR) {
370370
return cracen_sw_aes_ctr_crypt(attributes, key_buffer, key_buffer_size, input,
@@ -480,7 +480,7 @@ psa_status_t cracen_cipher_encrypt_setup(cracen_cipher_operation_t *operation,
480480
const uint8_t *key_buffer, size_t key_buffer_size,
481481
psa_algorithm_t alg)
482482
{
483-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
483+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
484484
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
485485
if (alg == PSA_ALG_CTR) {
486486
return cracen_sw_aes_ctr_setup(operation, attributes, key_buffer, key_buffer_size);
@@ -496,7 +496,7 @@ psa_status_t cracen_cipher_decrypt_setup(cracen_cipher_operation_t *operation,
496496
psa_algorithm_t alg)
497497
{
498498

499-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
499+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
500500
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
501501
if (alg == PSA_ALG_CTR) {
502502
return cracen_sw_aes_ctr_setup(operation, attributes, key_buffer, key_buffer_size);
@@ -511,7 +511,7 @@ psa_status_t cracen_cipher_set_iv(cracen_cipher_operation_t *operation, const ui
511511
{
512512
__ASSERT_NO_MSG(iv != NULL);
513513

514-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
514+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
515515
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
516516
if (operation->alg == PSA_ALG_CTR) {
517517
return cracen_sw_aes_ctr_set_iv(operation, iv, iv_length);
@@ -554,7 +554,7 @@ psa_status_t cracen_cipher_update(cracen_cipher_operation_t *operation, const ui
554554
__ASSERT_NO_MSG(input != NULL || input_length == 0);
555555
__ASSERT_NO_MSG(output_length != NULL);
556556

557-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
557+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
558558
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
559559
if (operation->alg == PSA_ALG_CTR) {
560560
return cracen_sw_aes_ctr_update(operation, input, input_length, output, output_size,
@@ -712,7 +712,7 @@ psa_status_t cracen_cipher_finish(cracen_cipher_operation_t *operation, uint8_t
712712
{
713713
__ASSERT_NO_MSG(output_length != NULL);
714714

715-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
715+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
716716
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
717717
if (operation->alg == PSA_ALG_CTR) {
718718
return cracen_sw_aes_ctr_finish(operation, output_length);
@@ -859,7 +859,7 @@ psa_status_t cracen_cipher_finish(cracen_cipher_operation_t *operation, uint8_t
859859

860860
psa_status_t cracen_cipher_abort(cracen_cipher_operation_t *operation)
861861
{
862-
#if defined(CONFIG_SOC_NRF54LV10A) && defined(CONFIG_PSA_NEED_CRACEN_CTR_AES)
862+
#if defined(CONFIG_SOC_NRF54LV10A) && defined(PSA_NEED_CRACEN_CTR_AES)
863863
/* Route AES_CTR to software implementation due to 16-bit counter limitation */
864864
if (operation->alg == PSA_ALG_CTR) {
865865
/* Software AES CTR implementation doesn't allocate hardware resources to free */

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/common.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
#include "common.h"
8-
#ifdef CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
8+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
99
#include "platform_keys/platform_keys.h"
1010
#endif
1111

@@ -30,14 +30,14 @@
3030
#include "rsa_key.h"
3131

3232
LOG_MODULE_DECLARE(cracen, CONFIG_CRACEN_LOG_LEVEL);
33-
#if CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
33+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
3434
#include "platform_keys/platform_keys.h"
3535
#endif
3636

3737
#define NOT_ENABLED_CURVE (0)
3838
#define NOT_ENABLED_HASH_ALG (0)
3939

40-
#ifdef CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
40+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
4141
/* Address from the IPS. May come from the MDK in the future. */
4242
#define DEVICE_SECRET_LENGTH 4
4343
#define DEVICE_SECRET_ADDRESS ((uint32_t *)0x0E001620)
@@ -689,7 +689,7 @@ int cracen_prepare_ik_key(const uint8_t *user_data)
689689

690690
__attribute__((unused)) struct sx_pk_config_ik cfg = {};
691691

692-
#ifdef CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
692+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
693693
cfg.device_secret = DEVICE_SECRET_ADDRESS;
694694
cfg.device_secret_sz = DEVICE_SECRET_LENGTH;
695695

@@ -753,7 +753,7 @@ static int cracen_clean_ik_key(const uint8_t *user_data)
753753

754754
static bool cracen_is_ikg_key(const psa_key_attributes_t *attributes)
755755
{
756-
#if CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
756+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
757757
return cracen_platform_keys_is_ikg_key(attributes);
758758
#else
759759
switch (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(psa_get_key_id(attributes))) {
@@ -774,7 +774,7 @@ static psa_status_t cracen_load_ikg_keyref(const psa_key_attributes_t *attribute
774774
k->prepare_key = cracen_prepare_ik_key;
775775
k->clean_key = cracen_clean_ik_key;
776776

777-
#if CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
777+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
778778
if (key_buffer_size != sizeof(ikg_opaque_key)) {
779779
return PSA_ERROR_INVALID_ARGUMENT;
780780
}
@@ -808,7 +808,7 @@ psa_status_t cracen_load_keyref(const psa_key_attributes_t *attributes, const ui
808808
{
809809
safe_memzero(k, sizeof(*k));
810810

811-
#if CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
811+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
812812
if (PSA_KEY_LIFETIME_GET_LOCATION(psa_get_key_lifetime(attributes)) ==
813813
PSA_KEY_LOCATION_CRACEN_KMU) {
814814
kmu_opaque_key_buffer *key = (kmu_opaque_key_buffer *)key_buffer;
@@ -878,7 +878,7 @@ psa_status_t cracen_load_keyref(const psa_key_attributes_t *attributes, const ui
878878
static psa_status_t cracen_get_ikg_opaque_key_size(const psa_key_attributes_t *attributes,
879879
size_t *key_size)
880880
{
881-
#ifdef CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
881+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
882882
return cracen_platform_keys_get_size(attributes, key_size);
883883
#else
884884
switch (MBEDTLS_SVC_KEY_ID_GET_KEY_ID(psa_get_key_id(attributes))) {
@@ -899,7 +899,7 @@ static psa_status_t cracen_get_ikg_opaque_key_size(const psa_key_attributes_t *a
899899
}
900900

901901
return PSA_ERROR_INVALID_ARGUMENT;
902-
#endif /* CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS */
902+
#endif /* PSA_NEED_CRACEN_PLATFORM_KEYS */
903903
}
904904

905905
psa_status_t cracen_get_opaque_size(const psa_key_attributes_t *attributes, size_t *key_size)

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ psa_status_t cracen_import_key(const psa_key_attributes_t *attributes, const uin
948948

949949
psa_key_location_t location =
950950
PSA_KEY_LIFETIME_GET_LOCATION(psa_get_key_lifetime(attributes));
951-
#ifdef CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
951+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
952952
if (location == PSA_KEY_LOCATION_CRACEN_KMU) {
953953
int slot_id = CRACEN_PSA_GET_KMU_SLOT(
954954
MBEDTLS_SVC_KEY_ID_GET_KEY_ID(psa_get_key_id(attributes)));
@@ -989,7 +989,7 @@ psa_status_t cracen_import_key(const psa_key_attributes_t *attributes, const uin
989989
return status;
990990
}
991991
#endif
992-
#ifdef CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
992+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
993993
if (location == PSA_KEY_LOCATION_CRACEN) {
994994
psa_key_lifetime_t lifetime;
995995
psa_drv_slot_number_t slot_id;
@@ -1228,7 +1228,7 @@ psa_status_t cracen_generate_key(const psa_key_attributes_t *attributes, uint8_t
12281228
psa_key_location_t location =
12291229
PSA_KEY_LIFETIME_GET_LOCATION(psa_get_key_lifetime(attributes));
12301230

1231-
#if CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
1231+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
12321232
if (location == PSA_KEY_LOCATION_CRACEN_KMU) {
12331233
return generate_key_for_kmu(attributes, key_buffer, key_buffer_size,
12341234
key_buffer_length);
@@ -1371,10 +1371,10 @@ psa_status_t cracen_get_builtin_key(psa_drv_slot_number_t slot_number,
13711371
return PSA_ERROR_NOT_SUPPORTED;
13721372
}
13731373
default:
1374-
#if CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
1374+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
13751375
return cracen_kmu_get_builtin_key(slot_number, attributes, key_buffer,
13761376
key_buffer_size, key_buffer_length);
1377-
#elif CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
1377+
#elif PSA_NEED_CRACEN_PLATFORM_KEYS
13781378
return cracen_platform_get_builtin_key(slot_number, attributes, key_buffer,
13791379
key_buffer_size, key_buffer_length);
13801380
#else
@@ -1394,7 +1394,7 @@ psa_status_t mbedtls_psa_platform_get_builtin_key(mbedtls_svc_key_id_t key_id,
13941394
* The function cracen_platform_get_key_slot will do the matching between the
13951395
* platform key ids and the Cracen bulitin ids.
13961396
*/
1397-
#if CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
1397+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
13981398
return cracen_platform_get_key_slot(key_id, lifetime, slot_number);
13991399
#else
14001400

@@ -1409,7 +1409,7 @@ psa_status_t mbedtls_psa_platform_get_builtin_key(mbedtls_svc_key_id_t key_id,
14091409
*slot_number = CRACEN_BUILTIN_MEXT_ID;
14101410
break;
14111411
default:
1412-
#if CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
1412+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
14131413
return cracen_kmu_get_key_slot(key_id, lifetime, slot_number);
14141414
#else
14151415
return PSA_ERROR_DOES_NOT_EXIST;
@@ -1420,14 +1420,14 @@ psa_status_t mbedtls_psa_platform_get_builtin_key(mbedtls_svc_key_id_t key_id,
14201420
PSA_KEY_LOCATION_CRACEN);
14211421

14221422
return PSA_SUCCESS;
1423-
#endif /* CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS */
1423+
#endif /* PSA_NEED_CRACEN_PLATFORM_KEYS */
14241424
}
14251425

14261426
psa_status_t cracen_export_key(const psa_key_attributes_t *attributes, const uint8_t *key_buffer,
14271427
size_t key_buffer_size, uint8_t *data, size_t data_size,
14281428
size_t *data_length)
14291429
{
1430-
#ifdef CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
1430+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
14311431
int status;
14321432
int nested_err;
14331433
psa_key_location_t location =
@@ -1480,7 +1480,7 @@ psa_status_t cracen_copy_key(psa_key_attributes_t *attributes, const uint8_t *so
14801480
size_t source_key_length, uint8_t *target_key_buffer,
14811481
size_t target_key_buffer_size, size_t *target_key_buffer_length)
14821482
{
1483-
#ifdef CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
1483+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
14841484
psa_key_location_t location =
14851485
PSA_KEY_LIFETIME_GET_LOCATION(psa_get_key_lifetime(attributes));
14861486

@@ -1534,10 +1534,10 @@ psa_status_t cracen_copy_key(psa_key_attributes_t *attributes, const uint8_t *so
15341534

15351535
psa_status_t cracen_destroy_key(const psa_key_attributes_t *attributes)
15361536
{
1537-
#ifdef CONFIG_PSA_NEED_CRACEN_KMU_DRIVER
1537+
#ifdef PSA_NEED_CRACEN_KMU_DRIVER
15381538
return cracen_kmu_destroy_key(attributes);
15391539
#endif
1540-
#ifdef CONFIG_PSA_NEED_CRACEN_PLATFORM_KEYS
1540+
#ifdef PSA_NEED_CRACEN_PLATFORM_KEYS
15411541
return cracen_platform_destroy_key(attributes);
15421542
#endif
15431543

0 commit comments

Comments
 (0)