Skip to content

Commit

Permalink
Update scripts and files are movement of fips202
Browse files Browse the repository at this point in the history
Produced by:

1. Systematic renaming

```
% find . -type f | grep -v ".git/" | grep -v "venv" | grep -v " " | \
  xargs sed -i '' 's%fips202/%mlkem/fips202/%g'
% find . -type f | grep -v ".git/" | grep -v "venv" | grep -v " " | \
  xargs sed -i '' 's%\.\./mlkem/fips202%fips202%g'
% find . -type f | grep -v ".git/" | grep -v "venv" | grep -v " " | \
  xargs sed -i '' 's%-Ifips202%-Imlkem/fips202%g'
% find . -type f | grep -v ".git/" | grep -v "venv" | grep -v " " | \
  xargs sed -i '' 's%custom_mlkem/fips202%custom_fips202%g'
% find . -type f | grep -v ".git/" | grep -v "venv" | grep -v " " | \
  xargs sed -i '' 's%mlkem_native/fips202%mlkem_native/mlkem/fips202%g'
```

2. Ad-hoc patching of `examples/custom_backend`.
3. Ad-hoc patching of `check-namespace` and `lint` script
4. Ad-hoc patching of Windows makefile

Signed-off-by: Hanno Becker <[email protected]>
  • Loading branch information
hanno-becker committed Dec 17, 2024
1 parent 00cf27d commit 02c78ce
Show file tree
Hide file tree
Showing 37 changed files with 57 additions and 57 deletions.
6 changes: 3 additions & 3 deletions FIPS202.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

If your library has a FIPS-202 implementation, you can use it instead of the one shipped with mlkem-native.

1. Replace `fips202/*` by your own FIPS-202 implementation.
2. Provide replacements for the headers [`fips202/fips202.h`](fips202/fips202.h) and [`fips202/fips202x4.h`](fips202/fips202x4.h) and the
1. Replace `mlkem/fips202/*` by your own FIPS-202 implementation.
2. Provide replacements for the headers [`mlkem/fips202/fips202.h`](mlkem/fips202/fips202.h) and [`mlkem/fips202/fips202x4.h`](mlkem/fips202/fips202x4.h) and the
functionalities specified therein:
* Structure definitions for `shake128ctx` and `shake128x4ctx`
* `shake128_absorb_once()`: Initialize a SHAKE-128 context and perform a single absorb step.
Expand All @@ -17,6 +17,6 @@ functionalities specified therein:
* `shake128x4_squeezeblocks()`: Squeeze 4x-batched SHAKE-128 context
* `shake128x4_release()`: Release a 4x-batched SHAKE-128 context after use

See [`fips202/fips202.h`](fips202/fips202.h) and [`fips202/fips202x4.h`](fips202/fips202x4.h) for more details. Note that the structure
See [`mlkem/fips202/fips202.h`](mlkem/fips202/fips202.h) and [`mlkem/fips202/fips202x4.h`](mlkem/fips202/fips202x4.h) for more details. Note that the structure
definitions may differ from those shipped with mlkem-native: In particular, you may fall back to an incremental hashing
implementation which tracks the current offset in its state.
22 changes: 11 additions & 11 deletions Makefile.Microsoft_nmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# SPDX-License-Identifier: Apache-2.0

CFLAGS = /nologo /O2 /Imlkem /Ifips202 /Ifips202/native /Imlkem/sys /Imlkem/native
CFLAGS = /nologo /O2 /Imlkem /Imlkem/fips202 /Imlkem/fips202/native /Imlkem/sys /Imlkem/native

OBJ_FILES = .\mlkem\*.obj \
.\fips202\*.obj \
.\mlkem\fips202\*.obj \

BUILD_DIR = test\build
MLKEM512_BUILD_DIR = $(BUILD_DIR)\mlkem512
Expand All @@ -28,9 +28,9 @@ OPT = 0
@if NOT EXIST $(MLKEM512_BUILD_DIR)\mlkem mkdir $(MLKEM512_BUILD_DIR)\mlkem
$(CC) $(CFLAGS) /D MLKEM_K=2 /c /Fo$(MLKEM512_BUILD_DIR)\mlkem\ $<

