@@ -92,24 +92,33 @@ libraries. The whole key encryption can be summarized as:
9292 keypair. Those keys will be our ephemeral keys.
9393* Generate a new secret (DH) using the ephemeral private key and the public key
9494 that corresponds to the private key embedded in the HW.
95- * Derive the new keys from the secret using HKDF (built on HMAC-SHA256). We
96- are not using a ` salt ` and using an ` info ` of ` MCUBoot_ECIES_v1 ` , generating
97- 48 bytes of key material.
95+ * Derive the new keys from the secret using HKDF. We are not using a ` salt `
96+ and using an ` info ` of ` MCUBoot_ECIES_v1 ` , generating 48 bytes of key material.
9897* A new random encryption key is generated (for AES). This is
9998 the AES key used to encrypt the images.
10099* The key is encrypted with AES-128-CTR or AES-256-CTR and a ` nonce ` of 0 using
101100 the first 16 bytes of key material generated previously by the HKDF.
102- * The encrypted key now goes through a HMAC-SHA256 using the remaining 32
101+ * The encrypted key now goes through a HMAC using the remaining 32
103102 bytes of key material from the HKDF.
104103
104+ There are different TLVs for ECIES-P256, ECIES-X25519 with SHA256 HKDF/HMAC
105+ and ECIES-X25519 with SHA512 HKDF/HMAC.
105106The final TLV is built from the 65 bytes for ECIES-P256 or 32 bytes for
106107ECIES-X25519, which correspond to the ephemeral public key, followed by the
107- 32 bytes of MAC tag and the 16 or 32 bytes of the encrypted key, resulting in
108- a TLV of 113 or 129 bytes for ECIES-P256 and 80 or 96 bytes for ECIES-X25519.
108+ MAC tag and the 16 or 32 bytes of the encrypted key, resulting in final TLV
109+ length:
110+ * ECIES-P256 has TLV length 113 to 129 bytes, depending on AES key length.
111+ * ECIES-X25519 on SHA256 TLV length is 80 or 96 bytes, depending on AES key
112+ length.
113+ * ECIES-X25519 on SHA512 TLV length is 112 or 128, depending on AES key
114+ length.
109115
110116The implemenation of ECIES-P256 is named ENC_EC256 in the source code and
111117artifacts while ECIES-X25519 is named ENC_X25519.
112118
119+ Note that MCUboot is built to support only one ECIES and HMAC SHA at once,
120+ and truncated HMAC is not supported at this time
121+
113122## [ Upgrade process] ( #upgrade-process )
114123
115124When starting a new upgrade process, ` MCUboot ` checks that the image in the
0 commit comments