mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 20:40:59 +02:00
IDF master c13afea63 (#5214)
esp-dsp: master 7cc5073 esp-face: master 420fc7e esp-rainmaker: f1b82c7 esp32-camera: master 6f8489e esp_littlefs: master b58f00c
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "esp_err.h"
|
||||
#include "supplicant_opt.h"
|
||||
|
||||
typedef time_t os_time_t;
|
||||
|
||||
@ -308,4 +309,27 @@ static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
return NULL;
|
||||
return os_realloc(ptr, nmemb * size);
|
||||
}
|
||||
|
||||
#ifdef USE_MBEDTLS_CRYPTO
|
||||
void forced_memzero(void *ptr, size_t len);
|
||||
#else
|
||||
/* Try to prevent most compilers from optimizing out clearing of memory that
|
||||
* becomes unaccessible after this function is called. This is mostly the case
|
||||
* for clearing local stack variables at the end of a function. This is not
|
||||
* exactly perfect, i.e., someone could come up with a compiler that figures out
|
||||
* the pointer is pointing to memset and then end up optimizing the call out, so
|
||||
* try go a bit further by storing the first octet (now zero) to make this even
|
||||
* a bit more difficult to optimize out. Once memset_s() is available, that
|
||||
* could be used here instead. */
|
||||
static void * (* const volatile memset_func)(void *, int, size_t) = memset;
|
||||
static uint8_t forced_memzero_val;
|
||||
|
||||
static inline void forced_memzero(void *ptr, size_t len)
|
||||
{
|
||||
memset_func(ptr, 0, len);
|
||||
if (len) {
|
||||
forced_memzero_val = ((uint8_t *) ptr)[0];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* OS_H */
|
||||
|
Reference in New Issue
Block a user