Skip to content

Commit cfbadc8

Browse files
committed
Fixes for wolfSSH user_settings.h template. Add low resource option.
1 parent 3d37423 commit cfbadc8

1 file changed

Lines changed: 56 additions & 25 deletions

File tree

examples/configs/user_settings_wolfssh.h

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ make
5353
extern "C" {
5454
#endif
5555

56+
/* #define USE_LOW_RESOURCE */
57+
5658
/* Platform */
57-
#if 0 /* Threading and filesystem required for wolfSSH tests \
58-
* Can be set for wolfSSH library only use */
59+
#ifdef USE_LOW_RESOURCE
60+
/* Threading and filesystem required for wolfSSH tests \
61+
* Can be set for wolfSSH library only use */
5962
#define SINGLE_THREADED
6063
#define NO_FILESYSTEM
64+
#define BENCH_EMBEDDED
6165
#endif
6266

6367
/* Features */
@@ -67,31 +71,51 @@ extern "C" {
6771
#endif
6872
#define HAVE_HASHDRBG
6973
#define WOLFSSL_ASN_TEMPLATE
70-
#define WOLFSSL_BASE64_ENCODE
7174
#define WOLFSSL_PUBLIC_MP
75+
#ifndef USE_LOW_RESOURCE
76+
#define WOLFSSL_BASE64_ENCODE
77+
#endif
78+
79+
#ifndef WOLFCRYPT_ONLY
80+
#define HAVE_TLS_EXTENSIONS
81+
#define HAVE_SUPPORTED_CURVES
82+
#define HAVE_ENCRYPT_THEN_MAC
83+
#endif
7284

7385
/* Timing Resistance */
7486
#define TFM_TIMING_RESISTANT
7587
#define ECC_TIMING_RESISTANT
7688
#define WC_RSA_BLINDING
7789

7890
/* Asymmetric */
79-
#undef NO_RSA
91+
#if 1 /* RSA */
92+
#undef NO_RSA
93+
#ifdef USE_LOW_RESOURCE
94+
#define RSA_LOW_MEM
95+
#endif
96+
#else
97+
#define NO_RSA
98+
#endif
99+
80100
#if 1 /* DH */
81101
#undef NO_DH
82-
#define HAVE_DH_DEFAULT_PARAMS
83-
#define HAVE_FFDHE_2048
102+
#ifndef WOLFCRYPT_ONLY
103+
#define HAVE_DH_DEFAULT_PARAMS
104+
#define HAVE_FFDHE_2048
105+
#endif
84106
#else
85107
#define NO_DH
86108
#endif
87-
#define HAVE_ECC
88-
#ifdef HAVE_ECC
89-
#if 0 /* optional ECC SHAMIR speedup */
109+
#if 1 /* ECC */
110+
#define HAVE_ECC
111+
#ifndef USE_LOW_RESOURCE /* optional ECC SHAMIR speedup */
90112
#define ECC_SHAMIR
91113
#endif
92114
#define ECC_USER_CURVES
93-
#define HAVE_ECC384
94-
#define HAVE_ECC521
115+
#ifndef USE_LOW_RESOURCE
116+
#define HAVE_ECC384
117+
#define HAVE_ECC521
118+
#endif
95119
#endif
96120

97121
/* Symmetric AES CBC/GCM */
@@ -100,13 +124,21 @@ extern "C" {
100124
#define HAVE_AESGCM
101125
#define GCM_SMALL
102126
#endif
127+
#ifdef USE_LOW_RESOURCE
128+
#define WOLFSSL_AES_SMALL_TABLES
129+
#endif
103130

104-
/* Hashing SHA-1, SHA2-256/384/512 */
105-
#undef NO_SHA
131+
/* Hashing SHA2-256/384/512 */
106132
#undef NO_SHA256
133+
#ifdef USE_LOW_RESOURCE
134+
#define USE_SLOW_SHA256
135+
#endif
107136
#if 1
108137
#define WOLFSSL_SHA384
109138
#define WOLFSSL_SHA512
139+
#ifdef USE_LOW_RESOURCE
140+
#define USE_SLOW_SHA512
141+
#endif
110142
#endif
111143

112144

@@ -120,10 +152,14 @@ extern "C" {
120152
#define WOLFSSL_SP_MATH
121153
#define WOLFSSL_SP_SMALL
122154

123-
#if !defined(NO_RSA) || !defined(NO_RSA)
155+
#if !defined(NO_RSA) || !defined(NO_DH)
124156
#undef WOLFSSL_SP_NO_2048 /* 2048-bit */
125-
#undef WOLFSSL_SP_NO_3072 /* 3072-bit */
126-
#define WOLFSSL_SP_4096 /* 4096-bit */
157+
#ifdef USE_LOW_RESOURCE
158+
#define WOLFSSL_SP_NO_3072 /* 3072-bit */
159+
#else
160+
#undef WOLFSSL_SP_NO_3072 /* 3072-bit */
161+
#define WOLFSSL_SP_4096 /* 4096-bit */
162+
#endif
127163

128164
#ifndef NO_RSA
129165
#define WOLFSSL_HAVE_SP_RSA
@@ -135,22 +171,17 @@ extern "C" {
135171
#ifdef HAVE_ECC
136172
#define WOLFSSL_HAVE_SP_ECC
137173

138-
#undef WOLFSSL_SP_NO_256
174+
#undef WOLFSSL_SP_NO_256 /* 256-bit */
139175
#ifdef HAVE_ECC384
140-
#define WOLFSSL_SP_384
176+
#define WOLFSSL_SP_384 /* 384-bit */
141177
#endif
142178
#ifdef HAVE_ECC521
143-
#define WOLFSSL_SP_521
179+
#define WOLFSSL_SP_521 /* 521-bit */
144180
#endif
145181
#endif
146182

147-
#ifndef WOLFCRYPT_ONLY
148-
#define HAVE_TLS_EXTENSIONS
149-
#define HAVE_SUPPORTED_CURVES
150-
#define HAVE_ENCRYPT_THEN_MAC
151-
#endif
152-
153183
/* Disable Algorithms */
184+
#define NO_SHA
154185
#define NO_DSA
155186
#define NO_DES3
156187
#define NO_MD4

0 commit comments

Comments
 (0)