2 * libwebsockets - lib/plat/lws-plat-esp32.c
4 * Copyright (C) 2010-2017 Andy Green <andy@warmcat.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation:
9 * version 2.1 of the License.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 #include "core/private.h"
28 gettimeofday(&tv, NULL);
29 return ((unsigned long long)tv.tv_sec * 1000000LL) + tv.tv_usec;
33 lws_get_random(struct lws_context *context, void *buf, int len)
35 #if defined(LWS_AMAZON_RTOS)
38 n = mbedtls_ctr_drbg_random(&context->mcdc, buf, len);
44 lwsl_err("%s: mbedtls_ctr_drbg_random returned 0x%x\n", __func__, n);
51 uint32_t r = esp_random();
52 uint8_t *p = (uint8_t *)&r;
64 return pb - (uint8_t *)buf;
69 LWS_VISIBLE void lwsl_emit_syslog(int level, const char *line)
71 lwsl_emit_stderr(level, line);
75 lws_plat_drop_app_privileges(struct lws_context *context, int actually_init)
81 lws_plat_recommended_rsa_bits(void)
84 * 2048-bit key generation takes up to a minute on ESP32, 4096
85 * is like 15 minutes +
90 void esp32_uvtimer_cb(TimerHandle_t t)
92 struct timer_mapping *p = pvTimerGetTimerID(t);