Skip to content
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

Support Armv8.5 RNDR as prediction resistance #2029

Merged
merged 14 commits into from
Dec 13, 2024

Conversation

torben-hansen
Copy link
Contributor

@torben-hansen torben-hansen commented Dec 3, 2024

Description of changes:

Adds Arm as a hardware source for prediction resistance, if supported. This covers Linux+Armv8.5-A that impements rndr. For exmaple, this should be enabled on Graviton3/Graviton4+Amazon Linux.

Note, only multiples of 8 are supported. That's what we need now and I don't see that need changing.

Call-outs:

Wrap the libcrypto inlined functions to workaround the Arm capability vector having internal linkage.

Apple doesn't implement FEAT_RNG on any of their M's. Might be able to implement for Windows. But I don't see a way to probe for the instruction here https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent.

Added s3_3_c2_c4_0 as a known symbol to the delocator to avoid it from interpreting the string as an external symbol that needs a trampoline... It's not really a symbol... And this was the quickest way to move forward.

Testing:

Tested that the function is executed successfully on a Graviton3 instance. This might also be executed through codebuild depending on which instances are spawned.

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.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 89.65517% with 3 lines in your changes missing coverage. Please review.

Project coverage is 78.72%. Comparing base (2459c63) to head (c40df9c).

Files with missing lines Patch % Lines
crypto/fipsmodule/rand/entropy/entropy_sources.c 72.72% 3 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##           randomness_generation    #2029   +/-   ##
======================================================
  Coverage                  78.71%   78.72%           
======================================================
  Files                        606      608    +2     
  Lines                     102759   102774   +15     
  Branches                   14578    14582    +4     
======================================================
+ Hits                       80887    80908   +21     
+ Misses                     21161    21156    -5     
+ Partials                     711      710    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@torben-hansen torben-hansen marked this pull request as ready for review December 4, 2024 14:40
@torben-hansen torben-hansen requested a review from a team as a code owner December 4, 2024 14:40
crypto/fipsmodule/cpucap/internal.h Outdated Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
@torben-hansen torben-hansen requested a review from dkostic December 8, 2024 16:31
crypto/fipsmodule/rand/asm/rndr-armv8.pl Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
crypto/fipsmodule/rand/asm/rndr-armv8.pl Outdated Show resolved Hide resolved
dkostic
dkostic previously approved these changes Dec 12, 2024
@torben-hansen torben-hansen requested a review from nebeid December 12, 2024 23:24
@torben-hansen torben-hansen requested a review from nebeid December 13, 2024 17:04
@torben-hansen torben-hansen merged commit 414cd0f into aws:randomness_generation Dec 13, 2024
107 of 116 checks passed
torben-hansen added a commit to torben-hansen/aws-lc that referenced this pull request Dec 13, 2024
Adds Arm as a hardware source for prediction resistance, if supported. This covers Linux+Armv8.5-A that impements rndr. For exmaple, this should be enabled on Graviton3/Graviton4+Amazon Linux.

Note, only multiples of 8 are supported. That's what we need now and I don't see that need changing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants