21 lines
568 B
C
21 lines
568 B
C
// rng.h
|
|
// Library initialization and randomness.
|
|
//
|
|
// The one documented sans-IO exception: randomness comes from the OS through libsodium.
|
|
|
|
#ifndef BRAVAIS_RNG_H
|
|
#define BRAVAIS_RNG_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#include "bravais.h"
|
|
|
|
// Initialize the crypto backends. Idempotent and thread-safe; call before any other crypto/ function.
|
|
bravais_result_t bravais_crypto_init(void);
|
|
|
|
// Fill buf with len cryptographically secure random bytes. Cannot fail once initialized.
|
|
void bravais_random_bytes(uint8_t* buf, size_t len);
|
|
|
|
#endif // BRAVAIS_RNG_H
|