|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
Use this project to call the PSA Crypto API with SharkSSL as its provider on Windows. Choose portable C or the assembly-enabled library for Win32 or x64. For the provider's supported operations and initialization, see the PSA provider guide.
Open build/VC-Win/SharkSSLPSA.sln in Visual Studio 2022 or 2026. Alternatively, run this command from the SharkSSL root in a Visual Studio Developer Command Prompt:
The solution builds SharkSSLPSA.lib under build/VC-Win/lib/<Platform>/<Configuration>/. It includes native SharkSSL cryptography and the PSA provider sources. It is independent of examples.sln; applications choose explicitly whether to link this PSA provider.
The project selects the MSVC toolset for the installed Visual Studio version (v143 for 2022 or v145 for 2026) and targets Windows SDK 10.0.26100.0. Install that SDK or retarget the project to an SDK available on the build host.
| Configuration | Win32 | x64 |
|---|---|---|
Debug, Release | Portable C | Portable C |
DebugAsm, ReleaseAsm | AES-NI/GHASH, AVX2 ChaCha20/Poly1305, SHA-256, X25519 AVX2 with integer ASM fallback | AES-NI/GHASH and optional VAES, AVX2 ChaCha20/Poly1305, SHA-256/384/512, X25519 BMI2/ADX, P-256/P-384 fields, BigInt and Keccak |
The Asm configurations include all required MASM files, CPU probes and X25519 adapters. They use runtime dispatch where supported; assembly inclusion alone does not guarantee a particular CPU path is selected. Win32 MASM objects use /safeseh. The AES context uses the standard shipped AES-256 layout, so no MASM preprocessor offset override is needed. Win32 retains the portable C BigInt and P-256/P-384 field paths; the x64 assembly configurations select their matching MASM backends. See the acceleration guide for timing properties and the x64 port for backend details.
Include inc/psa/crypto.h and link the library for the application's architecture and configuration. Also link bcrypt.lib for Windows entropy. Use /MD for Release or /MDd for Debug to match the library's C runtime.
Keep the application and library on consistent SharkSSL_cfg.h options, especially options affecting AES contexts or public structures. Rebuild both after changing those settings.
Initialize the provider before calling PSA operations, following the provider lifecycle. Its native RNG uses SHA-256 Hash_DRBG; initial seeding requires 48 entropy bytes and subsequent atomic reseeds require 32. The Windows entropy adapter supplies these bytes from the operating system.