Skip to content

Commit 3d37423

Browse files
committed
Template for wolfSSH minimal build using user_settings.h. ZD 17991.
1 parent 43f4ba9 commit 3d37423

3 files changed

Lines changed: 179 additions & 0 deletions

File tree

examples/configs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Example wolfSSL configuration file templates for use when autoconf is not availa
1515
* `user_settings_stm32.h`: Example configuration file generated from the wolfSSL STM32 Cube pack.
1616
* `user_settings_tls12`: Example for TLS v1.2 client only, ECC only, AES GCM only, SHA2-256 only.
1717
* `user_settings_wolfboot_keytools.h`: This from wolfBoot tools/keytools and is ECC, RSA, ED25519 and ChaCha20.
18+
* `user_settings_wolfssh.h`: Minimum options for building wolfSSH. See comment at top for ./configure used to generate.
1819
* `user_settings_wolftpm.h`: Minimum options for building wolfTPM. See comment at top for ./configure used to generate.
1920

2021
## Usage

examples/configs/include.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ EXTRA_DIST += examples/configs/user_settings_stm32.h
1313
EXTRA_DIST += examples/configs/user_settings_template.h
1414
EXTRA_DIST += examples/configs/user_settings_tls12.h
1515
EXTRA_DIST += examples/configs/user_settings_wolfboot_keytools.h
16+
EXTRA_DIST += examples/configs/user_settings_wolfssh.h
1617
EXTRA_DIST += examples/configs/user_settings_wolftpm.h
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/* user_settings_wolfssh.h
2+
*
3+
* Copyright (C) 2006-2024 wolfSSL Inc.
4+
*
5+
* This file is part of wolfSSL.
6+
*
7+
* wolfSSL is free software; you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation; either version 2 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* wolfSSL is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20+
*/
21+
22+
23+
/* To use the rename file to user_settings.h and define WOLFSSL_USER_SETTINGS */
24+
25+
/* Started from the following configure and hand tuned, organized and commented:
26+
./configure --enable-wolfssh --enable-sp=small --enable-sp-math \
27+
--disable-sp-asm --disable-asm --disable-sys-ca-certs --enable-aesgcm=small \
28+
--enable-cryptonly --disable-sha3 --disable-chacha --disable-poly1305 \
29+
--disable-md5 --disable-error-queue-per-thread --disable-pkcs12 \
30+
--disable-errorstrings --disable-sni --disable-sha224
31+
make
32+
*/
33+
34+
/* Tested using:
35+
cp ./examples/configs/user_settings_wolfssh.h user_settings.h
36+
cp ./examples/configs/user_settings_wolfssh.h ../wolfSSH/user_settings.h
37+
38+
wolfSSL:
39+
./configure --enable-usersettings --disable-examples CFLAGS="-Os"
40+
make
41+
sudo make install
42+
43+
wolfSSH:
44+
./configure --enable-scp --disable-shared --disable-term \
45+
CFLAGS="-DWOLFSSL_USER_SETTINGS -Os"
46+
make
47+
*/
48+
49+
#ifndef WOLFSSL_USER_SETTINGS_SSH_H
50+
#define WOLFSSL_USER_SETTINGS_SSH_H
51+
52+
#ifdef __cplusplus
53+
extern "C" {
54+
#endif
55+
56+
/* Platform */
57+
#if 0 /* Threading and filesystem required for wolfSSH tests \
58+
* Can be set for wolfSSH library only use */
59+
#define SINGLE_THREADED
60+
#define NO_FILESYSTEM
61+
#endif
62+
63+
/* Features */
64+
#define WOLFSSL_WOLFSSH
65+
#if 1
66+
#define WOLFCRYPT_ONLY /* no TLS */
67+
#endif
68+
#define HAVE_HASHDRBG
69+
#define WOLFSSL_ASN_TEMPLATE
70+
#define WOLFSSL_BASE64_ENCODE
71+
#define WOLFSSL_PUBLIC_MP
72+
73+
/* Timing Resistance */
74+
#define TFM_TIMING_RESISTANT
75+
#define ECC_TIMING_RESISTANT
76+
#define WC_RSA_BLINDING
77+
78+
/* Asymmetric */
79+
#undef NO_RSA
80+
#if 1 /* DH */
81+
#undef NO_DH
82+
#define HAVE_DH_DEFAULT_PARAMS
83+
#define HAVE_FFDHE_2048
84+
#else
85+
#define NO_DH
86+
#endif
87+
#define HAVE_ECC
88+
#ifdef HAVE_ECC
89+
#if 0 /* optional ECC SHAMIR speedup */
90+
#define ECC_SHAMIR
91+
#endif
92+
#define ECC_USER_CURVES
93+
#define HAVE_ECC384
94+
#define HAVE_ECC521
95+
#endif
96+
97+
/* Symmetric AES CBC/GCM */
98+
#undef NO_AES_CBC
99+
#if 1 /* GCM */
100+
#define HAVE_AESGCM
101+
#define GCM_SMALL
102+
#endif
103+
104+
/* Hashing SHA-1, SHA2-256/384/512 */
105+
#undef NO_SHA
106+
#undef NO_SHA256
107+
#if 1
108+
#define WOLFSSL_SHA384
109+
#define WOLFSSL_SHA512
110+
#endif
111+
112+
113+
/* Math */
114+
/* Multi Precision (MP): Enable support for uncommon key sizes / curves */
115+
#if 0
116+
#define WOLFSSL_SP_MATH_ALL
117+
#endif
118+
119+
/* Single Precision (SP) Math */
120+
#define WOLFSSL_SP_MATH
121+
#define WOLFSSL_SP_SMALL
122+
123+
#if !defined(NO_RSA) || !defined(NO_RSA)
124+
#undef WOLFSSL_SP_NO_2048 /* 2048-bit */
125+
#undef WOLFSSL_SP_NO_3072 /* 3072-bit */
126+
#define WOLFSSL_SP_4096 /* 4096-bit */
127+
128+
#ifndef NO_RSA
129+
#define WOLFSSL_HAVE_SP_RSA
130+
#endif
131+
#ifndef NO_DH
132+
#define WOLFSSL_HAVE_SP_DH
133+
#endif
134+
#endif
135+
#ifdef HAVE_ECC
136+
#define WOLFSSL_HAVE_SP_ECC
137+
138+
#undef WOLFSSL_SP_NO_256
139+
#ifdef HAVE_ECC384
140+
#define WOLFSSL_SP_384
141+
#endif
142+
#ifdef HAVE_ECC521
143+
#define WOLFSSL_SP_521
144+
#endif
145+
#endif
146+
147+
#ifndef WOLFCRYPT_ONLY
148+
#define HAVE_TLS_EXTENSIONS
149+
#define HAVE_SUPPORTED_CURVES
150+
#define HAVE_ENCRYPT_THEN_MAC
151+
#endif
152+
153+
/* Disable Algorithms */
154+
#define NO_DSA
155+
#define NO_DES3
156+
#define NO_MD4
157+
#define NO_MD5
158+
#define NO_RC4
159+
#define NO_PSK
160+
#define NO_PKCS12
161+
#define NO_PWDBASED
162+
#define WOLFSSL_NO_SHAKE128
163+
#define WOLFSSL_NO_SHAKE256
164+
165+
/* Disable Features */
166+
#define NO_ERROR_STRINGS
167+
#define WC_NO_ASYNC_THREADING
168+
#define NO_DES3_TLS_SUITES
169+
#define NO_OLD_TLS
170+
#define WOLFSSL_NO_TLS12
171+
172+
#ifdef __cplusplus
173+
}
174+
#endif
175+
176+
177+
#endif /* WOLFSSL_USER_SETTINGS_SSH_H */

0 commit comments

Comments
 (0)