diff --git a/src/config/CryCipher.cpp b/src/config/CryCipher.cpp index 77524ab9..c0bdbd94 100644 --- a/src/config/CryCipher.cpp +++ b/src/config/CryCipher.cpp @@ -22,11 +22,11 @@ class CryCipherInstance: public CryCipher { public: BOOST_CONCEPT_ASSERT((CipherConcept)); - CryCipherInstance(const std::string &cipherName, const optional warning = none): _cipherName(cipherName), _warning(warning) { + CryCipherInstance(const optional warning = none): _warning(warning) { } - const string &cipherName() const override { - return _cipherName; + string cipherName() const override { + return Cipher::NAME; } const optional &warning() const override { @@ -42,7 +42,6 @@ public: } private: - string _cipherName; optional _warning; }; @@ -50,26 +49,26 @@ const string CryCiphers::INTEGRITY_WARNING = "This cipher does not ensure integr //We have to use shared_ptr instead of unique_ref, because c++ initializer_list needs copyable values const vector> CryCiphers::SUPPORTED_CIPHERS = { - make_shared>("aes-256-gcm"), - make_shared>("aes-256-cfb", INTEGRITY_WARNING), - make_shared>("aes-128-gcm"), - make_shared>("aes-128-cfb", INTEGRITY_WARNING), - make_shared>("twofish-256-gcm"), - make_shared>("twofish-256-cfb", INTEGRITY_WARNING), - make_shared>("twofish-128-gcm"), - make_shared>("twofish-128-cfb", INTEGRITY_WARNING), - make_shared>("serpent-256-gcm"), - make_shared>("serpent-256-cfb", INTEGRITY_WARNING), - make_shared>("serpent-128-gcm"), - make_shared>("serpent-128-cfb", INTEGRITY_WARNING), - make_shared>("cast-256-gcm"), - make_shared>("cast-256-cfb", INTEGRITY_WARNING), - make_shared>("mars-448-gcm"), - make_shared>("mars-448-cfb", INTEGRITY_WARNING), - make_shared>("mars-256-gcm"), - make_shared>("mars-256-cfb", INTEGRITY_WARNING), - make_shared>("mars-128-gcm"), - make_shared>("mars-128-cfb", INTEGRITY_WARNING) + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING), + make_shared>(), + make_shared>(INTEGRITY_WARNING) }; const CryCipher& CryCiphers::find(const string &cipherName) { diff --git a/src/config/CryCipher.h b/src/config/CryCipher.h index 04d36214..416093a9 100644 --- a/src/config/CryCipher.h +++ b/src/config/CryCipher.h @@ -14,7 +14,7 @@ class CryCipher { public: virtual ~CryCipher() {} - virtual const std::string &cipherName() const = 0; + virtual std::string cipherName() const = 0; virtual const boost::optional &warning() const = 0; virtual cpputils::unique_ref createEncryptedBlockstore(cpputils::unique_ref baseBlockStore, const std::string &encKey) const = 0; virtual std::string createKey(cpputils::RandomGenerator &randomGenerator) const = 0;