make code compatible with openssl 3.x
Signed-off-by: Double Sine <xiao_ai_yu@live.cn>
This commit is contained in:
21
common/resource_traits/openssl/decoder_ctx.hpp
Normal file
21
common/resource_traits/openssl/decoder_ctx.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <openssl/decoder.h>
|
||||
|
||||
namespace nkg::resource_traits::openssl {
|
||||
|
||||
struct decoder_ctx {
|
||||
using handle_t = OSSL_DECODER_CTX*;
|
||||
|
||||
static constexpr handle_t invalid_value = nullptr;
|
||||
|
||||
[[nodiscard]]
|
||||
static bool is_valid(const handle_t& handle) noexcept {
|
||||
return handle != invalid_value;
|
||||
}
|
||||
|
||||
static void release(const handle_t& handle) noexcept {
|
||||
OSSL_DECODER_CTX_free(handle);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
21
common/resource_traits/openssl/encoder_ctx.hpp
Normal file
21
common/resource_traits/openssl/encoder_ctx.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <openssl/encoder.h>
|
||||
|
||||
namespace nkg::resource_traits::openssl {
|
||||
|
||||
struct encoder_ctx {
|
||||
using handle_t = OSSL_ENCODER_CTX*;
|
||||
|
||||
static constexpr handle_t invalid_value = nullptr;
|
||||
|
||||
[[nodiscard]]
|
||||
static bool is_valid(const handle_t& handle) noexcept {
|
||||
return handle != invalid_value;
|
||||
}
|
||||
|
||||
static void release(const handle_t& handle) noexcept {
|
||||
OSSL_ENCODER_CTX_free(handle);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
21
common/resource_traits/openssl/evp_cipher_ctx.hpp
Normal file
21
common/resource_traits/openssl/evp_cipher_ctx.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace nkg::resource_traits::openssl {
|
||||
|
||||
struct evp_cipher_ctx {
|
||||
using handle_t = EVP_CIPHER_CTX*;
|
||||
|
||||
static constexpr handle_t invalid_value = nullptr;
|
||||
|
||||
[[nodiscard]]
|
||||
static bool is_valid(const handle_t& handle) noexcept {
|
||||
return handle != invalid_value;
|
||||
}
|
||||
|
||||
static void release(const handle_t& handle) noexcept {
|
||||
EVP_CIPHER_CTX_free(handle);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
21
common/resource_traits/openssl/evp_pkey.hpp
Normal file
21
common/resource_traits/openssl/evp_pkey.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace nkg::resource_traits::openssl {
|
||||
|
||||
struct evp_pkey {
|
||||
using handle_t = EVP_PKEY*;
|
||||
|
||||
static constexpr handle_t invalid_value = nullptr;
|
||||
|
||||
[[nodiscard]]
|
||||
static bool is_valid(const handle_t& handle) noexcept {
|
||||
return handle != invalid_value;
|
||||
}
|
||||
|
||||
static void release(const handle_t& handle) noexcept {
|
||||
EVP_PKEY_free(handle);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
21
common/resource_traits/openssl/evp_pkey_ctx.hpp
Normal file
21
common/resource_traits/openssl/evp_pkey_ctx.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <openssl/evp.h>
|
||||
|
||||
namespace nkg::resource_traits::openssl {
|
||||
|
||||
struct evp_pkey_ctx {
|
||||
using handle_t = EVP_PKEY_CTX*;
|
||||
|
||||
static constexpr handle_t invalid_value = nullptr;
|
||||
|
||||
[[nodiscard]]
|
||||
static bool is_valid(const handle_t& handle) noexcept {
|
||||
return handle != invalid_value;
|
||||
}
|
||||
|
||||
static void release(const handle_t& handle) noexcept {
|
||||
EVP_PKEY_CTX_free(handle);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user