Skip to content

Commit

Permalink
Update ML-KEM's internal header files to use unique include guards
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewhop committed Dec 23, 2024
1 parent acf5220 commit 890396b
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 18 deletions.
1 change: 1 addition & 0 deletions crypto/fipsmodule/ml_kem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ that initialize a given structure with values corresponding to a parameter set.
- `symmetric-shake.c`: unnecessary include of fips202.h is removed.
- `api.h`: `pqcrystals` prefix substituted with `ml_kem` (to be able to build alongside `crypto/kyber`).
- `poly.c`: the `poly_frommsg` function was modified to address the constant-time issue described [here](https://github.com/pq-crystals/kyber/commit/9b8d30698a3e7449aeb34e62339d4176f11e3c6c).
- All internal header files were updated with unique `ML_KEM_*` include guards.

**Testing.** The KATs were obtained from an independent implementation of ML-KEM written in SPARK Ada subset: https://github.com/awslabs/LibMLKEM.
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/cbd.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef CBD_H
#define CBD_H
#ifndef ML_KEM_CBD_H
#define ML_KEM_CBD_H

#include <stdint.h>
#include "params.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/indcpa.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef INDCPA_H
#define INDCPA_H
#ifndef ML_KEM_INDCPA_H
#define ML_KEM_INDCPA_H

#include <stdint.h>
#include "params.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/ntt.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef NTT_H
#define NTT_H
#ifndef ML_KEM_NTT_H
#define ML_KEM_NTT_H

#include <stdint.h>
#include "params.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/params.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PARAMS_H
#define PARAMS_H
#ifndef ML_KEM_PARAMS_H
#define ML_KEM_PARAMS_H

#include <openssl/base.h>

Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/poly.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef POLY_H
#define POLY_H
#ifndef ML_KEM_POLY_H
#define ML_KEM_POLY_H

#include <stdint.h>
#include "params.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/polyvec.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef POLYVEC_H
#define POLYVEC_H
#ifndef ML_KEM_POLYVEC_H
#define ML_KEM_POLYVEC_H

#include <stdint.h>
#include "params.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/reduce.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef REDUCE_H
#define REDUCE_H
#ifndef ML_KEM_REDUCE_H
#define ML_KEM_REDUCE_H

#include <stdint.h>
#include "params.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/symmetric.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef SYMMETRIC_H
#define SYMMETRIC_H
#ifndef ML_KEM_SYMMETRIC_H
#define ML_KEM_SYMMETRIC_H

#include <stddef.h>
#include <stdint.h>
Expand Down
4 changes: 2 additions & 2 deletions crypto/fipsmodule/ml_kem/ml_kem_ref/verify.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef VERIFY_H
#define VERIFY_H
#ifndef ML_KEM_VERIFY_H
#define ML_KEM_VERIFY_H

#include <stddef.h>
#include <stdint.h>
Expand Down

0 comments on commit 890396b

Please sign in to comment.