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

Update HMAC to fail when null value is passed to out parameter #1662

Merged
merged 2 commits into from
Jul 1, 2024

Conversation

kexgaber
Copy link
Contributor

@kexgaber kexgaber commented Jun 25, 2024

Issues:

CryptoAlg-2522

Description of changes:

Currently, NULL passed as the value of out can result in a segmentation fault. This change adds checks to the HMAC one-shot API and HMAC_final function to handle scenarios where NULL is passed as a value to the out parameter to return from the functions and prevent further computation.

Testing:

Added additional test case in crypto/hmac_extra/hmac_test.cc to verify the behavior when NULL is passed as a value to out in both functions.

Call-outs:

  • OpenSSL supports this differently by allowing the computation to occur but allocating a throw-away array OpenSSL implementation

  • We should also evaluate if this change should be back-ported to the FIPS branches

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.

@kexgaber kexgaber requested a review from a team as a code owner June 25, 2024 18:38
@kexgaber kexgaber requested a review from skmcgrail June 25, 2024 18:46
@kexgaber kexgaber assigned andrewhop and unassigned andrewhop Jun 25, 2024
@kexgaber kexgaber requested a review from andrewhop June 25, 2024 18:46
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.21%. Comparing base (4368aaa) to head (6d821dd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1662      +/-   ##
==========================================
- Coverage   78.22%   78.21%   -0.01%     
==========================================
  Files         566      566              
  Lines       95165    95176      +11     
  Branches    13661    13663       +2     
==========================================
+ Hits        74442    74444       +2     
- Misses      20127    20137      +10     
+ Partials      596      595       -1     

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

@kexgaber kexgaber changed the title fixed hmac when used with null output Update HMAC to fail when null value is passed to out parameter Jun 25, 2024
@kexgaber kexgaber merged commit 21c5e48 into aws:main Jul 1, 2024
6 of 7 checks passed
@kexgaber kexgaber deleted the hmac_null branch July 1, 2024 21:24
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