Skip to content

Commit

Permalink
Fix old wolfSSL failures
Browse files Browse the repository at this point in the history
  • Loading branch information
julek-wolfssl committed Jun 11, 2024
1 parent d64fe8a commit f9d4940
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#ifdef JWT_WOLFSSL
#include <wolfssl/options.h>
#include <wolfssl/version.h>
#endif
#include <openssl/ec.h>
#include <openssl/ecdsa.h>
Expand Down
5 changes: 4 additions & 1 deletion tests/OpenSSLErrorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,16 @@ TEST(OpenSSLErrorTest, ExtractPubkeyFromCertReference) {
ASSERT_EQ(ec.value(), 0);
}

#if !defined(LIBWOLFSSL_VERSION_HEX) || LIBWOLFSSL_VERSION_HEX >= 0x05007000
/* Older versions of wolfSSL output different PEM encoding */
TEST(OpenSSLErrorTest, ConvertCertBase64DerToPemReference) {
std::error_code ec;
auto res = jwt::helper::convert_base64_der_to_pem(sample_cert_base64_der, ec);
ASSERT_EQ(res, sample_cert);
ASSERT_FALSE(!(!ec));
ASSERT_EQ(ec.value(), 0);
}
#endif

#ifndef LIBWOLFSSL_VERSION_HEX /* wolfSSL: limited ed support in compatibility layer */
TEST(OpenSSLErrorTest, ConvertEcdsaCertBase64DerToPemReference) {
Expand Down Expand Up @@ -1035,7 +1038,7 @@ TEST(OpenSSLErrorTest, ES256SignErrorCode) {
{&fail_EVP_DigestUpdate, 1, jwt::error::signature_generation_error::digestupdate_failed},
{&fail_EVP_DigestSignFinal, 1, jwt::error::signature_generation_error::signfinal_failed},
{&fail_EVP_DigestSignFinal, 2, jwt::error::signature_generation_error::signfinal_failed},
#ifndef LIBWOLFSSL_VERSION_HEX
#if !defined(LIBWOLFSSL_VERSION_HEX) || LIBWOLFSSL_VERSION_HEX < 0x05007000
{&fail_d2i_ECDSA_SIG, 1, jwt::error::signature_generation_error::signature_decoding_failed},
#else
{&fail_d2i_ECDSA_SIG, 1, jwt::error::signature_generation_error::signfinal_failed},
Expand Down

0 comments on commit f9d4940

Please sign in to comment.