Skip to content

Commit 21c81f1

Browse files
committed
autogen: run to update randombytes() declaration
Run the autogen script to reflect the changes made to the randombytes() API. Signed-off-by: Andreas Hatziiliou <[email protected]>
1 parent 535e75e commit 21c81f1

File tree

17 files changed

+67
-40
lines changed

17 files changed

+67
-40
lines changed

examples/basic_deterministic/mldsa_native/custom_no_randomized_config.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@
343343
* consumer.
344344
*
345345
* If this option is not set, mldsa-native expects a function
346-
* void randombytes(uint8_t *out, size_t outlen).
346+
* int randombytes(uint8_t *out, size_t outlen).
347+
* This function should return 0 on success, non-zero on failure.
347348
*
348349
* Set this option and define `mld_randombytes` if you want to
349350
* use a custom method to sample randombytes with a different name
@@ -354,9 +355,10 @@
354355
#if !defined(__ASSEMBLER__)
355356
#include <stdint.h>
356357
#include "sys.h"
357-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
358+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
358359
{
359360
... your implementation ...
361+
return 0; // 0 on success, non-zero on failure
360362
}
361363
#endif
362364
*/

examples/monolithic_build/config_44.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@
341341
* consumer.
342342
*
343343
* If this option is not set, mldsa-native expects a function
344-
* void randombytes(uint8_t *out, size_t outlen).
344+
* int randombytes(uint8_t *out, size_t outlen).
345+
* This function should return 0 on success, non-zero on failure.
345346
*
346347
* Set this option and define `mld_randombytes` if you want to
347348
* use a custom method to sample randombytes with a different name
@@ -352,9 +353,10 @@
352353
#if !defined(__ASSEMBLER__)
353354
#include <stdint.h>
354355
#include "sys.h"
355-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
356+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
356357
{
357358
... your implementation ...
359+
return 0; // 0 on success, non-zero on failure
358360
}
359361
#endif
360362
*/

examples/monolithic_build/config_65.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@
341341
* consumer.
342342
*
343343
* If this option is not set, mldsa-native expects a function
344-
* void randombytes(uint8_t *out, size_t outlen).
344+
* int randombytes(uint8_t *out, size_t outlen).
345+
* This function should return 0 on success, non-zero on failure.
345346
*
346347
* Set this option and define `mld_randombytes` if you want to
347348
* use a custom method to sample randombytes with a different name
@@ -352,9 +353,10 @@
352353
#if !defined(__ASSEMBLER__)
353354
#include <stdint.h>
354355
#include "sys.h"
355-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
356+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
356357
{
357358
... your implementation ...
359+
return 0; // 0 on success, non-zero on failure
358360
}
359361
#endif
360362
*/

examples/monolithic_build/config_87.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,8 @@
341341
* consumer.
342342
*
343343
* If this option is not set, mldsa-native expects a function
344-
* void randombytes(uint8_t *out, size_t outlen).
344+
* int randombytes(uint8_t *out, size_t outlen).
345+
* This function should return 0 on success, non-zero on failure.
345346
*
346347
* Set this option and define `mld_randombytes` if you want to
347348
* use a custom method to sample randombytes with a different name
@@ -352,9 +353,10 @@
352353
#if !defined(__ASSEMBLER__)
353354
#include <stdint.h>
354355
#include "sys.h"
355-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
356+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
356357
{
357358
... your implementation ...
359+
return 0; // 0 on success, non-zero on failure
358360
}
359361
#endif
360362
*/

examples/monolithic_build_multilevel/multilevel_config.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@
342342
* consumer.
343343
*
344344
* If this option is not set, mldsa-native expects a function
345-
* void randombytes(uint8_t *out, size_t outlen).
345+
* int randombytes(uint8_t *out, size_t outlen).
346+
* This function should return 0 on success, non-zero on failure.
346347
*
347348
* Set this option and define `mld_randombytes` if you want to
348349
* use a custom method to sample randombytes with a different name
@@ -353,9 +354,10 @@
353354
#if !defined(__ASSEMBLER__)
354355
#include <stdint.h>
355356
#include "sys.h"
356-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
357+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
357358
{
358359
... your implementation ...
360+
return 0; // 0 on success, non-zero on failure
359361
}
360362
#endif
361363
*/

mldsa/src/config.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@
327327
* consumer.
328328
*
329329
* If this option is not set, mldsa-native expects a function
330-
* void randombytes(uint8_t *out, size_t outlen).
330+
* int randombytes(uint8_t *out, size_t outlen).
331+
* This function should return 0 on success, non-zero on failure.
331332
*
332333
* Set this option and define `mld_randombytes` if you want to
333334
* use a custom method to sample randombytes with a different name
@@ -338,9 +339,10 @@
338339
#if !defined(__ASSEMBLER__)
339340
#include <stdint.h>
340341
#include "sys.h"
341-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
342+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
342343
{
343344
... your implementation ...
345+
return 0; // 0 on success, non-zero on failure
344346
}
345347
#endif
346348
*/

