Make sure, ciphers link without errors
This commit is contained in:
parent
71c808b229
commit
b92a87ab72
33
crypto/symmetric/ciphers.cpp
Normal file
33
crypto/symmetric/ciphers.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "ciphers.h"
|
||||
|
||||
#define DEFINE_CIPHER(InstanceName) \
|
||||
constexpr const char *InstanceName::NAME; \
|
||||
|
||||
namespace cpputils {
|
||||
|
||||
DEFINE_CIPHER(AES256_GCM);
|
||||
DEFINE_CIPHER(AES256_CFB);
|
||||
DEFINE_CIPHER(AES128_GCM);
|
||||
DEFINE_CIPHER(AES128_CFB);
|
||||
|
||||
DEFINE_CIPHER(Twofish256_GCM);
|
||||
DEFINE_CIPHER(Twofish256_CFB);
|
||||
DEFINE_CIPHER(Twofish128_GCM);
|
||||
DEFINE_CIPHER(Twofish128_CFB);
|
||||
|
||||
DEFINE_CIPHER(Serpent256_GCM);
|
||||
DEFINE_CIPHER(Serpent256_CFB);
|
||||
DEFINE_CIPHER(Serpent128_GCM);
|
||||
DEFINE_CIPHER(Serpent128_CFB);
|
||||
|
||||
DEFINE_CIPHER(Cast256_GCM);
|
||||
DEFINE_CIPHER(Cast256_CFB);
|
||||
|
||||
DEFINE_CIPHER(Mars448_GCM);
|
||||
DEFINE_CIPHER(Mars448_CFB);
|
||||
DEFINE_CIPHER(Mars256_GCM);
|
||||
DEFINE_CIPHER(Mars256_CFB);
|
||||
DEFINE_CIPHER(Mars128_GCM);
|
||||
DEFINE_CIPHER(Mars128_CFB);
|
||||
|
||||
}
|
@ -10,45 +10,44 @@
|
||||
#include "GCM_Cipher.h"
|
||||
#include "CFB_Cipher.h"
|
||||
|
||||
#define DEFINE_CIPHER(InstanceName, StringName, Mode, Base, Keysize) \
|
||||
class InstanceName final: public Mode<Base, Keysize> { \
|
||||
public: \
|
||||
BOOST_CONCEPT_ASSERT((CipherConcept<InstanceName>)); \
|
||||
static constexpr const char *NAME = StringName; \
|
||||
} \
|
||||
|
||||
#define DECLARE_CIPHER(InstanceName, StringName, Mode, Base, Keysize) \
|
||||
class InstanceName final: public Mode<Base, Keysize> { \
|
||||
public: \
|
||||
BOOST_CONCEPT_ASSERT((CipherConcept<InstanceName>)); \
|
||||
static constexpr const char *NAME = StringName; \
|
||||
} \
|
||||
|
||||
namespace cpputils {
|
||||
|
||||
static_assert(32 == CryptoPP::AES::MAX_KEYLENGTH, "If AES offered larger keys, we should offer a variant with it");
|
||||
DEFINE_CIPHER(AES256_GCM, "aes-256-gcm", GCM_Cipher, CryptoPP::AES, 32);
|
||||
DEFINE_CIPHER(AES256_CFB, "aes-256-cfb", CFB_Cipher, CryptoPP::AES, 32);
|
||||
DEFINE_CIPHER(AES128_GCM, "aes-128-gcm", GCM_Cipher, CryptoPP::AES, 16);
|
||||
DEFINE_CIPHER(AES128_CFB, "aes-128-cfb", CFB_Cipher, CryptoPP::AES, 16);
|
||||
DECLARE_CIPHER(AES256_GCM, "aes-256-gcm", GCM_Cipher, CryptoPP::AES, 32);
|
||||
DECLARE_CIPHER(AES256_CFB, "aes-256-cfb", CFB_Cipher, CryptoPP::AES, 32);
|
||||
DECLARE_CIPHER(AES128_GCM, "aes-128-gcm", GCM_Cipher, CryptoPP::AES, 16);
|
||||
DECLARE_CIPHER(AES128_CFB, "aes-128-cfb", CFB_Cipher, CryptoPP::AES, 16);
|
||||
|
||||
static_assert(32 == CryptoPP::Twofish::MAX_KEYLENGTH, "If Twofish offered larger keys, we should offer a variant with it");
|
||||
DEFINE_CIPHER(Twofish256_GCM, "twofish-256-gcm", GCM_Cipher, CryptoPP::Twofish, 32);
|
||||
DEFINE_CIPHER(Twofish256_CFB, "twofish-256-cfb", CFB_Cipher, CryptoPP::Twofish, 32);
|
||||
DEFINE_CIPHER(Twofish128_GCM, "twofish-128-gcm", GCM_Cipher, CryptoPP::Twofish, 16);
|
||||
DEFINE_CIPHER(Twofish128_CFB, "twofish-128-cfb", CFB_Cipher, CryptoPP::Twofish, 16);
|
||||
DECLARE_CIPHER(Twofish256_GCM, "twofish-256-gcm", GCM_Cipher, CryptoPP::Twofish, 32);
|
||||
DECLARE_CIPHER(Twofish256_CFB, "twofish-256-cfb", CFB_Cipher, CryptoPP::Twofish, 32);
|
||||
DECLARE_CIPHER(Twofish128_GCM, "twofish-128-gcm", GCM_Cipher, CryptoPP::Twofish, 16);
|
||||
DECLARE_CIPHER(Twofish128_CFB, "twofish-128-cfb", CFB_Cipher, CryptoPP::Twofish, 16);
|
||||
|
||||
static_assert(32 == CryptoPP::Serpent::MAX_KEYLENGTH, "If Serpent offered larger keys, we should offer a variant with it");
|
||||
DEFINE_CIPHER(Serpent256_GCM, "serpent-256-gcm", GCM_Cipher, CryptoPP::Serpent, 32);
|
||||
DEFINE_CIPHER(Serpent256_CFB, "serpent-256-cfb", CFB_Cipher, CryptoPP::Serpent, 32);
|
||||
DEFINE_CIPHER(Serpent128_GCM, "serpent-128-gcm", GCM_Cipher, CryptoPP::Serpent, 16);
|
||||
DEFINE_CIPHER(Serpent128_CFB, "serpent-128-cfb", CFB_Cipher, CryptoPP::Serpent, 16);
|
||||
DECLARE_CIPHER(Serpent256_GCM, "serpent-256-gcm", GCM_Cipher, CryptoPP::Serpent, 32);
|
||||
DECLARE_CIPHER(Serpent256_CFB, "serpent-256-cfb", CFB_Cipher, CryptoPP::Serpent, 32);
|
||||
DECLARE_CIPHER(Serpent128_GCM, "serpent-128-gcm", GCM_Cipher, CryptoPP::Serpent, 16);
|
||||
DECLARE_CIPHER(Serpent128_CFB, "serpent-128-cfb", CFB_Cipher, CryptoPP::Serpent, 16);
|
||||
|
||||
static_assert(32 == CryptoPP::CAST256::MAX_KEYLENGTH, "If Cast offered larger keys, we should offer a variant with it");
|
||||
DEFINE_CIPHER(Cast256_GCM, "cast-256-gcm", GCM_Cipher, CryptoPP::CAST256, 32);
|
||||
DEFINE_CIPHER(Cast256_CFB, "cast-256-cfb", CFB_Cipher, CryptoPP::CAST256, 32);
|
||||
DECLARE_CIPHER(Cast256_GCM, "cast-256-gcm", GCM_Cipher, CryptoPP::CAST256, 32);
|
||||
DECLARE_CIPHER(Cast256_CFB, "cast-256-cfb", CFB_Cipher, CryptoPP::CAST256, 32);
|
||||
|
||||
static_assert(56 == CryptoPP::MARS::MAX_KEYLENGTH, "If Mars offered larger keys, we should offer a variant with it");
|
||||
DEFINE_CIPHER(Mars448_GCM, "mars-448-gcm", GCM_Cipher, CryptoPP::MARS, 56);
|
||||
DEFINE_CIPHER(Mars448_CFB, "mars-448-cfb", CFB_Cipher, CryptoPP::MARS, 56);
|
||||
DEFINE_CIPHER(Mars256_GCM, "mars-256-gcm", GCM_Cipher, CryptoPP::MARS, 32);
|
||||
DEFINE_CIPHER(Mars256_CFB, "mars-256-cfb", CFB_Cipher, CryptoPP::MARS, 32);
|
||||
DEFINE_CIPHER(Mars128_GCM, "mars-128-gcm", GCM_Cipher, CryptoPP::MARS, 16);
|
||||
DEFINE_CIPHER(Mars128_CFB, "mars-128-cfb", CFB_Cipher, CryptoPP::MARS, 16);
|
||||
DECLARE_CIPHER(Mars448_GCM, "mars-448-gcm", GCM_Cipher, CryptoPP::MARS, 56);
|
||||
DECLARE_CIPHER(Mars448_CFB, "mars-448-cfb", CFB_Cipher, CryptoPP::MARS, 56);
|
||||
DECLARE_CIPHER(Mars256_GCM, "mars-256-gcm", GCM_Cipher, CryptoPP::MARS, 32);
|
||||
DECLARE_CIPHER(Mars256_CFB, "mars-256-cfb", CFB_Cipher, CryptoPP::MARS, 32);
|
||||
DECLARE_CIPHER(Mars128_GCM, "mars-128-gcm", GCM_Cipher, CryptoPP::MARS, 16);
|
||||
DECLARE_CIPHER(Mars128_CFB, "mars-128-cfb", CFB_Cipher, CryptoPP::MARS, 16);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user