mcpp index

compat.openssl

#include

OpenSSL — TLS/crypto library (static, install()-driven build)

#include <openssl/ssl.h>
mcpp add compat.openssl@3.5.1

Usage

From this repository's own test project — built and run by CI, not written for the website.

// compat.openssl end-to-end: headers resolve, both archives link, and the
// library initialises far enough to stand up a TLS context and run a digest.
//
// Touching BOTH archives is the point: libssl.a (SSL_CTX_new, TLS_method) and
// libcrypto.a (EVP_*). A link that silently dropped one, or picked up a host
// libssl.so instead of the package's own static build, fails here.
//
// HAVE_OPENSSL comes from this project's own cfg-gated cxxflags — the package
// is linux/macOS-only, so elsewhere this file is an empty main().
#ifdef HAVE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/evp.h>
#include <openssl/opensslv.h>

#include <cstring>

int main() {
    // Built from the 3.5.1 tarball this descriptor pins.
    if (OPENSSL_VERSION_MAJOR != 3 || OPENSSL_VERSION_MINOR != 5) return 1;

    // libssl: a usable client context.
    SSL_CTX* ctx = SSL_CTX_new(TLS_client_method());
// …

tests/examples/openssl/tests/tls.cpp · project tests/examples/openssl

Build

targets
openssl (lib)
language
c++23
C standard
c11
import std
no
include dirs
include

Sources (1)

  • mcpp_openssl_anchor.c

Versions

VersionPlatforms Mirrorssha256
3.5.1 latest LinuxmacOS CN GLOBAL 529043b15cff…