From bb67069e4a031aa9d45179286a1f578b7b4a88ed Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 30 Sep 2024 22:05:26 +1000 Subject: [PATCH] Kyber original: fix to work Encapsulate the message (hash of rand) for original. Final of FIPS 203 uses rand. --- wolfcrypt/src/wc_kyber.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/src/wc_kyber.c b/wolfcrypt/src/wc_kyber.c index 8e56bcc0e..a53091c61 100644 --- a/wolfcrypt/src/wc_kyber.c +++ b/wolfcrypt/src/wc_kyber.c @@ -630,7 +630,11 @@ int wc_KyberKey_EncapsulateWithRandom(KyberKey* key, unsigned char* ct, if (ret == 0) { /* Encapsulate the message using the key and the seed (coins). */ +#ifdef WOLFSSL_KYBER_ORIGINAL + ret = kyberkey_encapsulate(key, msg, kr + KYBER_SYM_SZ, ct); +#else ret = kyberkey_encapsulate(key, rand, kr + KYBER_SYM_SZ, ct); +#endif } #ifdef WOLFSSL_KYBER_ORIGINAL