|
SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
|
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.
include/ only to participating targets and keep the same component mask in the adapter and its callers.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.
| 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 |
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.