Skip to content

Commit

Permalink
fix extra line
Browse files Browse the repository at this point in the history
  • Loading branch information
prince-chrismc committed Dec 26, 2023
1 parent 1b8ce6f commit dcecffc
Showing 1 changed file with 24 additions and 27 deletions.
51 changes: 24 additions & 27 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,44 +494,41 @@ namespace jwt {
#endif
};

namespace details {
inline std::unique_ptr<BIO, decltype(&BIO_free_all)> make_mem_buf_bio() {
return std::unique_ptr<BIO, decltype(&BIO_free_all)>(BIO_new(BIO_s_mem()), BIO_free_all);
}
inline std::unique_ptr<BIO, decltype(&BIO_free_all)> make_mem_buf_bio() {
return std::unique_ptr<BIO, decltype(&BIO_free_all)>(BIO_new(BIO_s_mem()), BIO_free_all);
}

inline std::unique_ptr<BIO, decltype(&BIO_free_all)> make_mem_buf_bio(const std::string& data) {
return std::unique_ptr<BIO, decltype(&BIO_free_all)>(
inline std::unique_ptr<BIO, decltype(&BIO_free_all)> make_mem_buf_bio(const std::string& data) {
return std::unique_ptr<BIO, decltype(&BIO_free_all)>(
#if OPENSSL_VERSION_NUMBER <= 0x10100003L
BIO_new_mem_buf(const_cast<char*>(data.data()), static_cast<int>(data.size())), BIO_free_all
BIO_new_mem_buf(const_cast<char*>(data.data()), static_cast<int>(data.size())), BIO_free_all
#else
BIO_new_mem_buf(data.data(), static_cast<int>(data.size())), BIO_free_all
BIO_new_mem_buf(data.data(), static_cast<int>(data.size())), BIO_free_all
#endif
);
}
);
}

template<typename error_category = error::rsa_error>
std::string write_bio_to_string(std::unique_ptr<BIO, decltype(&BIO_free_all)>& bio_out,
std::error_code& ec) {
char* ptr = nullptr;
auto len = BIO_get_mem_data(bio_out.get(), &ptr);
if (len <= 0 || ptr == nullptr) {
ec = error_category::convert_to_pem_failed;
return {};
}
return {ptr, static_cast<size_t>(len)};
template<typename error_category = error::rsa_error>
std::string write_bio_to_string(std::unique_ptr<BIO, decltype(&BIO_free_all)>& bio_out, std::error_code& ec) {
char* ptr = nullptr;
auto len = BIO_get_mem_data(bio_out.get(), &ptr);
if (len <= 0 || ptr == nullptr) {
ec = error_category::convert_to_pem_failed;
return {};
}
return {ptr, static_cast<size_t>(len)};
}

inline std::unique_ptr<EVP_MD_CTX, void (*)(EVP_MD_CTX*)> make_evp_md_ctx() {
return
inline std::unique_ptr<EVP_MD_CTX, void (*)(EVP_MD_CTX*)> make_evp_md_ctx() {
return
#ifdef JWT_OPENSSL_1_0_0
std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_destroy)>(EVP_MD_CTX_create(),
&EVP_MD_CTX_destroy);
std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_destroy)>(EVP_MD_CTX_create(), &EVP_MD_CTX_destroy);
#else
std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)>(EVP_MD_CTX_new(), &EVP_MD_CTX_free);
std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)>(EVP_MD_CTX_new(), &EVP_MD_CTX_free);
#endif
}
}

/**
/**
* \brief Extract the public key of a pem certificate
*
* \tparam error_category jwt::error enum category to match with the keys being used
Expand Down

0 comments on commit dcecffc

Please sign in to comment.