-
Notifications
You must be signed in to change notification settings - Fork 2
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
FIPS 203 FINAL - Candidate new KAT inputs and results #15
FIPS 203 FINAL - Candidate new KAT inputs and results #15
Conversation
Signed-off-by: Rod Chapman <rodchap@amazon.com>
I can confirm that AWS-LC's ML-KEM implementation successfully passes the KATs. To check this I did the following:
I pushed the test to my fork of AWS-LC for posterity: aws/aws-lc@81cb021. Note1: this is just a quick test in my fork of AWS-LC, I'll soon push a change to update AWS-LC itself. Note2: that the implementation in AWS-LC was originally copied from the official Kyber repository (https://github.com/pq-crystals/kyber). |
Added domain separation in keygen and new KATs. The KATs were sourced from post-quantum-cryptography/KAT#15.
Added domain separation in keygen and new KATs. The KATs were sourced from post-quantum-cryptography/KAT#15.
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. In as subsequent PR we'll rename all functions/folders/identifiers to drop the "ipd" suffix. p.s. 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.") ```
@rod-chapman I can confirm it works on one of my implementations. I've one more to update and check. |
This PR contributes candidate KAT files for FIPS 203 FINAL (MLKEM), updated for the 13th August 2024 issue of FIPS 203.
The same random inputs, seeds, and messages are used as before.
New results were produced by the AWS LibMLKEM implementation. I hope verification of these results with other implementations will follow.