Skip to content

Commit

Permalink
Move definitiion of P11Engine dtor out of header
Browse files Browse the repository at this point in the history
These calls are deprecated, and moving them out to the implementation
means they are only pulled when BUILD_P11 is set.
  • Loading branch information
cajun-rat committed Aug 4, 2024
1 parent f88fb5f commit aacf20b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/libaktualizr/crypto/p11engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ P11Engine::P11Engine(boost::filesystem::path module_path, std::string pass)
ssl_engine_ = engine;
}

P11Engine::~P11Engine() {
if (ssl_engine_ != nullptr) {
ENGINE_finish(ssl_engine_);
ENGINE_free(ssl_engine_);
ENGINE_cleanup(); // for openssl < 1.1
}
}

// Hack for clang-tidy
#ifndef PKCS11_ENGINE_PATH
#define PKCS11_ENGINE_PATH "dummy"
Expand Down
8 changes: 1 addition & 7 deletions src/libaktualizr/crypto/p11engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,7 @@ class P11Engine {
P11Engine &operator=(const P11Engine &) = delete;
P11Engine &operator=(P11Engine &&) = delete;

virtual ~P11Engine() {
if (ssl_engine_ != nullptr) {
ENGINE_finish(ssl_engine_);
ENGINE_free(ssl_engine_);
ENGINE_cleanup(); // for openssl < 1.1
}
}
virtual ~P11Engine();

ENGINE *getEngine() { return ssl_engine_; }
std::string getItemFullId(const std::string &id) const { return uri_prefix_ + id; }
Expand Down

0 comments on commit aacf20b

Please sign in to comment.