{fips202}.c{$(MLKEM512_BUILD_DIR)\fips202}.obj::
@if NOT EXIST $(MLKEM512_BUILD_DIR)\fips202 mkdir $(MLKEM512_BUILD_DIR)\fips202
$(CC) $(CFLAGS) /D MLKEM_K=2 /c /Fo$(MLKEM512_BUILD_DIR)\fips202\ $<
{mlkem\fips202}.c{$(MLKEM512_BUILD_DIR)\mlkem\fips202}.obj::
@if NOT EXIST $(MLKEM512_BUILD_DIR)\mlkem\fips202 mkdir $(MLKEM512_BUILD_DIR)\mlkem\fips202
$(CC) $(CFLAGS) /D MLKEM_K=2 /c /Fo$(MLKEM512_BUILD_DIR)\mlkem\fips202\ $<

{test}.c{$(MLKEM512_BUILD_DIR)\test}.obj::
@if NOT EXIST $(MLKEM512_BUILD_DIR)\test mkdir $(MLKEM512_BUILD_DIR)\test
Expand All @@ -41,9 +41,9 @@ OPT = 0
@if NOT EXIST $(MLKEM768_BUILD_DIR)\mlkem mkdir $(MLKEM768_BUILD_DIR)\mlkem
$(CC) $(CFLAGS) /D MLKEM_K=3 /c /Fo$(MLKEM768_BUILD_DIR)\mlkem\ $<

{fips202}.c{$(MLKEM768_BUILD_DIR)\fips202}.obj::
@if NOT EXIST $(MLKEM768_BUILD_DIR)\fips202 mkdir $(MLKEM768_BUILD_DIR)\fips202
$(CC) $(CFLAGS) /D MLKEM_K=3 /c /Fo$(MLKEM768_BUILD_DIR)\fips202\ $<
{mlkem\fips202}.c{$(MLKEM768_BUILD_DIR)\mlkem\fips202}.obj::
@if NOT EXIST $(MLKEM768_BUILD_DIR)\mlkem\fips202 mkdir $(MLKEM768_BUILD_DIR)\mlkem\fips202
$(CC) $(CFLAGS) /D MLKEM_K=3 /c /Fo$(MLKEM768_BUILD_DIR)\mlkem\fips202\ $<

{test}.c{$(MLKEM768_BUILD_DIR)\test}.obj::
@if NOT EXIST $(MLKEM768_BUILD_DIR)\test mkdir $(MLKEM768_BUILD_DIR)\test
Expand All @@ -54,9 +54,9 @@ OPT = 0
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\mlkem mkdir $(MLKEM1024_BUILD_DIR)\mlkem
$(CC) $(CFLAGS) /D MLKEM_K=4 /c /Fo$(MLKEM1024_BUILD_DIR)\mlkem\ $<

{fips202}.c{$(MLKEM1024_BUILD_DIR)\fips202}.obj::
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\fips202 mkdir $(MLKEM1024_BUILD_DIR)\fips202
$(CC) $(CFLAGS) /D MLKEM_K=4 /c /Fo$(MLKEM1024_BUILD_DIR)\fips202\ $<
{mlkem\fips202}.c{$(MLKEM1024_BUILD_DIR)\mlkem\fips202}.obj::
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\mlkem\fips202 mkdir $(MLKEM1024_BUILD_DIR)\mlkem\fips202
$(CC) $(CFLAGS) /D MLKEM_K=4 /c /Fo$(MLKEM1024_BUILD_DIR)\mlkem\fips202\ $<

{test}.c{$(MLKEM1024_BUILD_DIR)\test}.obj::
@if NOT EXIST $(MLKEM1024_BUILD_DIR)\test mkdir $(MLKEM1024_BUILD_DIR)\test
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mlkem-native is split in a _frontend_ and two _backends_ for arithmetic and FIPS
fixed, written in C and covers all routines that are not critical to performance. The backends are flexible, take care of
performance-sensitive routines, and can be implemented in C or native code (assembly/intrinsics); see
[mlkem/native/arith_native.h](mlkem/native/arith_native.h) for the arithmetic backend and
[fips202/native/fips202_native.h](fips202/native/fips202_native.h) for the FIPS-202 backend. mlkem-native currently
[mlkem/fips202/native/fips202_native.h](mlkem/fips202/native/fips202_native.h) for the FIPS-202 backend. mlkem-native currently
offers three backends for C, AArch64 and x86_64 - if you'd like contribute new backends, please reach out or just open a
PR.