mldsa/src/debug.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ void mld_debug_check_bounds(const char *file, int line, const int32_t *ptr,
9191

9292
/* Because of https://github.com/diffblue/cbmc/issues/8570, we can't
9393
* just use a single flattened array_bound(...) here. */
94-
#define mld_assert_bound_2d(ptr, M, N, value_lb, value_ub) \
95-
cassert(forall(kN, 0, (M), \
96-
array_bound(&((int32_t(*)[(N)])(ptr))[kN][0], 0, (N), \
94+
#define mld_assert_bound_2d(ptr, M, N, value_lb, value_ub) \
95+
cassert(forall(kN, 0, (M), \
96+
array_bound(&((int32_t (*)[(N)])(ptr))[kN][0], 0, (N), \
9797
(value_lb), (value_ub))))
9898

99-
#define mld_assert_abs_bound_2d(ptr, M, N, value_abs_bd) \
100-
cassert(forall(kN, 0, (M), \
101-
array_abs_bound(&((int32_t(*)[(N)])(ptr))[kN][0], 0, (N), \
99+
#define mld_assert_abs_bound_2d(ptr, M, N, value_abs_bd) \
100+
cassert(forall(kN, 0, (M), \
101+
array_abs_bound(&((int32_t (*)[(N)])(ptr))[kN][0], 0, (N), \
102102
(value_abs_bd))))
103103

104104
#else /* !MLDSA_DEBUG && CBMC */

mldsa/src/polyvec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -334,26 +334,26 @@ void mld_polyvecl_pointwise_acc_montgomery(mld_poly *w, const mld_polyvecl *u,
334334
mld_assert_bound_2d(u->vec, MLDSA_L, MLDSA_N, 0, MLDSA_Q);
335335
mld_assert_abs_bound_2d(v->vec, MLDSA_L, MLDSA_N, MLD_NTT_BOUND);
336336
mld_polyvecl_pointwise_acc_montgomery_l4_native(
337-
w->coeffs, (const int32_t(*)[MLDSA_N])u->vec,
338-
(const int32_t(*)[MLDSA_N])v->vec);
337+
w->coeffs, (const int32_t (*)[MLDSA_N])u->vec,
338+
(const int32_t (*)[MLDSA_N])v->vec);
339339
mld_assert_abs_bound(w->coeffs, MLDSA_N, MLDSA_Q);
340340
#elif defined(MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L5) && \
341341
MLD_CONFIG_PARAMETER_SET == 65
342342
/* TODO: proof */
343343
mld_assert_bound_2d(u->vec, MLDSA_L, MLDSA_N, 0, MLDSA_Q);
344344
mld_assert_abs_bound_2d(v->vec, MLDSA_L, MLDSA_N, MLD_NTT_BOUND);
345345
mld_polyvecl_pointwise_acc_montgomery_l5_native(
346-
w->coeffs, (const int32_t(*)[MLDSA_N])u->vec,
347-
(const int32_t(*)[MLDSA_N])v->vec);
346+
w->coeffs, (const int32_t (*)[MLDSA_N])u->vec,
347+
(const int32_t (*)[MLDSA_N])v->vec);
348348
mld_assert_abs_bound(w->coeffs, MLDSA_N, MLDSA_Q);
349349
#elif defined(MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L7) && \
350350
MLD_CONFIG_PARAMETER_SET == 87
351351
/* TODO: proof */
352352
mld_assert_bound_2d(u->vec, MLDSA_L, MLDSA_N, 0, MLDSA_Q);
353353
mld_assert_abs_bound_2d(v->vec, MLDSA_L, MLDSA_N, MLD_NTT_BOUND);
354354
mld_polyvecl_pointwise_acc_montgomery_l7_native(
355-
w->coeffs, (const int32_t(*)[MLDSA_N])u->vec,
356-
(const int32_t(*)[MLDSA_N])v->vec);
355+
w->coeffs, (const int32_t (*)[MLDSA_N])u->vec,
356+
(const int32_t (*)[MLDSA_N])v->vec);
357357
mld_assert_abs_bound(w->coeffs, MLDSA_N, MLDSA_Q);
358358
#else /* !(MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L4 && \
359359
MLD_CONFIG_PARAMETER_SET == 44) && \

proofs/cbmc/poly_uniform_4x/poly_uniform_4x_harness.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void harness(void)
99
mld_poly *r1;
1010
mld_poly *r2;
1111
mld_poly *r3;
12-
uint8_t(*seed)[MLD_ALIGN_UP(MLDSA_SEEDBYTES + 2)];
12+
uint8_t (*seed)[MLD_ALIGN_UP(MLDSA_SEEDBYTES + 2)];
1313

1414
mld_poly_uniform_4x(r0, r1, r2, r3, seed);
1515
}

test/break_pct_config.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@
343343
* consumer.
344344
*
345345
* If this option is not set, mldsa-native expects a function
346-
* void randombytes(uint8_t *out, size_t outlen).
346+
* int randombytes(uint8_t *out, size_t outlen).
347+
* This function should return 0 on success, non-zero on failure.
347348
*
348349
* Set this option and define `mld_randombytes` if you want to
349350
* use a custom method to sample randombytes with a different name
@@ -354,9 +355,10 @@
354355
#if !defined(__ASSEMBLER__)
355356
#include <stdint.h>
356357
#include "sys.h"
357-
static MLD_INLINE void mld_randombytes(uint8_t *ptr, size_t len)
358+
static MLD_INLINE int mld_randombytes(uint8_t *ptr, size_t len)
358359
{
359360
... your implementation ...
361+
return 0; // 0 on success, non-zero on failure
360362
}
361363
#endif
362364
*/

0 commit comments

Comments
 (0)