Anjay Lite
|
Platform hook for providing randomness. More...
Go to the source code of this file.
Functions | |
int | anj_rng_generate (uint8_t *buffer, size_t size) |
Platform hook for providing randomness.
This header declares a minimal API that platform integrators must implement to provide entropy to Anjay Lite. It defines:
The implementation may wrap a TRNG, OS CSRNG service, or any other platform-specific entropy source. Quality of generated data directly impacts security features that depend on randomness.
int anj_rng_generate | ( | uint8_t * | buffer, |
size_t | size | ||
) |
Generates random bytes and fills buffer
with them.
Implementation has to be provided by the application and is used by the library wherever randomness is needed. It is also an entropy source for crypto libraries when default integrations are used (e.g. ANJ_WITH_MBEDTLS).
When using a library with secure connections, a cryptographically secure random number generator (CSRNG) is required. Recommended RNG sources in this case include:
getrandom()
)For case with non-secure connections, any general-purpose PRNG is acceptable.
[out] | buffer | Pointer to the buffer where generated bytes will be stored. |
size | Number of bytes to generate and write to out . |