Expand All @@ -98,8 +98,8 @@ as templates, or see [examples/custom_backend](examples/custom_backend) for a mi
### Can I bring my own FIPS-202?

If your library has a FIPS-202 implementation, you can use it instead of the one shipped with mlkem-native: Replace
[`fips202/*`](fips202) by your FIPS-202 implementation, and make sure to include replacements for the headers
[`fips202/fips202.h`](fips202/fips202.h) and [`fips202/fips202x4.h`](fips202/fips202x4.h) and the functionalities specified
[`mlkem/fips202/*`](fips202) by your FIPS-202 implementation, and make sure to include replacements for the headers
[`mlkem/fips202/fips202.h`](mlkem/fips202/fips202.h) and [`mlkem/fips202/fips202x4.h`](mlkem/fips202/fips202x4.h) and the functionalities specified
therein. See [FIPS202.md](FIPS202.md) for details, and
[examples/bring_your_own_fips202](examples/bring_your_own_fips202) for an example using
[tiny_sha3](https://github.com/mjosaarinen/tiny_sha3/).
Expand Down
2 changes: 1 addition & 1 deletion cbmc/KeccakF1600_StateExtractBytes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/keccakf1600.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/keccakf1600.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateExtractBytes
USE_FUNCTION_CONTRACTS=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/KeccakF1600_StatePermute/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/keccakf1600.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/keccakf1600.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StatePermute
USE_FUNCTION_CONTRACTS=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/KeccakF1600_StateXORBytes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/keccakf1600.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/keccakf1600.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateXORBytes
USE_FUNCTION_CONTRACTS=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ ADD_LIBRARY_FLAG := --add-library
INCLUDES ?=
INCLUDES += -I$(PROOFDIR)
INCLUDES += -I$(SRCDIR)/mlkem -I$(SRCDIR)/mlkem/sys -I$(SRCDIR)/mlkem/native
INCLUDES += -I$(SRCDIR)/fips202 -I$(SRCDIR)/fips202/native
INCLUDES += -I$(SRCDIR)/fips202 -I$(SRCDIR)/mlkem/fips202/native

# Preprocessor definitions -D...
DEFINES ?=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/gen_matrix_entry/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/mlkem/indcpa.c $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/indcpa.c $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=gen_matrix_entry
USE_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)shake128_absorb_once $(FIPS202_NAMESPACE)shake128_squeezeblocks $(MLKEM_NAMESPACE)rej_uniform
Expand Down
2 changes: 1 addition & 1 deletion cbmc/gen_matrix_entry_x4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/mlkem/indcpa.c $(SRCDIR)/fips202/fips202x4.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/indcpa.c $(SRCDIR)/mlkem/fips202/fips202x4.c

