/* SPDX-License-Identifier: GPL-3.0-only */ #ifndef SAK_WOLF_CRYPTO_POLICY_H #define SAK_WOLF_CRYPTO_POLICY_H #include /* PR10133 recommends this existing check for older releases. In 5.8.2 the * software validator must not be replaced with a successful hardware stub. */ #if !defined(HAVE_ECC) || !defined(WOLFSSL_VALIDATE_ECC_IMPORT) || \ !defined(HAVE_ECC_CHECK_KEY) #error "wolf crypto policy: ECC requires validated imports" #endif #if defined(NO_ECC_CHECK_PUBKEY_ORDER) || defined(WOLF_CRYPTO_CB_ONLY_ECC) || \ defined(WOLFSSL_ATECC508A) || defined(WOLFSSL_ATECC608A) || \ defined(WOLFSSL_CRYPTOCELL) || defined(WOLFSSL_SILABS_SE_ACCEL) || \ defined(WOLFSSL_SE050) || defined(WOLFSSL_STM32_PKA) #error "wolf crypto policy: review ECC validation backend before changing it" #endif #ifndef WOLFSSL_ECDHX_SHARED_NOT_ZERO #error "wolf crypto policy: X25519 requires all-zero shared-secret rejection" #endif /* PR9275 selects small math on Xtensa to avoid compiler-introduced timing * differences. Check resolved settings, not just command-line intentions. * https://github.com/wolfSSL/wolfssl/pull/9275 */ #if !defined(HAVE_CURVE25519) || !defined(CURVE25519_SMALL) #error "wolf crypto policy: X25519 requires CURVE25519_SMALL" #endif #if !defined(HAVE_ED25519) || !defined(ED25519_SMALL) #error "wolf crypto policy: Ed25519 requires ED25519_SMALL" #endif /* 5.8.2 excludes small math from automatic blinding and rejects this pairing. * Do not force blinding back on: key layout and function signatures differ. */ #ifdef WOLFSSL_CURVE25519_BLINDING #error "wolf crypto policy: small X25519 is incompatible with blinding" #endif #if defined(HAVE_CURVE448) || defined(HAVE_ED448) #error "wolf crypto policy: review PR9275 small math before enabling 448" #endif #endif