Skip to content

Commit 625d8fe

Browse files
committed
nrf_security: CRACEN: Make KDF operations struct depend on project config
cracen_key_derivation_operation_t struct is modified so as to include KDF algorithms required by the project configuration. Ref: NCSDK-35675 Signed-off-by: Anton Zyma <[email protected]>
1 parent 1cdc508 commit 625d8fe

File tree

3 files changed

+70
-7
lines changed

3 files changed

+70
-7
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ struct cracen_key_derivation_operation {
240240
cracen_hash_operation_t hash_op;
241241
};
242242
union {
243+
#if defined(CONFIG_PSA_NEED_CRACEN_HKDF)
243244
struct {
244245
uint8_t blk_counter;
245246
uint8_t prk[SX_HASH_MAX_ENABLED_BLOCK_SIZE];
@@ -248,7 +249,8 @@ struct cracen_key_derivation_operation {
248249
size_t info_length;
249250
bool info_set;
250251
} hkdf;
251-
252+
#endif /* CONFIG_PSA_NEED_CRACEN_HKDF */
253+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
252254
struct {
253255
uint64_t input_cost;
254256
char password[SX_HASH_MAX_ENABLED_BLOCK_SIZE];
@@ -259,7 +261,8 @@ struct cracen_key_derivation_operation {
259261
uint8_t uj[PSA_MAC_MAX_SIZE];
260262
uint8_t tj[PSA_MAC_MAX_SIZE];
261263
} pbkdf2;
262-
264+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
265+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
263266
struct {
264267
uint8_t key_buffer[CRACEN_MAX_AES_KEY_SIZE];
265268
struct sxkeyref keyref;
@@ -275,11 +278,13 @@ struct cracen_key_derivation_operation {
275278
uint32_t L;
276279
uint8_t K_0[SX_BLKCIPHER_AES_BLK_SZ];
277280
} cmac_ctr;
278-
281+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
282+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS)
279283
struct {
280284
uint8_t key[32];
281285
} ecjpake_to_pms;
282-
286+
#endif /* PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS */
287+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_PRF) || defined(CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS)
283288
struct {
284289
/* May contain secret, length of secret as uint16be, other secret
285290
* and other secret length as uint16be.
@@ -293,6 +298,7 @@ struct cracen_key_derivation_operation {
293298
size_t counter;
294299
uint8_t a[SX_HASH_MAX_ENABLED_BLOCK_SIZE];
295300
} tls12;
301+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_PRF || CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS */
296302
};
297303
};
298304
typedef struct cracen_key_derivation_operation cracen_key_derivation_operation_t;

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

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static psa_status_t cracen_ecdh_montgmr_calc_secret(const struct sx_pk_ecurve *c
151151

152152
/**
153153
* \brief Initialize and set up the MAC operation that will be used to generate pseudo-random
154-
* bytes for HDKF and PBKDF2.
154+
* bytes for HKDF and PBKDF2.
155155
*
156156
* \param[in, out] operation Cracen key derivation operation object.
157157
* \param[in] key_buffer Key buffer or HKDF salt.
@@ -180,6 +180,7 @@ static psa_status_t start_mac_operation(cracen_key_derivation_operation_t *opera
180180
mac_alg);
181181
}
182182

183+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
183184
static size_t pbkdf2_prf_output_length(psa_algorithm_t alg)
184185
{
185186
if (alg == PSA_ALG_PBKDF2_AES_CMAC_PRF_128) {
@@ -188,12 +189,14 @@ static size_t pbkdf2_prf_output_length(psa_algorithm_t alg)
188189
return PSA_HASH_LENGTH(PSA_ALG_GET_HASH(alg));
189190
}
190191
}
192+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
191193

192194
psa_status_t cracen_key_derivation_setup(cracen_key_derivation_operation_t *operation,
193195
psa_algorithm_t alg)
194196
{
195197
operation->alg = alg;
196198

199+
#if defined(CONFIG_PSA_NEED_CRACEN_HKDF)
197200
if (IS_ENABLED(PSA_NEED_CRACEN_HKDF) && (PSA_ALG_IS_HKDF(operation->alg) ||
198201
PSA_ALG_IS_HKDF_EXPAND(operation->alg))) {
199202
size_t hash_size = PSA_HASH_LENGTH(PSA_ALG_HKDF_GET_HASH(alg));
@@ -222,7 +225,9 @@ psa_status_t cracen_key_derivation_setup(cracen_key_derivation_operation_t *oper
222225

223226
return PSA_SUCCESS;
224227
}
228+
#endif /* CONFIG_PSA_NEED_CRACEN_HKDF */
225229

230+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
226231
if (IS_ENABLED(PSA_NEED_CRACEN_PBKDF2_HMAC) && PSA_ALG_IS_PBKDF2(operation->alg)) {
227232
size_t output_length = pbkdf2_prf_output_length(operation->alg);
228233

@@ -234,15 +239,19 @@ psa_status_t cracen_key_derivation_setup(cracen_key_derivation_operation_t *oper
234239
operation->state = CRACEN_KD_STATE_PBKDF2_INIT;
235240
return PSA_SUCCESS;
236241
}
242+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
237243

244+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS)
238245
if (IS_ENABLED(PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS)) {
239246
if (operation->alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) {
240247
operation->capacity = PSA_TLS12_ECJPAKE_TO_PMS_DATA_SIZE;
241248
operation->state = CRACEN_KD_STATE_TLS12_ECJPAKE_TO_PMS_INIT;
242249
return PSA_SUCCESS;
243250
}
244251
}
252+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS */
245253

254+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_PRF) || defined(CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS)
246255
if (IS_ENABLED(PSA_NEED_CRACEN_TLS12_PRF) && PSA_ALG_IS_TLS12_PRF(operation->alg)) {
247256
operation->state = CRACEN_KD_STATE_TLS12_PRF_INIT;
248257
operation->capacity = UINT64_MAX;
@@ -255,6 +264,7 @@ psa_status_t cracen_key_derivation_setup(cracen_key_derivation_operation_t *oper
255264
operation->capacity = UINT64_MAX;
256265
return PSA_SUCCESS;
257266
}
267+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_PRF || CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS */
258268

259269
if (IS_ENABLED(PSA_NEED_CRACEN_SRP_PASSWORD_HASH) && PSA_ALG_IS_SRP_PASSWORD_HASH(alg)) {
260270
if (PSA_ALG_HKDF_GET_HASH(alg) != CRACEN_SRP_HASH_ALG) {
@@ -264,6 +274,7 @@ psa_status_t cracen_key_derivation_setup(cracen_key_derivation_operation_t *oper
264274
return PSA_SUCCESS;
265275
}
266276

277+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
267278
if (operation->alg == PSA_ALG_SP800_108_COUNTER_CMAC) {
268279
operation->capacity = PSA_ALG_SP800_108_COUNTER_CMAC_INIT_CAPACITY;
269280
operation->state = CRACEN_KD_STATE_CMAC_CTR_INIT;
@@ -272,6 +283,7 @@ psa_status_t cracen_key_derivation_setup(cracen_key_derivation_operation_t *oper
272283

273284
return PSA_SUCCESS;
274285
}
286+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
275287

276288
return PSA_ERROR_NOT_SUPPORTED;
277289
}
@@ -291,6 +303,7 @@ psa_status_t cracen_key_derivation_set_capacity(cracen_key_derivation_operation_
291303
return PSA_SUCCESS;
292304
}
293305

306+
#if defined(CONFIG_PSA_NEED_CRACEN_HKDF)
294307
static psa_status_t
295308
cracen_key_derivation_input_bytes_hkdf(cracen_key_derivation_operation_t *operation,
296309
psa_key_derivation_step_t step, const uint8_t *data,
@@ -374,7 +387,9 @@ cracen_key_derivation_input_bytes_hkdf(cracen_key_derivation_operation_t *operat
374387

375388
return PSA_SUCCESS;
376389
}
390+
#endif /* CONFIG_PSA_NEED_CRACEN_HKDF */
377391

392+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
378393
static psa_status_t
379394
cracen_key_derivation_input_bytes_pbkdf2(cracen_key_derivation_operation_t *operation,
380395
psa_key_derivation_step_t step, const uint8_t *data,
@@ -445,7 +460,9 @@ cracen_key_derivation_input_bytes_pbkdf2(cracen_key_derivation_operation_t *oper
445460

446461
return PSA_SUCCESS;
447462
}
463+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
448464

465+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
449466
static psa_status_t
450467
cracen_key_derivation_input_bytes_cmac_ctr(cracen_key_derivation_operation_t *operation,
451468
psa_key_derivation_step_t step, const uint8_t *data,
@@ -502,7 +519,9 @@ cracen_key_derivation_input_bytes_cmac_ctr(cracen_key_derivation_operation_t *op
502519

503520
return PSA_SUCCESS;
504521
}
522+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
505523

524+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_PRF) || defined(CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS)
506525
static psa_status_t
507526
cracen_key_derivation_input_bytes_tls12(cracen_key_derivation_operation_t *operation,
508527
psa_key_derivation_step_t step, const uint8_t *data,
@@ -576,6 +595,7 @@ cracen_key_derivation_input_bytes_tls12(cracen_key_derivation_operation_t *opera
576595
}
577596
return PSA_SUCCESS;
578597
}
598+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_PRF || CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS */
579599

580600
static psa_status_t
581601
cracen_key_derivation_input_bytes_srp(cracen_key_derivation_operation_t *operation,
@@ -641,6 +661,7 @@ psa_status_t cracen_key_derivation_input_bytes(cracen_key_derivation_operation_t
641661
psa_key_derivation_step_t step, const uint8_t *data,
642662
size_t data_length)
643663
{
664+
#if defined(CONFIG_PSA_NEED_CRACEN_HKDF)
644665
if (IS_ENABLED(PSA_NEED_CRACEN_HKDF) && (PSA_ALG_IS_HKDF(operation->alg) ||
645666
PSA_ALG_IS_HKDF_EXTRACT(operation->alg))) {
646667
return cracen_key_derivation_input_bytes_hkdf(operation, step, data, data_length);
@@ -657,17 +678,23 @@ psa_status_t cracen_key_derivation_input_bytes(cracen_key_derivation_operation_t
657678
}
658679
return cracen_key_derivation_input_bytes_hkdf(operation, step, data, data_length);
659680
}
681+
#endif /* CONFIG_PSA_NEED_CRACEN_HKDF */
660682

683+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
661684
if (IS_ENABLED(PSA_NEED_CRACEN_PBKDF2_HMAC) && PSA_ALG_IS_PBKDF2(operation->alg)) {
662685
return cracen_key_derivation_input_bytes_pbkdf2(operation, step, data, data_length);
663686
}
687+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
664688

689+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
665690
if (IS_ENABLED(PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC) &&
666691
(operation->alg == PSA_ALG_SP800_108_COUNTER_CMAC)) {
667692
return cracen_key_derivation_input_bytes_cmac_ctr(operation, step, data,
668693
data_length);
669694
}
695+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
670696

697+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS)
671698
if (IS_ENABLED(PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS) &&
672699
operation->alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) {
673700
if (operation->state != CRACEN_KD_STATE_TLS12_ECJPAKE_TO_PMS_INIT) {
@@ -682,7 +709,9 @@ psa_status_t cracen_key_derivation_input_bytes(cracen_key_derivation_operation_t
682709
sizeof(operation->ecjpake_to_pms.key));
683710
return PSA_SUCCESS;
684711
}
712+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS */
685713

714+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_PRF) || defined(CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS)
686715
if (IS_ENABLED(PSA_NEED_CRACEN_TLS12_PRF) && PSA_ALG_IS_TLS12_PRF(operation->alg)) {
687716
return cracen_key_derivation_input_bytes_tls12(operation, step, data, data_length);
688717
}
@@ -691,6 +720,7 @@ psa_status_t cracen_key_derivation_input_bytes(cracen_key_derivation_operation_t
691720
PSA_ALG_IS_TLS12_PSK_TO_MS(operation->alg)) {
692721
return cracen_key_derivation_input_bytes_tls12(operation, step, data, data_length);
693722
}
723+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_PRF || CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS */
694724

695725
if (IS_ENABLED(PSA_NEED_CRACEN_SRP_PASSWORD_HASH) &&
696726
PSA_ALG_IS_SRP_PASSWORD_HASH(operation->alg)) {
@@ -705,13 +735,16 @@ psa_status_t cracen_key_derivation_input_key(cracen_key_derivation_operation_t *
705735
const psa_key_attributes_t *attributes,
706736
const uint8_t *key_buffer, size_t key_buffer_size)
707737
{
738+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
708739
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
740+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
709741

710742
if (operation->alg != PSA_ALG_SP800_108_COUNTER_CMAC) {
711743
return cracen_key_derivation_input_bytes(operation, step, key_buffer,
712744
key_buffer_size);
713745
}
714746

747+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
715748
if (psa_get_key_type(attributes) != PSA_KEY_TYPE_AES) {
716749
return PSA_ERROR_NOT_SUPPORTED;
717750
}
@@ -739,12 +772,15 @@ psa_status_t cracen_key_derivation_input_key(cracen_key_derivation_operation_t *
739772

740773
operation->state = CRACEN_KD_STATE_CMAC_CTR_KEY_LOADED;
741774
return status;
775+
#else
776+
return PSA_ERROR_INVALID_ARGUMENT;
777+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
742778
}
743779

744780
psa_status_t cracen_key_derivation_input_integer(cracen_key_derivation_operation_t *operation,
745781
psa_key_derivation_step_t step, uint64_t value)
746782
{
747-
783+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
748784
if (IS_ENABLED(PSA_NEED_CRACEN_PBKDF2_HMAC)) {
749785
if ((PSA_ALG_IS_PBKDF2(operation->alg)) && step == PSA_KEY_DERIVATION_INPUT_COST) {
750786
if (operation->pbkdf2.input_cost) {
@@ -755,10 +791,12 @@ psa_status_t cracen_key_derivation_input_integer(cracen_key_derivation_operation
755791
return PSA_SUCCESS;
756792
}
757793
}
794+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
758795

759796
return PSA_ERROR_NOT_SUPPORTED;
760797
}
761798

799+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
762800
static int
763801
cracen_key_derivation_cmac_ctr_add_core_fixed_input(cracen_key_derivation_operation_t *operation,
764802
struct sxmac *cmac_ctx)
@@ -870,7 +908,9 @@ cracen_key_derivation_cmac_ctr_generate_block(cracen_key_derivation_operation_t
870908
operation->cmac_ctr.counter++;
871909
return PSA_SUCCESS;
872910
}
911+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
873912

913+
#if defined(CONFIG_PSA_NEED_CRACEN_HKDF)
874914
/**
875915
* \brief Generates the next block for HKDF.
876916
*
@@ -922,7 +962,9 @@ cracen_key_derivation_hkdf_generate_block(cracen_key_derivation_operation_t *ope
922962

923963
return PSA_SUCCESS;
924964
}
965+
#endif /* CONFIG_PSA_NEED_CRACEN_HKDF */
925966

967+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
926968
/**
927969
* \brief Generates the next block for PBKDF2.
928970
*
@@ -992,7 +1034,9 @@ cracen_key_derivation_pbkdf2_generate_block(cracen_key_derivation_operation_t *o
9921034

9931035
return PSA_SUCCESS;
9941036
}
1037+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
9951038

1039+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_PRF) || defined(CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS)
9961040
static psa_status_t
9971041
cracen_key_derivation_tls12_prf_generate_block(cracen_key_derivation_operation_t *operation)
9981042
{
@@ -1072,6 +1116,7 @@ cracen_key_derivation_tls12_prf_generate_block(cracen_key_derivation_operation_t
10721116

10731117
return status;
10741118
}
1119+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_PRF || CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS */
10751120

10761121
psa_status_t cracen_key_agreement(const psa_key_attributes_t *attributes, const uint8_t *priv_key,
10771122
size_t priv_key_size, const uint8_t *publ_key,
@@ -1127,6 +1172,7 @@ psa_status_t cracen_key_derivation_output_bytes(cracen_key_derivation_operation_
11271172
{
11281173
psa_status_t (*generator)(cracen_key_derivation_operation_t *) = NULL;
11291174

1175+
#if defined(CONFIG_PSA_NEED_CRACEN_HKDF)
11301176
if (IS_ENABLED(PSA_NEED_CRACEN_HKDF) && (PSA_ALG_IS_HKDF(operation->alg) ||
11311177
PSA_ALG_IS_HKDF_EXPAND(operation->alg))) {
11321178
if (operation->state < CRACEN_KD_STATE_HKDF_KEYED || !operation->hkdf.info_set) {
@@ -1153,7 +1199,9 @@ psa_status_t cracen_key_derivation_output_bytes(cracen_key_derivation_operation_
11531199
memcpy(output, operation->hkdf.prk, prk_length);
11541200
return PSA_SUCCESS;
11551201
}
1202+
#endif /* CONFIG_PSA_NEED_CRACEN_HKDF */
11561203

1204+
#if defined(CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC)
11571205
if (IS_ENABLED(PSA_NEED_CRACEN_PBKDF2_HMAC) && PSA_ALG_IS_PBKDF2(operation->alg)) {
11581206
/* Salt, password and input cost must have been provided. */
11591207
if (!operation->pbkdf2.input_cost) {
@@ -1168,7 +1216,9 @@ psa_status_t cracen_key_derivation_output_bytes(cracen_key_derivation_operation_
11681216
operation->state = CRACEN_KD_STATE_PBKDF2_OUTPUT;
11691217
generator = cracen_key_derivation_pbkdf2_generate_block;
11701218
}
1219+
#endif /* CONFIG_PSA_NEED_CRACEN_PBKDF2_HMAC */
11711220

1221+
#if defined(CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC)
11721222
if (IS_ENABLED(PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC) &&
11731223
(operation->alg == PSA_ALG_SP800_108_COUNTER_CMAC)) {
11741224
if (operation->state == CRACEN_KD_STATE_CMAC_CTR_KEY_LOADED ||
@@ -1189,7 +1239,9 @@ psa_status_t cracen_key_derivation_output_bytes(cracen_key_derivation_operation_
11891239
return PSA_ERROR_BAD_STATE;
11901240
}
11911241
}
1242+
#endif /* CONFIG_PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC */
11921243

1244+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS)
11931245
if (IS_ENABLED(PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS) &&
11941246
operation->alg == PSA_ALG_TLS12_ECJPAKE_TO_PMS) {
11951247
size_t outlen;
@@ -1204,7 +1256,9 @@ psa_status_t cracen_key_derivation_output_bytes(cracen_key_derivation_operation_
12041256
}
12051257
return PSA_SUCCESS;
12061258
}
1259+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS */
12071260

1261+
#if defined(CONFIG_PSA_NEED_CRACEN_TLS12_PRF) || defined(CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS)
12081262
if (IS_ENABLED(PSA_NEED_CRACEN_TLS12_PRF) && PSA_ALG_IS_TLS12_PRF(operation->alg)) {
12091263
operation->state = CRACEN_KD_STATE_TLS12_PRF_OUTPUT;
12101264
generator = cracen_key_derivation_tls12_prf_generate_block;
@@ -1215,6 +1269,7 @@ psa_status_t cracen_key_derivation_output_bytes(cracen_key_derivation_operation_
12151269
operation->state = CRACEN_KD_STATE_TLS12_PSK_TO_MS_OUTPUT;
12161270
generator = cracen_key_derivation_tls12_prf_generate_block;
12171271
}
1272+
#endif /* CONFIG_PSA_NEED_CRACEN_TLS12_PRF || CONFIG_PSA_NEED_CRACEN_TLS12_PSK_TO_MS */
12181273

12191274
if (IS_ENABLED(PSA_NEED_CRACEN_SRP_PASSWORD_HASH) &&
12201275
PSA_ALG_IS_SRP_PASSWORD_HASH(operation->alg)) {

subsys/nrf_security/src/drivers/cracen/psa_driver.Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1858,7 +1858,9 @@ config PSA_NEED_CRACEN_KEY_DERIVATION_DRIVER
18581858
PSA_NEED_CRACEN_TLS12_ECJPAKE_TO_PMS || \
18591859
PSA_NEED_CRACEN_PBKDF2_HMAC || \
18601860
PSA_NEED_CRACEN_SRP_PASSWORD_HASH || \
1861-
PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC
1861+
PSA_NEED_CRACEN_SP800_108_COUNTER_CMAC || \
1862+
PSA_NEED_CRACEN_TLS12_PRF || \
1863+
PSA_NEED_CRACEN_TLS12_PSK_TO_MS
18621864

18631865
config PSA_NEED_CRACEN_KMU_DRIVER
18641866
bool

0 commit comments

Comments
 (0)