-
Notifications
You must be signed in to change notification settings - Fork 155
Add CTR-DRBG derivation function #2863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CTR-DRBG derivation function #2863
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fips-2024-09-27 #2863 +/- ##
===================================================
- Coverage 78.59% 78.48% -0.11%
===================================================
Files 585 585
Lines 101047 100260 -787
Branches 14311 14346 +35
===================================================
- Hits 79418 78691 -727
+ Misses 20993 20930 -63
- Partials 636 639 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The CI on this FIPSv3 branch is quite out of date, so there are going to be a lot of failing jobs. I manually checked whether the failing ones are benign or not. All OK. |
| int CTR_DRBG_reseed_df(CTR_DRBG_STATE *drbg, | ||
| const uint8_t entropy[CTR_DRBG_ENTROPY_LEN], | ||
| const uint8_t *additional_data, | ||
| size_t additional_data_len) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this stuff from 8.7.1 or 8.7.2? if neither where is defined in the spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean the naming or the algorithm? Sorry not sure I understand the question.
Algorithm is 10.2.1.4.2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, unclear question on my part. i meant specifically additional_data and its length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, the (maximum allowed) length is governed by Table 3: Definitions for the CTR_DRBG in SP800-90A. The upper bound is 2^32 bytes.
|
Checked all failing dimensions. I believe they are due to outdated CI and unrelated to this change. |
Equivalent to #2863 except removed SET_DIT_AUTO_RESET which is not supported in this version.
Description of changes:
IG D.L requires that the entropy argument has full-entropy. This won't happen using the passive method. Hence, implement a derivation function to compensate.
Derivation function is implemented a described in SP800-90A using a generation counter for the nonce. The nonce is then unique per process up to 2^128 life-time initializations.
The new ctr-drbg derivation function interface is not exported. Instead it's only used internally. I kept the existing ctr-drbg interface around in an attempt to make the change minimal.
RAND_bytes()will continue to use the existing ctr-drbg implementation except if in FIPS and if not using the special CPU Jitter mode.Call-outs:
All FIPS related tests are adjusted to use the new ctr-drbg derivation functions.
performance on Arm64
Now
Before
Testing:
Added lots of KATs for the new ctr-drbg with df interface.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.