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

ML-KEM-IPD to ML-KEM #1775

Closed
wants to merge 18 commits into from
Closed

ML-KEM-IPD to ML-KEM #1775

wants to merge 18 commits into from

Conversation

dkostic
Copy link
Contributor

@dkostic dkostic commented Aug 16, 2024

Issues:

CryptoAlg-2619

Description of changes:

In this PR we made a small change that transitions the ML-KEM
implementation from the Initial Public Draft (IPD) to the final ML-KEM
as defined in FIPS 203: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.pdf.
The only change needed was the domain separation in key generation.
This required updated KATs as well. The new KATs were obtained from:
post-quantum-cryptography/KAT#15,
and converted to the form AWS-LC expects*. Besides this one material change,
we updated the code and folder names to remove IPD suffix.

Call-outs:

*python script used for KATs conversion:

import sys

if len(sys.argv) != 2:
    print("Usage: python convert.py <filename>")
    sys.exit(1)
filename = sys.argv[1]

# PARSE THE INPUT FILE
all_groups = []
try:
    with open(filename, 'r') as file:
        group = {}
        for line in file:
            key = line.strip().split(" ")[0]
            value = line.strip().split(" ")[2]
            if key == "count":
                if (len(group) != 0):
                    all_groups.append(group)
                group = {}
            group[key] = value
except FileNotFoundError:
    print(f"Error: The file '{filename}' was not found.")

try:
    with open(filename + "_out.txt", 'w') as file:
        for group in all_groups:
            file.write("\n")
            file.write("count = " + group["count"] + "\n")
            file.write("keypair_coins = " + group["d"] + group["z"] + "\n")
            file.write("pk = " + group["pk"] + "\n")
            file.write("sk = " + group["sk"] + "\n")
            file.write("encap_coins = " + group["msg"] + "\n")
            file.write("ct = " + group["ct"] + "\n")
            file.write("ss = " + group["ss"] + "\n")

except FileNotFoundError:
    print(f"Error: The file '{filename}' was not found.")

Testing:

How is this change tested (unit tests, fuzz tests, etc.)? Are there any testing steps to be verified by the reviewer?

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 Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.31%. Comparing base (79d5d16) to head (71144da).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1775      +/-   ##
==========================================
- Coverage   78.44%   78.31%   -0.13%     
==========================================
  Files         580      581       +1     
  Lines       96780    97064     +284     
  Branches    13863    13909      +46     
==========================================
+ Hits        75921    76020      +99     
- Misses      20243    20422     +179     
- Partials      616      622       +6     

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

@dkostic dkostic mentioned this pull request Aug 23, 2024
@dkostic
Copy link
Contributor Author

dkostic commented Aug 23, 2024

I've split this PR in two smaller ones:

So closing this one.

@dkostic dkostic closed this Aug 23, 2024
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.

2 participants