From dcecffcb3db7a657b7d42a8464300a972baf8009 Mon Sep 17 00:00:00 2001 From: Christopher McArthur Date: Tue, 26 Dec 2023 13:59:09 -0500 Subject: [PATCH] fix extra line --- include/jwt-cpp/jwt.h | 51 ++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 27 deletions(-) diff --git a/include/jwt-cpp/jwt.h b/include/jwt-cpp/jwt.h index a3d369634..25e1440dd 100644 --- a/include/jwt-cpp/jwt.h +++ b/include/jwt-cpp/jwt.h @@ -494,44 +494,41 @@ namespace jwt { #endif }; - namespace details { - inline std::unique_ptr make_mem_buf_bio() { - return std::unique_ptr(BIO_new(BIO_s_mem()), BIO_free_all); - } + inline std::unique_ptr make_mem_buf_bio() { + return std::unique_ptr(BIO_new(BIO_s_mem()), BIO_free_all); + } - inline std::unique_ptr make_mem_buf_bio(const std::string& data) { - return std::unique_ptr( + inline std::unique_ptr make_mem_buf_bio(const std::string& data) { + return std::unique_ptr( #if OPENSSL_VERSION_NUMBER <= 0x10100003L - BIO_new_mem_buf(const_cast(data.data()), static_cast(data.size())), BIO_free_all + BIO_new_mem_buf(const_cast(data.data()), static_cast(data.size())), BIO_free_all #else - BIO_new_mem_buf(data.data(), static_cast(data.size())), BIO_free_all + BIO_new_mem_buf(data.data(), static_cast(data.size())), BIO_free_all #endif - ); - } + ); + } - template - std::string write_bio_to_string(std::unique_ptr& 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(len)}; + template + std::string write_bio_to_string(std::unique_ptr& 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(len)}; + } - inline std::unique_ptr make_evp_md_ctx() { - return + inline std::unique_ptr make_evp_md_ctx() { + return #ifdef JWT_OPENSSL_1_0_0 - std::unique_ptr(EVP_MD_CTX_create(), - &EVP_MD_CTX_destroy); + std::unique_ptr(EVP_MD_CTX_create(), &EVP_MD_CTX_destroy); #else - std::unique_ptr(EVP_MD_CTX_new(), &EVP_MD_CTX_free); + std::unique_ptr(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