SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
OpenSSL compatibility for SharkSSL

Keep familiar OpenSSL calls while using SharkSSL for TLS and cryptography. This optional adapter lets you reuse application code that fits its supported API subset and select only the components that code needs. Memory BIOs work without a native TLS library; cryptography and TLS use your matching SharkSSL build.

The adapter provides source compatibility: rebuild your application with its headers. It is an experimental, bounded implementation, not a replacement for every OpenSSL API or a binary-compatible OpenSSL library. Start by checking the supported interfaces and limits.

Start here

  1. Run the memory BIO example to learn the object and buffer ownership rules without networking or RNG setup.
  2. Choose the components and build inputs your application needs. Add include/ only to participating targets and keep the same component mask in the adapter and its callers.
  3. For TLS, follow connection setup, initialize the random number generator (RNG) and clock, and configure peer verification before sending application data.

The openssl/*.h headers retain the supported OpenSSL API spellings; the implementation exports SharkSslOssl_ symbols. Do not mix these headers with system OpenSSL headers in one translation unit. The standard adapter headers do not advertise an OpenSSL version. The opt-in Paho profile selects the client code paths it supports.

Find the guide for your task

Task Guide
Check whether an application fits the API subset Supported OpenSSL interfaces and limits
Select components, native sources and platform hooks Build the OpenSSL compatibility adapter
Build and run the sample programs Direct-source OpenSSL compatibility examples
Manage memory buffers or custom transport callbacks BIO buffers and custom transports
Encrypt or decrypt an authenticated message Encrypt and decrypt with EVP AES-GCM
Hash, authenticate or derive keys; request random bytes Hashing, HMAC, key derivation and random bytes
Load PEM keys and sign or verify messages PEM keys and message signatures
Create TLS objects, exchange data and close a connection TLS connections and I/O
Attach sockets or integrate Paho/libevent Socket and event-loop integration
Configure trust, dates and the expected peer name Verify a TLS peer
Load identity and CA certificates from files or buffers Load TLS credentials and trust from PEM
Require a client certificate Authenticate clients with mutual TLS
Select TLS versions and explicit cipher names Select TLS versions and ciphers
Inspect the negotiated protocol and cipher Inspect the negotiated TLS connection
Negotiate an application protocol with ALPN Negotiate an application protocol with ALPN
Inspect a peer certificate or pin its public key Inspect peer certificates and public keys
Handle failures and supply per-thread error storage Handle errors and retries

Integration boundaries

Use one matching native SharkSSL implementation for crypto or TLS. The adapter requires its native backend; these components do not support a PSA consumer build. Your application owns entropy collection, RNG initialization, time, transport scheduling and synchronization. Reference counting does not make mutable contexts or connections safe for concurrent operations.

The TLS verification guide explains differences from OpenSSL, including the 24-hour certificate-start allowance. Session resumption, encrypted private-key loading, full X509 path building and OpenSSL provider loading are outside the supported subset. Check the relevant guide before assuming that a familiar API name has every OpenSSL behavior.