compat.openssl
#includeOpenSSL — TLS/crypto library (static, install()-driven build)
#include <openssl/ssl.h>
mcpp add compat.openssl@3.5.1
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// 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_*) — libssl.lib / libcrypto.lib on Windows. 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 supported on all three platforms now (linux/macOS: perl Configure + GNU
// Make; windows: VC-WIN64A + nmake), so the real test runs everywhere.
#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;
// …
tests/examples/openssl/tests/tls.cpp · 项目 tests/examples/openssl
构建
- targets
openssl (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
include
源文件 (1)
mcpp_openssl_anchor.c