Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build and tests for wolfSSL #352

Merged
merged 16 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ jobs:
wolfssl:
runs-on: ubuntu-latest
strategy:
fail-fast: false
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved
matrix:
wolfssl:
- { ref: "v5.1.1-stable", name: "5.1.1"}
- { ref: "v5.2.0-stable", name: "5.2.0" }
- { ref: "v5.3.0-stable", name: "5.3.0"}
- { ref: "v5.7.0-stable", name: "5.7.0"}
name: wolfSSL ${{ matrix.wolfssl.name }}
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,18 @@ target_include_directories(jwt-cpp INTERFACE $<BUILD_INTERFACE:${JWT_INCLUDE_PAT

if(${JWT_SSL_LIBRARY} MATCHES "OpenSSL")
target_link_libraries(jwt-cpp INTERFACE OpenSSL::SSL OpenSSL::Crypto)
target_compile_definitions(jwt-cpp INTERFACE JWT_OPENSSL)
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved
endif()

if(${JWT_SSL_LIBRARY} MATCHES "LibreSSL")
target_link_libraries(jwt-cpp INTERFACE LibreSSL::TLS)
target_compile_definitions(jwt-cpp INTERFACE JWT_LIBRESSL)
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved
endif()

if(${JWT_SSL_LIBRARY} MATCHES "wolfSSL")
target_link_libraries(jwt-cpp INTERFACE PkgConfig::wolfssl)
# This is required to access OpenSSL compatibility API
target_include_directories(jwt-cpp INTERFACE ${wolfssl_INCLUDE_DIRS})
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved
target_compile_definitions(jwt-cpp INTERFACE OPENSSL_EXTRA OPENSSL_ALL)
endif()

if(NOT JWT_DISABLE_PICOJSON AND JWT_EXTERNAL_PICOJSON)
Expand Down
4 changes: 4 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ The minimum is `jwt.h` but you will need to add the defines:

- [`JWT_DISABLE_BASE64`](https://github.com/Thalhammer/jwt-cpp/blob/c9a511f436eaa13857336ebeb44dbc5b7860fe01/include/jwt-cpp/jwt.h#L11)
- [`JWT_DISABLE_PICOJSON`](https://github.com/Thalhammer/jwt-cpp/blob/c9a511f436eaa13857336ebeb44dbc5b7860fe01/include/jwt-cpp/jwt.h#L4)
- The SSL library being used needs to be defined:
- `JWT_OPENSSL` for OpenSSL (Default)
- `JWT_LIBRESSL` for LibreSSL
- `JWT_WOLFSSL` for wolfSSL
prince-chrismc marked this conversation as resolved.
Show resolved Hide resolved

In addition to providing your own JSON traits implementation, see [traits.md](traits.md) for more information.

Expand Down
2 changes: 2 additions & 0 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@

#if defined(LIBWOLFSSL_VERSION_HEX)
#define JWT_OPENSSL_1_1_1
#include <wolfssl/options.h>
#include <wolfssl/version.h>
#endif

#ifndef JWT_CLAIM_EXPLICIT
Expand Down
2 changes: 1 addition & 1 deletion tests/HelperTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace {
std::string google_cert =
// This is to handle the different subject alternate name ordering
// see https://github.com/wolfSSL/wolfssl/issues/4397
#ifdef LIBWOLFSSL_VERSION_HEX
#if defined(LIBWOLFSSL_VERSION_HEX) && LIBWOLFSSL_VERSION_HEX < 0x05007000
R"(-----BEGIN CERTIFICATE-----
MIIFfTCCBOagAwIBAgIKYFOB9QABAACIvTANBgkqhkiG9w0BAQUFADBGMQswCQYD
VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu
Expand Down
Loading
Loading