clean up ref use
This commit is contained in:
parent
c3650ba38d
commit
0e708e72f8
@ -39,7 +39,6 @@ auto Challenge::on_ircmsg(IrcCommand cmd, const IrcMsg &msg) -> void {
|
||||
|
||||
auto Challenge::finish_challenge() -> void
|
||||
{
|
||||
Ref<EVP_PKEY_CTX> ctx;
|
||||
unsigned int digestlen = EVP_MAX_MD_SIZE;
|
||||
unsigned char digest[EVP_MAX_MD_SIZE];
|
||||
size_t len = mybase64::decoded_size(buffer_.size());
|
||||
@ -50,8 +49,8 @@ auto Challenge::finish_challenge() -> void
|
||||
ciphertext.resize(len);
|
||||
|
||||
// Setup decryption context
|
||||
ctx.reset(EVP_PKEY_CTX_new(key_.get(), nullptr));
|
||||
if (ctx.get() == nullptr)
|
||||
Ref<EVP_PKEY_CTX> ctx{EVP_PKEY_CTX_new(key_.get(), nullptr)};
|
||||
if (not ctx)
|
||||
return log_openssl_errors("Challenge EVP_PKEY_CTX_new: ");
|
||||
|
||||
if (1 != EVP_PKEY_decrypt_init(ctx.get()))
|
||||
|
@ -25,14 +25,14 @@ template <> struct RefTraits<EVP_PKEY_CTX> {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct FnDeleter {
|
||||
struct RefDeleter {
|
||||
auto operator()(T *ptr) const -> void { RefTraits<T>::Free(ptr); }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct Ref : std::unique_ptr<T, FnDeleter<T>>
|
||||
struct Ref : std::unique_ptr<T, RefDeleter<T>>
|
||||
{
|
||||
using base = std::unique_ptr<T, FnDeleter<T>>;
|
||||
using base = std::unique_ptr<T, RefDeleter<T>>;
|
||||
|
||||
/// Owns nothing
|
||||
Ref() noexcept = default;
|
||||
|
Loading…
x
Reference in New Issue
Block a user