NetBurner 3.5.8
PDF Version
Toggle main menu visibility
user_settings_switches.h
1
/* user_settings_switches.h
2
*
3
* Applies the NetBurner crypto switches: the crypto profile, NB_TLS_KEYLOG,
4
* SSL_TLS_1_3_SUPPORT, ENABLE_ECC384, ENABLE_ECC521 and SSL_CUSTOM_MALLOC.
5
*
6
* Each platform user_settings.h includes this file last, after
7
* <crypto/platform/user_settings-overload.h>. A switch therefore takes effect
8
* whether it is set in user_settings.h, in predef.h, or in a project copy of
9
* user_settings-overload.h.
10
*/
11
12
/* ------------------------------------------------------------------------- */
13
/* Crypto profile */
14
/* ------------------------------------------------------------------------- */
15
/* Selected in the CRYPTO PROFILE SELECTION section of user_settings.h. */
16
/* With no profile selected, user_settings.h gives full compatibility. */
17
18
#if (defined(CRYPTO_PROFILE_AESGCM) + defined(CRYPTO_PROFILE_CHACHA) + defined(CRYPTO_PROFILE_MINIMAL)) > 1
19
#error "Define only one of CRYPTO_PROFILE_AESGCM, CRYPTO_PROFILE_CHACHA and CRYPTO_PROFILE_MINIMAL"
20
#endif
21
22
#if defined(CRYPTO_PROFILE_AESGCM) || defined(CRYPTO_PROFILE_CHACHA) || defined(CRYPTO_PROFILE_MINIMAL)
23
/* TLS 1.3 only, for a smaller footprint */
24
#define WOLFSSL_NO_TLS12
25
#undef WOLFSSL_STATIC_RSA
26
#undef WOLFSSL_STATIC_DH
27
28
/* No DH */
29
#undef WOLFSSL_DH_CONST
30
#undef HAVE_FFDHE_2048
31
#undef HAVE_FFDHE_4096
32
#undef HAVE_FFDHE_6144
33
#undef HAVE_FFDHE_8192
34
#define NO_DH
35
36
/* No DES3 */
37
#define NO_DES3
38
#endif
39
40
#if defined(CRYPTO_PROFILE_AESGCM) || defined(CRYPTO_PROFILE_MINIMAL)
41
/* No ChaCha20-Poly1305, Curve25519 or Ed25519 */
42
#undef HAVE_CHACHA
43
#undef HAVE_POLY1305
44
#undef HAVE_CURVE25519
45
#undef HAVE_ED25519
46
#endif
47
48
/* ------------------------------------------------------------------------- */
49
/* TLS 1.3 */
50
/* ------------------------------------------------------------------------- */
51
/* SSL_TLS_1_3_SUPPORT is defined in predef.h. System code outside the */
52
/* crypto library also reads it. */
53
54
#ifndef SSL_TLS_1_3_SUPPORT
55
#undef WOLFSSL_TLS13
56
#undef WOLFSSL_EARLY_DATA
57
#endif
58
59
/* ------------------------------------------------------------------------- */
60
/* ECC curves */
61
/* ------------------------------------------------------------------------- */
62
/* ENABLE_ECC384 and ENABLE_ECC521 are defined in predef.h. */
63
64
#ifdef ENABLE_ECC384
65
#define HAVE_ECC384
66
#else
67
/* wolfSSL 5.9.1 preferredGroup[] in tls.c gates SECP384R1 on
68
* !NO_ECC384 (not on HAVE_ECC384), but TLSX_KeyShare_GenEccKey gates
69
* its switch arm on HAVE_ECC384. Without explicit NO_ECC384, TLS 1.3
70
* client advertises SECP384R1 then key gen returns BAD_FUNC_ARG. */
71
#define NO_ECC384
72
#endif
73
74
#ifdef ENABLE_ECC521
75
// #define HAVE_ECC521
76
#else
77
/* Same preferredGroup vs. TLSX_KeyShare_GenEccKey asymmetry as
78
* NO_ECC384 above, but for SECP521R1. */
79
#define NO_ECC521
80
#endif
81
82
/* ------------------------------------------------------------------------- */
83
/* TLS key logging */
84
/* ------------------------------------------------------------------------- */
85
/* NB_TLS_KEYLOG is described in the Debugging section of user_settings.h. */
86
87
#ifdef NB_TLS_KEYLOG
88
#define HAVE_SECRET_CALLBACK
89
#endif
90
91
#ifdef WOLFSSL_SSLKEYLOGFILE
92
#error "WOLFSSL_SSLKEYLOGFILE needs a filesystem, and NetBurner platforms set NO_FILESYSTEM. Define NB_TLS_KEYLOG instead."
93
#endif
94
95
/* ------------------------------------------------------------------------- */
96
/* Memory allocator */
97
/* ------------------------------------------------------------------------- */
98
/* SSL_CUSTOM_MALLOC is defined in predef.h. Value 1 selects the fastest */
99
/* memory on the platform, which user_settings.h names with */
100
/* NB_SSL_FASTEST_ALLOCATOR and NB_SSL_FASTEST_BUFFER. */
101
102
#ifdef SSL_CUSTOM_MALLOC
103
#define XMALLOC_OVERRIDE
104
105
/* prototypes for user heap override functions */
106
/* Note: Realloc only required for normal math */
107
#include <stddef.h>
/* for size_t */
108
109
extern
void
* NBMalloc(
size_t
n);
110
extern
void
NBFree(
void
*p);
111
extern
void
* NBRealloc(
void
*p,
size_t
n);
112
113
#define XMALLOC(n, h, t) NBMalloc(n)
114
#define XFREE(p, h, t) NBFree(p)
115
#define XREALLOC(p, n, h, t) NBRealloc(p, n)
116
117
#if SSL_CUSTOM_MALLOC == 1
// Fastest memory on platform
118
#define CREATE_MEMORY_ALLOCATOR(name,size) NB_SSL_FASTEST_ALLOCATOR(name,size)
119
#define CREATE_MEMORY_BUFFER(name,size) NB_SSL_FASTEST_BUFFER(name,size)
120
#elif SSL_CUSTOM_MALLOC == 2
121
#define CREATE_MEMORY_ALLOCATOR(name,size) CREATE_MEMORY_ALLOCATOR_TCM(name,size)
122
#define CREATE_MEMORY_BUFFER(name,size) CREATE_MEMORY_BUFFER_TCM(name,size)
123
#elif SSL_CUSTOM_MALLOC == 3
124
#define CREATE_MEMORY_ALLOCATOR(name,size) CREATE_MEMORY_ALLOCATOR_SRAM(name,size)
125
#define CREATE_MEMORY_BUFFER(name,size) CREATE_MEMORY_BUFFER_SRAM(name,size)
126
#elif SSL_CUSTOM_MALLOC == 4
127
#define CREATE_MEMORY_ALLOCATOR(name,size) CREATE_MEMORY_ALLOCATOR_SDRAM(name,size)
128
#define CREATE_MEMORY_BUFFER(name,size) CREATE_MEMORY_BUFFER_SDRAM(name,size)
129
#endif
130
#endif
libraries
include
crypto
platform
user_settings_switches.h
Generated by
1.18.0