Skip to content

Commit 8665295

Browse files
authored
Merge pull request #7198 from dgarske/tls12only
Template for TLS v1.2 only
2 parents 1356e07 + ca726e9 commit 8665295

3 files changed

Lines changed: 160 additions & 0 deletions

File tree

.github/workflows/os-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
'examples/configs/user_settings_min_ecc.h',
6868
'examples/configs/user_settings_wolfboot_keytools.h',
6969
'examples/configs/user_settings_wolftpm.h',
70+
'examples/configs/user_settings_tls12.h',
7071
]
7172
name: make user_setting.h (testwolfcrypt only)
7273
runs-on: ${{ matrix.os }}

examples/configs/include.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ EXTRA_DIST += examples/configs/user_settings_template.h
99
EXTRA_DIST += examples/configs/user_settings_fipsv2.h
1010
EXTRA_DIST += examples/configs/user_settings_fipsv5.h
1111
EXTRA_DIST += examples/configs/user_settings_stm32.h
12+
EXTRA_DIST += examples/configs/user_settings_tls12.h
1213
EXTRA_DIST += examples/configs/user_settings_wolftpm.h
1314
EXTRA_DIST += examples/configs/user_settings_EBSnet.h
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/* user_settings_tls12.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+
/* Example for TLS v1.2 client only, ECC only, AES GCM only, SHA2-256 only */
23+
/* Derived using:
24+
* ./configure --disable-rsa --disable-dh --disable-tls13 --disable-chacha \
25+
* --disable-poly1305 --disable-sha224 --disable-sha --disable-md5
26+
* From generated wolfssl/options.h
27+
* Build and Test using:
28+
* ./configure --enable-usersettings --disable-examples
29+
* make
30+
* ./wolfcrypt/test/testwolfcrypt
31+
*/
32+
33+
#ifndef WOLFSSL_USER_SETTINGS_H
34+
#define WOLFSSL_USER_SETTINGS_H
35+
36+
#ifdef __cplusplus
37+
extern "C" {
38+
#endif
39+
40+
/* ------------------------------------------------------------------------- */
41+
/* Platform */
42+
/* ------------------------------------------------------------------------- */
43+
/* Use the SetIO callbacks, not the internal wolfio.c socket code */
44+
#define WOLFSSL_USER_IO
45+
#define WOLFSSL_IGNORE_FILE_WARN /* ignore file includes not required */
46+
//#define WOLFSSL_SMALL_STACK /* option to reduce stack size, offload to heap */
47+
#define NO_FILESYSTEM
48+
#define NO_WRITEV
49+
#define NO_SIG_WRAPPER
50+
51+
/* ------------------------------------------------------------------------- */
52+
/* Math */
53+
/* ------------------------------------------------------------------------- */
54+
/* Math Options */
55+
#if 1 /* Single-precision (SP) wolf math - ECC only */
56+
#define WOLFSSL_HAVE_SP_ECC /* use sp_c32.c for math */
57+
#define WOLFSSL_SP_SMALL /* use smaller version of code */
58+
#define WOLFSSL_SP_MATH /* only SP math - eliminates fast math code */
59+
/* optional Cortex-M3+ speedup with inline assembly */
60+
//#define WOLFSSL_SP_ARM_CORTEX_M_ASM
61+
#elif 1
62+
/* Multi-precision wolf math */
63+
#define WOLFSSL_SP_MATH_ALL /* use sp_int.c generic math */
64+
#define WOLFSSL_SP_SMALL /* use smaller version of code */
65+
#else
66+
/* Fast Math - tfm.c */
67+
#define USE_FAST_MATH
68+
#define TFM_TIMING_RESISTANT
69+
#define WOLFSSL_NO_ASM
70+
#endif
71+
72+
/* ------------------------------------------------------------------------- */
73+
/* TLS */
74+
/* ------------------------------------------------------------------------- */
75+
/* Enable TLS v1.2 (on by default) */
76+
#undef WOLFSSL_NO_TLS12
77+
/* Disable TLS server code */
78+
#define NO_WOLFSSL_SERVER
79+
//#define NO_WOLFSSL_CLIENT
80+
/* Disable TLS v1.3 code */
81+
#undef WOLFSSL_TLS13
82+
/* Disable older TLS version prior to 1.2 */
83+
#define NO_OLD_TLS
84+
85+
/* Enable default TLS extensions */
86+
#define HAVE_TLS_EXTENSIONS
87+
#define HAVE_SUPPORTED_CURVES
88+
#define HAVE_EXTENDED_MASTER
89+
#define HAVE_ENCRYPT_THEN_MAC
90+
#define HAVE_SERVER_RENEGOTIATION_INFO
91+
//#define HAVE_SNI /* optional Server Name Indicator (SNI) */
92+
93+
/* ASN */
94+
#define WOLFSSL_ASN_TEMPLATE /* use newer ASN template asn.c code (default) */
95+
96+
/* Disable Features */
97+
#define NO_SESSION_CACHE /* disable session resumption */
98+
#define NO_PSK /* pre-shared-key support */
99+
100+
/* ------------------------------------------------------------------------- */
101+
/* Algorithms */
102+
/* ------------------------------------------------------------------------- */
103+
/* RNG */
104+
#define HAVE_HASHDRBG /* Use DRBG SHA2-256 and seed */
105+
106+
/* Enable ECC */
107+
#define HAVE_ECC
108+
#define ECC_USER_CURVES /* Enable only ECC curves specific */
109+
#undef NO_ECC256 /* Enable SECP256R1 only (on by default) */
110+
#define ECC_TIMING_RESISTANT /* Enable Timing Resistance */
111+
/* Optional ECC calculation speed improvement if not using SP implementation */
112+
//#define ECC_SHAMIR
113+
114+
/* Enable SHA2-256 only (on by default) */
115+
#undef NO_SHA256
116+
//#define USE_SLOW_SHA256 /* Reduces code size by not partially unrolling */
117+
118+
/* Enable AES GCM only */
119+
#define HAVE_AESGCM
120+
#define GCM_SMALL /* use small GHASH table */
121+
#define NO_AES_CBC /* Disable AES CBC */
122+
123+
/* Optional Features */
124+
//#define WOLFSSL_BASE64_ENCODE /* Enable Base64 encoding */
125+
126+
127+
/* Disable Algorithms */
128+
#define NO_RSA
129+
#define NO_DH
130+
#define NO_SHA
131+
#define NO_DSA
132+
#define NO_RC4
133+
#define NO_MD4
134+
#define NO_MD5
135+
#define NO_DES3
136+
#define NO_PWDBASED
137+
#define WOLFSSL_NO_SHAKE128
138+
#define WOLFSSL_NO_SHAKE256
139+
140+
/* ------------------------------------------------------------------------- */
141+
/* Debugging */
142+
/* ------------------------------------------------------------------------- */
143+
#undef DEBUG_WOLFSSL
144+
#undef NO_ERROR_STRINGS
145+
#if 0
146+
#define DEBUG_WOLFSSL
147+
#else
148+
#if 1
149+
#define NO_ERROR_STRINGS
150+
#endif
151+
#endif
152+
153+
#ifdef __cplusplus
154+
}
155+
#endif
156+
157+
158+
#endif /* WOLFSSL_USER_SETTINGS_H */

0 commit comments

Comments
 (0)