CHECK_FUNCTION_CONTRACTS= gen_matrix_entry_x4
USE_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)shake128x4_absorb_once $(FIPS202_NAMESPACE)shake128x4_squeezeblocks $(MLKEM_NAMESPACE)rej_uniform
Expand Down
2 changes: 1 addition & 1 deletion cbmc/keccak_absorb_once/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=keccak_absorb_once
USE_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateXORBytes $(FIPS202_NAMESPACE)KeccakF1600_StatePermute
Expand Down
2 changes: 1 addition & 1 deletion cbmc/keccak_squeeze_once/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=keccak_squeeze_once
USE_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateExtractBytes $(FIPS202_NAMESPACE)KeccakF1600_StatePermute
Expand Down
2 changes: 1 addition & 1 deletion cbmc/keccak_squeezeblocks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=keccak_squeezeblocks
USE_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateExtractBytes $(FIPS202_NAMESPACE)KeccakF1600_StatePermute
Expand Down
2 changes: 1 addition & 1 deletion cbmc/keccakf1600_extractbytes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/keccakf1600.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/keccakf1600.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateExtractBytes
USE_FUNCTION_CONTRACTS=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/keccakf1600_permute/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/keccakf1600.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/keccakf1600.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StatePermute
USE_FUNCTION_CONTRACTS=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/keccakf1600_xorbytes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/keccakf1600.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/keccakf1600.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)KeccakF1600_StateXORBytes
USE_FUNCTION_CONTRACTS=
Expand Down
2 changes: 1 addition & 1 deletion cbmc/sha3_256/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)sha3_256
USE_FUNCTION_CONTRACTS=keccak_absorb_once keccak_squeeze_once
Expand Down
2 changes: 1 addition & 1 deletion cbmc/sha3_512/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)sha3_512
USE_FUNCTION_CONTRACTS=keccak_absorb_once keccak_squeeze_once
Expand Down
2 changes: 1 addition & 1 deletion cbmc/shake128_absorb_once/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)shake128_absorb_once
USE_FUNCTION_CONTRACTS=keccak_absorb_once
Expand Down
2 changes: 1 addition & 1 deletion cbmc/shake128_squeezeblocks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)shake128_squeezeblocks
USE_FUNCTION_CONTRACTS=keccak_squeezeblocks
Expand Down
2 changes: 1 addition & 1 deletion cbmc/shake256/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ REMOVE_FUNCTION_BODY +=
UNWINDSET +=

PROOF_SOURCES += $(PROOFDIR)/$(HARNESS_FILE).c
PROJECT_SOURCES += $(SRCDIR)/fips202/fips202.c
PROJECT_SOURCES += $(SRCDIR)/mlkem/fips202/fips202.c

CHECK_FUNCTION_CONTRACTS=$(FIPS202_NAMESPACE)shake256
USE_FUNCTION_CONTRACTS=keccak_absorb_once keccak_squeeze_once
Expand Down
2 changes: 1 addition & 1 deletion examples/bring_your_own_fips202/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ An application using mlkem-native with a custom FIPS-202 implementation needs th
1. Arithmetic part of the mlkem-native source tree: [`mlkem/`](../../mlkem)
2. A secure pseudo random number generator, implementing [`randombytes.h`](../../mlkem/randombytes.h).
2. A custom FIPS-202 with `fips202.h` and `fips202x4.h` headers compatible with
[`fips202/fips202.h`](../../fips202/fips202.h) and [`fips202/fips202x4.h`](../../fips202/fips202x4.h).
[`mlkem/fips202/fips202.h`](../fips202/fips202.h) and [`mlkem/fips202/fips202x4.h`](../fips202/fips202x4.h).
3. The application source code

**WARNING:** The `randombytes()` implementation used here is for TESTING ONLY. You MUST NOT use this implementation
Expand Down
6 changes: 3 additions & 3 deletions examples/custom_backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ An application using mlkem-native with a custom FIPS-202 backend and custom conf
3. FIPS-202 part of the mlkem-native source tree, [`fips/`](../../fips202). If you only want to use your backend,
you can remove all existing backends; that's what this example does.
4. A custom FIPS-202 backend. In this example, the metadata file is
[custom.h](mlkem_native/fips202/native/custom/custom.h), the implementation shim is
[custom_impl.h](mlkem_native/fips202/native/custom/src/custom_impl.h), wrapping the
[sha3.c](mlkem_native/fips202/native/custom/src/sha3.c) and setting `MLKEM_USE_FIPS101_X1_NATIVE` to indicate that we
[custom.h](mlkem_native/mlkem/fips202/native/custom/custom.h), the implementation shim is
[custom_impl.h](mlkem_native/mlkem/fips202/native/custom/src/custom_impl.h), wrapping the
[sha3.c](mlkem_native/mlkem/fips202/native/custom/src/sha3.c) and setting `MLKEM_USE_FIPS101_X1_NATIVE` to indicate that we
replace 1-fold Keccak-F1600.
5. Either modify the existing [config.h](mlkem_native/mlkem/config.h), or register a new config. In this example, we add
a new config [custom_config.h](mlkem_native/custom_config.h) and register it from the command line for
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/custom_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
* _FIPS202_NAMESPACE
*
* Description: The macros to use to namespace global symbols
* from fips202/.
* from mlkem/fips202/.
*****************************************************************************/
#define FIPS202_NAMESPACE(sym) CONC(CUSTOM_TINY_SHA3_, sym)
#define _FIPS202_NAMESPACE(sym) CONC(_CUSTOM_TINY_SHA3_, sym)
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/LICENSE
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/fips202.c
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/fips202.h
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/fips202x4.c
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/fips202x4.h
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/keccakf1600.c
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/keccakf1600.h
2 changes: 1 addition & 1 deletion examples/custom_backend/mlkem_native/fips202/native/api.h
4 changes: 2 additions & 2 deletions examples/mlkem_native_as_code_package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ INC=
INC+=-Imlkem_native/mlkem
INC+=-Imlkem_native/mlkem
INC+=-Imlkem_native/mlkem/native
INC+=-Imlkem_native/fips202
INC+=-Imlkem_native/fips202/native
INC+=-Imlkem_native/mlkem/fips202
INC+=-Imlkem_native/mlkem/fips202/native

