Skip to content
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
5 changes: 1 addition & 4 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ The configuration file [mlkem_native_config.h](mlkem_native/mlkem_native_config.
- `MLK_CONFIG_PARAMETER_SET`: Security level (512, 768, or 1024). Default is 768.
- `MLK_CONFIG_NAMESPACE_PREFIX`: Symbol prefix for the API. Set to `mlkem` in this example.

To change the security level, modify `MLK_CONFIG_PARAMETER_SET` in the config file or pass it via CFLAGS:
```bash
make build CFLAGS="-DMLK_CONFIG_PARAMETER_SET=512"
```
To change the security level, modify `MLK_CONFIG_PARAMETER_SET` in the config file or pass it via CFLAGS.

## Usage

Expand Down
1 change: 0 additions & 1 deletion examples/basic/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* This requires specifying the parameter set and namespace prefix
* used for the build.
*/
#define MLK_CONFIG_NAMESPACE_PREFIX mlkem
#include "mlkem_native/mlkem_native.h"

#include "test_only_rng/notrandombytes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -76,7 +76,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/bring_your_own_fips202/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
1 change: 0 additions & 1 deletion examples/bring_your_own_fips202/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* This requires specifying the parameter set and namespace prefix
* used for the build.
*/
#define MLK_CONFIG_NAMESPACE_PREFIX mlkem
#include <mlkem_native.h>

#include "test_only_rng/notrandombytes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -76,7 +76,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/bring_your_own_fips202_static/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
1 change: 0 additions & 1 deletion examples/bring_your_own_fips202_static/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* This requires specifying the parameter set and namespace prefix
* used for the build.
*/
#define MLK_CONFIG_NAMESPACE_PREFIX mlkem
#include <mlkem_native.h>

#include "test_only_rng/notrandombytes.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -77,7 +77,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/custom_backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
2 changes: 1 addition & 1 deletion examples/custom_backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The configuration file [mlkem_native_config.h](mlkem_native/mlkem_native_config.

A custom backend consists of:
1. A metadata header (e.g., [custom.h](mlkem_native/src/fips202/native/custom/custom.h)) that:
- Sets `MLK_USE_FIPS202_X1_NATIVE` (and/or `X2`/`X4`) to indicate which functions are replaced
- Sets `MLK_USE_FIPS202_X1_NATIVE` (and/or `X4`) to indicate which functions are replaced
- Includes the implementation header
2. An implementation providing `mlk_keccakf1600_native()` (and/or batched variants)

Expand Down
4 changes: 2 additions & 2 deletions examples/custom_backend/mlkem_native/mlkem_native_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -78,7 +78,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/monolithic_build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -75,7 +75,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/monolithic_build_multilevel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -76,7 +76,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/monolithic_build_multilevel_native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -80,7 +80,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
3 changes: 3 additions & 0 deletions examples/monolithic_build_native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

build
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -75,7 +75,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
1 change: 0 additions & 1 deletion examples/multilevel_build/mlkem_native/mlkem_native.c

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -75,7 +75,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -77,7 +77,7 @@
*
*****************************************************************************/
/* No need to set this -- we _are_ already in a custom config */
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
4 changes: 2 additions & 2 deletions mlkem/mlkem_native_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -58,7 +58,7 @@
* on the command line.
*
*****************************************************************************/
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
2 changes: 1 addition & 1 deletion mlkem/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
/* Functions are prefixed by MLK_CONFIG_NAMESPACE_PREFIX.
*
* If multiple parameter sets are used, functions depending on the parameter
* set are additionally prefixed with 512/768/1024. See config.h.
* set are additionally prefixed with 512/768/1024. See mlkem_native_config.h.
*
* Example: If MLK_CONFIG_NAMESPACE_PREFIX is mlkem, then
* MLK_NAMESPACE_K(enc) becomes mlkem512_enc/mlkem768_enc/mlkem1024_enc.
Expand Down
4 changes: 2 additions & 2 deletions mlkem/src/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ __contract__(
* If a feature is enabled at compile-time, we assume it is supported by
* the host that the resulting library/binary will be built on.
* If this assumption is not true, you MUST overwrite this function.
* See the documentation of MLK_CONFIG_CUSTOM_CAPABILITY_FUNC in config.h
* for more information. */
* See the documentation of MLK_CONFIG_CUSTOM_CAPABILITY_FUNC in
* mlkem_native_config.h for more information. */
(void)cap;
return 1;
}
Expand Down
4 changes: 2 additions & 2 deletions test/break_pct_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -74,7 +74,7 @@
* on the command line.
*
*****************************************************************************/
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
2 changes: 1 addition & 1 deletion test/configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT

# Metadata for test configuration files
# Each entry describes how a test config differs from mlkem/src/config.h
# Each entry describes how a test config differs from mlkem/mlkem_native_config.h

configs:
- path: test/no_asm_config.h
Expand Down
4 changes: 2 additions & 2 deletions test/custom_memcpy_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -73,7 +73,7 @@
* on the command line.
*
*****************************************************************************/
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
4 changes: 2 additions & 2 deletions test/custom_memset_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -73,7 +73,7 @@
* on the command line.
*
*****************************************************************************/
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
4 changes: 2 additions & 2 deletions test/custom_native_capability_config_0.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -74,7 +74,7 @@
* on the command line.
*
*****************************************************************************/
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
4 changes: 2 additions & 2 deletions test/custom_native_capability_config_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* Name: MLK_CONFIG_FILE
*
* Description: If defined, this is a header that will be included instead
* of the default configuration file mlkem/src/config.h.
* of the default configuration file mlkem/mlkem_native_config.h.
*
* When you need to build mlkem-native in multiple configurations,
* using varying MLK_CONFIG_FILE can be more convenient
Expand All @@ -74,7 +74,7 @@
* on the command line.
*
*****************************************************************************/
/* #define MLK_CONFIG_FILE "config.h" */
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */

/******************************************************************************
* Name: MLK_CONFIG_NAMESPACE_PREFIX
Expand Down
Loading