evp_cipher_ctx.hpp 478 B

12345678910111213141516171819202122
  1. #pragma once
  2. #include <openssl/evp.h>
  3. namespace nkg::resource_traits::openssl {
  4. struct evp_cipher_ctx {
  5. using handle_t = EVP_CIPHER_CTX*;
  6. static constexpr handle_t invalid_value = nullptr;
  7. [[nodiscard]]
  8. static bool is_valid(const handle_t& handle) noexcept {
  9. return handle != invalid_value;
  10. }
  11. static void release(const handle_t& handle) noexcept {
  12. EVP_CIPHER_CTX_free(handle);
  13. }
  14. };
  15. }