|
| 1 | +/* user_settings_tinytls13.h |
| 2 | + * |
| 3 | + * Copyright (C) 2006-2026 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 3 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 | +/* Tiny TLS 1.3 footprint profile. |
| 23 | + * |
| 24 | + * A TLS 1.3-only build that strips to a PSK + ECDHE floor (no X.509), with |
| 25 | + * X.509 cert verify, mTLS, server role, zero-heap, and PQC as opt-in adders. |
| 26 | + * The WOLFSSL_TINY_TLS13 umbrella in settings.h expands these into the |
| 27 | + * underlying wolfSSL macros; this file just selects the profile and options. |
| 28 | + * |
| 29 | + * Smallest footprint comes from a dead-code-eliminated, LTO link of a single |
| 30 | + * client/server: |
| 31 | + * cp ./examples/configs/user_settings_tinytls13.h user_settings.h |
| 32 | + * ./configure --enable-usersettings --enable-static --disable-shared \ |
| 33 | + * --disable-examples --disable-crypttests |
| 34 | + * make |
| 35 | + * # link your app: -Os -flto -ffunction-sections -fdata-sections \ |
| 36 | + * # -Wl,--gc-sections (use gcc-ar/gcc-ranlib for LTO archives) |
| 37 | + */ |
| 38 | + |
| 39 | +#ifndef WOLFSSL_USER_SETTINGS_H |
| 40 | +#define WOLFSSL_USER_SETTINGS_H |
| 41 | + |
| 42 | +#ifdef __cplusplus |
| 43 | +extern "C" { |
| 44 | +#endif |
| 45 | + |
| 46 | +/* ===== PROFILE ========================================================== */ |
| 47 | +#if 1 /* Profile A: PSK + ECDHE floor, no X.509 (smallest) */ |
| 48 | + #define WOLFSSL_TINY_TLS13 |
| 49 | +#endif |
| 50 | +#if 0 /* Profile B: + minimal X.509 cert verify (ECDSA P-256). Implies core. */ |
| 51 | + #define WOLFSSL_TINY_TLS13_CERT |
| 52 | +#endif |
| 53 | + |
| 54 | +/* ===== ROLE / AUTH ADDERS =============================================== */ |
| 55 | +#if 0 /* add TLS 1.3 server role (default is client only) */ |
| 56 | + #define WOLFSSL_TINY_TLS13_SERVER |
| 57 | +#endif |
| 58 | +#if 0 /* mutual TLS (X.509 client auth, adds ECDSA sign). Implies cert. */ |
| 59 | + #define WOLFSSL_TINY_TLS13_MUTUAL_AUTH |
| 60 | +#endif |
| 61 | +#if 0 /* add RSA-PSS cert verify (cert profile is ECDSA-only by default) */ |
| 62 | + #define WOLFSSL_TINY_TLS13_RSA_VERIFY |
| 63 | +#endif |
| 64 | + |
| 65 | +/* ===== MEMORY MODEL ===================================================== */ |
| 66 | +#if 0 /* zero-heap: static memory pool, no system malloc (deterministic RAM). |
| 67 | + * App provides the pool via wolfSSL_CTX_load_static_memory(). */ |
| 68 | + #define WOLFSSL_TINY_TLS13_STATIC_MEM |
| 69 | +#endif |
| 70 | + |
| 71 | +/* ===== SPEED ============================================================ */ |
| 72 | +#if 0 /* tiny+fast: assembly crypto instead of small-C (size up, speed up) */ |
| 73 | + #define WOLFSSL_TINY_TLS13_ASM |
| 74 | +#endif |
| 75 | + |
| 76 | +/* ===== CURVE (Profile A) =============================================== */ |
| 77 | +/* Default curve is X25519. For P-256 ECDHE instead, enable the next block. |
| 78 | + * (Profile B uses P-256 automatically for both ECDHE and ECDSA verify.) */ |
| 79 | +#if 0 |
| 80 | + #define HAVE_ECC |
| 81 | + #define ECC_USER_CURVES |
| 82 | +#endif |
| 83 | + |
| 84 | +/* ===== AEAD / HASH ADDERS (floor is AES-128-GCM + SHA-256) ============= */ |
| 85 | +#if 0 /* ChaCha20-Poly1305 */ |
| 86 | + #define HAVE_CHACHA |
| 87 | + #define HAVE_POLY1305 |
| 88 | +#endif |
| 89 | +#if 0 /* AES-256-GCM (floor is AES-128 only) */ |
| 90 | + #undef NO_AES_256 |
| 91 | + #define WOLFSSL_AES_256 |
| 92 | +#endif |
| 93 | +#if 0 /* SHA-384 (for AES-256-GCM-SHA384 etc.) */ |
| 94 | + #define WOLFSSL_SHA384 |
| 95 | +#endif |
| 96 | + |
| 97 | +/* ===== PQC ADDERS (valid on either profile; SHA-3/SHAKE pulled in auto) = */ |
| 98 | +#if 0 /* ML-DSA-65 verify-only */ |
| 99 | + #define WOLFSSL_HAVE_MLDSA |
| 100 | + #define WOLFSSL_DILITHIUM_VERIFY_ONLY |
| 101 | + #define WOLFSSL_DILITHIUM_VERIFY_SMALL_MEM |
| 102 | + #define WOLFSSL_DILITHIUM_NO_ASN1 |
| 103 | + #define WOLFSSL_NO_ML_DSA_44 |
| 104 | + #define WOLFSSL_NO_ML_DSA_87 |
| 105 | +#endif |
| 106 | +#if 0 /* ML-KEM-768 + X25519MLKEM768 hybrid */ |
| 107 | + #define WOLFSSL_HAVE_MLKEM |
| 108 | + #define WOLFSSL_WC_MLKEM |
| 109 | +#endif |
| 110 | + |
| 111 | +/* ===== PLATFORM (bare-metal defaults; adjust for your target) ========== */ |
| 112 | +#if 1 |
| 113 | + #define WOLFSSL_USER_IO /* provide your own send/recv callbacks */ |
| 114 | + #define NO_FILESYSTEM |
| 115 | + #define WOLFSSL_NO_SOCK |
| 116 | + #define NO_WRITEV |
| 117 | + #define WOLFSSL_NO_GETPID |
| 118 | +#endif |
| 119 | +/* Provide a hardware RNG seed for bare metal: |
| 120 | + * #define CUSTOM_RAND_GENERATE_SEED my_hw_seed (int f(byte*, word32)) */ |
| 121 | + |
| 122 | +#ifdef __cplusplus |
| 123 | +} |
| 124 | +#endif |
| 125 | + |
| 126 | +#endif /* WOLFSSL_USER_SETTINGS_H */ |
0 commit comments