Skip to content

Commit 6329f64

Browse files
committed
Added missing ECC, Crypto CB and Wolf Port macros
1 parent f02ba84 commit 6329f64

1 file changed

Lines changed: 236 additions & 0 deletions

File tree

wolfSSL/src/chapter02.md

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,6 +1568,54 @@ This extension allows debugging callbacks through the use of signals in an envir
15681568
15691569
Enable crypto callback support. This feature is also enabled automatically when [`--enable-cryptocb`](#enable-cryptocb) is used.
15701570
1571+
#### WOLF_CRYPTO_CB_FIND
1572+
1573+
Enable find device callback functions for looking up registered crypto devices by device ID. Requires [`WOLF_CRYPTO_CB`](#wolf_crypto_cb).
1574+
1575+
#### WOLF_CRYPTO_CB_CMD
1576+
1577+
Enable command callback functions that are invoked during register and unregister of crypto callback devices. Requires [`WOLF_CRYPTO_CB`](#wolf_crypto_cb).
1578+
1579+
#### WOLF_CRYPTO_CB_COPY
1580+
1581+
Enable copy callback for algorithm structures, allowing hash and cipher state to be copied via the crypto callback framework. Requires [`WOLF_CRYPTO_CB`](#wolf_crypto_cb).
1582+
1583+
#### WOLF_CRYPTO_CB_FREE
1584+
1585+
Enable free callback for algorithm structures, allowing cleanup of crypto objects via the crypto callback framework. Requires [`WOLF_CRYPTO_CB`](#wolf_crypto_cb).
1586+
1587+
#### WOLF_CRYPTO_CB_AES_SETKEY
1588+
1589+
Enable crypto callback support for AES key setup operations. Allows hardware to handle key scheduling. Requires [`WOLF_CRYPTO_CB`](#wolf_crypto_cb).
1590+
1591+
#### WOLF_CRYPTO_CB_RSA_PAD
1592+
1593+
Enable crypto callback support for RSA padding operations, allowing custom padding handling by hardware or external modules. Requires [`WOLF_CRYPTO_CB`](#wolf_crypto_cb).
1594+
1595+
#### DEBUG_CRYPTOCB
1596+
1597+
Enable debug InfoString functions for crypto callback operations. Useful for debugging which crypto operations are being routed to hardware.
1598+
1599+
#### WC_USE_DEVID
1600+
1601+
Specify a default device ID to use for crypto callbacks when no hardware-specific device (such as CAAM) is detected.
1602+
1603+
#### WC_NO_DEFAULT_DEVID
1604+
1605+
Disable automatic default device ID selection in the crypto callback framework. When defined, applications must explicitly pass a device ID for all crypto operations.
1606+
1607+
#### WOLFSSL_CAAM_DEVID
1608+
1609+
Defines the device ID constant (value 7) for NXP CAAM hardware crypto. Used in default device ID selection logic.
1610+
1611+
#### NO_SHA2_CRYPTO_CB
1612+
1613+
Disable crypto callback support for SHA-384 and SHA-512 operations. When defined, these hash operations will always use software implementations.
1614+
1615+
#### WOLF_CRYPTO_CB_ONLY_RSA
1616+
1617+
Restricts RSA operations to use only crypto callbacks, disabling all software RSA implementations. Useful when RSA should be delegated entirely to hardware.
1618+
15711619
#### WOLFSSL_DYN_CERT
15721620
15731621
Allow allocation of subjectCN and publicKey fields when parsing certificates even with WOLFSSL_NO_MALLOC set. If using the WOLFSSL_NO_MALLOC option with RSA certificates the public key needs to be retained for CA's for validate certificates on the peer's certificate. This appears as a ConfirmSignature error -173 BAD_FUNC_ARG, since the ca->publicKey is NULL.
@@ -1742,6 +1790,106 @@ A Fusion RTOS implementation is used for tickets to represent the difference bet
17421790
17431791
Can be used for devices which have a small stack size. This increases the use of dynamic memory in `wolfcrypt/src/integer.c`, but can lead to slower performance.
17441792
1793+
#### WOLFSSL_PTHREADS
1794+
1795+
Use pthread-based mutex and threading implementations. Auto-detected on most POSIX systems.
1796+
1797+
#### WOLFSSL_MUTEX_INITIALIZER
1798+
1799+
Use static mutex initialization (e.g., `PTHREAD_MUTEX_INITIALIZER`) instead of dynamic `pthread_mutex_init`. Useful for reducing initialization overhead.
1800+
1801+
#### WC_MUTEX_OPS_INLINE
1802+
1803+
Use inlined mutex operations instead of function calls. Can improve performance on platforms where mutex operations are frequent.
1804+
1805+
#### WOLFSSL_USE_RWLOCK
1806+
1807+
Enable reader-writer lock support for improved concurrency in read-heavy workloads.
1808+
1809+
#### WOLFSSL_THREAD_NO_JOIN
1810+
1811+
Create threads without join capability (detached threads). Useful on platforms that do not support thread joining.
1812+
1813+
#### WOLFSSL_ALGO_HW_MUTEX
1814+
1815+
Enable per-algorithm hardware mutex locks for AES, hash, public-key, and RNG operations. Useful when hardware crypto engines require serialized access.
1816+
1817+
#### WOLFSSL_CRYPT_HW_MUTEX
1818+
1819+
Master control for hardware crypto mutex initialization. When enabled, provides `wolfSSL_CryptHwMutexInit`, `Lock`, and `UnLock` functions.
1820+
1821+
#### USE_WOLFSSL_MEMORY
1822+
1823+
Enable custom memory allocation hooks (`wolfSSL_SetAllocators`). On by default. Allows replacing malloc/realloc/free with custom implementations.
1824+
1825+
#### WOLFSSL_TRACK_MEMORY
1826+
1827+
Enable memory allocation tracking and statistics. Useful for profiling memory usage in wolfSSL/wolfCrypt.
1828+
1829+
#### WOLFSSL_TRACK_MEMORY_VERBOSE
1830+
1831+
Enable verbose memory tracking output with per-allocation details. Extends [`WOLFSSL_TRACK_MEMORY`](#wolfssl_track_memory).
1832+
1833+
#### WOLFSSL_MEM_FAIL_COUNT
1834+
1835+
Count malloc failures for testing. Allows testing error handling paths by failing after a specified number of allocations.
1836+
1837+
#### WOLFSSL_CHECK_MEM_ZERO
1838+
1839+
Verify that sensitive memory (key material, etc.) is properly zeroed on free. Debug tool for detecting potential key material leaks.
1840+
1841+
#### WOLFSSL_GMTIME
1842+
1843+
Provide a custom gmtime implementation for platforms without standard C library time functions.
1844+
1845+
#### STRING_USER
1846+
1847+
User provides all string function implementations. Disables built-in string function wrappers.
1848+
1849+
#### USE_WOLF_STRTOK
1850+
1851+
Use wolfSSL's built-in strtok implementation for portability on platforms without strtok_r.
1852+
1853+
#### USE_WOLF_STRSEP
1854+
1855+
Use wolfSSL's built-in strsep implementation for portability.
1856+
1857+
#### USE_WOLF_STRLCPY
1858+
1859+
Use wolfSSL's built-in strlcpy implementation for portability on platforms without BSD strlcpy.
1860+
1861+
#### USE_WOLF_STRLCAT
1862+
1863+
Use wolfSSL's built-in strlcat implementation for portability.
1864+
1865+
#### USE_WOLF_STRCASECMP
1866+
1867+
Use wolfSSL's built-in case-insensitive string comparison for portability.
1868+
1869+
#### USE_WOLF_STRNCASECMP
1870+
1871+
Use wolfSSL's built-in length-limited case-insensitive string comparison for portability.
1872+
1873+
#### USE_WOLF_STRDUP
1874+
1875+
Use wolfSSL's built-in strdup implementation for portability.
1876+
1877+
#### WOLFSSL_ATOMIC_OPS
1878+
1879+
Enable atomic operations for thread-safe reference counting and other operations without requiring full mutexes.
1880+
1881+
#### WOLFSSL_USER_DEFINED_ATOMICS
1882+
1883+
User-provided atomic operation implementations. Define this when the platform requires custom atomic primitives.
1884+
1885+
#### WOLFSSL_LEANPSK
1886+
1887+
Lean PSK (Pre-Shared Key) build with minimal features. Reduces code size by disabling non-essential features.
1888+
1889+
#### WOLF_C89
1890+
1891+
Enable C89 compatibility mode. Ensures the codebase compiles with strict C89/ANSI C compilers.
1892+
17451893
#### ALT_ECC_SIZE
17461894
17471895
If using fast math and RSA/DH you can define this to reduce your ECC memory consumption. Instead of using stack for ECC points it will allocate from the heap.
@@ -1841,6 +1989,94 @@ Enable Intel’s RDRAND instruction for wolfSSL’s random source.
18411989
18421990
Enables ECC Fixed Point Cache, which speeds up repeated operations against same private key. Can also define number of entries and LUT bits using `FP_ENTRIES` and `FP_LUT` to reduce default static memory usage.
18431991
1992+
#### FP_ENTRIES
1993+
1994+
Defines the number of cache entries (default 15) for the ECC fixed-point multiplication lookup table. Requires [`FP_ECC`](#fp_ecc). Adjust to balance memory usage and performance.
1995+
1996+
#### FP_LUT
1997+
1998+
Sets the lookup table bit size (2-12, default 8) for ECC fixed-point precomputation. Larger values use more memory but provide faster verification. Requires [`FP_ECC`](#fp_ecc).
1999+
2000+
#### FP_ECC_CONTROL
2001+
2002+
Auto-selects cached fixed-point ECC verification using SP functions when [`WOLFSSL_HAVE_SP_ECC`](#wolfssl_have_sp_ecc) is available. Enabled by default when applicable.
2003+
2004+
#### HAVE_ECC_CHECK_PUBKEY_ORDER
2005+
2006+
Enables ECC public key order validation during import to detect invalid keys. Auto-enabled unless [`NO_ECC_CHECK_PUBKEY_ORDER`](#no_ecc_check_pubkey_order) is defined or hardware accelerators are in use.
2007+
2008+
#### HAVE_ECC_MAKE_PUB
2009+
2010+
Enables the `wc_ecc_make_pub` function to compute a public key from a private key. Enabled by default.
2011+
2012+
#### HAVE_ECC_VERIFY_HELPER
2013+
2014+
Enables ECC signature verification helper functions. Auto-enabled unless hardware accelerators are in use.
2015+
2016+
#### NO_ECC_CHECK_PUBKEY_ORDER
2017+
2018+
Disables ECC public key order validation checks during key import. Not recommended for production use as it skips important security validation.
2019+
2020+
#### WC_NO_CACHE_RESISTANT
2021+
2022+
Disables cache-resistant operations (conditional swaps) in ECC scalar multiplication to reduce overhead. Not recommended as it may expose operations to cache-based side-channel attacks.
2023+
2024+
#### WOLFSSL_ECC_NO_SMALL_STACK
2025+
2026+
Disables `WOLFSSL_SMALL_STACK` optimizations for ECC operations, forcing stack allocation instead of heap. Useful when stack space is plentiful and heap allocation overhead is undesirable.
2027+
2028+
#### WOLFSSL_PUBLIC_ECC_ADD_DBL
2029+
2030+
Makes `ecc_projective_add_point` and `ecc_projective_dbl_point` public APIs instead of internal-only functions. Useful for applications that need direct access to ECC point arithmetic.
2031+
2032+
#### SQRTMOD_USE_MOD_EXP
2033+
2034+
Computes square root modulo prime using modular exponentiation instead of the Jacobi symbol method for compressed key decompression. Off by default.
2035+
2036+
#### WOLFSSL_ECIES_OLD
2037+
2038+
Uses the original wolfSSL ECIES format where the public key is not included in the shared secret material. Off by default.
2039+
2040+
#### WOLFSSL_ECIES_ISO18033
2041+
2042+
Uses the ISO 18033 ECIES standard which includes the public key in the shared secret derivation. Off by default.
2043+
2044+
#### WOLFSSL_ECIES_GEN_IV
2045+
2046+
Generates a random IV for ECIES encryption instead of deriving it from the KDF output. Off by default.
2047+
2048+
#### WOLFSSL_SP_521
2049+
2050+
Enables single-precision (SP) math optimized implementation for the P-521 ECC curve. Off by default; auto-enabled when [`WOLFSSL_SP_MATH`](#wolfssl_sp_math) or [`WOLFSSL_SP_MATH_ALL`](#wolfssl_sp_math_all) is set and `HAVE_ECC521` is defined.
2051+
2052+
#### WOLFSSL_SP_SM2
2053+
2054+
Enables single-precision (SP) math optimized implementation for the SM2 curve (Chinese cryptographic standard). Auto-enabled when [`WOLFSSL_SM2`](#wolfssl_sm2) is set.
2055+
2056+
#### WOLF_CRYPTO_CB_ONLY_ECC
2057+
2058+
Restricts ECC operations to use only crypto callbacks, disabling all software ECC implementations. Useful when all ECC operations should be delegated to hardware or an external module. Off by default.
2059+
2060+
#### WC_ASYNC_ENABLE_ECC
2061+
2062+
Enables asynchronous (non-blocking) ECC operations with crypto callbacks. Requires [`WOLFSSL_ASYNC_CRYPT`](#wolfssl_async_crypt). Off by default.
2063+
2064+
#### WC_ASYNC_ENABLE_ECC_KEYGEN
2065+
2066+
Enables asynchronous ECC key generation, allowing key generation to be offloaded to hardware accelerators. Requires [`WOLFSSL_ASYNC_CRYPT`](#wolfssl_async_crypt). Off by default.
2067+
2068+
#### PLUTON_CRYPTO_ECC
2069+
2070+
Enables use of ARM Pluton trusted execution environment for ECC operations. Off by default.
2071+
2072+
#### WOLFSSL_CAAM_BLACK_KEY_SM
2073+
2074+
Uses NXP CAAM secure memory for encrypted black key storage in ECC operations. Off by default.
2075+
2076+
#### WOLFSSL_KCAPI_ECC
2077+
2078+
Offloads ECC operations to the Linux Kernel Crypto API (kcAPI) for hardware acceleration. Off by default.
2079+
18442080
#### WOLFSSL_ASYNC_CRYPT
18452081
18462082
This enables support for asynchronous cryptography using hardware based adapters such as the Intel QuickAssist or Marvell (Cavium) Nitrox V. The asynchronous code is not included in the public distribution and is available for evaluation by contacting us via email at facts@wolfssl.com.

0 commit comments

Comments
 (0)