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 move to the FIPS module #1802

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ add_library(
kyber/kem_kyber.c
lhash/lhash.c
mem.c
ml_kem/ml_kem.c
obj/obj.c
obj/obj_xref.c
ocsp/ocsp_asn.c
Expand Down
6 changes: 3 additions & 3 deletions crypto/evp_extra/evp_extra_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2072,9 +2072,9 @@ static const struct KnownKEM kKEMs[] = {
{"Kyber512r3", NID_KYBER512_R3, 800, 1632, 768, 32, 64, 32, "kyber/kat/kyber512r3.txt"},
{"Kyber768r3", NID_KYBER768_R3, 1184, 2400, 1088, 32, 64, 32, "kyber/kat/kyber768r3.txt"},
{"Kyber1024r3", NID_KYBER1024_R3, 1568, 3168, 1568, 32, 64, 32, "kyber/kat/kyber1024r3.txt"},
{"MLKEM512", NID_MLKEM512, 800, 1632, 768, 32, 64, 32, "ml_kem/kat/mlkem512.txt"},
{"MLKEM768", NID_MLKEM768, 1184, 2400, 1088, 32, 64, 32, "ml_kem/kat/mlkem768.txt"},
{"MLKEM1024", NID_MLKEM1024, 1568, 3168, 1568, 32, 64, 32, "ml_kem/kat/mlkem1024.txt"},
{"MLKEM512", NID_MLKEM512, 800, 1632, 768, 32, 64, 32, "fipsmodule/ml_kem/kat/mlkem512.txt"},
{"MLKEM768", NID_MLKEM768, 1184, 2400, 1088, 32, 64, 32, "fipsmodule/ml_kem/kat/mlkem768.txt"},
{"MLKEM1024", NID_MLKEM1024, 1568, 3168, 1568, 32, 64, 32, "fipsmodule/ml_kem/kat/mlkem1024.txt"},
};

class PerKEMTest : public testing::TestWithParam<KnownKEM> {};
Expand Down
1 change: 1 addition & 0 deletions crypto/fipsmodule/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
#include "kdf/sskdf.c"
#include "md4/md4.c"
#include "md5/md5.c"
#include "ml_kem/ml_kem.c"
#include "modes/cbc.c"
#include "modes/cfb.c"
#include "modes/ctr.c"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdint.h>
#include <string.h>

#include "../../internal.h"
#include "../../../internal.h"

#include "params.h"
#include "indcpa.h"
Expand Down Expand Up @@ -162,7 +162,7 @@ static unsigned int rej_uniform(int16_t *r,
**************************************************/
#define GEN_MATRIX_NBLOCKS ((12*KYBER_N/8*(1 << 12)/KYBER_Q + XOF_BLOCKBYTES)/XOF_BLOCKBYTES)
// Not static for benchmarking
void gen_matrix(ml_kem_params *params, polyvec *a, const uint8_t *seed, int transposed)
void gen_matrix(ml_kem_params *params, polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed)
{
unsigned int ctr, i, j, k;
unsigned int buflen, off;
Expand Down Expand Up @@ -267,7 +267,7 @@ void indcpa_enc(ml_kem_params *params,
uint8_t *c,
const uint8_t *m,
const uint8_t *pk,
const uint8_t *coins)
const uint8_t coins[KYBER_SYMBYTES])
{
unsigned int i;
uint8_t seed[KYBER_SYMBYTES];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "polyvec.h"

#define gen_matrix KYBER_NAMESPACE(gen_matrix)
void gen_matrix(ml_kem_params *params, polyvec *a, const uint8_t *seed, int transposed);
void gen_matrix(ml_kem_params *params, polyvec *a, const uint8_t seed[KYBER_SYMBYTES], int transposed);

#define indcpa_keypair_derand KYBER_NAMESPACE(indcpa_keypair_derand)
void indcpa_keypair_derand(ml_kem_params *params,
Expand All @@ -19,7 +19,7 @@ void indcpa_enc(ml_kem_params *params,
uint8_t *c,
const uint8_t *m,
const uint8_t *pk,
const uint8_t *coins);
const uint8_t coins[KYBER_SYMBYTES]);

#define indcpa_dec KYBER_NAMESPACE(indcpa_dec)
void indcpa_dec(ml_kem_params *params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "cbd.h"
#include "symmetric.h"

#include "../../internal.h"
#include "../../../internal.h"

/*************************************************
* Name: poly_compress
Expand Down
Loading
Loading