2023-06-01 00:00:00 +00:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
|
|
#ifndef rng_h
|
|
|
|
|
#define rng_h
|
|
|
|
|
|
2025-02-06 00:00:00 +00:00
|
|
|
#include <sqisign_namespace.h>
|
|
|
|
|
|
2023-06-01 00:00:00 +00:00
|
|
|
/**
|
|
|
|
|
* Randombytes initialization.
|
|
|
|
|
* Initialization may be needed for some random number generators (e.g. CTR-DRBG).
|
|
|
|
|
*
|
|
|
|
|
* @param[in] entropy_input 48 bytes entropy input
|
|
|
|
|
* @param[in] personalization_string Personalization string
|
|
|
|
|
* @param[in] security_strength Security string
|
|
|
|
|
*/
|
2025-02-06 00:00:00 +00:00
|
|
|
SQISIGN_API
|
2023-06-01 00:00:00 +00:00
|
|
|
void randombytes_init(unsigned char *entropy_input,
|
|
|
|
|
unsigned char *personalization_string,
|
|
|
|
|
int security_strength);
|
|
|
|
|
|
2025-02-06 00:00:00 +00:00
|
|
|
/**
|
|
|
|
|
* Random byte generation using /dev/urandom.
|
|
|
|
|
* The caller is responsible to allocate sufficient memory to hold x.
|
|
|
|
|
*
|
|
|
|
|
* @param[out] x Memory to hold the random bytes.
|
|
|
|
|
* @param[in] xlen Number of random bytes to be generated
|
|
|
|
|
* @return int 0 on success, -1 otherwise
|
|
|
|
|
*/
|
|
|
|
|
SQISIGN_API
|
|
|
|
|
int randombytes_select(unsigned char *x, unsigned long long xlen);
|
|
|
|
|
|
2023-06-01 00:00:00 +00:00
|
|
|
/**
|
|
|
|
|
* Random byte generation.
|
|
|
|
|
* The caller is responsible to allocate sufficient memory to hold x.
|
|
|
|
|
*
|
|
|
|
|
* @param[out] x Memory to hold the random bytes.
|
|
|
|
|
* @param[in] xlen Number of random bytes to be generated
|
|
|
|
|
* @return int 0 on success, -1 otherwise
|
|
|
|
|
*/
|
2025-02-06 00:00:00 +00:00
|
|
|
SQISIGN_API
|
2023-06-01 00:00:00 +00:00
|
|
|
int randombytes(unsigned char *x, unsigned long long xlen);
|
|
|
|
|
|
|
|
|
|
#endif /* rng_h */
|