-
Notifications
You must be signed in to change notification settings - Fork 121
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
Integrate ube for rand engine #1897
Integrate ube for rand engine #1897
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## randomness_generation #1897 +/- ##
=========================================================
+ Coverage 78.42% 78.46% +0.04%
=========================================================
Files 585 585
Lines 97020 97060 +40
Branches 13903 13919 +16
=========================================================
+ Hits 76090 76162 +72
+ Misses 20311 20282 -29
+ Partials 619 616 -3 ☔ View full report in Codecov by Sentry. |
@@ -252,7 +293,7 @@ static void RAND_bytes_core( | |||
|
|||
OPENSSL_cleanse(pred_resistance, RAND_PRED_RESISTANCE_LEN); | |||
|
|||
if (rand_ensure_valid_state() != 1) { | |||
if (rand_ensure_valid_state(state) != 1) { |
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.
NP: in a future PR can you add a comment here explaining why we need to abort. I get that it means a UBE occurred and if that happened after line 235 and before line 242 you could end up with duplicate state, we might just forget/think this looks weird in the future.
ccb97ef
into
aws:randomness_generation
This PR integrates protection of the thread-local state into the new randomness generation implementation. rand_ensure_ctr_drbg_uniquness() is the function that determines whether a randomization of the thread-local state is necessary. rand_ensure_ctr_drbg_uniquness() is called inline in the core randomness generation code path (in RAND_bytes_core() and invoked on every entry. The only mechanism currently implemented that can force a randomization is the UBE mechanism implemented in bc7aeff. Note that if UBE is "unavailable" then a randomization is forced every time.
This PR integrates protection of the thread-local state into the new randomness generation implementation. rand_ensure_ctr_drbg_uniquness() is the function that determines whether a randomization of the thread-local state is necessary. rand_ensure_ctr_drbg_uniquness() is called inline in the core randomness generation code path (in RAND_bytes_core() and invoked on every entry. The only mechanism currently implemented that can force a randomization is the UBE mechanism implemented in bc7aeff. Note that if UBE is "unavailable" then a randomization is forced every time.
Description of changes:
This PR integrates protection of the thread-local state into the new randomness generation implementation.
rand_ensure_ctr_drbg_uniquness()
is the function that determines whether a randomization of the thread-local state is necessary.rand_ensure_ctr_drbg_uniquness()
is called inline in the core randomness generation code path (inRAND_bytes_core()
and invoked on every entry.The only mechanism currently implemented that can force a randomization is the UBE mechanism implemented in bc7aeff. Note that if UBE is "unavailable" then a randomization is forced every time.
Testing:
Some additional support code is implemented to mock the UBE detection and determine if correct behaviour occurred.
The failing tests are because the target branch is
randomness_generation
that haven't been rebased onmain
branch with fixes.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.