// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- // vim: ts=8 sw=2 smarttab #include "EncryptionFormat.h" #include "include/compat.h" #include "librbd/crypto/luks/FormatRequest.h" #include "librbd/crypto/luks/LoadRequest.h" namespace librbd { namespace crypto { namespace luks { template EncryptionFormat::EncryptionFormat( encryption_algorithm_t alg, std::string&& passphrase) : m_alg(alg), m_passphrase(std::move(passphrase)) { } template EncryptionFormat::~EncryptionFormat() { ceph_memzero_s( &m_passphrase[0], m_passphrase.capacity(), m_passphrase.size()); } template void EncryptionFormat::format(I* image_ctx, Context* on_finish) { auto req = luks::FormatRequest::create( image_ctx, get_format(), m_alg, std::move(m_passphrase), &m_crypto, on_finish, false); req->send(); } template void EncryptionFormat::load(I* image_ctx, Context* on_finish) { auto req = luks::LoadRequest::create( image_ctx, get_format(), std::move(m_passphrase), &m_crypto, on_finish); req->send(); } } // namespace luks } // namespace crypto } // namespace librbd template class librbd::crypto::luks::EncryptionFormat; template class librbd::crypto::luks::LUKS1EncryptionFormat; template class librbd::crypto::luks::LUKS2EncryptionFormat;