|
7 | 7 | #define MBEDTLS_H |
8 | 8 |
|
9 | 9 | #include <nanoHAL.h> |
| 10 | +#include "nf_mbedtls_config.h" |
10 | 11 |
|
11 | 12 | #ifdef PLATFORM_ESP32 |
12 | 13 | #include <esp32_idf.h> |
13 | 14 | #endif |
14 | 15 |
|
15 | 16 | #include <sockets_lwip.h> |
16 | 17 |
|
| 18 | +#ifdef __cplusplus |
| 19 | +extern "C" |
| 20 | +{ |
| 21 | +#endif |
| 22 | + |
17 | 23 | #include "mbedtls/platform.h" |
18 | 24 | #include "mbedtls/net_sockets.h" |
19 | 25 | #include "mbedtls/ssl.h" |
|
22 | 28 | #include "mbedtls/error.h" |
23 | 29 | #include "mbedtls/certs.h" |
24 | 30 |
|
25 | | -typedef struct mbedTLS_NFContext |
26 | | -{ |
27 | | - mbedtls_entropy_context* entropy; |
28 | | - mbedtls_ctr_drbg_context* ctr_drbg; |
29 | | - mbedtls_ssl_config* conf; |
30 | | - mbedtls_ssl_context* ssl; |
31 | | - mbedtls_net_context* server_fd; |
32 | | - mbedtls_x509_crt* x509_crt; |
33 | | - mbedtls_pk_context* pk; |
34 | | -}mbedTLS_NFContext; |
35 | | - |
36 | | -int net_would_block( const mbedtls_net_context *ctx ); |
37 | | -int mbedtls_net_recv( void *ctx, unsigned char *buf, size_t len ); |
38 | | -int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len ); |
39 | | -int mbedtls_net_recv_timeout( void *ctx, unsigned char *buf, size_t len, uint32_t timeout ); |
40 | | -void mbedtls_net_free( mbedtls_net_context *ctx ); |
41 | | - |
42 | | -// debug output declaration |
43 | | -void nf_debug( void *ctx, int level, const char *file, int line, const char *str ); |
44 | | - |
45 | | -#ifdef __cplusplus |
46 | | -extern "C" { |
47 | | -#endif |
48 | | - |
49 | | -// function returning the system date and time in Unix Epoch |
50 | | -time_t nf_get_unix_epoch(); |
| 31 | + typedef struct mbedTLS_NFContext |
| 32 | + { |
| 33 | + mbedtls_entropy_context *entropy; |
| 34 | + mbedtls_ctr_drbg_context *ctr_drbg; |
| 35 | + mbedtls_ssl_config *conf; |
| 36 | + mbedtls_ssl_context *ssl; |
| 37 | + mbedtls_net_context *server_fd; |
| 38 | + mbedtls_x509_crt *x509_crt; |
| 39 | + mbedtls_pk_context *pk; |
| 40 | + } mbedTLS_NFContext; |
| 41 | + |
| 42 | + int net_would_block(const mbedtls_net_context *ctx); |
| 43 | + int mbedtls_net_recv(void *ctx, unsigned char *buf, size_t len); |
| 44 | + int mbedtls_net_send(void *ctx, const unsigned char *buf, size_t len); |
| 45 | + int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len, uint32_t timeout); |
| 46 | + void mbedtls_net_free(mbedtls_net_context *ctx); |
| 47 | + |
| 48 | + // debug output declaration |
| 49 | + void nf_debug(void *ctx, int level, const char *file, int line, const char *str); |
| 50 | + |
| 51 | + // function returning the system date and time in Unix Epoch |
| 52 | + time_t nf_get_unix_epoch(); |
51 | 53 |
|
52 | 54 | #ifdef __cplusplus |
53 | 55 | } |
|
0 commit comments