To view this discussion on the web visit https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/C8BF3C02-8538-4795-A06D-0DC508F4896F%40amongbytes.com.
- Experimental identifiers in https://github.com/open-quantum-safe/oqs-provider/blob/main/oqs-template/oqs-kem-info.md which clearly state which NIST round the quantum-safe algorithm is from.
- Names “X25519Kyber768Draft00”, “SecP256r1Kyber768Draft00” in https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml which clearly state they are not the final ML-KEM, but the round 3 version.
- Names “ecdh-nistp256-kybe...@openquantumsafe.org”, …, “x25519-kyber-5...@amazon.com“ in https://github.com/csosto-pk/pq-ssh/blob/master/draft-kampanakis-ssh-pq-ke.txt for SSH which have the version in the name.
A couple more KATs from early implementations, not NIST
- for Kyber round 3 https://github.com/aws/s2n-tls/blob/a6517c5fe97b1aa1898f2233498613dd53735bd8/tests/unit/kats/kyber_r3.kat
- for TLS 1.3 https://github.com/aws/s2n-tls/blob/a6517c5fe97b1aa1898f2233498613dd53735bd8/tests/unit/kats/tls13_server_hybrid_key_share_recv.kat , https://github.com/aws/s2n-tls/blob/a6517c5fe97b1aa1898f2233498613dd53735bd8/tests/unit/kats/generate_pq_hybrid_tls13_handshake_kats.py , https://github.com/aws/s2n-tls/blob/a6517c5fe97b1aa1898f2233498613dd53735bd8/tests/unit/kats/hybrid_prf.kat
From: pqc-...@list.nist.gov <pqc-...@list.nist.gov>
On Behalf Of Mitchell
Sent: Thursday, October 5, 2023 11:39 AM
To: pqc-forum <pqc-...@list.nist.gov>
Cc: Paul Hoffman <paul.h...@icann.org>; pqc-forum <pqc-...@list.nist.gov>; Mitchell <berry...@gmail.com>
Subject: RE: [EXTERNAL] [Ext] [pqc-forum] Known Answer Tests for ML-KEM
|
CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. |
--
You received this message because you are subscribed to the Google Groups "pqc-forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
pqc-forum+...@list.nist.gov.
To view this discussion on the web visit https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/a44cd588-519d-4a07-8811-be748643e158n%40list.nist.gov.
Simon (and others),
We agree that having test vectors is very important. However, we don't typically put the test vectors in the FIPS themselves. For example, if you look at the SHA-3 standard FIPS 202, in appendix B we point somewhere else, rather than having them in that document. Specifically, it points to our Computer Security Resources Center page
where we prefer to put them. That way they can be more easily updated, while it is much more difficult to update a FIPS. We will update that page for the new PQC algorithms, and we'll be sure to announce when we do that. Thanks,
Dustin
Thanks Dustin,
I think NIST is typically doing an _excellent_ work with test vectors. In addition to the test vectors on the Computer Security Resources Center page,
there is also a NIST-hosted server called Automated Cryptographic Validation Test System (ACVTS) provides algorithm test vectors.
https://csrc.nist.gov/csrc/media/Presentations/2023/validation-testing-for-block-cipher-modes/images-media/sess-6-celi-bcm-workshop-2023.pdf
Berry Mitchell wrote:
>People are rolling out these modifications independently.
I am a bit shocked to see how eager people are to use non-standardized algorithms. I think the only reasonable thing to do is to wait until the final NIST standards are published. Using non-standardized algorithms not only creates interoperability problems
but also risks creating security problems.
Cheers,
John
To view this discussion on the web visit https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/ccc1f175-df26-45ca-98bd-251a1197a395n%40list.nist.gov.
Hi,
I strongly agree with the necessity of including negative test vectors. Negative test vectors are very important for catching bugs that might have security implications. I think all future algorithm and protocols standards should have negative test vectors.
I recently created negative test vectors for the EDHOC protocol, which immediately uncovered bugs in several of the implementations.
https://datatracker.ietf.org/doc/draft-ietf-lake-traces/
Cheers,
John
To view this discussion on the web visit https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/CAO%2BHxbD6r5i%2BLK1h%2BZKjU7nTpVAU1GUUcT4Zr-9Q8YyO8gM2BQ%40mail.gmail.com.
Hi,
I strongly agree with the necessity of including negative test vectors. Negative test vectors are very important for catching bugs that might have security implications. I think all future algorithm and protocols standards should have negative test vectors.
Hello,
Over recent days we worked with Roderic Chapman from AWS on two
separate MLKEM
implementations that precisely follow the FIPS-203 draft, to
make sure we have the
same understanding of the draft (one of those implementations
can be formally
verified). We got to the point where both implementations are
interoperable. We
only tested Kyber 768.
I was hoping that someone can confirm our results (or prove
wrong). That can be
done by running KAT vectors against their own implementation. We used following KATs:
https://github.com/post-quantum-cryptography/KAT/tree/v0.0.1/MLKEM
Note: Those vectors are _just_ a
tool to ensure correct understanding of
FIPS-203 draft.
Kind regards,
Kris Kwiatkowski
To view this discussion on the web visit https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/9f14de21-1dca-4b8c-88e8-640e3c552953n%40list.nist.gov.
-----Original Message----- From: 'Robin Larrieu' via pqc-forum <pqc-...@list.nist.gov> Sent: Monday, October 23, 2023 4:13 AM To: pqc-forum <pqc-...@list.nist.gov> Subject: Re: [pqc-forum] Known Answer Tests for ML-KEM Hi all, I also think that option 2 can be confusing because of the transpose symbol in both lines 6 and 19. Option 1 reduces the risk of confusion at the cost of introducing a new notation, that may hide the underlying logic.[Dang, Quynh H. (Fed)] With option 2, we would also remove the line for y_hat on page 10. Everything would be fully clear. There is only one dot product between a matrix and a column, so there is no room for using a wrong dot product function. Option 2 uses a matrix B_hat and makes it clear at the line 6 that B_hat is the transpose of A_hat. This comment would show the underlying logic of the need to transpose the matrix A (from key gen) before computing its dot product with r_hat as (Matrix dot column) in Kyber's encryption.
As suggested by Quynh, I sent an official comment to fips-203- comm...@nist.gov; I copied this comment in the other thread "Question about Ahat_transposed in ML-KEM / Kyber", but I can summarize it here as well. In this official comment, I listed 2 additional options: Option 3: 1) change Algorithm 12 (KeyGen) as in the other 2 options, and 2) change line 6 of Algorithm 13 (Encrypt) from "Ahat[i,j] <- SampleNTT(XOF(ρ, i, j))" to "Ahat[i,j] <- SampleNTT(XOF(ρ, j, i))" 3) keep line 19 of Algorithm 13 unchanged[Dang, Quynh H. (Fed)] This option requires keeping the functions for w_hat and y_hat on page 10. So, it still has room for confusion when one implements line 19. The implementer might do a transpose than use the equation for y_hat, then the result is wrong. The implementer might not do a transpose, then use the equation for w_hat, then the result is also wrong.
In the case of the implementer does the transpose, then use the equation for w_hat, (the result is correct), the disadvantage of this over the option 2 is the unnecessary transpose operation. Option 2 does not do any transpose operation. Another benefit of option 2 over option 3 is that option 2 looks the same with the Kyber's spec except that 1 change to remove all rooms for confusion. Kyber uses only A_hat_Transposed, option 2 uses only B_hat. Option 3 uses A_hat and A_hat_Transposed.
Option 4: 1) change Algorithm 12 (KeyGen) as in the other 2 options, and 2) change line 6 of Algorithm 13 (Encrypt) from "Ahat[i,j] <- SampleNTT(XOF(ρ, i, j))" to "Ahat[i,j] <- SampleNTT(XOF(ρ, j, i))" 3) change line 19 of Algorithm 13 from "u <- NTT^(-1)(Ahat o rhat) + e1" to "u <- NTT^(-1)(rhat o Ahat) + e1"[Dang, Quynh H. (Fed)] The downside of this option is that it looks fundamentally different from Kyber that has been known even though the result is correct. And we would need to specify one more unnecessarily dot product function and then must prove that the 2 equations (one in this FIPS and one in the Kyber's 3rd round spec) produce the same result. With this option, likely we would receive questions about this from new implementers in the future when they just look at this algorithm and check it against the Kyber's spec.
Hi Robin and all,
I apologize I meant option 1 (the one uses B_hat) when I said option 2 at places. See below.
From: Robin Larrieu <robin....@cryptonext-security.com>
Sent: Monday, October 23, 2023 9:56 AM
To: Dang, Quynh H. (Fed) <quynh...@nist.gov>; pqc-forum <pqc-...@list.nist.gov>
Subject: Re: [pqc-forum] Known Answer Tests for ML-KEM
Hi Quynh,
It seems your response uses "option 2" for "use Bhat" and "option 1" for "use Ahat_transpose", while your initial message was the opposite.
Anyway, I mostly agree with you, but let me expand my line of thought below.
Le 23/10/2023 à 13:09, Dang, Quynh H. (Fed) a écrit :
-----Original Message-----From: 'Robin Larrieu' via pqc-forum <pqc-...@list.nist.gov>Sent: Monday, October 23, 2023 4:13 AMTo: pqc-forum <pqc-...@list.nist.gov>Subject: Re: [pqc-forum] Known Answer Tests for ML-KEMHi all,I also think that option 2 can be confusing because of the transpose symbolin both lines 6 and 19.Option 1 reduces the risk of confusion at the cost of introducing a newnotation, that may hide the underlying logic.[Dang, Quynh H. (Fed)] With option 2, we would also remove the line for y_hat on page 10. Everything would be fully clear. There is only one dot product between a matrix and a column, so there is no room for using a wrong dot product function.Option 2 uses a matrix B_hat and makes it clear at the line 6 that B_hat is the transpose of A_hat. This comment would show the underlying logic of the need to transpose the matrix A (from key gen) before computing its dot product with r_hat as (Matrix dot column) in Kyber's encryption.
[Dang, Quynh H. (Fed)] I meant to say option 1 here: the one using B_hat, not option 2.
With option 2 (using Ahat_transpose), implementers may be wondering if they are using the correct access pattern when filling the matrix Ahat_transpose in line 6 and when multiplying in line 19: - when they see "Ahat_transpose[i,j] = ...", they may ask themselves "should I write the coefficient in position [i,j], or in position [j,i] because of the transpose?" (second is wrong) - when they see "Ahat_transpose * rhat", they may ask themselves "should I read column-wise because of the transpose, or row-wise as usual since it was transposed from the beginning ?" (first is wrong). Clearly leaving the formula for yhat would make the confusion worse, so NIST should definitely remove it if this option is selected. For this reason, I prefer option 1 (using Bhat) over option 2.
[Dang, Quynh H. (Fed)] Yes, I also prefer option 1.
As suggested by Quynh, I sent an official comment to fips-203-comm...@nist.gov; I copied this comment in the other thread "Questionabout Ahat_transposed in ML-KEM / Kyber", but I can summarize it here aswell.In this official comment, I listed 2 additional options:Option 3:1) change Algorithm 12 (KeyGen) as in the other 2 options, and2) change line 6 of Algorithm 13 (Encrypt) from "Ahat[i,j] <-SampleNTT(XOF(ρ, i, j))" to "Ahat[i,j] <- SampleNTT(XOF(ρ, j, i))"3) keep line 19 of Algorithm 13 unchanged[Dang, Quynh H. (Fed)] This option requires keeping the functions for w_hat and y_hat on page 10. So, it still has room for confusion when one implements line 19. The implementer might do a transpose than use the equation for y_hat, then the result is wrong. The implementer might not do a transpose, then use the equation for w_hat, then the result is also wrong.
Maybe I am playing the devil's advocate here, but I think these scenario are less likely than an implementer overlooking the swapped indices in XOF(rho,i,j) compared to the XOF(rho,j,i) that was done in KeyGen, which also leads to a wrong result. Since option 3 does not swap indices, it removes this potential source of confusion, and makes it clear that the matrix is exactly the same as for KeyGen.
[Dang, Quynh H. (Fed)] True. It has this advantage over the option 1. But, people must follow the standard as written, the order of input is matter. If i||j is coded as j||i, the result would be different.
In the case of the implementer does the transpose, then use the equation for w_hat, (the result is correct), the disadvantage of this over the option 2 is the unnecessary transpose operation. Option 2 does not do any transpose operation.Another benefit of option 2 over option 3 is that option 2 looks the same with the Kyber's spec except that 1 change to remove all rooms for confusion. Kyber uses only A_hat_Transposed, option 2 uses only B_hat. Option 3 uses A_hat and A_hat_Transposed.
[Dang, Quynh H. (Fed)] Again, I meant option 1 when I said option 2 over here.
With option 3, the implementer has essentially three ways to go:
- transpose, then do a standard matrix-column product (formula for what)
- do the matrix-column product with an adjusted access pattern (formula for yhat)
- generate Ahat_transpose from the beginning.
The first solution is a plain 1-to-1 implementation of option 3, and the next two are rather straightforward implementation tricks to avoid computing the transpose.
I believe that the pseudo-code description of the algorithm is more useful as an explanation of the underlying logic (hence option 3), but I guess it also makes sense to include micro-optimizations (like options 1 and 2) to help with implementations. So if
people prefer option 1 or 2, I am fine with that as well.
Option 4:1) change Algorithm 12 (KeyGen) as in the other 2 options, and2) change line 6 of Algorithm 13 (Encrypt) from "Ahat[i,j] <-SampleNTT(XOF(ρ, i, j))" to "Ahat[i,j] <- SampleNTT(XOF(ρ, j, i))"3) change line 19 of Algorithm 13 from "u <- NTT^(-1)(Ahat o rhat) + e1"to "u <- NTT^(-1)(rhat o Ahat) + e1"[Dang, Quynh H. (Fed)] The downside of this option is that it looks fundamentally different from Kyber that has been known even though the result is correct. And we would need to specify one more unnecessarily dot product function and then must prove that the 2 equations (one in this FIPS and one in the Kyber's 3rd round spec) produce the same result. With this option, likely we would receive questions about this from new implementers in the future when they just look at this algorithm and check it against the Kyber's spec.
The idea behind option 4 was to further go in the direction of explaining the underlying logic. When you put KeyGen, Encrypt, and Decrypt side-by-side, I find it easier with option 4 to replace the intermediate results t, u, v, v' by their
value to observe the simplifications and understand what is going on. With the current formulation, one has some additional transpositions to do, which is not a big deal when one does the computation but makes it a little bit more obscure at first.
Anyway, I agree that it may be too different from what is currently in place so we can forget about it.
Robin
[Dang, Quynh H. (Fed)] Regards, Quynh.