-
Notifications
You must be signed in to change notification settings - Fork 118
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
Tree DRBG with Jitter Entropy root #1958
Merged
torben-hansen
merged 24 commits into
aws:randomness_generation
from
torben-hansen:ragdoll_chain_source
Nov 13, 2024
Merged
Tree DRBG with Jitter Entropy root #1958
torben-hansen
merged 24 commits into
aws:randomness_generation
from
torben-hansen:ragdoll_chain_source
Nov 13, 2024
Conversation
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
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## randomness_generation #1958 +/- ##
=========================================================
- Coverage 78.78% 78.73% -0.05%
=========================================================
Files 595 605 +10
Lines 101780 102679 +899
Branches 14424 14562 +138
=========================================================
+ Hits 80183 80845 +662
- Misses 20959 21133 +174
- Partials 638 701 +63 ☔ View full report in Codecov by Sentry. |
torben-hansen
force-pushed
the
ragdoll_chain_source
branch
from
November 7, 2024 19:06
ac45c0f
to
1ea6d8f
Compare
skmcgrail
reviewed
Nov 8, 2024
andrewhop
reviewed
Nov 8, 2024
torben-hansen
commented
Nov 11, 2024
andrewhop
reviewed
Nov 12, 2024
andrewhop
reviewed
Nov 12, 2024
andrewhop
approved these changes
Nov 13, 2024
skmcgrail
approved these changes
Nov 13, 2024
torben-hansen
merged commit Nov 13, 2024
ddaf6d3
into
aws:randomness_generation
113 of 116 checks passed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
Implements a tree-DRBG using CPU Jitter as root. I had to implement some implementation-defined state, so switched from an immutable entropy source object
entropy_source
to a mutable one. Instead I factored out the vtable into a immutable object that defines the API to the entropy source.The tree-DRBG is quite straightforward. The painful part is managing memory.
free_thread
will manage thread-local memory.zeroize_thread
in case they haven't been properly closed. A destructor in the tree-DRBG implementation will make sure to free the global DRBG + CPU Jitter object. This should also mean that we can safely unload DSO's.Changes to CPU Jitter code entails:
__int64
is a language extension, old compilers aren't happy with that. Fix by replacing with portableint64_t
time
is shadowing a global declaration from some imported header file. Fix by renaming parameters and local variables.There are warnings, that turns into errors, originating from
-Wconversion
on the oldest GCC. These are false-positives because prior to GCC 4.3,-Wconversion
didn't have anything to do with finding troublesome implicit conversions, it was an aid in converting from old C to modern C. Disable on those old compilers.jitterentropy-base-windows.h
distributes definitions ofjent_get_nstime()
throughout compilation units. However, many of these doesn't use the function causing unused function warnings for Windows clang builds. Tried different things but inlining was the only thing that worked.Call-outs:
The requirement to zeroize memory before exiting is handled a little special. When all frontend DRBGs have been locked and can't produce anymore output, we kick off zeroizing the associated entropy source. We do this bottom-up: first the global DRBG is zeroized with random data, that thread-local DRBGs can use as seeds and randomise their state. This is needed because the front-end DRBGs might still try to reseed requiring access to the entropy source. Note, any data from the entropy source is just random and will never be used to generate any output to a consumer - because the frontend DRBGs has been locked and will spin forever if scheduled.
Testing:
There are currently some gaps in testing. I will implement comprehensive testing later.
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.