SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
Constant-time cryptography and assembly acceleration

SharkSSL combines constant-time native cryptography with processor-specific assembly to reduce the cost of secure connections and encrypted data transfers. You keep the same public APIs while choosing the implementation that fits your processor, toolchain and memory budget.

The full source includes assembly backends for Arm Cortex-M, AArch64, x86/x64, RISC-V, ESP32-S3 Xtensa, Renesas RX and MIPS. Each accelerates a specific set of operations; use the platform guide to choose the files and configuration. The product page explains the source packages, including which distribution supplies the assembly sources.

What constant-time means here

The native software AES block and AES-GCM paths use fixed-access bitsliced AES; GCM also uses fixed-access GHASH. Secret key and data values do not select lookup-table addresses, branches or shift counts in those implementations. The x86/x64 and AArch64 AES-GCM assembly paths retain that constant-time design.

Native ECC private-key operations use timing-resistant arithmetic. The optional P-256 and P-384 field backends preserve fixed control and memory-access schedules. Use the public cryptographic APIs, whose private-key paths select the required operations; a generic internal BigInt helper is not necessarily a constant-time private-key interface.

Constant-time describes execution with respect to secret values, not an equal duration for every message length or key size. Compiler output, processor instruction timing and the selected backend matter. Hardware accelerators and external PSA providers have their own security properties; the software claim does not establish power-analysis, fault-injection or tamper resistance.

Find an accelerated backend

Target family Available acceleration examples Port guides
x86 and x64 AES-NI/PCLMULQDQ, optional VAES on x64, ChaCha20/Poly1305, SHA-2; x64 also provides curve, BigInt and Keccak backends SharkSSL 64-bit x86 cryptography (GCC), SharkSSL 64-bit x86 cryptography (MSVC), SharkSSL 32-bit x86 cryptography (GCC), SharkSSL 32-bit x86 cryptography (MSVC)
AArch64 AES/GHASH crypto instructions, ChaCha20/Poly1305, SHA-2, curve/BigInt, Keccak and ML-KEM kernels SharkSSL AArch64 cryptography (GCC), SharkSSL AArch64 cryptography (IAR)
Arm Cortex-M Curve/BigInt arithmetic, cipher/hash helpers, optional Helium kernels and PQC kernels selected for the core SharkSSL Cortex-M cryptography (GCC), SharkSSL Cortex-M cryptography (IAR)
RISC-V and ESP32-P4 RV32IM curve/BigInt arithmetic, ML-KEM kernels and P4 PIE acceleration; P4 also has optional peripheral adapters SharkSSL RV32IM cryptography (GCC), SharkSSL ESP32-P4 PIE and peripheral cryptography (GCC)
ESP32-S3 Xtensa Keccak and ML-KEM assembly, with optional AES and hash peripherals SharkSSL ESP32-S3 cryptography (GCC)
Renesas RX Curve/BigInt, cipher/hash and PQC kernels for the selected RX core SharkSSL Renesas RX cryptography (GCC), SharkSSL Renesas RX cryptography (IAR)
MIPS32 BigInt word operations, ChaCha20, Keccak and selected ML-KEM polynomial operations SharkSSL MIPS32 cryptography (GCC)

For Kinetis MMCAU and Nordic CRACEN integrations, see SharkSSL Kinetis K60 cryptography and SharkSSL Nordic CRACEN integration. The table is an orientation map; each port's requirements define its actual algorithm, instruction-set and toolchain coverage.

Select speed and footprint together

  1. Enable the algorithm and public API your application needs. Optimization flags do not enable disabled algorithms.
  2. Select only the corresponding backend flags and source files. Match the ABI, byte order and target options across C, assembly and the application.
  3. Preserve the port's CPU feature checks and fallback rules. For example, x86/x64 dispatch can retain portable paths on CPUs without the selected instructions; globally enabling newer instructions can defeat that fallback.
  4. Choose compact or unrolled variants for the target's flash/cache and RAM budget. Measure the workload that matters: handshake latency, sustained throughput and peak memory are different results.

The configuration reference documents the selectors, including SHARKSSL_OPTIMIZED_AES_ASM, SHARKSSL_OPTIMIZED_GCM_ASM, SHARKSSL_ECC_P256_ASM and SHARKSSL_ECC_P384_ASM. Use the documented workload and build conditions when comparing backend performance. Compact code can win on a small instruction cache even when it executes more instructions.

For hybrid key exchange and PQC kernel selection, see Post-quantum cryptography. For a complete build procedure and source list, use the matching Ports guide and Configure SharkSSL for Your Build.