Sponge-based RNGs.
More...
Go to the source code of this file.
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
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. More...
|
|
Sponge-based RNGs.
- Copyright
- Copyright (c) 2015-2016 Cryptography Research, Inc.
Released under the MIT License. See LICENSE.txt for license information.
- Author
- Mike Hamburg
- Warning
- This construction isn't final. In particular, the outputs of deterministic RNGs from this mechanism might change in future versions.
◆ decaf_spongerng_init_from_buffer()
void DECAF_API_VIS decaf_spongerng_init_from_buffer |
( |
decaf_keccak_prng_t |
prng, |
|
|
const uint8_t *__restrict__ |
in, |
|
|
size_t |
len, |
|
|
int |
deterministic |
|
) |
| |
Initialize a sponge-based CSPRNG from a buffer.
- Parameters
-
[out] | prng | The PRNG object. |
[in] | in | The initialization data. |
[in] | len | The length of the initialization data. |
[in] | deterministic | If zero, allow RNG to stir in nondeterministic data from RDRAND or RDTSC. |
◆ decaf_spongerng_init_from_dev_urandom()
Initialize a nondeterministic sponge-based CSPRNG from /dev/urandom.
- Return values
-
DECAF_SUCCESS | success. |
DECAF_FAILURE | failure. |
- Note
- On failure, errno can be used to determine the cause.
- Parameters
-
[out] | prng | sponge The sponge object. |
◆ decaf_spongerng_init_from_file()
Initialize a sponge-based CSPRNG from a file.
- Return values
-
DECAF_SUCCESS | success. |
DECAF_FAILURE | failure. |
- Note
- On failure, errno can be used to determine the cause.
- Parameters
-
[out] | prng | The PRNG object. |
[in] | file | A name of a file containing initial data. |
[in] | len | The length of the initial data. Must be positive. |
[in] | deterministic | If zero, allow RNG to stir in nondeterministic data from RDRAND or RDTSC. |
◆ decaf_spongerng_next()
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.
- Parameters
-
[in,out] | prng | The PRNG object. |
[out] | out | Output buffer. |
[in] | len | Number of bytes to output. |
◆ decaf_spongerng_stir()
void DECAF_API_VIS decaf_spongerng_stir |
( |
decaf_keccak_prng_t |
prng, |
|
|
const uint8_t *__restrict__ |
in, |
|
|
size_t |
len |
|
) |
| |
Stir entropy data into a sponge-based CSPRNG from a buffer.
- Parameters
-
[out] | prng | The PRNG object. |
[in] | in | The entropy data. |
[in] | len | The length of the initial data. |