| 1 |
/* |
| 2 |
* Copyright (c) The mldsa-native project authors |
| 3 |
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT |
| 4 |
*/ |
| 5 |
#ifndef MLD_RANDOMBYTES_H |
| 6 |
#define MLD_RANDOMBYTES_H |
| 7 |
|
| 8 |
#include <stddef.h> |
| 9 |
#include <stdint.h> |
| 10 |
|
| 11 |
#include "cbmc.h" |
| 12 |
#include "common.h" |
| 13 |
|
| 14 |
#if !defined(MLD_CONFIG_NO_RANDOMIZED_API) |
| 15 |
#if !defined(MLD_CONFIG_CUSTOM_RANDOMBYTES) |
| 16 |
MLD_MUST_CHECK_RETURN_VALUE |
| 17 |
int randombytes(uint8_t *out, size_t outlen); |
| 18 |
static MLD_INLINE int mld_randombytes(uint8_t *out, size_t outlen) |
| 19 |
__contract__( |
| 20 |
requires(memory_no_alias(out, outlen)) |
| 21 |
assigns(memory_slice(out, outlen)) |
| 22 |
) { return randombytes(out, outlen); } |
| 23 |
#endif /* !MLD_CONFIG_CUSTOM_RANDOMBYTES */ |
| 24 |
#endif /* !MLD_CONFIG_NO_RANDOMIZED_API */ |
| 25 |
#endif /* !MLD_RANDOMBYTES_H */ |