Skip to content

Commit

Permalink
cracen: imported FWENC key used for AES-GCM
Browse files Browse the repository at this point in the history
The key was imported from SICR for usage with ECB,
which made it impossible to decrypt the firmware.

Signed-off-by: Artur Hadasz <[email protected]>
  • Loading branch information
ahasztag authored and jukkar committed Dec 9, 2024
1 parent 31f49ba commit 729cb58
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,12 @@ psa_status_t cracen_platform_get_builtin_key(psa_drv_slot_number_t slot_number,
psa_set_key_algorithm(attributes, PSA_ALG_PURE_EDDSA);
psa_set_key_usage_flags(attributes, PSA_KEY_USAGE_VERIFY_MESSAGE);
} else if (key.sicr.type == PSA_KEY_TYPE_AES) {
/* This will be AES-KW when it is supported. */
psa_set_key_algorithm(attributes, PSA_ALG_ECB_NO_PADDING);
/* Currently AES-KW is not supported, so the key stored in SICR
* is directly used to decrypt the firmware (using AES-GCM).
* When AES-KW is supported, this will possibly need to be extended
* so that both AES-KW and direct decryption can be supported.
*/
psa_set_key_algorithm(attributes, PSA_ALG_GCM);
psa_set_key_usage_flags(attributes, PSA_KEY_USAGE_DECRYPT);

if (PSA_BITS_TO_BYTES(key.sicr.bits) > sizeof(decrypted_key)) {
Expand Down

0 comments on commit 729cb58

Please sign in to comment.