# Part B:
#
Expand Down
2 changes: 1 addition & 1 deletion examples/mlkem_native_as_code_package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This directory contains a minimal example for how to use mlkem-native as a code

An application using mlkem-native as-is needs to include the following components:

1. mlkem-native source tree, including [`mlkem/`](../../mlkem) and [`fips202/`](../../fips202).
1. mlkem-native source tree, including [`mlkem/`](../../mlkem) and [`mlkem/fips202/`](../../fips202).
2. A secure pseudo random number generator, implementing [`randombytes.h`](../../mlkem/randombytes.h).
3. The application source code

Expand Down
6 changes: 3 additions & 3 deletions mk/crypto.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# SPDX-License-Identifier: Apache-2.0
CPPFLAGS += -Ifips202 -Ifips202/native
FIPS202_SRCS = $(wildcard fips202/*.c)
CPPFLAGS += -Imlkem/fips202 -Imlkem/fips202/native
FIPS202_SRCS = $(wildcard mlkem/fips202/*.c)
ifeq ($(OPT),1)
FIPS202_SRCS += $(wildcard fips202/native/aarch64/src/*.S) $(wildcard fips202/native/x86_64/src/*.c)
FIPS202_SRCS += $(wildcard mlkem/fips202/native/aarch64/src/*.S) $(wildcard mlkem/fips202/native/x86_64/src/*.c)
endif

$(BUILD_DIR)/libmlkem.a: $(call OBJS, $(FIPS202_SRCS))
Expand Down
4 changes: 2 additions & 2 deletions mlkem/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
* _FIPS202_NAMESPACE
*
* Description: The macros to use to namespace global symbols
* from fips202/.
* from mlkem/fips202/.
*****************************************************************************/
#define FIPS202_NAMESPACE(sym) FIPS202_DEFAULT_NAMESPACE(sym)
#define _FIPS202_NAMESPACE(sym) _FIPS202_DEFAULT_NAMESPACE(sym)
Expand Down Expand Up @@ -96,7 +96,7 @@
*
*****************************************************************************/
#if defined(MLKEM_USE_NATIVE) && !defined(MLKEM_NATIVE_FIPS202_BACKEND)
#define MLKEM_NATIVE_FIPS202_BACKEND "../fips202/native/default.h"
#define MLKEM_NATIVE_FIPS202_BACKEND "fips202/native/default.h"
#endif /* MLKEM_NATIVE_FIPS202_BACKEND */

#endif /* MLkEM_NATIVE_CONFIG_H */
2 changes: 1 addition & 1 deletion scripts/ci/check-namespace
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def run():
check_folder("test/build/mlkem512/mlkem", list_mlkem_namespaces(512))
check_folder("test/build/mlkem768/mlkem", list_mlkem_namespaces(768))
check_folder("test/build/mlkem1024/mlkem", list_mlkem_namespaces(1024))
check_folder("test/build/fips202", list_fips202_namespaces())
check_folder("test/build/mlkem/fips202", list_fips202_namespaces())


if __name__ == "__main__":
Expand Down

0 comments on commit 02c78ce

Please sign in to comment.