Skip to content

Commit 75ab215

Browse files
willieyzmkannwischer
authored andcommitted
Consolidate MLD_CONFIG_CUSTOM_ZEROIZE with mlkem-native
The MLD_CONFIG_CUSTOM_ZEROIZE macro in mldsa/src/ct.h behaves slightly differently from MLK_CONFIG_CUSTOM_ZEROIZE in mlkem/src/verify.h. This commit aligns their behavior. Signed-off-by: willieyz <willie.zhao@chelpis.com>
1 parent b87337f commit 75ab215

File tree

31 files changed

+130
-143
lines changed

31 files changed

+130
-143
lines changed

examples/basic_deterministic/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@
364364
* zeroizes intermediate stack buffers before returning from
365365
* function calls.
366366
*
367-
* Set this option and define `mld_zeroize_native` if you want to
367+
* Set this option and define `mld_zeroize` if you want to
368368
* use a custom method to zeroize intermediate stack buffers.
369369
* The default implementation uses SecureZeroMemory on Windows
370370
* and a memset + compiler barrier otherwise. If neither of those
371371
* is available on the target platform, compilation will fail,
372372
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
373-
* a custom implementation of `mld_zeroize_native()`.
373+
* a custom implementation of `mld_zeroize()`.
374374
*
375375
* WARNING:
376376
* The explicit stack zeroization conducted by mldsa-native
@@ -383,15 +383,15 @@
383383
*
384384
* If you need bullet-proof zeroization of the stack, you need to
385385
* consider additional measures instead of what this feature
386-
* provides. In this case, you can set mld_zeroize_native to a
386+
* provides. In this case, you can set mld_zeroize to a
387387
* no-op.
388388
*
389389
*****************************************************************************/
390390
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
391391
#if !defined(__ASSEMBLER__)
392392
#include <stdint.h>
393393
#include "src/src.h"
394-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
394+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
395395
{
396396
... your implementation ...
397397
}

examples/basic_lowram/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@
363363
* zeroizes intermediate stack buffers before returning from
364364
* function calls.
365365
*
366-
* Set this option and define `mld_zeroize_native` if you want to
366+
* Set this option and define `mld_zeroize` if you want to
367367
* use a custom method to zeroize intermediate stack buffers.
368368
* The default implementation uses SecureZeroMemory on Windows
369369
* and a memset + compiler barrier otherwise. If neither of those
370370
* is available on the target platform, compilation will fail,
371371
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
372-
* a custom implementation of `mld_zeroize_native()`.
372+
* a custom implementation of `mld_zeroize()`.
373373
*
374374
* WARNING:
375375
* The explicit stack zeroization conducted by mldsa-native
@@ -382,15 +382,15 @@
382382
*
383383
* If you need bullet-proof zeroization of the stack, you need to
384384
* consider additional measures instead of what this feature
385-
* provides. In this case, you can set mld_zeroize_native to a
385+
* provides. In this case, you can set mld_zeroize to a
386386
* no-op.
387387
*
388388
*****************************************************************************/
389389
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
390390
#if !defined(__ASSEMBLER__)
391391
#include <stdint.h>
392392
#include "src/src.h"
393-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
393+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
394394
{
395395
... your implementation ...
396396
}

examples/bring_your_own_fips202/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@
364364
* zeroizes intermediate stack buffers before returning from
365365
* function calls.
366366
*
367-
* Set this option and define `mld_zeroize_native` if you want to
367+
* Set this option and define `mld_zeroize` if you want to
368368
* use a custom method to zeroize intermediate stack buffers.
369369
* The default implementation uses SecureZeroMemory on Windows
370370
* and a memset + compiler barrier otherwise. If neither of those
371371
* is available on the target platform, compilation will fail,
372372
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
373-
* a custom implementation of `mld_zeroize_native()`.
373+
* a custom implementation of `mld_zeroize()`.
374374
*
375375
* WARNING:
376376
* The explicit stack zeroization conducted by mldsa-native
@@ -383,15 +383,15 @@
383383
*
384384
* If you need bullet-proof zeroization of the stack, you need to
385385
* consider additional measures instead of what this feature
386-
* provides. In this case, you can set mld_zeroize_native to a
386+
* provides. In this case, you can set mld_zeroize to a
387387
* no-op.
388388
*
389389
*****************************************************************************/
390390
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
391391
#if !defined(__ASSEMBLER__)
392392
#include <stdint.h>
393393
#include "src/src.h"
394-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
394+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
395395
{
396396
... your implementation ...
397397
}

