17static const char *
const TAG =
"helpers.host";
20 FILE *fp = fopen(
"/dev/urandom",
"r");
22 ESP_LOGW(TAG,
"Could not open /dev/urandom, errno=%d", errno);
25 size_t read = fread(data, 1,
len, fp);
27 ESP_LOGW(TAG,
"Not enough data from /dev/urandom");
42 static const uint8_t esphome_host_mac_address[6] = USE_ESPHOME_HOST_MAC_ADDRESS;
43 memcpy(mac, esphome_host_mac_address,
sizeof(esphome_host_mac_address));
Providing packet encoding functions for exchanging data with a remote host.
bool random_bytes(uint8_t *data, size_t len)
Generate len random bytes using the platform's secure RNG (hardware RNG or OS CSPRNG).
void get_mac_address_raw(uint8_t *mac)
Get the device MAC address as raw bytes, written into the provided byte array (6 bytes).