libdecaf
Loading...
Searching...
No Matches
spongerng.h
Go to the documentation of this file.
1
12#ifndef __DECAF_SPONGERNG_H__
13#define __DECAF_SPONGERNG_H__
14
15#include <decaf/shake.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
25
28
32 const uint8_t *__restrict__ in,
33 size_t len,
34 int deterministic
35) DECAF_NONNULL;
36
45 const char *file,
46 size_t len,
47 int deterministic
48) DECAF_NONNULL DECAF_WARN_UNUSED;
49
58) DECAF_WARN_UNUSED;
59
61void DECAF_API_VIS decaf_spongerng_next (
63 uint8_t * __restrict__ out,
64 size_t len
65);
66
68void DECAF_API_VIS decaf_spongerng_stir (
70 const uint8_t * __restrict__ in,
71 size_t len
72) DECAF_NONNULL;
73
75static DECAF_INLINE void
76decaf_spongerng_destroy (
78);
79
81/***************************************/
82/* Implementations of inline functions */
83/***************************************/
84void decaf_spongerng_destroy (decaf_keccak_prng_t doomed) {
85 decaf_sha3_destroy(doomed->sponge);
86}
/* internal */
88
89#ifdef __cplusplus
90} /* extern "C" */
91#endif
92
93#endif /* __DECAF_SPONGERNG_H__ */
decaf_error_t
Another boolean type used to indicate success or failure.
Definition common.h:120
SHA2-512.
void DECAF_API_VIS decaf_sha3_destroy(decaf_keccak_sponge_t sponge)
Destroy a DECAF_SHA3 or DECAF_SHAKE sponge context by overwriting it with 0.
struct decaf_keccak_sponge_s decaf_keccak_sponge_t[1]
Convenience GMP-style one-element array version.
Definition shake.h:33
void DECAF_API_VIS decaf_spongerng_init_from_buffer(decaf_keccak_prng_t prng, const uint8_t *__restrict__ in, size_t len, int deterministic) DECAF_NONNULL
Initialize a sponge-based CSPRNG from a buffer.
void DECAF_API_VIS decaf_spongerng_next(decaf_keccak_prng_t prng, uint8_t *__restrict__ out, size_t len)
Output bytes from a sponge-based CSPRNG.
decaf_error_t DECAF_API_VIS decaf_spongerng_init_from_dev_urandom(decaf_keccak_prng_t prng) DECAF_WARN_UNUSED
Initialize a nondeterministic sponge-based CSPRNG from /dev/urandom.
decaf_error_t DECAF_API_VIS decaf_spongerng_init_from_file(decaf_keccak_prng_t prng, const char *file, size_t len, int deterministic) DECAF_NONNULL DECAF_WARN_UNUSED
Initialize a sponge-based CSPRNG from a file.
void DECAF_API_VIS decaf_spongerng_stir(decaf_keccak_prng_t prng, const uint8_t *__restrict__ in, size_t len) DECAF_NONNULL
Stir entropy data into a sponge-based CSPRNG from a buffer.
decaf_keccak_prng_s decaf_keccak_prng_t[1]
Keccak CSPRNG structure as one-element array.
Definition spongerng.h:27
Keccak CSPRNG structure as struct.
Definition spongerng.h:22
decaf_keccak_sponge_t sponge
Internal sponge object.
Definition spongerng.h:23