Commit 23e99b0d authored by Fabio Utzig's avatar Fabio Utzig Committed by Fabio Utzig
Browse files

boot: encrypted: fix HKDF input size macro

Use correct macro for the size of a DH shared secret. The previously
used macro had the same size (SHA-256 digest length) but incorrect
semantics.

Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 005e7a0f
Loading
Loading
Loading
Loading
+1 −1
Changes for boot/bootutil/src/encrypted.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -531,7 +531,7 @@ boot_enc_load(struct enc_key_data *enc_state, int image_index,
     */

    len = TC_AES_KEY_SIZE + TC_SHA256_DIGEST_SIZE;
    rc = hkdf(shared, TC_SHA256_DIGEST_SIZE, (uint8_t *)"MCUBoot_ECIES_v1", 16,
    rc = hkdf(shared, NUM_ECC_BYTES, (uint8_t *)"MCUBoot_ECIES_v1", 16,
            derived_key, &len);
    if (rc != 0 || len != (TC_AES_KEY_SIZE + TC_SHA256_DIGEST_SIZE)) {
        return -1;