forked from maximkulkin/esp-wolfssl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_settings.h
53 lines (39 loc) · 908 Bytes
/
user_settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef wolfcrypt_user_settings_h
#define wolfcrypt_user_settings_h
#ifdef ESP_IDF
#define WOLFSSL_ESPIDF
#include <esp_system.h>
static inline int hwrand_generate_block(uint8_t *buf, size_t len) {
int i;
for (i=0; i+4 < len; i+=4) {
*((uint32_t*)buf) = esp_random();
buf += 4;
}
if (i < len) {
uint32_t r = esp_random();
while (i < len) {
*buf++ = r;
r >>= 8;
i++;
}
}
return 0;
}
#else
#include <esp/hwrand.h>
static inline int hwrand_generate_block(uint8_t *buf, size_t len) {
hwrand_fill(buf, len);
return 0;
}
#define MP_LOW_MEM
#define FREERTOS
#define WC_NO_HARDEN
#define NO_WOLFSSL_DIR
#define SINGLE_THREADED
#define WOLFSSL_LWIP
#define NO_INLINE
#define NO_WOLFSSL_MEMORY
#define NO_WOLFSSL_SMALL_STACK
#endif
#define CUSTOM_RAND_GENERATE_BLOCK hwrand_generate_block
#endif