@@ -92,24 +92,33 @@ libraries. The whole key encryption can be summarized as:
92
92
keypair. Those keys will be our ephemeral keys.
93
93
* Generate a new secret (DH) using the ephemeral private key and the public key
94
94
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.
98
97
* A new random encryption key is generated (for AES). This is
99
98
the AES key used to encrypt the images.
100
99
* The key is encrypted with AES-128-CTR or AES-256-CTR and a ` nonce ` of 0 using
101
100
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
103
102
bytes of key material from the HKDF.
104
103
104
+ There are different TLVs for ECIES-P256, ECIES-X25519 with SHA256 HKDF/HMAC
105
+ and ECIES-X25519 with SHA512 HKDF/HMAC.
105
106
The final TLV is built from the 65 bytes for ECIES-P256 or 32 bytes for
106
107
ECIES-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.
109
115
110
116
The implemenation of ECIES-P256 is named ENC_EC256 in the source code and
111
117
artifacts while ECIES-X25519 is named ENC_X25519.
112
118
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
+
113
122
## [ Upgrade process] ( #upgrade-process )
114
123
115
124
When starting a new upgrade process, ` MCUboot ` checks that the image in the
0 commit comments