Skip to content

bootutil: encryption: Fix typo in PSA code #2312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions boot/bootutil/src/encrypted_psa.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ static const uint8_t ec_pubkey_oid[] = MBEDTLS_OID_ISO_IDENTIFIED_ORG \
/* Partitioning of HKDF derived material, from the exchange derived key */
/* AES key encryption key */
#define HKDF_AES_KEY_INDEX 0
#define HKDF_ASE_KEY_SIZE (BOOT_ENC_KEY_SIZE)
#define HKDF_AES_KEY_SIZE (BOOT_ENC_KEY_SIZE)
/* MAC feed */
#define HKDF_MAC_FEED_INDEX (HKDF_AES_KEY_INDEX + HKDF_ASE_KEY_SIZE)
#define HKDF_MAC_FEED_INDEX (HKDF_AES_KEY_INDEX + HKDF_AES_KEY_SIZE)
#define HKDF_MAC_FEED_SIZE (32) /* This is SHA independent */
/* Total size */
#define HKDF_SIZE (HKDF_ASE_KEY_SIZE + HKDF_MAC_FEED_SIZE)
#define HKDF_SIZE (HKDF_AES_KEY_SIZE + HKDF_MAC_FEED_SIZE)

/* Fixme: This duplicates code from encrypted.c and depends on mbedtls */
static int
Expand Down Expand Up @@ -270,7 +270,7 @@ boot_decrypt_key(const uint8_t *buf, uint8_t *enckey)

/* Import the AES partition of derived key, the first 16 bytes */
psa_ret = psa_import_key(&kattr, &derived_key[HKDF_AES_KEY_INDEX],
HKDF_ASE_KEY_SIZE, &kid);
HKDF_AES_KEY_SIZE, &kid);
memset(derived_key, 0, sizeof(derived_key));
if (psa_ret != PSA_SUCCESS) {
BOOT_LOG_ERR("AES key import failed %d", psa_ret);
Expand Down
Loading