-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The NIST SP 800-90A[1] spec of HMAC_DRBG uses "!= Null" checks, but "Null" is never defined in the document. In the current implementation, this was interpreteted as nil. However, the NIST examples document[2] uses "<empty>" values, so []byte{} should be passed in the test cases. If that happens, the nil checks do not work as expected. Therefore, instead of checking equality with nil, it should be checked whether the length of additional_info is zero. As additional evidence I cite the openssl implementation[3], which checks for zero length instead of NULL pointer equality. [1]: https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf [2]: https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/HMAC_DRBG.pdf [3]: https://github.com/openssl/openssl/pull/6779/files#diff-c44c9681c4fc49b1d7e9e74578085212R77-R79
- Loading branch information
keks
committed
Aug 4, 2020
1 parent
3a0b2f3
commit 383efd5
Showing
3 changed files
with
56 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
go/common/crypto/drbg: Also consider empty slices as Null values | ||
|
||
The wrong handling of an edge case in the HMAC_DRBG implementation has been | ||
corrected. An update with empty `additional_data` now behaves the same as an | ||
update with nil additional data. While the spec is not 100% clear around how | ||
this is to be treated, supplemental documentation suggests that this is the | ||
correct way to handle it. | ||
|
||
TODO: Did Oasis ever do this call? Does this break something? |
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