⬆️ Update LibreSSL version up to 4.2.1 (#410)

* Update LibreSSL version to 4.2.1 in CI configuration and documentation

* update OpenSSLErrorTest for LibreSSL 4.2.0+

Add Linux LibreSSL support in CMake presets

* add debug output to failure for all ssl libraries

* fix type in libressl version check

* chore: lint
This commit is contained in:
Chris Mc
2026-02-16 20:03:33 -08:00
committed by GitHub
parent 91848add8f
commit 179beb3627
6 changed files with 67 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ inputs:
version:
description: The desired LibreSSL version to install
required: false
default: "3.3.0"
default: "4.2.1"
runs:
using: composite
steps:

View File

@@ -55,14 +55,14 @@ jobs:
run: cmake --preset unit-tests -DOPENSSL_ROOT_DIR=/tmp -DCMAKE_CXX_FLAGS="-DOPENSSL_NO_DEPRECATED=1" -DCMAKE_C_FLAGS="-DOPENSSL_NO_DEPRECATED=1"
- run: cmake --build --preset unit-tests
- name: test
run: ctest --preset unit-tests
run: ctest --preset unit-tests --output-on-failure
libressl:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
libressl: ["3.5.3", "3.4.3", "3.3.6"]
libressl: ["4.2.1", "4.1.2", "3.9.2"]
name: LibreSSL ${{ matrix.libressl }}
steps:
- uses: actions/checkout@v4
@@ -76,7 +76,7 @@ jobs:
run: cmake --preset unit-tests -DJWT_SSL_LIBRARY:STRING=LibreSSL
- run: cmake --build --preset unit-tests
- name: test
run: ctest --preset unit-tests
run: ctest --preset unit-tests --output-on-failure
- if: github.event_name == 'push' && always()
uses: ./.github/actions/badge
@@ -106,7 +106,7 @@ jobs:
run: cmake --preset unit-tests -DJWT_SSL_LIBRARY:STRING=wolfSSL
- run: cmake --build --preset unit-tests
- name: test
run: ctest --preset unit-tests
run: ctest --preset unit-tests --output-on-failure
- if: github.event_name == 'push' && always()
uses: ./.github/actions/badge

1
.gitignore vendored
View File

@@ -318,3 +318,4 @@ build/*
package-lock.json
CMakeUserPresets.json
cmake/FindLibreSSL.cmake

View File

@@ -18,9 +18,9 @@ These are the versions which are currently being tested:
| OpenSSL | LibreSSL | wolfSSL |
| ----------------- | -------------- | -------------- |
| ![3.0.19][o3.0] | ![3.3.6][l3.3] | ![5.1.1][w5.1] |
| ![3.5.5][o3.5] :star: | ![3.4.3][l3.4] | ![5.2.0][w5.2] |
| ![3.6.1][o3.6] | ![3.5.3][l3.5] | ![5.3.0][w5.3] |
| ![3.0.19][o3.0] | ![4.2.1][l4.2] | ![5.1.1][w5.1] |
| ![3.5.5][o3.5] :star: | ![4.1.2][l4.1] | ![5.2.0][w5.2] |
| ![3.6.1][o3.6] | ![3.9.2][l3.9] | ![5.3.0][w5.3] |
> [!NOTE]
> :star: Indicates LTS (Long-Term Support) versions. [OpenSSL versions](https://openssl-library.org/policies/releasestrat/index.html) are supported as follows:
@@ -36,9 +36,9 @@ These are the versions which are currently being tested:
[o3.0]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.0.19/shields.json
[o3.5]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.5.5/shields.json
[o3.6]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/openssl/3.6.1/shields.json
[l3.3]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.3.6/shields.json
[l3.4]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.4.3/shields.json
[l3.5]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.5.3/shields.json
[l4.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.2.1/shields.json
[l4.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/4.1.2/shields.json
[l3.9]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/libressl/3.9.2/shields.json
[w5.1]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.1.1/shields.json
[w5.2]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.2.0/shields.json
[w5.3]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/Thalhammer/jwt-cpp/badges/wolfssl/5.3.0/shields.json

View File

@@ -37,6 +37,30 @@
"JWT_BUILD_TESTS": "ON"
}
},
{
"name": "mac-libressl",
"inherits": ["unit-tests"],
"displayName": "macOS Unit Tests (LibreSSL)",
"description": "This is only available on macOS and requires LibreSSL to be installed via Homebrew. You can install it with `brew install libressl`. You need to manually download the FindLibreSSL.cmake file from the LibreSSL repository and place it in the cmake/ directory of this project.",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
},
"cacheVariables": {
"JWT_SSL_LIBRARY": "LibreSSL",
"LIBRESSL_ROOT_DIR": "$env{HOMEBREW_PREFIX}/opt/libressl"
}
},
{
"name": "linux-libressl",
"inherits": ["linux", "unit-tests"],
"displayName": "Linux Unit Tests (LibreSSL)",
"description": "This is only available on Linux and requires LibreSSL to be installed. You need to manually download the FindLibreSSL.cmake file from the LibreSSL repository and place it in the cmake/ directory of this project.",
"cacheVariables": {
"JWT_SSL_LIBRARY": "LibreSSL"
}
},
{
"name": "ci-fuzzing",
"inherits": ["debug", "linux"],
@@ -103,6 +127,22 @@
"jwt-cpp-test"
]
},
{
"name": "mac-libressl",
"configurePreset": "mac-libressl",
"configuration": "Debug",
"targets": [
"jwt-cpp-test"
]
},
{
"name": "linux-libressl",
"configurePreset": "linux-libressl",
"configuration": "Debug",
"targets": [
"jwt-cpp-test"
]
},
{
"name": "ci-fuzzing",
"configurePreset": "ci-fuzzing",

View File

@@ -330,6 +330,20 @@ int EC_KEY_check_key(const EC_KEY* key) {
return origMethod(key);
}
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x4020000fL
// LibreSSL 4.2.0+ changed EVP_PKEY_get1_EC_KEY to take const EVP_PKEY*
EC_KEY* EVP_PKEY_get1_EC_KEY(const EVP_PKEY* pkey) {
static EC_KEY* (*origMethod)(const EVP_PKEY* pkey) = nullptr;
if (origMethod == nullptr) origMethod = (decltype(origMethod))dlsym(RTLD_NEXT, SYMBOL_NAME("EVP_PKEY_get1_EC_KEY"));
bool fail = fail_EVP_PKEY_get1_EC_KEY & 1;
fail_EVP_PKEY_get1_EC_KEY = fail_EVP_PKEY_get1_EC_KEY >> 1;
if (fail)
return nullptr;
else
return origMethod(pkey);
}
#else
// LibreSSL < 4.2.0 uses non-const EVP_PKEY*
EC_KEY* EVP_PKEY_get1_EC_KEY(EVP_PKEY* pkey) {
static EC_KEY* (*origMethod)(EVP_PKEY * pkey) = nullptr;
if (origMethod == nullptr) origMethod = (decltype(origMethod))dlsym(RTLD_NEXT, SYMBOL_NAME("EVP_PKEY_get1_EC_KEY"));
@@ -341,6 +355,7 @@ EC_KEY* EVP_PKEY_get1_EC_KEY(EVP_PKEY* pkey) {
return origMethod(pkey);
}
#endif
#endif
ECDSA_SIG* ECDSA_SIG_new(void) {
static ECDSA_SIG* (*origMethod)() = nullptr;