mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-27 00:17:22 +02:00
API encryption (#2254)
This commit is contained in:
@@ -54,5 +54,8 @@
|
||||
#define USE_SOCKET_IMPL_BSD_SOCKETS
|
||||
#endif
|
||||
|
||||
#define USE_API_PLAINTEXT
|
||||
#define USE_API_NOISE
|
||||
|
||||
// Disabled feature flags
|
||||
//#define USE_BSEC // Requires a library with proprietary license.
|
||||
|
||||
@@ -55,6 +55,15 @@ double random_double() { return random_uint32() / double(UINT32_MAX); }
|
||||
|
||||
float random_float() { return float(random_double()); }
|
||||
|
||||
void fill_random(uint8_t *data, size_t len) {
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
esp_fill_random(data, len);
|
||||
#else
|
||||
int err = os_get_random(data, len);
|
||||
assert(err == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static uint32_t fast_random_seed = 0; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)
|
||||
|
||||
void fast_random_set_seed(uint32_t seed) { fast_random_seed = seed; }
|
||||
|
||||
@@ -109,6 +109,8 @@ double random_double();
|
||||
/// Returns a random float between 0 and 1. Essentially just casts random_double() to a float.
|
||||
float random_float();
|
||||
|
||||
void fill_random(uint8_t *data, size_t len);
|
||||
|
||||
void fast_random_set_seed(uint32_t seed);
|
||||
uint32_t fast_random_32();
|
||||
uint16_t fast_random_16();
|
||||
|
||||
Reference in New Issue
Block a user