1 /* 2 * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #include "randombytes_internal.h" 7 #include "esp_system.h" 8 randombytes_esp32xx_implementation_name(void)9static const char *randombytes_esp32xx_implementation_name(void) 10 { 11 return CONFIG_IDF_TARGET; 12 } 13 14 /* 15 Plug the ESP32 hardware RNG into libsodium's custom RNG support, as per 16 https://download.libsodium.org/doc/advanced/custom_rng.html 17 18 Note that this RNG is selected by default (see randombytes_default.h), so there 19 is no need to call randombytes_set_implementation(). 20 */ 21 const struct randombytes_implementation randombytes_esp32_implementation = { 22 .implementation_name = randombytes_esp32xx_implementation_name, 23 .random = esp_random, 24 .stir = NULL, 25 .uniform = NULL, 26 .buf = esp_fill_random, 27 .close = NULL, 28 }; 29