From f08bbfdadc1d60e63409cefd41182309da776fd4 Mon Sep 17 00:00:00 2001
From: "Matthias J. Kannwischer" <matthias@kannwischer.eu>
Date: Wed, 11 Dec 2024 13:01:42 +0800
Subject: [PATCH] Correct buffer size of re-encrypted ciphertext

The re-encrypted ciphertext has KYBER_CIPHERTEXTBYTES bytes. For some reason the current code adds KYBER_SYMBYTES to that for now reason.
---
 ref/kem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ref/kem.c b/ref/kem.c
index 63abc102..08e8ecfb 100644
--- a/ref/kem.c
+++ b/ref/kem.c
@@ -145,7 +145,7 @@ int crypto_kem_dec(uint8_t *ss,
   uint8_t buf[2*KYBER_SYMBYTES];
   /* Will contain key, coins */
   uint8_t kr[2*KYBER_SYMBYTES];
-  uint8_t cmp[KYBER_CIPHERTEXTBYTES+KYBER_SYMBYTES];
+  uint8_t cmp[KYBER_CIPHERTEXTBYTES];
   const uint8_t *pk = sk+KYBER_INDCPA_SECRETKEYBYTES;
 
   indcpa_dec(buf, ct, sk);