| 1 | /* |
| 2 | * sx_ntfy_mbedtls_config.h -- minimal mbedTLS 3.6 configuration for |
| 3 | * plugin_ntfy (SCORPIOX BOT open-source ntfy channel connector). |
| 4 | * |
| 5 | * This file REPLACES mbedtls/mbedtls_config.h wholesale (the build passes |
| 6 | * -DMBEDTLS_CONFIG_FILE="sx_ntfy_mbedtls_config.h"). mbedTLS ships ~90 |
| 7 | * options that are all OFF unless listed, so everything this client needs is |
| 8 | * named here explicitly -- there is no "upstream default" to lean on. |
| 9 | * |
| 10 | * What this config is, deliberately: |
| 11 | * TLS 1.2 CLIENT ONLY. No server code (no MBEDTLS_SSL_SRV_C), no PSA |
| 12 | * keystore, no file I/O (the trust anchors arrive as an in-memory PEM |
| 13 | * bundle), no network helpers (MBEDTLS_NET_C is off -- plugin_ntfy owns |
| 14 | * its own non-blocking sockets and feeds them to mbedtls through |
| 15 | * mbedtls_ssl_set_bio(), which is the only way to keep a hard deadline on |
| 16 | * every phase of the handshake and of a long-lived subscription read). |
| 17 | * |
| 18 | * X.509 chain verification and hostname verification stay ON. There is no |
| 19 | * MBEDTLS_SSL_VERIFY_NONE code path compiled into this plugin at all: the |
| 20 | * transport refuses to talk when the certificate does not check out. |
| 21 | * |
| 22 | * Vendored from the same mbedTLS 3.6.6 tree that scorpiox code builds with |
| 23 | * (clang scorpiox/vendor/mbedtls), so both share one audited source. |
| 24 | */ |
| 25 | |
| 26 | #ifndef SX_NTFY_MBEDTLS_CONFIG_H |
| 27 | #define SX_NTFY_MBEDTLS_CONFIG_H |
| 28 | |
| 29 | /* ------------------------------------------------------------------ */ |
| 30 | /* System support */ |
| 31 | /* ------------------------------------------------------------------ */ |
| 32 | #define MBEDTLS_HAVE_ASM |
| 33 | #define MBEDTLS_HAVE_TIME |
| 34 | #define MBEDTLS_HAVE_TIME_DATE /* certificate notBefore/notAfter */ |
| 35 | #define MBEDTLS_PLATFORM_C |
| 36 | |
| 37 | /* ------------------------------------------------------------------ */ |
| 38 | /* Symmetric ciphers + modes used by the TLS 1.2 suites we allow */ |
| 39 | /* ------------------------------------------------------------------ */ |
| 40 | #define MBEDTLS_AES_C |
| 41 | #define MBEDTLS_AES_ROM_TABLES /* ROM S-boxes: smaller, constant-time */ |
| 42 | #define MBEDTLS_CIPHER_C |
| 43 | #define MBEDTLS_CIPHER_MODE_CBC |
| 44 | #define MBEDTLS_CIPHER_MODE_CTR /* required internally by GCM */ |
| 45 | #define MBEDTLS_GCM_C /* AES-GCM is what real servers pick */ |
| 46 | #define MBEDTLS_CCM_C |
| 47 | #define MBEDTLS_CIPHER_NULL_CIPHER /* not requested; kept off by omission */ |
| 48 | |
| 49 | /* ------------------------------------------------------------------ */ |
| 50 | /* Hashes / MAC */ |
| 51 | /* ------------------------------------------------------------------ */ |
| 52 | #define MBEDTLS_MD_C |
| 53 | #define MBEDTLS_SHA1_C /* legacy suites only (server chooses) */ |
| 54 | #define MBEDTLS_SHA224_C |
| 55 | #define MBEDTLS_SHA256_C |
| 56 | #define MBEDTLS_SHA384_C |
| 57 | #define MBEDTLS_SHA512_C |
| 58 | #define MBEDTLS_MD5_C /* some legacy cert chains still sign MD5 */ |
| 59 | #define MBEDTLS_POLY1305_C |
| 60 | #define MBEDTLS_CHACHAPOLY_C |
| 61 | #define MBEDTLS_CHACHA20_C |
| 62 | |
| 63 | /* ------------------------------------------------------------------ */ |
| 64 | /* RNG */ |
| 65 | /* ------------------------------------------------------------------ */ |
| 66 | #define MBEDTLS_ENTROPY_C |
| 67 | #define MBEDTLS_CTR_DRBG_C |
| 68 | |
| 69 | /* ------------------------------------------------------------------ */ |
| 70 | /* ASN.1 / OIDs / PEM */ |
| 71 | /* ------------------------------------------------------------------ */ |
| 72 | #define MBEDTLS_ASN1_PARSE_C |
| 73 | #define MBEDTLS_ASN1_WRITE_C |
| 74 | #define MBEDTLS_OID_C |
| 75 | #define MBEDTLS_BASE64_C |
| 76 | #define MBEDTLS_PEM_PARSE_C /* the bundled trust anchors are PEM */ |
| 77 | |
| 78 | /* ------------------------------------------------------------------ */ |
| 79 | /* X.509 -- verification is ON, always */ |
| 80 | /* ------------------------------------------------------------------ */ |
| 81 | #define MBEDTLS_X509_USE_C |
| 82 | #define MBEDTLS_X509_CRT_PARSE_C |
| 83 | |
| 84 | /* ------------------------------------------------------------------ */ |
| 85 | /* Public keys (key exchange + signature verification) */ |
| 86 | /* ------------------------------------------------------------------ */ |
| 87 | #define MBEDTLS_PK_C |
| 88 | #define MBEDTLS_PK_PARSE_C |
| 89 | #define MBEDTLS_PK_WRITE_C /* SPKI export for the certificate pin */ |
| 90 | #define MBEDTLS_BIGNUM_C |
| 91 | #define MBEDTLS_RSA_C |
| 92 | #define MBEDTLS_PKCS1_V15 /* RSA key exchange */ |
| 93 | #define MBEDTLS_PKCS1_V21 /* RSA-PSS signatures in TLS 1.2 */ |
| 94 | #define MBEDTLS_ECP_C |
| 95 | #define MBEDTLS_ECDH_C |
| 96 | #define MBEDTLS_ECDSA_C |
| 97 | #define MBEDTLS_ECP_DP_SECP256R1_ENABLED |
| 98 | #define MBEDTLS_ECP_DP_SECP384R1_ENABLED |
| 99 | #define MBEDTLS_ECP_DP_SECP521R1_ENABLED |
| 100 | #define MBEDTLS_ECP_DP_X25519_ENABLED |
| 101 | #define MBEDTLS_ECP_DP_SECP224R1_ENABLED |
| 102 | #define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED |
| 103 | #define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED |
| 104 | #define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED |
| 105 | |
| 106 | /* ------------------------------------------------------------------ */ |
| 107 | /* TLS 1.2 client */ |
| 108 | /* ------------------------------------------------------------------ */ |
| 109 | #define MBEDTLS_SSL_CLI_C |
| 110 | #define MBEDTLS_SSL_TLS_C |
| 111 | #define MBEDTLS_SSL_PROTO_TLS1_2 |
| 112 | #define MBEDTLS_SSL_SESSION_TICKETS /* reconnect without a full handshake */ |
| 113 | |
| 114 | /* |
| 115 | * Server Name Indication. |
| 116 | * |
| 117 | * This file replaces mbedtls_config.h wholesale, so upstream's "on by |
| 118 | * default" does NOT apply: without this line ssl_write_hostname_ext() is |
| 119 | * compiled out, mbedtls_ssl_set_hostname() still sets the verification name |
| 120 | * but the ClientHello carries no SNI extension, and any host serving several |
| 121 | * sites from one IP (every CDN fronting an ntfy relay) drops the handshake |
| 122 | * with a fatal alert. Off-by-default config files are where TLS bugs hide. |
| 123 | */ |
| 124 | #define MBEDTLS_SSL_SERVER_NAME_INDICATION |
| 125 | |
| 126 | /* Keep the peer certificate after the handshake -- plugin_ntfy reports the |
| 127 | * leaf fingerprint / checks SPKI pins against it. */ |
| 128 | #define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE |
| 129 | |
| 130 | /* ------------------------------------------------------------------ */ |
| 131 | /* Misc */ |
| 132 | /* ------------------------------------------------------------------ */ |
| 133 | #define MBEDTLS_ERROR_C /* mbedtls_strerror for the log file */ |
| 134 | #define MBEDTLS_VERSION_C |
| 135 | |
| 136 | /* Explicitly NOT defined (each one is a deliberate decision, not an |
| 137 | * oversight): MBEDTLS_NET_C, MBEDTLS_SSL_SRV_C, MBEDTLS_FS_IO, |
| 138 | * MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PKCS5_C, MBEDTLS_PKCS12_C, MBEDTLS_X509_CRL_PARSE_C, |
| 139 | * MBEDTLS_X509_CSR_PARSE_C, MBEDTLS_DEBUG_C, MBEDTLS_ECP_DP_SECP192R1_ENABLED, |
| 140 | * MBEDTLS_KEY_EXCHANGE_DHE_* (no finite-field DH: one fewer code path and |
| 141 | * modern servers never need it), MBEDTLS_SSL_RENEGOTIATION. |
| 142 | */ |
| 143 | |
| 144 | #endif /* SX_NTFY_MBEDTLS_CONFIG_H */ |