-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not use broken key derivation for AES-GCM
This commit fixes a cryptographic security issue w.r.t. wrapping data encryption keys. The key derivation function (KDF) used when a data encryption key is sealed is not a PRF. One way to show that a function is not a PRF is to proof that there is a relation between different output values of the function. In particular, the AES key derivation function used before has the following property: ``` Let v0, v1, v2 and v3 be 128 bit values (HEX) as following: v0 = 00000000000000000000000000000000 v1 = 01000000000000000000000000000000 v2 = 00000000000000000000000000000001 v3 = 01000000000000000000000000000001 Further let K be an arbitrary 256 bit key and f the AES key derivation function. Then invoking f with K and the iv values returns 4 output values k0 = f(K, v0) k1 = f(K, v1) k2 = f(K, v2) k3 = f(K, v3) Now, the following statement is true: k0 ^ k1 ^ k2 == k3 // ^ is XOR So, from deriving k0, k1, k2 you can infer k3. This clearly violates the definition of a PRF. ``` This commit fixes this by replacing the KDF with `HMAC-SHA-256`. Since, HMAC has been proven to a PRF if the used hash function is collision-resistant this is an adequate fix. However, switching to HMAC-SHA-256 is not ideal in the sense that we now rely on 2 primitives (AES and SHA-256) instead of one. However, this can be addressed in the future when more research has been done.
- Loading branch information
Andreas Auernhammer
committed
Mar 18, 2020
1 parent
f8cbc38
commit 3300fb6
Showing
2 changed files
with
46 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters