Skip to content

Commit bdb16a3

Browse files
valeriosettiadeaarm
authored andcommitted
Crypto: fix unused variable when !BUILTIN_ALG_SP800_108_COUNTER_CMAC
TF-PSA-Crypto patch with title "Implement SP800-108 Counter CMAC key derivation in PSA Crypto Core" modified "psa_key_derivation_input_internal()" function adding the "attributes" parameter. However this is only used when MBEDTLS_PSA_BUILTIN_ALG_SP800_108_COUNTER_CMAC is enabled. If not a warning will be generated at build time for unused variable. This commit updates the patch resolving this problem. Change-Id: I76ee349a1964d174dc2a6e00933fe0ec6d67a128 Signed-off-by: Valerio Setti <vsetti@baylibre.com>
1 parent 66503e7 commit bdb16a3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

lib/ext/tf-psa-crypto/0013-Implement-SP800-108-Counter-CMAC-key-derivation-in-P.patch

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ using the construction recommended by NIST Special Publication 800-108r1
1212

1313
Signed-off-by: Amjad Ouled-Ameur <amjad.ouled-ameur@arm.com>
1414
---
15-
core/psa_crypto.c | 232 ++++++++++++++++++++++++++++++++++++++++++++--
16-
1 file changed, 226 insertions(+), 6 deletions(-)
15+
core/psa_crypto.c | 234 ++++++++++++++++++++++++++++++++++++++++++++--
16+
1 file changed, 228 insertions(+), 6 deletions(-)
1717

1818
diff --git a/core/psa_crypto.c b/core/psa_crypto.c
1919
index 9981bb447..11de5071d 100644
@@ -329,7 +329,7 @@ index 9981bb447..11de5071d 100644
329329
psa_key_type_t key_type,
330330
const uint8_t *data,
331331
size_t data_length)
332-
@@ -7586,11 +7799,17 @@ static psa_status_t psa_key_derivation_input_internal(
332+
@@ -7586,11 +7799,19 @@ static psa_status_t psa_key_derivation_input_internal(
333333
goto exit;
334334
}
335335

@@ -344,11 +344,13 @@ index 9981bb447..11de5071d 100644
344344
+ status = psa_sp800_108_counter_cmac_input(&operation->ctx.sp800_108_cmac,
345345
+ attributes, step, data, data_length);
346346
+ } else
347+
+#else /* MBEDTLS_PSA_BUILTIN_ALG_SP800_108_COUNTER_CMAC */
348+
+ (void) attributes;
347349
+#endif /* MBEDTLS_PSA_BUILTIN_ALG_SP800_108_COUNTER_CMAC */
348350
#if defined(BUILTIN_ALG_ANY_HKDF)
349351
if (PSA_ALG_IS_ANY_HKDF(kdf_alg)) {
350352
status = psa_hkdf_input(&operation->ctx.hkdf, kdf_alg,
351-
@@ -7682,7 +7901,7 @@ psa_status_t psa_key_derivation_input_bytes(
353+
@@ -7682,7 +7903,7 @@ psa_status_t psa_key_derivation_input_bytes(
352354
LOCAL_INPUT_ALLOC(data_external, data_length, data);
353355

354356
status = psa_key_derivation_input_internal(operation, step,
@@ -357,7 +359,7 @@ index 9981bb447..11de5071d 100644
357359
data, data_length);
358360
#if !defined(MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS)
359361
exit:
360-
@@ -7723,7 +7942,8 @@ psa_status_t psa_key_derivation_input_key(
362+
@@ -7723,7 +7944,8 @@ psa_status_t psa_key_derivation_input_key(
361363
}
362364

363365
status = psa_key_derivation_input_internal(operation,
@@ -367,7 +369,7 @@ index 9981bb447..11de5071d 100644
367369
slot->key.data,
368370
slot->key.bytes);
369371

370-
@@ -7841,7 +8061,7 @@ static psa_status_t psa_key_agreement_internal(psa_key_derivation_operation_t *o
372+
@@ -7841,7 +8063,7 @@ static psa_status_t psa_key_agreement_internal(psa_key_derivation_operation_t *o
371373
* the shared secret. A shared secret is permitted wherever a key
372374
* of type DERIVE is permitted. */
373375
status = psa_key_derivation_input_internal(operation, step,

0 commit comments

Comments
 (0)