hal namespace
Namespaces
Classes
- class GpioIrqBinding
- Pico GPIO IRQ binding helper.
- class GpioPin
- class SpiBus
- class UartStreamIo
- Default board UART-backed byte stream used by local control transport.
Functions
- auto fill_random_bytes(uint8_t* out, size_t size) -> bool
- Fills buffer with random bytes from the platform entropy source.
Function documentation
bool prf:: hal:: fill_random_bytes(uint8_t* out,
size_t size)
#include <hal/random.hpp>
Fills buffer with random bytes from the platform entropy source.
This function exists primarily for cryptographic consumers such as device key generation, so the implementation must provide randomness suitable for cryptographic use, not just a fast PRNG stream.
On RP2350, the current implementation uses the Pico SDK random subsystem (get_rand_64()), but only with hardware TRNG entropy enabled in the SDK mixer and seed path (PICO_RAND_ENTROPY_SRC_TRNG=1 and PICO_RAND_SEED_ENTROPY_SRC_TRNG=1). In that configuration, the entropy source is the RP2350 hardware TRNG and is considered acceptable for this firmware's cryptographic needs.
On other platforms, src/hal must provide an equivalent implementation backed by a platform-appropriate cryptographic entropy source.