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

Keccak1600_Squeeze/Absorb Layer (rename) #2097

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

manastasova
Copy link
Contributor

Issues:

Resolves Keccak1600_ Layer creation, part of #CryptoAlg-2810

Description of changes:

  • Rename Absorb and Squeeze functions since they are Keccak-specific.
  • Remove of redefinition of |SHAKExxx_BLOCKSIZE| as |SHAKExxx_RATE|.

This PR introduces the lowest API layer for SHA3 and SHAKE new API design:

  • Introduce new Keccak1600 API layer.
    • Keccak1600 layer implements KeccakF1600 Absorb and Squeeze functions; Keccak1600 layer does not manage internal input/output buffers.
  • Later FIPS202, SHA3 and SHAKE layers will be introduced on the top Keccak1600 APIs.

Call-outs:

Remove OPENSSL_EXPORT from some SHA3/SHAKE functions.

Testing:

./crypto/crypto_test --gtest_filter="KeccakInternalTest.*"
./crypto/crypto_test --gtest_filter="SHA3Test.*"
./crypto/crypto_test --gtest_filter="SHAKETest.*"

./crypto/crypto_test --gtest_filter="All/PerKEMTest.*"
./crypto/crypto_test --gtest_filter="All/PQDSAParameterTest.*"

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.

Clean redefinition of SHAKE blocksize/rate macros; Update their use inside MLKEM and MLDSA.
@manastasova manastasova requested a review from a team as a code owner January 6, 2025 23:11
@codecov-commenter
Copy link

codecov-commenter commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.75%. Comparing base (697acc6) to head (872d368).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2097   +/-   ##
=======================================
  Coverage   78.74%   78.75%           
=======================================
  Files         598      598           
  Lines      103656   103656           
  Branches    14720    14720           
=======================================
+ Hits        81622    81632   +10     
+ Misses      21382    21373    -9     
+ Partials      652      651    -1     

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

@jakemas jakemas self-requested a review January 6, 2025 23:54
@@ -64,11 +64,9 @@ extern "C" {
// SHAKE constants, from NIST FIPS202.
// https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf
#define SHAKE_PAD_CHAR 0x1F
#define SHAKE128_BLOCKSIZE (KECCAK1600_WIDTH - 128 * 2) / 8
#define SHAKE256_BLOCKSIZE (KECCAK1600_WIDTH - 256 * 2) / 8
#define SHAKE128_RATE 168
Copy link
Contributor

@jakemas jakemas Jan 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning these (SHAKE128/256_RATE) up!

Fix alignment

Co-authored-by: Jake Massimo <jakemas@amazon.com>
@andrewhop andrewhop merged commit edeb62f into aws:main Jan 7, 2025
124 of 125 checks passed
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