Skip to content

Commit ca33469

Browse files
committed
Add missing AES build macros
1 parent 6329f64 commit ca33469

1 file changed

Lines changed: 360 additions & 0 deletions

File tree

wolfSSL/src/chapter02.md

Lines changed: 360 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,106 @@ Enables AES-GCM support.
726726
727727
Enables AES-XTS support.
728728
729+
#### WOLFSSL_AES_128
730+
731+
Enables AES-128 key size support. Enabled by default. Disable to remove AES-128 and reduce code size when only larger key sizes are needed.
732+
733+
#### WOLFSSL_AES_192
734+
735+
Enables AES-192 key size support. Enabled by default. Disable to remove AES-192 and reduce code size.
736+
737+
#### WOLFSSL_AES_256
738+
739+
Enables AES-256 key size support. Enabled by default. Disable to remove AES-256 when not needed.
740+
741+
#### AES_MAX_KEY_SIZE
742+
743+
Sets the maximum AES key size in bits. Defaults to 256. Can be set to 128 or 192 to reduce code and memory usage.
744+
745+
#### HAVE_AES_ECB
746+
747+
Enables AES-ECB (Electronic Codebook) mode. Off by default. ECB mode encrypts each block independently and is generally not recommended for most applications, but is needed by some protocols.
748+
749+
#### HAVE_AES_DECRYPT
750+
751+
Enables AES decryption support. On by default. Can be disabled to save code size on platforms that only need AES encryption (e.g., GCM encryption-only).
752+
753+
#### WOLFSSL_AES_COUNTER
754+
755+
Enables AES-CTR (Counter) mode. Turns a block cipher into a stream cipher using an incrementing counter.
756+
757+
#### WOLFSSL_AES_CFB
758+
759+
Enables AES-CFB (Cipher Feedback) mode. Includes CFB-1, CFB-8, CFB-64, and CFB-128 sub-modes unless restricted by [`WOLFSSL_NO_AES_CFB_1_8`](#wolfssl_no_aes_cfb_1_8).
760+
761+
#### WOLFSSL_NO_AES_CFB_1_8
762+
763+
Disables AES-CFB-1 and AES-CFB-8 sub-modes when [`WOLFSSL_AES_CFB`](#wolfssl_aes_cfb) is enabled. Reduces code size when only CFB-64/128 are needed.
764+
765+
#### WOLFSSL_AES_OFB
766+
767+
Enables AES-OFB (Output Feedback) mode. OFB mode turns AES into a stream cipher and does not require padding.
768+
769+
#### WOLFSSL_AES_CTS
770+
771+
Enables AES-CTS (Ciphertext Stealing) mode. CTS allows encrypting data that is not a multiple of the block size without padding.
772+
773+
#### WOLFSSL_AES_SIV
774+
775+
Enables AES-SIV (Synthetic Initialization Vector) mode (RFC 5297). A nonce-misuse resistant AEAD mode that provides deterministic authenticated encryption.
776+
777+
#### WOLFSSL_AES_EAX
778+
779+
Enables AES-EAX AEAD mode. EAX is a two-pass AEAD scheme built from CTR mode and OMAC (CMAC), providing authenticated encryption with associated data.
780+
781+
#### HAVE_AES_KEYWRAP
782+
783+
Enables AES Key Wrap support (RFC 3394). Used for wrapping (encrypting) cryptographic keys for secure transport.
784+
785+
#### WOLFSSL_AES_CBC_LENGTH_CHECKS
786+
787+
Enables strict validation of input data length for AES-CBC operations. When enabled, CBC encrypt/decrypt will return an error if the input length is not a multiple of the AES block size.
788+
789+
#### HAVE_AESGCM_DECRYPT
790+
791+
Enables AES-GCM decryption support. On by default when [`HAVE_AESGCM`](#have_aesgcm) is enabled. Can be disabled on constrained devices that only need GCM encryption.
792+
793+
#### WOLFSSL_AESGCM_STREAM
794+
795+
Enables streaming AES-GCM API. Allows processing AES-GCM data incrementally rather than all at once, useful for large data or memory-constrained environments.
796+
797+
#### WC_AES_GCM_DEC_AUTH_EARLY
798+
799+
Authenticates the GCM tag before performing decryption. Provides fail-fast behavior when the authentication tag does not match, avoiding unnecessary decryption of invalid ciphertext.
800+
801+
#### GCM_TABLE
802+
803+
Use a pre-computed 4-bit lookup table for AES-GCM Galois field multiplication. Faster than [`GCM_SMALL`](#gcm_small) but uses more memory. See also [`GCM_TABLE_4BIT`](#gcm_table_4bit) and [`GCM_WORD32`](#gcm_word32).
804+
805+
#### GCM_TABLE_4BIT
806+
807+
Explicit option for 4-bit GCM lookup table mode. Functions similarly to [`GCM_TABLE`](#gcm_table).
808+
809+
#### GCM_WORD32
810+
811+
Use a 32-bit word implementation for AES-GCM Galois field multiplication. An alternative to [`GCM_SMALL`](#gcm_small) and [`GCM_TABLE`](#gcm_table) that works well on platforms without 64-bit support.
812+
813+
#### GCM_GMULT_LEN
814+
815+
Enables GCM GMULT length optimization for processing multiple blocks of AAD or ciphertext in a single GMULT call.
816+
817+
#### WOLFSSL_AESXTS_STREAM
818+
819+
Enables streaming AES-XTS API. Allows processing AES-XTS data incrementally across multiple update calls rather than a single operation.
820+
821+
#### WC_AESXTS_STREAM_NO_REQUEST_ACCOUNTING
822+
823+
Disables request accounting in the streaming AES-XTS API. Removes overhead of tracking data unit boundaries when not needed.
824+
825+
#### WC_AES_XTS_SUPPORT_SIMULTANEOUS_ENC_AND_DEC_KEYS
826+
827+
Allows an AES-XTS context to hold both encryption and decryption keys simultaneously. By default, XTS contexts support only one direction at a time to save memory.
828+
729829
#### HAVE_CAMELLIA
730830
731831
Enables Camellia support.
@@ -1705,6 +1805,178 @@ Or
17051805
extern int custom_rand_generate_block(unsigned char* output, unsigned int sz);
17061806
```
17071807
1808+
#### WC_NO_RNG
1809+
1810+
Disables all RNG (Random Number Generator) support. Use when the application provides its own random data or when no randomness is needed (e.g., deterministic operations only).
1811+
1812+
#### HAVE_HASHDRBG
1813+
1814+
Enables the Hash-based Deterministic Random Bit Generator (DRBG) per NIST SP 800-90A. This is the default RNG implementation in wolfSSL using SHA-256 as the underlying hash.
1815+
1816+
#### WC_RNG_BLOCKING
1817+
1818+
Makes RNG operations blocking, retrying on transient failures rather than returning an error. Useful on platforms where the entropy source may temporarily be unavailable.
1819+
1820+
#### WC_VERBOSE_RNG
1821+
1822+
Enables verbose debug output for RNG operations. Prints detailed information about seed generation, DRBG state, and health test results.
1823+
1824+
#### WC_RNG_SEED_CB
1825+
1826+
Enables a custom seed callback function for the DRBG. Allows the application to provide its own entropy source via `wc_SetSeed_Cb()`.
1827+
1828+
#### WC_RNG_BANK_SUPPORT
1829+
1830+
Enables RNG bank support for pre-generating random data. Allows buffering random bytes in advance for faster subsequent random number requests.
1831+
1832+
#### WOLFSSL_RNG_USE_FULL_SEED
1833+
1834+
Uses the full seed length (384 bits) for DRBG seeding instead of the minimum required. Provides additional entropy margin.
1835+
1836+
#### WOLFSSL_GENSEED_FORTEST
1837+
1838+
Uses a deterministic seed source for testing purposes. WARNING: This produces predictable random output and must never be used in production.
1839+
1840+
#### WOLFSSL_KEEP_RNG_SEED_FD_OPEN
1841+
1842+
Keeps the `/dev/random` or `/dev/urandom` file descriptor open between seed operations instead of opening and closing it each time. Reduces overhead on systems with frequent reseeding.
1843+
1844+
#### CUSTOM_RAND_GENERATE
1845+
1846+
Allows the user to define a custom random word generator function. The function should return a single random word (`unsigned int`).
1847+
1848+
#### CUSTOM_RAND_GENERATE_SEED_OS
1849+
1850+
Allows the user to define a custom OS-level seed generator function, replacing the default platform-specific `GenerateSeed()` while still using the wolfSSL DRBG on top.
1851+
1852+
#### HAVE_ENTROPY_MEMUSE
1853+
1854+
Enables the memory-use based entropy source. This entropy source measures timing variations in memory access patterns (cache hits/misses) to generate entropy for DRBG seeding.
1855+
1856+
#### ENTROPY_MEMUSE_FORCE_FAILURE
1857+
1858+
Forces the memory-use entropy source to fail. Used for testing error handling paths in the entropy collection code.
1859+
1860+
#### HAVE_GETRANDOM
1861+
1862+
Indicates that the Linux `getrandom()` syscall is available for entropy collection. Automatically detected on supported platforms.
1863+
1864+
#### WOLFSSL_GETRANDOM
1865+
1866+
Enables use of the `getrandom()` syscall as the entropy source for DRBG seeding on Linux systems. More reliable than reading from `/dev/urandom` as it blocks until sufficient entropy is available.
1867+
1868+
#### FORCE_FAILURE_GETRANDOM
1869+
1870+
Forces the `getrandom()` syscall to fail. Used for testing fallback entropy source paths.
1871+
1872+
#### NO_DEV_URANDOM
1873+
1874+
Disables use of `/dev/urandom` for random seeding. When defined along with [`NO_DEV_RANDOM`](#no_dev_random), an alternative seed source must be provided.
1875+
1876+
#### HAVE_AMD_RDSEED
1877+
1878+
Enables use of AMD's RDSEED instruction for direct hardware entropy. Similar to [`HAVE_INTEL_RDSEED`](#have_intel_rdseed) but for AMD processors.
1879+
1880+
#### IDIRECT_DEV_RANDOM
1881+
1882+
Specifies a custom path for the random device on iDirect platforms instead of the default `/dev/random`.
1883+
1884+
#### WIN_REUSE_CRYPT_HANDLE
1885+
1886+
Reuses the Windows `CryptContext` handle between random number generation calls instead of acquiring and releasing it each time. Improves performance on Windows.
1887+
1888+
#### WC_RNG_SEED_APT_CUTOFF
1889+
1890+
Sets the cutoff value for the DRBG Adaptive Proportion Test (APT). The APT detects degradation in the entropy source by checking if any single value appears too frequently within a window.
1891+
1892+
#### WC_RNG_SEED_APT_WINDOW
1893+
1894+
Sets the window size for the DRBG Adaptive Proportion Test (APT). Defines how many samples are examined in each test window.
1895+
1896+
#### WC_RNG_SEED_RCT_CUTOFF
1897+
1898+
Sets the cutoff value for the DRBG Repetition Count Test (RCT). The RCT detects catastrophic entropy source failure by checking for consecutive identical outputs.
1899+
1900+
#### STM32_RNG
1901+
1902+
Enables the STM32 hardware Random Number Generator peripheral for entropy collection.
1903+
1904+
#### STM32_NUTTX_RNG
1905+
1906+
Enables STM32 hardware RNG access through the NuttX RTOS `/dev/random` interface.
1907+
1908+
#### WOLFSSL_STM32F427_RNG
1909+
1910+
Enables hardware RNG support specific to the STM32F427 microcontroller.
1911+
1912+
#### WOLFSSL_STM32_RNG_NOLIB
1913+
1914+
Enables direct register access to the STM32 RNG peripheral without using the STM32 HAL library. Useful for bare-metal deployments.
1915+
1916+
#### WOLFSSL_PIC32MZ_RNG
1917+
1918+
Enables the Microchip PIC32MZ hardware Random Number Generator for entropy collection.
1919+
1920+
#### FREESCALE_RNGA
1921+
1922+
Enables the Freescale/NXP RNGA (Random Number Generator Accelerator) hardware peripheral.
1923+
1924+
#### FREESCALE_K70_RNGA
1925+
1926+
Enables RNGA support specific to the Freescale/NXP Kinetis K70 microcontroller family.
1927+
1928+
#### FREESCALE_RNGB
1929+
1930+
Enables the Freescale/NXP RNGB (Random Number Generator version B) hardware peripheral.
1931+
1932+
#### FREESCALE_KSDK_2_0_RNGA
1933+
1934+
Enables Freescale/NXP RNGA through the KSDK 2.0 SDK driver interface.
1935+
1936+
#### FREESCALE_KSDK_2_0_TRNG
1937+
1938+
Enables Freescale/NXP TRNG (True Random Number Generator) through the KSDK 2.0 SDK driver interface.
1939+
1940+
#### MAX3266X_RNG
1941+
1942+
Enables the Maxim MAX3266X hardware Random Number Generator.
1943+
1944+
#### QAT_ENABLE_RNG
1945+
1946+
Enables hardware RNG through the Intel QuickAssist Technology (QAT) accelerator.
1947+
1948+
#### WOLFSSL_ATECC_RNG
1949+
1950+
Enables hardware RNG from the Microchip ATECC508A/ATECC608A secure element.
1951+
1952+
#### WOLFSSL_SILABS_TRNG
1953+
1954+
Enables the Silicon Labs True Random Number Generator (TRNG) for entropy collection.
1955+
1956+
#### WOLFSSL_SCE_NO_TRNG
1957+
1958+
Disables the TRNG on Renesas Secure Crypto Engine (SCE). AES and other SCE features remain available but RNG uses a software implementation.
1959+
1960+
#### WOLFSSL_SCE_TRNG_HANDLE
1961+
1962+
Specifies the Renesas SCE TRNG handle to use for random number generation.
1963+
1964+
#### WOLFSSL_SE050_NO_TRNG
1965+
1966+
Disables the TRNG on NXP SE050 secure element. Other SE050 crypto operations remain available.
1967+
1968+
#### WOLFSSL_PSA_NO_RNG
1969+
1970+
Disables RNG through the Platform Security Architecture (PSA) crypto API. Use when PSA is enabled but RNG should use a different source.
1971+
1972+
#### HAVE_IOTSAFE_HWRNG
1973+
1974+
Enables hardware RNG from an IoT-Safe compliant SIM card or secure element.
1975+
1976+
#### WOLFSSL_XILINX_CRYPT_VERSAL
1977+
1978+
Enables crypto hardware support on Xilinx Versal platforms, including the hardware TRNG for entropy collection.
1979+
17081980
#### NO_PUBLIC_GCM_SET_IV
17091981
17101982
Use this if you have done your own custom hardware port and not provided a public implementation of [`wc_AesGcmSetIV()`](group__AES.md#function-wc_aesgcmsetiv)
@@ -1977,6 +2249,94 @@ Enables use of Intel’s AVX/AVX2 instructions for accelerating AES, ChaCha20, P
19772249
19782250
Enables use of AES accelerated operations which are built into some Intel and AMD chipsets. When using this define, the `aes_asm.asm` (for Windows with at&t syntax) or `aes_asm.S` file is used to optimize via the Intel AES new instruction set (AESNI).
19792251
2252+
#### WOLFSSL_AESNI_BY4
2253+
2254+
Enables 4-block parallel AES-NI processing. Processes four AES blocks simultaneously using AES-NI pipelining for improved throughput. Requires [`WOLFSSL_AESNI`](#wolfssl_aesni).
2255+
2256+
#### WOLFSSL_AESNI_BY6
2257+
2258+
Enables 6-block parallel AES-NI processing. Processes six AES blocks simultaneously using AES-NI pipelining for maximum throughput. Requires [`WOLFSSL_AESNI`](#wolfssl_aesni).
2259+
2260+
#### WOLFSSL_AES_SMALL_TABLES
2261+
2262+
Uses smaller AES S-box lookup tables. Reduces code/data size at the cost of slightly slower AES operations. Useful for memory-constrained embedded targets.
2263+
2264+
#### WOLFSSL_AES_NO_UNROLL
2265+
2266+
Disables loop unrolling in AES round functions. Reduces code size at the cost of performance. Useful for constrained environments where code size matters more than speed.
2267+
2268+
#### WOLFSSL_AES_TOUCH_LINES
2269+
2270+
Touch all AES table cache lines before lookups to provide side-channel resistance. Mitigates cache-timing attacks by ensuring all table entries are in cache before use.
2271+
2272+
#### WC_AES_BITSLICED
2273+
2274+
Enables bitsliced AES implementation. Uses a bitwise-parallel technique that processes multiple blocks simultaneously and provides constant-time execution for side-channel resistance.
2275+
2276+
#### AES_GCM_GMULT_NCT
2277+
2278+
Enables non-constant-time GCM GMULT implementation. Faster but not protected against cache-timing side-channel attacks. Only use when side-channel resistance is not required.
2279+
2280+
#### NO_WOLFSSL_ALLOC_ALIGN
2281+
2282+
Disables aligned memory allocation for AES contexts. By default, AES contexts are aligned to cache line boundaries for performance. Disable on platforms that do not support aligned allocation.
2283+
2284+
#### WC_ASYNC_ENABLE_AES
2285+
2286+
Enables asynchronous AES operations. Allows AES encrypt/decrypt to be offloaded to hardware accelerators using the wolfSSL async crypto framework.
2287+
2288+
#### WOLFSSL_CRYPTOCELL_AES
2289+
2290+
Enables AES acceleration using ARM CryptoCell hardware. Requires the CryptoCell SDK and [`WOLFSSL_CRYPTOCELL`](#wolfssl_cryptocell).
2291+
2292+
#### WOLFSSL_DEVCRYPTO_AES
2293+
2294+
Enables AES acceleration via Linux `/dev/crypto` interface. Requires [`WOLFSSL_DEVCRYPTO`](#wolfssl_devcrypto).
2295+
2296+
#### WOLFSSL_DEVCRYPTO_CBC
2297+
2298+
Enables AES-CBC acceleration via Linux `/dev/crypto` interface. Requires [`WOLFSSL_DEVCRYPTO`](#wolfssl_devcrypto).
2299+
2300+
#### WOLFSSL_KCAPI_AES
2301+
2302+
Enables AES operations through the Linux kernel crypto API (AF_ALG). Offloads AES to the kernel's crypto subsystem.
2303+
2304+
#### WOLFSSL_NO_KCAPI_AES_CBC
2305+
2306+
Disables AES-CBC through KCAPI when [`WOLFSSL_KCAPI_AES`](#wolfssl_kcapi_aes) is enabled. Useful when only non-CBC AES modes are needed through the kernel crypto API.
2307+
2308+
#### WOLFSSL_PSA_NO_AES
2309+
2310+
Disables AES through the Platform Security Architecture (PSA) crypto API. Use when PSA is enabled but AES should use the software implementation instead.
2311+
2312+
#### WOLFSSL_SCE_NO_AES
2313+
2314+
Disables AES through the Renesas Secure Crypto Engine (SCE). Use when SCE is enabled but AES should use the software implementation.
2315+
2316+
#### NO_IMX6_CAAM_AES
2317+
2318+
Disables AES acceleration on NXP i.MX6 CAAM (Cryptographic Acceleration and Assurance Module). Use when CAAM is enabled but AES should use the software implementation.
2319+
2320+
#### WOLFSSL_AFALG_XILINX_AES
2321+
2322+
Enables AES acceleration through AF_ALG on Xilinx platforms. Uses the Xilinx crypto hardware via the Linux AF_ALG interface.
2323+
2324+
#### NO_WOLFSSL_ESP32_CRYPT_AES
2325+
2326+
Disables ESP32 hardware AES acceleration. Use when building for ESP32 but AES should use the software implementation.
2327+
2328+
#### STM32_CRYPTO_AES_ONLY
2329+
2330+
Restricts STM32 hardware crypto to AES operations only. Other algorithms will use software implementations even when STM32 crypto hardware is available.
2331+
2332+
#### WC_DEBUG_CIPHER_LIFECYCLE
2333+
2334+
Enables debug logging for AES cipher context lifecycle events (init, set key, free). Useful for debugging resource leaks or double-free issues with AES contexts.
2335+
2336+
#### WOLFSSL_HW_METRICS
2337+
2338+
Enables tracking of hardware acceleration usage metrics. When enabled, wolfSSL counts how many operations were offloaded to hardware vs. handled in software, accessible via `wolfCrypt_GetHwMetrics()`.
2339+
19802340
#### HAVE_INTEL_RDSEED
19812341
19822342
Enable Intel’s RDSEED for DRBG seed source.

0 commit comments

Comments
 (0)