mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 10:46:31 +00:00
adapt bearsll-esp8266 to ESP32
This commit is contained in:
parent
90ee6f3995
commit
968fda65ca
@ -140,6 +140,24 @@ seeder_win32(const br_prng_class **ctx)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if BR_USE_ESP8266_RAND
|
#if BR_USE_ESP8266_RAND
|
||||||
|
#ifdef ESP32
|
||||||
|
extern uint32_t esp_random(void);
|
||||||
|
|
||||||
|
static int
|
||||||
|
seeder_esp8266(const br_prng_class **ctx) //TODO: rename/refactor it to ESP32
|
||||||
|
{
|
||||||
|
uint32_t tmp[32 / sizeof(uint32_t)];
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for (i=0; i<sizeof(tmp)/sizeof(tmp[0]); i++) {
|
||||||
|
tmp[i] = esp_random();
|
||||||
|
}
|
||||||
|
|
||||||
|
(*ctx)->update(ctx, tmp, sizeof tmp);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
extern uint32_t phy_get_rand(void); // From the ESP8266 SDK
|
extern uint32_t phy_get_rand(void); // From the ESP8266 SDK
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -157,6 +175,7 @@ seeder_esp8266(const br_prng_class **ctx)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* see bearssl_rand.h */
|
/* see bearssl_rand.h */
|
||||||
|
|
||||||
|
@ -33,7 +33,11 @@ br_chacha20_ct_run(const void *key,
|
|||||||
uint32_t kw[8], ivw[3];
|
uint32_t kw[8], ivw[3];
|
||||||
size_t u;
|
size_t u;
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
static const uint32_t CW[] = {
|
||||||
|
#else
|
||||||
static const uint32_t CW[] PROGMEM = {
|
static const uint32_t CW[] PROGMEM = {
|
||||||
|
#endif
|
||||||
0x61707865, 0x3320646e, 0x79622d32, 0x6b206574
|
0x61707865, 0x3320646e, 0x79622d32, 0x6b206574
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@
|
|||||||
* Set BR_LOMUL on platforms where it makes sense.
|
* Set BR_LOMUL on platforms where it makes sense.
|
||||||
*/
|
*/
|
||||||
#ifndef BR_LOMUL
|
#ifndef BR_LOMUL
|
||||||
#if BR_ARMEL_CORTEXM_GCC || (defined(ESP8266) && !defined(ESP8266M32))
|
#if BR_ARMEL_CORTEXM_GCC || ((defined(ESP8266) || defined(ESP32)) && !defined(ESP8266M32))
|
||||||
#define BR_LOMUL 1
|
#define BR_LOMUL 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -315,7 +315,7 @@
|
|||||||
* Use ESP8266 hardware random generator when possible.
|
* Use ESP8266 hardware random generator when possible.
|
||||||
*/
|
*/
|
||||||
#ifndef BR_USE_ESP8266_RAND
|
#ifndef BR_USE_ESP8266_RAND
|
||||||
#if defined(ESP8266)
|
#if (defined(ESP8266) || defined(ESP32))
|
||||||
#define BR_USE_ESP8266_RAND 1
|
#define BR_USE_ESP8266_RAND 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@ -433,7 +433,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BR_USE_UNIX_TIME
|
#ifndef BR_USE_UNIX_TIME
|
||||||
#if defined __unix__ || defined __linux__ || defined ESP8266 \
|
#if defined __unix__ || defined __linux__ || defined ESP8266 || defined ESP32\
|
||||||
|| defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
|
|| defined _POSIX_SOURCE || defined _POSIX_C_SOURCE \
|
||||||
|| (defined __APPLE__ && defined __MACH__)
|
|| (defined __APPLE__ && defined __MACH__)
|
||||||
#define BR_USE_UNIX_TIME 1
|
#define BR_USE_UNIX_TIME 1
|
||||||
@ -2568,7 +2568,7 @@ br_cpuid(uint32_t mask_eax, uint32_t mask_ebx,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ESP8266
|
#if (defined(ESP8266)|| defined(ESP32))
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user