examples/bring_your_own_fips202_static/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,13 +365,13 @@
365365
* zeroizes intermediate stack buffers before returning from
366366
* function calls.
367367
*
368-
* Set this option and define `mld_zeroize_native` if you want to
368+
* Set this option and define `mld_zeroize` if you want to
369369
* use a custom method to zeroize intermediate stack buffers.
370370
* The default implementation uses SecureZeroMemory on Windows
371371
* and a memset + compiler barrier otherwise. If neither of those
372372
* is available on the target platform, compilation will fail,
373373
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
374-
* a custom implementation of `mld_zeroize_native()`.
374+
* a custom implementation of `mld_zeroize()`.
375375
*
376376
* WARNING:
377377
* The explicit stack zeroization conducted by mldsa-native
@@ -384,15 +384,15 @@
384384
*
385385
* If you need bullet-proof zeroization of the stack, you need to
386386
* consider additional measures instead of what this feature
387-
* provides. In this case, you can set mld_zeroize_native to a
387+
* provides. In this case, you can set mld_zeroize to a
388388
* no-op.
389389
*
390390
*****************************************************************************/
391391
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
392392
#if !defined(__ASSEMBLER__)
393393
#include <stdint.h>
394394
#include "src/src.h"
395-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
395+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
396396
{
397397
... your implementation ...
398398
}

examples/custom_backend/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,13 +360,13 @@
360360
* zeroizes intermediate stack buffers before returning from
361361
* function calls.
362362
*
363-
* Set this option and define `mld_zeroize_native` if you want to
363+
* Set this option and define `mld_zeroize` if you want to
364364
* use a custom method to zeroize intermediate stack buffers.
365365
* The default implementation uses SecureZeroMemory on Windows
366366
* and a memset + compiler barrier otherwise. If neither of those
367367
* is available on the target platform, compilation will fail,
368368
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
369-
* a custom implementation of `mld_zeroize_native()`.
369+
* a custom implementation of `mld_zeroize()`.
370370
*
371371
* WARNING:
372372
* The explicit stack zeroization conducted by mldsa-native
@@ -379,15 +379,15 @@
379379
*
380380
* If you need bullet-proof zeroization of the stack, you need to
381381
* consider additional measures instead of what this feature
382-
* provides. In this case, you can set mld_zeroize_native to a
382+
* provides. In this case, you can set mld_zeroize to a
383383
* no-op.
384384
*
385385
*****************************************************************************/
386386
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
387387
#if !defined(__ASSEMBLER__)
388388
#include <stdint.h>
389389
#include "src/src.h"
390-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
390+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
391391
{
392392
... your implementation ...
393393
}

examples/monolithic_build/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@
363363
* zeroizes intermediate stack buffers before returning from
364364
* function calls.
365365
*
366-
* Set this option and define `mld_zeroize_native` if you want to
366+
* Set this option and define `mld_zeroize` if you want to
367367
* use a custom method to zeroize intermediate stack buffers.
368368
* The default implementation uses SecureZeroMemory on Windows
369369
* and a memset + compiler barrier otherwise. If neither of those
370370
* is available on the target platform, compilation will fail,
371371
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
372-
* a custom implementation of `mld_zeroize_native()`.
372+
* a custom implementation of `mld_zeroize()`.
373373
*
374374
* WARNING:
375375
* The explicit stack zeroization conducted by mldsa-native
@@ -382,15 +382,15 @@
382382
*
383383
* If you need bullet-proof zeroization of the stack, you need to
384384
* consider additional measures instead of what this feature
385-
* provides. In this case, you can set mld_zeroize_native to a
385+
* provides. In this case, you can set mld_zeroize to a
386386
* no-op.
387387
*
388388
*****************************************************************************/
389389
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
390390
#if !defined(__ASSEMBLER__)
391391
#include <stdint.h>
392392
#include "src/src.h"
393-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
393+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
394394
{
395395
... your implementation ...
396396
}

examples/monolithic_build_multilevel/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@
364364
* zeroizes intermediate stack buffers before returning from
365365
* function calls.
366366
*
367-
* Set this option and define `mld_zeroize_native` if you want to
367+
* Set this option and define `mld_zeroize` if you want to
368368
* use a custom method to zeroize intermediate stack buffers.
369369
* The default implementation uses SecureZeroMemory on Windows
370370
* and a memset + compiler barrier otherwise. If neither of those
371371
* is available on the target platform, compilation will fail,
372372
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
373-
* a custom implementation of `mld_zeroize_native()`.
373+
* a custom implementation of `mld_zeroize()`.
374374
*
375375
* WARNING:
376376
* The explicit stack zeroization conducted by mldsa-native
@@ -383,15 +383,15 @@
383383
*
384384
* If you need bullet-proof zeroization of the stack, you need to
385385
* consider additional measures instead of what this feature
386-
* provides. In this case, you can set mld_zeroize_native to a
386+
* provides. In this case, you can set mld_zeroize to a
387387
* no-op.
388388
*
389389
*****************************************************************************/
390390
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
391391
#if !defined(__ASSEMBLER__)
392392
#include <stdint.h>
393393
#include "src/src.h"
394-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
394+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
395395
{
396396
... your implementation ...
397397
}

