@@ -4779,6 +4779,212 @@ extern void uITRON4_free(void *p) ;
47794779 #endif
47804780#endif /* HAVE_ENTROPY_MEMUSE */
47814781
4782+ /* ---------------------------------------------------------------------------*/
4783+ /* Configuration validation rules */
4784+ /* These enforce build constraints across all platforms */
4785+ /* ---------------------------------------------------------------------------*/
4786+
4787+ /* Mutual Exclusivity Rules */
4788+ #if defined(WOLFSSL_SP_MATH ) && defined(WOLFSSL_SP_MATH_ALL )
4789+ #error "WOLFSSL_SP_MATH and WOLFSSL_SP_MATH_ALL are incompatible"
4790+ #endif
4791+ #if defined(WOLFCRYPT_ONLY ) && defined(OPENSSL_ALL )
4792+ #error "WOLFCRYPT_ONLY and OPENSSL_ALL are mutually incompatible"
4793+ #endif
4794+ #if defined(WOLFSSL_MAX_STRENGTH ) && defined(WOLFSSL_LEANPSK )
4795+ #error "Cannot use Max Strength and Lean PSK at the same time"
4796+ #endif
4797+ #if defined(WOLFSSL_HAVE_WOLFSCEP ) && defined(WOLFSSL_LEANTLS )
4798+ #error "Cannot use SCEP and Lean TLS at the same time"
4799+ #endif
4800+ #if defined(WOLFSSL_MAX_STRENGTH ) && defined(WOLFSSL_ALLOW_SSLV3 )
4801+ #error "Cannot use Max Strength and SSLv3 at the same time"
4802+ #endif
4803+
4804+ /* Dependency Rules (Feature X requires Feature Y) */
4805+ #if defined(WOLFSSL_SHA224 ) && defined(NO_SHA256 )
4806+ #error "SHA-224 (WOLFSSL_SHA224) requires SHA-256"
4807+ #endif
4808+ #if defined(WOLFSSL_SM2 ) && !defined(HAVE_ECC )
4809+ #error "SM2 (WOLFSSL_SM2) requires ECC (HAVE_ECC)"
4810+ #endif
4811+ #if defined(HAVE_ECC_BRAINPOOL ) && !defined(WOLFSSL_CUSTOM_CURVES )
4812+ #error "Brainpool curves (HAVE_ECC_BRAINPOOL) require WOLFSSL_CUSTOM_CURVES"
4813+ #endif
4814+ #if defined(FP_ECC ) && !defined(HAVE_ECC )
4815+ #error "FP_ECC requires ECC (HAVE_ECC)"
4816+ #endif
4817+ #if defined(HAVE_ECC_ENCRYPT ) && !defined(HAVE_ECC )
4818+ #error "ECC encrypt (HAVE_ECC_ENCRYPT) requires ECC (HAVE_ECC)"
4819+ #endif
4820+ #if defined(HAVE_ECC_ENCRYPT ) && !defined(HAVE_HKDF )
4821+ #error "ECC encrypt (HAVE_ECC_ENCRYPT) requires HKDF (HAVE_HKDF)"
4822+ #endif
4823+ #if defined(WOLFCRYPT_HAVE_ECCSI ) && !defined(HAVE_ECC )
4824+ #error "ECCSI (WOLFCRYPT_HAVE_ECCSI) requires ECC (HAVE_ECC)"
4825+ #endif
4826+ #if defined(WOLFCRYPT_HAVE_SAKKE ) && !defined(HAVE_ECC )
4827+ #error "SAKKE (WOLFCRYPT_HAVE_SAKKE) requires ECC (HAVE_ECC)"
4828+ #endif
4829+ #if !defined(WOLFCRYPT_ONLY ) && defined(HAVE_ANON ) && defined(NO_DH )
4830+ #error "Anonymous ciphers (HAVE_ANON) require DH"
4831+ #endif
4832+ #if defined(FORTRESS ) && defined(NO_AES )
4833+ #error "Fortress (FORTRESS) requires AES"
4834+ #endif
4835+ #if defined(HAVE_AESGCM ) && defined(NO_AES )
4836+ #error "AES-GCM (HAVE_AESGCM) requires AES"
4837+ #endif
4838+ #if defined(HAVE_AESCCM ) && defined(NO_AES )
4839+ #error "AES-CCM (HAVE_AESCCM) requires AES"
4840+ #endif
4841+ #if defined(WOLFSSL_AES_COUNTER ) && defined(NO_AES )
4842+ #error "AES-CTR (WOLFSSL_AES_COUNTER) requires AES"
4843+ #endif
4844+ #if defined(HAVE_ED448 ) && !defined(WOLFSSL_SHA512 )
4845+ #error "ED448 (HAVE_ED448) requires SHA-512 (WOLFSSL_SHA512)"
4846+ #endif
4847+ #if defined(WOLFSSL_SHAKE128 ) && !defined(WOLFSSL_SHA3 )
4848+ #error "SHAKE128 (WOLFSSL_SHAKE128) requires SHA-3 (WOLFSSL_SHA3)"
4849+ #endif
4850+ #if defined(WOLFSSL_SHAKE256 ) && !defined(WOLFSSL_SHA3 )
4851+ #error "SHAKE256 (WOLFSSL_SHAKE256) requires SHA-3 (WOLFSSL_SHA3)"
4852+ #endif
4853+ #if defined(HAVE_XCHACHA ) && !defined(HAVE_CHACHA )
4854+ #error "XChaCha (HAVE_XCHACHA) requires ChaCha (HAVE_CHACHA)"
4855+ #endif
4856+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_REQUIRE_FFDHE ) && \
4857+ defined(NO_DH )
4858+ #error "FFDHE-only (WOLFSSL_REQUIRE_FFDHE) requires DH"
4859+ #endif
4860+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_REQUIRE_FFDHE ) && \
4861+ !defined(HAVE_SUPPORTED_CURVES )
4862+ #error "FFDHE-only (WOLFSSL_REQUIRE_FFDHE) requires" \
4863+ " Supported Curves (HAVE_SUPPORTED_CURVES)"
4864+ #endif
4865+ #if defined(HAVE_SCRYPT ) && defined(NO_PWDBASED )
4866+ #error "scrypt (HAVE_SCRYPT) requires pwdbased"
4867+ #endif
4868+ #if defined(HAVE_OCSP ) && defined(NO_ASN )
4869+ #error "OCSP (HAVE_OCSP) requires ASN"
4870+ #endif
4871+ #if defined(HAVE_SMIME ) && defined(NO_ASN )
4872+ #error "S/MIME (HAVE_SMIME) requires ASN"
4873+ #endif
4874+ #if defined(HAVE_OCSP ) && defined(NO_RSA ) && !defined(HAVE_ECC )
4875+ #error "OCSP (HAVE_OCSP) requires RSA or ECC (HAVE_ECC)"
4876+ #endif
4877+ #if defined(HAVE_PKCS7 ) && defined(NO_RSA ) && !defined(HAVE_ECC )
4878+ #error "PKCS7 (HAVE_PKCS7) requires RSA or ECC (HAVE_ECC)"
4879+ #endif
4880+ #if defined(HAVE_PKCS7 ) && defined(NO_SHA ) && defined(NO_SHA256 )
4881+ #error "PKCS7 (HAVE_PKCS7) requires SHA or SHA-256"
4882+ #endif
4883+ #if defined(WOLFSSL_HAVE_WOLFSCEP ) && defined(NO_AES ) && defined(NO_DES3 )
4884+ #error "SCEP (WOLFSSL_HAVE_WOLFSCEP) requires AES or 3DES"
4885+ #endif
4886+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_SNIFFER ) && \
4887+ defined(NO_RSA ) && !defined(HAVE_ECC ) && !defined(HAVE_CURVE25519 )
4888+ #error "Sniffer (WOLFSSL_SNIFFER) requires RSA," \
4889+ " ECC (HAVE_ECC), or Curve25519 (HAVE_CURVE25519)"
4890+ #endif
4891+ #if !defined(NO_RSA ) && !defined(WOLFSSL_RSA_VERIFY_ONLY ) && \
4892+ defined(NO_ASN ) && !defined(WOLFCRYPT_ONLY )
4893+ #error "RSA requires ASN (NO_ASN must not be defined)"
4894+ #endif
4895+ #if !defined(NO_DSA ) && defined(NO_ASN )
4896+ #error "DSA requires ASN (NO_ASN must not be defined)"
4897+ #endif
4898+ #if !defined(WOLFCRYPT_ONLY ) && defined(NO_PSK ) && defined(NO_ASN )
4899+ #error "Enable PSK (NO_PSK must not be defined)" \
4900+ " if disabling ASN (NO_ASN)"
4901+ #endif
4902+ #if defined(WOLFSSL_WOLFSSH ) && defined(NO_HMAC )
4903+ #error "WOLFSSH (WOLFSSL_WOLFSSH) requires HMAC"
4904+ #endif
4905+
4906+ /* Conflicting Feature Rules */
4907+ #if defined(WOLFSSL_SP_MATH ) && !defined(WOLFSSL_SP_MATH_ALL )
4908+ #if defined(WOLFSSL_CUSTOM_CURVES )
4909+ #error "Cannot use SP math (WOLFSSL_SP_MATH)" \
4910+ " with custom curves (WOLFSSL_CUSTOM_CURVES)"
4911+ #endif
4912+ #if !defined(NO_DSA )
4913+ #error "Cannot use single precision math (WOLFSSL_SP_MATH) and DSA"
4914+ #endif
4915+ #if defined(WOLFCRYPT_HAVE_SRP )
4916+ #error "Cannot use SP math (WOLFSSL_SP_MATH)" \
4917+ " with SRP (WOLFCRYPT_HAVE_SRP)"
4918+ #endif
4919+ #endif
4920+ #if defined(USE_INTEGER_HEAP_MATH ) && defined(WOLFSSL_STATIC_MEMORY )
4921+ #error "Heap math (USE_INTEGER_HEAP_MATH) is incompatible" \
4922+ " with static memory (WOLFSSL_STATIC_MEMORY)"
4923+ #endif
4924+ #if defined(WC_16BIT_CPU ) && \
4925+ (defined(WOLFSSL_SP_MATH ) || defined(WOLFSSL_SP_MATH_ALL ))
4926+ #error "16-bit build (WC_16BIT_CPU) is not available with SP math"
4927+ #endif
4928+
4929+ /* Streaming Feature Rules */
4930+ #if defined(WOLFSSL_AESGCM_STREAM ) && !defined(HAVE_AESGCM )
4931+ #error "AES-GCM streaming (WOLFSSL_AESGCM_STREAM)" \
4932+ " requires AES-GCM (HAVE_AESGCM)"
4933+ #endif
4934+ #if defined(WOLFSSL_AESXTS_STREAM ) && !defined(WOLFSSL_AES_XTS )
4935+ #error "AES-XTS streaming (WOLFSSL_AESXTS_STREAM)" \
4936+ " requires AES-XTS (WOLFSSL_AES_XTS)"
4937+ #endif
4938+ #if defined(WOLFSSL_ED25519_STREAMING_VERIFY ) && !defined(HAVE_ED25519 )
4939+ #error "ED25519 streaming verify" \
4940+ " (WOLFSSL_ED25519_STREAMING_VERIFY)" \
4941+ " requires ED25519 (HAVE_ED25519)"
4942+ #endif
4943+ #if defined(WOLFSSL_ED448_STREAMING_VERIFY ) && !defined(HAVE_ED448 )
4944+ #error "ED448 streaming verify" \
4945+ " (WOLFSSL_ED448_STREAMING_VERIFY)" \
4946+ " requires ED448 (HAVE_ED448)"
4947+ #endif
4948+
4949+ /* QUIC Rules */
4950+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_QUIC ) && \
4951+ !defined(WOLFSSL_TLS13 )
4952+ #error "QUIC (WOLFSSL_QUIC) requires TLS 1.3 (WOLFSSL_TLS13)"
4953+ #endif
4954+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_QUIC ) && \
4955+ !defined(HAVE_AESGCM )
4956+ #error "QUIC (WOLFSSL_QUIC) requires AES-GCM (HAVE_AESGCM)"
4957+ #endif
4958+
4959+ /* Crypto Callback Rules */
4960+ #if defined(WC_TEST_NO_CRYPTOCB_SW_TEST ) && !defined(WOLF_CRYPTO_CB )
4961+ #error "Crypto callback SW test" \
4962+ " (WC_TEST_NO_CRYPTOCB_SW_TEST)" \
4963+ " requires WOLF_CRYPTO_CB"
4964+ #endif
4965+ #if (defined(WOLF_CRYPTO_CB_COPY ) || defined(WOLF_CRYPTO_CB_FREE )) && \
4966+ !defined(WOLF_CRYPTO_CB )
4967+ #error "Crypto callback utilities" \
4968+ " (WOLF_CRYPTO_CB_COPY/WOLF_CRYPTO_CB_FREE)" \
4969+ " require WOLF_CRYPTO_CB"
4970+ #endif
4971+
4972+ /* Early Data / Session Rules */
4973+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_EARLY_DATA ) && \
4974+ !defined(WOLFSSL_TLS13 )
4975+ #error "Early data requires TLS 1.3 (WOLFSSL_TLS13)"
4976+ #endif
4977+ #if !defined(WOLFCRYPT_ONLY ) && defined(WOLFSSL_EARLY_DATA ) && \
4978+ !defined(HAVE_SESSION_TICKET ) && defined(NO_PSK )
4979+ #error "Early data requires session tickets (HAVE_SESSION_TICKET) or PSK"
4980+ #endif
4981+
4982+ /* DES3 TLS Suite Rule - auto-disable DES3 TLS suites when DES3 is disabled */
4983+ #if !defined(WOLFCRYPT_ONLY ) && !defined(NO_DES3_TLS_SUITES ) && \
4984+ defined(NO_DES3 )
4985+ #define NO_DES3_TLS_SUITES
4986+ #endif
4987+
47824988#if defined(NO_WOLFSSL_CLIENT ) && defined(NO_WOLFSSL_SERVER ) && \
47834989 !defined(WOLFCRYPT_ONLY ) && !defined(NO_TLS )
47844990#error "If TLS is enabled please make sure either client or server is enabled."
0 commit comments