|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
#include "SharkSslConfigEndian.h"Go to the source code of this file.
Macros | |
| #define | SHARKSSL_TLS_1_3 1 |
| TLS 1.3 stack Disable by setting SHARKSSL_TLS_1_3=0. More... | |
| #define | SHARKSSL_TLS_1_2 1 |
| TLS 1.2 stack Disable by setting SHARKSSL_TLS_1_2=0. More... | |
| #define | SHARKSSL_PSA_KEY_SLOTS 12 |
| Number of volatile key slots in the SharkSSL PSA provider. More... | |
| #define | SHARKSSL_PSA_DYNAMIC_KEY_SLOTS 0 |
| Select 1 to allocate SharkSSL PSA provider key slots on demand. More... | |
| #define | SHARKSSL_PSA_CONSUMER_SECRET_HANDLES 0 |
| Select 1 to use an external PSA Crypto provider for TLS operations. More... | |
| #define | SHARKSSL_PSA_CONSUMER_STRICT_IDENTITY 0 |
| Select 1 to require a PSA signing key for every local TLS identity. More... | |
| #define | SHARKSSL_RFC_9846_CONFORMANCE_PROFILE 0 |
| Select 1 to enforce the compile-time feature set required by the general RFC 9846 profile. More... | |
| #define | SHARKSSL_USE_AES_256 1 |
| Enable/disable AES 256. More... | |
| #define | SHARKSSL_USE_AES_128 1 |
| Enable/disable AES 128. More... | |
| #define | SHARKSSL_USE_AES_192 0 |
| AES-192 is not used in SSL/TLS enable only if needed in application using the crypto API. More... | |
| #define | SHARKSSL_ENABLE_AES_GCM 1 |
| AES-GCM requires AES: the AES-GCM ciphersuites are included. More... | |
| #define | SHARKSSL_AES_GCM_CT_M4_ASM 0 |
| The native software AES is constant time: SharkSslAesCtx (block encryption and decryption, CBC, CTR, CCM, the PSA AES ciphers and key wrap) and AES-GCM use a fixed-access bitsliced AES, and AES-GCM a fixed-access GHASH. More... | |
| #define | SHARKSSL_AES_GCM_CT_MVE_ASM 0 |
| Select the Cortex-M85 Helium (MVE) GHASH for software CT AES-GCM, instead of SHARKSSL_AES_GCM_CT_M4_ASM. More... | |
| #define | SHARKSSL_AES_CT_KEY_ASM 0 |
| Run the AES-128/192/256 key expansion of the bitsliced AES in Thumb-2 on little-endian Cortex-M4/M7/M33/M85: compile crypto/Cortex-M_GCC/SharkSslAesCT_M4.S (GCC) or crypto/Cortex-M_IAR/SharkSslAesCT_M4.s (IAR) with the same options. More... | |
| #define | SHARKSSL_USE_CHACHA20 1 |
| AES-CCM requires AES: only for crypto functions - CCM TLS ciphersuites removed. More... | |
| #define | SHARKSSL_USE_SHA_384 1 |
| SHA256 support for certificate signatures and the SHA256 ciphersuites. More... | |
| #define | SHARKSSL_USE_POLY1305 1 |
| Enable/disable SHA512 support; Note SHA512 is not required by SSL/TLS. More... | |
| #define | SHARKSSL_SSL_SERVER_CODE 1 |
| Select 1 to enable SERVER side TLS. More... | |
| #define | SHARKSSL_ENABLE_CLIENT_AUTH 1 |
| Select 1 to enable client authentication from server. More... | |
| #define | SHARKSSL_MAX_HANDSHAKE_LENGTH 0x00004000UL |
| Select 1 to enable support for Post Handshake Authentication (RFC 8446 sections 4.2.6 and 4.6.2) More... | |
| #define | SHARKSSL_ENABLE_HELLO_RETRY_REQUEST SHARKSSL_TLS_1_3 |
| Compile TLS 1.3 HelloRetryRequest handling. More... | |
| #define | SHARKSSL_TLS_1_3_INITIAL_KEY_SHARE_X25519_ONLY 0 |
| Select 1 to send only an X25519 key share in the initial TLS 1.3 ClientHello. More... | |
| #define | SHARKSSL_TLS_1_3_INITIAL_BRAINPOOL_GROUP 0 |
| Select one RFC 8734 Brainpool group as the initial TLS 1.3 key share Set to TLS_NAMEDGROUP_BRAINPOOLP256R1TLS13, P384R1TLS13, or P512R1TLS13 Zero retains the usual initial key shares. More... | |
| #define | SHARKSSL_ENABLE_KEY_UPDATE SHARKSSL_TLS_1_3 |
| Select 1 to enable TLS 1.3 KeyUpdate support (RFC 9846 section 4.7.3; RFC 8446 section 4.6.3). More... | |
| #define | SHARKSSL_TLS_1_3_AES_GCM_KEY_UPDATE_THRESHOLD 0x00800000UL |
| Number of TLS 1.3 records that may be encrypted with one AES-GCM key before SharkSSL proactively sends a KeyUpdate. More... | |
| #define | SHARKSSL_SSL_CLIENT_CODE 1 |
| Select 1 to enable CLIENT side TLS. More... | |
| #define | SHARKSSL_RANDOMIZE_EXTENSIONS 1 |
| Select 1 to randomize the order of extensions in ClientHello. More... | |
| #define | SHARKSSL_ENABLE_SNI 1 |
| Select 1 to enable support for Server Name Indication. More... | |
| #define | SHARKSSL_ENABLE_CA_EXTENSION 1 |
| Select 1 to enable support for Certificate Authorities extension (RFC 8446 section 4.2.4) Note: SHARKSSL_TLS_1_3 and SHARKSSL_ENABLE_CA_LIST must be enabled. More... | |
| #define | SHARKSSL_ENABLE_RSA 1 |
| Select 0 to disable RSA: the RSA ciphersuites in TLS 1.2 and RSA certificates and signatures in TLS 1.2 and TLS 1.3. More... | |
| #define | SHARKSSL_ENABLE_SESSION_CACHE 1 |
| Select 1 to enable session caching. More... | |
| #define | SHARKSSL_ENABLE_SECURE_RENEGOTIATION SHARKSSL_TLS_1_2 |
| Select 1 to enable renegotiation Only secure renegotiation (RFC 5746) is supported Note: with the default define below, it is enabled whenever TLS 1.2 is NOTE: IMPLEMENTED ONLY ON THE SERVER SIDE. More... | |
| #define | SHARKSSL_ENABLE_DHE_RSA 0 |
| Enable legacy TLS 1.2 DHE_RSA ciphersuites. More... | |
| #define | SHARKSSL_DHE_MIN_PRIME_BITS 2048 |
| Minimum size in bits of the DHE_RSA prime p sent by a server: the client aborts the handshake with an insufficient_security alert when p is shorter. More... | |
| #define | SHARKSSL_USE_SHA_256 1 |
| TLS 1.2/1.3 require SHA-256, do not modify the following settings. More... | |
| #define | SHARKSSL_ENABLE_SELECT_CIPHERSUITE 1 |
| Enable/disable the SharkSslCon_selectCiphersuite API. More... | |
| #define | SHARKSSL_SELECT_CIPHERSUITE_LIST_DEPTH 8 |
| Determine the number of ciphersuites that can be selected, in decreasing order of preference; this value is only in effect if the SHARKSSL_ENABLE_SELECT_CIPHERSUITE is selected. More... | |
| #define | SHARKSSL_ENABLE_ALPN_EXTENSION 1 |
| Enable/disable ALPN API (support for ALPN extension, RFC 7301) More... | |
| #define | SHARKSSL_ENABLE_RSA_API 1 |
| Enable/disable RSA API (sharkssl_RSA_public_encrypt, sharkssl_RSA_private_decrypt, sharkssl_RSA_private_encrypt, sharkssl_RSA_public_decrypt, SharkSslRSAKey_size) More... | |
| #define | SHARKSSL_ENABLE_RSA_PKCS1 1 |
| Enable the native RSA key generator. More... | |
| #define | SHARKSSL_ENABLE_ECDSA_API 1 |
| Enable/disable RSASSA-PSS padding in RSA API (RFC 8017) (SHARKSSL_ENABLE_RSA_API must be enabled to use RSASSA-PSS through the RSA API) More... | |
| #define | SHARKSSL_ECDSA_ONLY_VERIFY 0 |
| Disable ECDSA sign API functions (sharkssl_ECDSA_sign, SharkSslECDSA_siglen) - effective only if ECDSA API is compiled (SHARKSSL_ENABLE_ECDSA_API must be enabled); used to achieve minimum code size in crypto-only builds. More... | |
| #define | SHARKSSL_ENABLE_PEM_API 1 |
| Select 1 to enable PEM certs/keys decoding If RSA_API is enabled, then also the functions sharkssl_PEM_to_RSAKey and SharkSslRSAKey_free are available If ECDSA_API is enabled, then also the functions sharkssl_PEM_to_ECCKey and SharkSslECCKey_free are available. More... | |
| #define | SHARKSSL_ENABLE_INFO_API 1 |
| Enable/disable support for encrypted PKCS#8 certificates in sharkssl_PEM function (requires SHARKSSL_ENABLE_AES_CBC and SHARKSSL_USE_SHA_256) More... | |
| #define | SHARKSSL_ENABLE_CERT_CHAIN 1 |
| Select 1 to enable certificate chain support. More... | |
| #define | SHARKSSL_ENABLE_CA_LIST 1 |
| Select 1 to enable CA check (client or server with client auth) More... | |
| #define | SHARKSSL_ENABLE_CERTSTORE_API 1 |
| Select 1 to enable certificate storage. More... | |
| #define | SHARKSSL_ENABLE_CERT_KEYUSAGE 0 |
| Select 1 to enable SharkSslCertInfo_parseCert for local DER certificates. More... | |
| #define | SHARKSSL_MD5_SMALL_FOOTPRINT 0 |
| Select 1 for smaller, but slower MD5. More... | |
| #define | SHARKSSL_SHA1_SMALL_FOOTPRINT 0 |
| Select 1 for smaller, but slower SHA1. More... | |
| #define | SHARKSSL_SHA256_SMALL_FOOTPRINT 0 |
| Select 1 for smaller, but slower SHA256. More... | |
| #define | SHARKSSL_BIGINT_EXP_SLIDING_WINDOW_K 4 |
| Select a window size between 1 (slower, less RAM) and 5. More... | |
| #define | SHARKSSL_BIGINT_MULT_LOOP_UNROLL 1 |
| Select 0 for smaller multiplication loops or 1 to unroll them. More... | |
| #define | SHARKSSL_ENABLE_AES_CTR_MODE 1 |
| Select 1 to include AES CTR mode (USE_AES_xxx must be enabled) More... | |
| #define | SHARKSSL_AES_CIPHER_LOOP_UNROLL 1 |
| Select 0 for smaller AES loops or 1 to unroll them. More... | |
| #define | SHARKSSL_UNALIGNED_ACCESS 0 |
| Select 1 if your architecture supports unaligned memory access (x86, ARM-Cortex-M3, ColdFire) More... | |
| #define | SHARKSSL_USE_ECC 1 |
| Elliptic Curve Cryptography. More... | |
| #define | SHARKSSL_ENABLE_ECDSA 1 |
| Select 1 to enable generation and verification of elliptic curve digital signatures. More... | |
| #define | SHARKSSL_ECC_VERIFY_POINT 1 |
| Select 1 to verify that a point lies on a curve; TLS 1.3 always enables this verification for peer key shares. More... | |
| #define | SHARKSSL_ECC_FIXED_BASE_COMB 1 |
| Enable Ed25519/Ed448 support (RFC 8032). More... | |
| #define | SHARKSSL_ECC_MULT_FIXED_WINDOW 4 |
| Compute k*Q for any other point Q of SECP256R1, SECP384R1 and SECP521R1 (ECDH shared secret) with a fixed window of this many bits and the same timing resistance as generic multiplication. More... | |
| #define | SHARKSSL_ECC_SMALL_FOOTPRINT 0 |
| Select 1 for smaller and slower ECDSA signing and fixed-base comb code with the same timing resistance. More... | |
| #define | SHARKSSL_ECC_USE_SECP256R1 1 |
| Enable/disable the SECP256R1 curve. More... | |
| #define | SHARKSSL_ECC_USE_SECP384R1 1 |
| Enable/disable the SECP384R1 curve. More... | |
| #define | SHARKSSL_ECC_USE_SECP521R1 1 |
| Enable/disable the SECP521R1 curve. More... | |
| #define | SHARKSSL_ECC_USE_BRAINPOOLP256R1 1 |
| Enable/disable the brainpoolP256r1 curve (RFC 5639) More... | |
| #define | SHARKSSL_ECC_USE_BRAINPOOLP384R1 1 |
| Enable/disable the brainpoolP384r1 curve (RFC 5639) More... | |
| #define | SHARKSSL_ECC_USE_BRAINPOOLP512R1 1 |
| Enable/disable the brainpoolP512r1 curve (RFC 5639) More... | |
| #define | SHARKSSL_ECC_USE_CURVE25519 1 |
| Enable/disable the Curve25519 curve (RFC 7748) More... | |
| #define | SHARKSSL_ENABLE_X25519_API 1 |
| Enable/disable the X25519 public API (sharkssl_X25519_createKeyPair, sharkssl_X25519_sharedSecret) More... | |
| #define | SHARKSSL_X25519_DEDICATED 1 |
| Select 1 to use dedicated Curve25519 field arithmetic (SharkSslBigInt.c) modulo p = 2^255 - 19, with a fixed inversion chain. More... | |
| #define | SHARKSSL_ECC_USE_CURVE448 0 |
| Enable/disable the Curve448 curve (RFC 7748) More... | |
| #define | SHARKSSL_ENABLE_ECDHE_RSA 1 |
| Select 1 to enable ECDHE_RSA ciphersuites (RFC 8422) Elliptic Curve Cryptography (SHARKSSL_USE_ECC) must be enabled RSA (SHARKSSL_ENABLE_RSA) must be enabled. More... | |
| #define | SHARKSSL_ENABLE_ECDHE_ECDSA 1 |
| Select 1 to enable ECDHE_ECDSA ciphersuites (RFC 8422) Elliptic Curve Cryptography (SHARKSSL_USE_ECC) must be enabled SHARKSSL_ENABLE_ECDSA must be set. More... | |
| #define | SHARKSSL_OPTIMIZED_BIGINT_ASM 0 |
| Select the full BigInt assembly backend: add, subtract, right shift, multiplication and Montgomery reduction. More... | |
| #define | SHARKSSL_OPTIMIZED_BIGINT_WORD_ASM 0 |
| Select an assembly backend for BigInt add, subtract and right shift only. More... | |
| #define | SHARKSSL_ECC_P256_ASM 0 |
| Select 1 to use the assembly for the P-256 (secp256r1) field arithmetic: on Cortex-M4/M7 SharkSslP256_M4.S for GCC, SharkSslP256_M4.s for IAR and Keil; on RXv2/RXv3 SharkSslP256_RX.S for GCC, SharkSslP256_RX.s for IAR; on AArch64 SharkSslP256_ARM64.S for GCC; on RV32IM SharkSslP256_RISCV.S for GCC. More... | |
| #define | SHARKSSL_ECC_P384_ASM 0 |
| Select 1 to use the assembly for the P-384 (secp384r1) field arithmetic: on Cortex-M4/M7 SharkSslP384_M4.S for GCC, SharkSslP384_M4.s for IAR and Keil; on RXv2/RXv3 SharkSslP384_RX.S for GCC, SharkSslP384_RX.s for IAR; on AArch64 SharkSslP384_ARM64.S for GCC. More... | |
| #define | SHARKSSL_OPTIMIZED_CHACHA_ASM 0 |
| Enabling assembler optimized CHACHA requires SharkSslCrypto_XX.s. More... | |
| #define | SHARKSSL_OPTIMIZED_POLY1305_ASM 0 |
| Enabling assembler optimized POLY requires SharkSslCrypto_XX.s. More... | |
| #define | SHARKSSL_OPTIMIZED_SHA256_ASM 0 |
| Enabling assembler SHA-256 requires the target backend. More... | |
| #define | SHARKSSL_OPTIMIZED_SHA384_ASM 0 |
| Enabling assembler SHA-384 and SHA-512 requires the target backend. More... | |
| #define | SHARKSSL_OPTIMIZED_GHASH_ASM 0 |
| Enabling assembler optimized GHASH requires SharkSslCrypto_XX.s. More... | |
| #define | SHARKSSL_OPTIMIZED_GCM_ASM 0 |
| Enabling the combined assembler AES-GCM block kernel requires SharkSslCrypto_XX.s. More... | |
| #define | SHARKSSL_OPTIMIZED_AES_ASM 0 |
| Enabling the assembler AES block cipher requires SharkSslAes_XX.s: AES-NI on x86/x64, AES-CE on ARM64 (with SharkSslCrypto_ARM64.c). More... | |
| #define | SHARKSSL_AES_CT_NEON 0 |
| The constant-time bitsliced AES on AArch64 Advanced SIMD (NEON) registers, eight blocks per call: CTR, CBC decryption and the software AES-GCM use it for three or more blocks. More... | |
| #define | SHARKSSL_OPTIMIZED_GCM_VAES_ASM 0 |
| Enabling the VAES/VPCLMULQDQ AES-GCM backend requires the VAES assembly file and its CPUID probe in addition to the AES-NI kernel. More... | |
| #define | SHARKSSL_RNG_MULTITHREADED 1 |
| The native cryptographic RNG is SHA-256 Hash_DRBG (SP 800-90A Rev. More... | |
| #define | SHARKSSL_NOPACK 0 |
| Select 1 to keep every optional field of the public structures whatever the configuration, so that their layout does not depend on the selected options. More... | |
| #define | SHARKSSL_CHECK_DATE 0 |
| SharkSslCon_trusted also checks certificate expiration and returns SharkSslConTrust_CertCnDate if date(s) are within: timeFrom <= now and timeTo >= now This setting requires baGetUnixTime() returning the correct time. More... | |
| #define | SHARKSSL_ENABLE_RSASSA_PSS 1 |
| sanity defines — do not edit below this line! More... | |
SharkSSL feature defaults and dependency checks.
Start with a working project for your platform. Keep the TLS library, crypto implementation, application, and any assembly sources on the same configuration. Rebuild them together after changing options that affect interfaces or context layouts.
| Build | Where settings come from |
|---|---|
| Standalone SharkSSL | The selected TargConfig.h supplies platform adaptation. SharkSSL_cfg.h includes SharkSSL_opts.h, then supplies missing defaults. Use project compiler definitions or the selected options file. |
| PSA consumer | Set SHARKSSL_PSA_CONSUMER=1, select the provider headers, and compile the consumer adapters. Link one provider; the flag alone does not supply it. |
| SharkSSL PSA provider | Build src/psa separately. Its storage, driver, slot, and algorithm settings belong to the provider, not an arbitrary external provider used by a consumer. |
Most feature switches are integer booleans, 0 or 1. Size/count/selector macros have their own ranges and units in SharkSSL_cfg.h. Use numeric #if tests for numeric switches. The SHARKSSL_TINY block in SharkSSL_opts.h uses a presence test and includes unsafe security/algorithm choices; follow Build for a Constrained Device instead of enabling that recipe.
Normal applications include SharkSSL.h. It loads the selected platform's TargConfig.h, then configuration options and byte-order validation before any crypto implementation uses them. Direct configuration consumers, including preprocessed assembly, must receive the same settings as the C sources.
| Macro | Type, values, and default |
|---|---|
BA_BYTE_ORDER | Integer selector describing the actual target representation. Normally derived from a recognized compiler or platform fact. If neither is available, the application must select one of the two named constants below before configuration validation. |
BA_BYTE_ORDER_LITTLE_ENDIAN | Fixed integer constant 1234; applications must not redefine it. |
BA_BYTE_ORDER_BIG_ENDIAN | Fixed integer constant 4321; applications must not redefine it. |
For a port whose compiler cannot report byte order, put the following in SharkSSL_opts.h or an equivalent shared compiler definition, after confirming the target representation:
BA_BYTE_ORDER is the single byte-order selector. Ports with a known platform byte order set it when absent or reject a conflicting value directly. SharkSslConfigEndian.h supplies the two fixed constants, loads SharkSSL_opts.h once, resolves any remaining compiler-derived default and validates the selected value. The supplied BareMetal, INTEGRITY, MDK, MQX, Windows and embOS ports supply their default before including this header, then check the final selection against their platform facts.
An options-file override uses #undef BA_BYTE_ORDER before its #define, as shown above, because the port may already have supplied a default. Both options-file and command-line selections must agree with the port and recognized compiler facts. Unknown or unsupported values, altered constants, and conflicting selections cause compilation errors. Vendor CPU/RTOS constants keep their names.
Remove legacy B_LITTLE_ENDIAN and B_BIG_ENDIAN compiler definitions; they are rejected. Use numeric comparisons such as #if BA_BYTE_ORDER == BA_BYTE_ORDER_LITTLE_ENDIAN in application adaptations. Rebuild C and assembly sources together after changing target settings.
| Option family | What it selects |
|---|---|
SHARKSSL_SSL_CLIENT_CODE, SHARKSSL_SSL_SERVER_CODE | Compiled TLS roles. The SharkSsl constructor then chooses a role present in that build. These do not create sockets or start an application server. |
SHARKSSL_TLS_1_2, SHARKSSL_TLS_1_3 | Protocol implementations. Negotiation still depends on the peer and enabled algorithms. |
SHARKSSL_ENABLE_CLIENT_AUTH, SHARKSSL_ENABLE_POST_HANDSHAKE_AUTH | TLS certificate-authentication capabilities. Applications still install identities and apply peer authorization. |
SHARKSSL_ENABLE_CA_LIST, SHARKSSL_CHECK_DATE | CA-validation support and certificate-date checking. Expected-name checks and application trust decisions remain required. |
SHARKSSL_ENABLE_PEM_API, SHARKSSL_ENABLE_CERTSTORE_API | Runtime key/certificate conversion and CA-list assembly. These are separate from generating a CSR or issuing a certificate. |
SHARKSSL_ENABLE_CSR_CREATION, SHARKSSL_ENABLE_CSR_SIGNING, SHARKSSL_ENABLE_ASN1_KEY_CREATION | Optional ASN.1/CSR utilities declared in SharkSslASN1.h and SharkSslCSR.h. These selectors are not defined by SharkSSL_cfg.h; undefined selectors behave as 0. A project can supply earlier definitions. Link the corresponding src/util/SharkSslCSR.c implementation. |
SHARKSSL_ENABLE_RSAKEY_CREATE, SHARKSSL_ENABLE_ECCKEY_CREATE | Native key generation. A PSA consumer uses provider key generation and key-handle APIs instead. |
SHARKSSL_ENABLE_RSA_API, SHARKSSL_ENABLE_ECDSA_API, SHARKSSL_ENABLE_X25519_API | Standalone public-key interfaces. Availability of an algorithm inside TLS does not automatically select every standalone API. |
| AES/GCM, ChaCha20/Poly1305, hashes, curves, and TLS signature flags | Native algorithm and TLS capabilities, subject to their dependencies. A PSA build additionally needs provider support. |
SHARKSSL_ENABLE_AES_CBC, SHARKSSL_ENABLE_AES_CCM, SHARKSSL_ENABLE_AES_CTR_MODE, SHARKSSL_USE_AES_192 | Application crypto and applicable key-conversion support. Current TLS does not offer CBC/CCM suites or AES-192 suites. |
SHARKSSL_ENABLE_SESSION_CACHE | TLS session-resumption support. The separate client cache manager needs its implementation and application integration. |
SHARKSSL_PSA_KEY_SLOTS, SHARKSSL_PSA_DYNAMIC_KEY_SLOTS | Capacity/allocation policy of the SharkSSL PSA provider. They do not configure another vendor's PSA provider. |
SHARKSSL_PSA_CONSUMER_* | TLS consumer policy and optional application crypto adapters. See SharkSSL PSA consumer. |
Dependencies are checked by the selected headers. Passing those checks establishes only the encoded compile-time prerequisites; it does not prove that all source files, provider algorithms, or target services are present. For macro defaults use the header reference, then check earlier overrides. The documentation build exposes optional APIs for discovery and is not a compiler-settings recipe for a product.
Native SharkSSL uses SHA-256 Hash_DRBG. The implementation follows NIST SP 800-90A Rev. 1, sections 10.1.1 and 10.3.1, with nonce requirements from section 8.6.7. It is original SharkSSL code using the existing SHA-256 primitive. Algorithm support does not imply CAVP or FIPS module validation.
Native builds (SHARKSSL_PSA_CONSUMER=0) always use Hash_DRBG. PSA consumers (SHARKSSL_PSA_CONSUMER=1) use their selected provider's RNG. There is no separate native RNG algorithm selector. Do not define SHARKSSL_USE_RNG_TINYMT or SHARKSSL_USE_RNG_FORTUNA in the build. A nonzero value causes a configuration error.
The application must supply entropy before using the native RNG, before starting threads when SHARKSSL_RNG_MULTITHREADED is enabled. Call sharkssl_entropyEx(seed, seedLen) with at least 48 unpredictable bytes for initial seeding and at least 32 fresh bytes for subsequent reseeds. It initializes or reseeds the DRBG atomically and returns zero on success.
In a PSA consumer build, sharkssl_entropy(void) initializes the selected provider; complete any required hardware or storage setup first. The provider manages entropy, and sharkssl_entropyEx is not exposed to the consumer.
sharkssl_rng retains its nonzero, multiple-of-four output-length contract. The native DRBG context and its lifecycle functions remain private.
The SharkSSL PSA provider obtains 48 bytes on first initialization and 32 fresh bytes before each subsequent nonempty random request. Windows uses BCryptGenRandom, Linux uses getrandom, and bare-metal builds provide sharkssl_psa_get_entropy. A PSA consumer delegates to its selected provider and does not instantiate a second native RNG.
Supply entropy from an appropriate OS or hardware source and handle errors. Buffer length alone does not establish entropy quality. Clock values, addresses and fixed example constants do not provide a seed; legacy demonstration placeholders must be replaced. The Kinetis MMCAU backend now shares this DRBG and needs application-supplied entropy too. Rebuild C and assembly with the same configuration after migrating.
The FreeRTOS, BareMetal, MDK, embOS and template ports require an application implementation of U32 baGetUnixTime(void). Link that function with the application. These ports supply no default clock implementation; a build that uses the clock without supplying it will fail to link.
The return value is an unsigned 32-bit count of seconds. Reads must not advance the clock. Session and ticket expiry require advancing elapsed seconds. When SHARKSSL_CHECK_DATE=1, return UTC seconds since 1970-01-01 and initialize the clock before evaluating certificate trust. With date checks disabled, an application may use a monotonic seconds clock for session expiry. Account for hardware counter wrap and tick frequency in the application; raw ticks and milliseconds are not seconds.
To map an existing application clock, declare that function and define the baGetUnixTime() macro before including TargConfig.h. The mapped function must meet the same contract. A function implemented in C++ must use C linkage when linked with the C library.
The Windows, POSIX, INTEGRITY and default mbed ports use time(0); initialize their wall clock as required by the platform. ThreadX and MQX retain their platform clock integration and require correct application initialization and time units.
SHARKSSL_DISABLE_INBUF_EXPANSION is an optional integer boolean. When undefined it behaves as 0: the TLS input buffer can grow. Value 1 prevents that expansion; incoming records/handshakes must fit the supplied capacity. It is used by SharkSslCon.c and SharkSslCon.h, rather than defined among the public configuration defaults. Follow the SharkSslCon_getBuf and SharkSslCon_getBufLen contracts for every receive.
SHARKSSL_X25519_ASM is a port-specific integer boolean, normally left undefined (0). The dedicated X25519 code in SharkSslBigInt.c checks that it is used with SHARKSSL_X25519_DEDICATED=1 and a supported Cortex-M DSP or little-endian RX target. Other assembly adapters use SHARKSSL_X25519_ASM_HOOK; these switches are not interchangeable. Follow the matching Ports guide for source files and compiler options.
Selecting a macro does not add assembly files, an entropy source, a socket adapter, or persistent storage to the build.
| #define SHARKSSL_ENABLE_RSASSA_PSS 1 |
sanity defines — do not edit below this line!
The SHARKSSL_BIGINT_TIMING_RESISTANT option has been removed. Reject configurations that still select its former variable-time mode. The SHARKSSL_ECC_TIMING_RESISTANT option has been removed: the ECC code is always timing resistant. Reject configurations that still select its former variable-time mode. TLS 1.3 sanity #defines