examples/monolithic_build_multilevel_native/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,13 @@
364364
* zeroizes intermediate stack buffers before returning from
365365
* function calls.
366366
*
367-
* Set this option and define `mld_zeroize_native` if you want to
367+
* Set this option and define `mld_zeroize` if you want to
368368
* use a custom method to zeroize intermediate stack buffers.
369369
* The default implementation uses SecureZeroMemory on Windows
370370
* and a memset + compiler barrier otherwise. If neither of those
371371
* is available on the target platform, compilation will fail,
372372
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
373-
* a custom implementation of `mld_zeroize_native()`.
373+
* a custom implementation of `mld_zeroize()`.
374374
*
375375
* WARNING:
376376
* The explicit stack zeroization conducted by mldsa-native
@@ -383,15 +383,15 @@
383383
*
384384
* If you need bullet-proof zeroization of the stack, you need to
385385
* consider additional measures instead of what this feature
386-
* provides. In this case, you can set mld_zeroize_native to a
386+
* provides. In this case, you can set mld_zeroize to a
387387
* no-op.
388388
*
389389
*****************************************************************************/
390390
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
391391
#if !defined(__ASSEMBLER__)
392392
#include <stdint.h>
393393
#include "src/src.h"
394-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
394+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
395395
{
396396
... your implementation ...
397397
}

examples/monolithic_build_native/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@
363363
* zeroizes intermediate stack buffers before returning from
364364
* function calls.
365365
*
366-
* Set this option and define `mld_zeroize_native` if you want to
366+
* Set this option and define `mld_zeroize` if you want to
367367
* use a custom method to zeroize intermediate stack buffers.
368368
* The default implementation uses SecureZeroMemory on Windows
369369
* and a memset + compiler barrier otherwise. If neither of those
370370
* is available on the target platform, compilation will fail,
371371
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
372-
* a custom implementation of `mld_zeroize_native()`.
372+
* a custom implementation of `mld_zeroize()`.
373373
*
374374
* WARNING:
375375
* The explicit stack zeroization conducted by mldsa-native
@@ -382,15 +382,15 @@
382382
*
383383
* If you need bullet-proof zeroization of the stack, you need to
384384
* consider additional measures instead of what this feature
385-
* provides. In this case, you can set mld_zeroize_native to a
385+
* provides. In this case, you can set mld_zeroize to a
386386
* no-op.
387387
*
388388
*****************************************************************************/
389389
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
390390
#if !defined(__ASSEMBLER__)
391391
#include <stdint.h>
392392
#include "src/src.h"
393-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
393+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
394394
{
395395
... your implementation ...
396396
}

examples/multilevel_build/mldsa_native/mldsa_native_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,13 @@
363363
* zeroizes intermediate stack buffers before returning from
364364
* function calls.
365365
*
366-
* Set this option and define `mld_zeroize_native` if you want to
366+
* Set this option and define `mld_zeroize` if you want to
367367
* use a custom method to zeroize intermediate stack buffers.
368368
* The default implementation uses SecureZeroMemory on Windows
369369
* and a memset + compiler barrier otherwise. If neither of those
370370
* is available on the target platform, compilation will fail,
371371
* and you will need to use MLD_CONFIG_CUSTOM_ZEROIZE to provide
372-
* a custom implementation of `mld_zeroize_native()`.
372+
* a custom implementation of `mld_zeroize()`.
373373
*
374374
* WARNING:
375375
* The explicit stack zeroization conducted by mldsa-native
@@ -382,15 +382,15 @@
382382
*
383383
* If you need bullet-proof zeroization of the stack, you need to
384384
* consider additional measures instead of what this feature
385-
* provides. In this case, you can set mld_zeroize_native to a
385+
* provides. In this case, you can set mld_zeroize to a
386386
* no-op.
387387
*
388388
*****************************************************************************/
389389
/* #define MLD_CONFIG_CUSTOM_ZEROIZE
390390
#if !defined(__ASSEMBLER__)
391391
#include <stdint.h>
392392
#include "src/src.h"
393-
static MLD_INLINE void mld_zeroize_native(void *ptr, size_t len)
393+
static MLD_INLINE void mld_zeroize(void *ptr, size_t len)
394394
{
395395
... your implementation ...
396396
}

0 commit comments

Comments
 (0)