aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/block')
-rw-r--r--src/lib/block/aes/aes.cpp6
-rw-r--r--src/lib/block/aes_ni/aes_ni.cpp6
-rw-r--r--src/lib/block/aes_ssse3/aes_ssse3.cpp8
-rw-r--r--src/lib/block/block_cipher.cpp290
-rw-r--r--src/lib/block/block_cipher.h2
-rw-r--r--src/lib/block/block_utils.h11
-rw-r--r--src/lib/block/blowfish/blowfish.cpp4
-rw-r--r--src/lib/block/camellia/camellia.cpp6
-rw-r--r--src/lib/block/cascade/cascade.cpp4
-rw-r--r--src/lib/block/cast/cast128.cpp4
-rw-r--r--src/lib/block/cast/cast256.cpp4
-rw-r--r--src/lib/block/des/des.cpp5
-rw-r--r--src/lib/block/des/desx.cpp4
-rw-r--r--src/lib/block/gost_28147/gost_28147.cpp4
-rw-r--r--src/lib/block/idea/idea.cpp4
-rw-r--r--src/lib/block/idea_sse2/idea_sse2.cpp4
-rw-r--r--src/lib/block/kasumi/kasumi.cpp4
-rw-r--r--src/lib/block/lion/lion.cpp11
-rw-r--r--src/lib/block/lion/lion.h2
-rw-r--r--src/lib/block/mars/mars.cpp4
-rw-r--r--src/lib/block/misty1/misty1.cpp4
-rw-r--r--src/lib/block/noekeon/noekeon.cpp4
-rw-r--r--src/lib/block/noekeon_simd/noekeon_simd.cpp4
-rw-r--r--src/lib/block/rc2/rc2.cpp4
-rw-r--r--src/lib/block/rc5/rc5.cpp4
-rw-r--r--src/lib/block/rc6/rc6.cpp4
-rw-r--r--src/lib/block/safer/safer_sk.cpp4
-rw-r--r--src/lib/block/seed/seed.cpp4
-rw-r--r--src/lib/block/serpent/serpent.cpp4
-rw-r--r--src/lib/block/serpent_simd/serp_simd.cpp4
-rw-r--r--src/lib/block/tea/tea.cpp4
-rw-r--r--src/lib/block/threefish/threefish.cpp4
-rw-r--r--src/lib/block/threefish_avx2/threefish_avx2.cpp4
-rw-r--r--src/lib/block/twofish/twofish.cpp5
-rw-r--r--src/lib/block/xtea/xtea.cpp4
-rw-r--r--src/lib/block/xtea_simd/xtea_simd.cpp4
36 files changed, 326 insertions, 126 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index b9e00fe6c..61cc9d777 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -7,15 +7,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/aes.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(AES_128, "AES-128");
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(AES_192, "AES-192");
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(AES_256, "AES-256");
-
namespace {
const byte SE[256] = {
diff --git a/src/lib/block/aes_ni/aes_ni.cpp b/src/lib/block/aes_ni/aes_ni.cpp
index 29e729da4..d359ec772 100644
--- a/src/lib/block/aes_ni/aes_ni.cpp
+++ b/src/lib/block/aes_ni/aes_ni.cpp
@@ -5,17 +5,13 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/aes_ni.h>
+#include <botan/loadstor.h>
#include <botan/cpuid.h>
#include <wmmintrin.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_aes_ni(), AES_128_NI, "AES-128", "aes_ni", 200);
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_aes_ni(), AES_192_NI, "AES-192", "aes_ni", 200);
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_aes_ni(), AES_256_NI, "AES-256", "aes_ni", 200);
-
namespace {
__m128i aes_128_key_expansion(__m128i key, __m128i key_with_rcon)
diff --git a/src/lib/block/aes_ssse3/aes_ssse3.cpp b/src/lib/block/aes_ssse3/aes_ssse3.cpp
index 50acd7668..bfc76ecee 100644
--- a/src/lib/block/aes_ssse3/aes_ssse3.cpp
+++ b/src/lib/block/aes_ssse3/aes_ssse3.cpp
@@ -10,20 +10,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/aes_ssse3.h>
#include <botan/cpuid.h>
#include <tmmintrin.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_ssse3(), AES_128_SSSE3, "AES-128",
- "ssse3", BOTAN_SIMD_ALGORITHM_PRIO);
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_ssse3(), AES_192_SSSE3, "AES-192",
- "ssse3", BOTAN_SIMD_ALGORITHM_PRIO);
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_ssse3(), AES_256_SSSE3, "AES-256",
- "ssse3", BOTAN_SIMD_ALGORITHM_PRIO);
-
namespace {
const __m128i low_nibs = _mm_set1_epi8(0x0F);
diff --git a/src/lib/block/block_cipher.cpp b/src/lib/block/block_cipher.cpp
new file mode 100644
index 000000000..cc9d16737
--- /dev/null
+++ b/src/lib/block/block_cipher.cpp
@@ -0,0 +1,290 @@
+/*
+* Block Ciphers
+* (C) 2015 Jack Lloyd
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+#include <botan/block_cipher.h>
+#include <botan/cpuid.h>
+#include <botan/internal/simd_32.h>
+#include <botan/internal/block_utils.h>
+
+#if defined(BOTAN_HAS_AES)
+ #include <botan/aes.h>
+#endif
+
+#if defined(BOTAN_HAS_AES_SSSE3)
+ #include <botan/aes_ssse3.h>
+#endif
+
+#if defined(BOTAN_HAS_AES_NI)
+ #include <botan/aes_ni.h>
+#endif
+
+#if defined(BOTAN_HAS_BLOWFISH)
+ #include <botan/blowfish.h>
+#endif
+
+#if defined(BOTAN_HAS_CAMELLIA)
+ #include <botan/camellia.h>
+#endif
+
+#if defined(BOTAN_HAS_CAST)
+ #include <botan/cast128.h>
+ #include <botan/cast256.h>
+#endif
+
+#if defined(BOTAN_HAS_CASCADE)
+ #include <botan/cascade.h>
+#endif
+
+#if defined(BOTAN_HAS_DES)
+ #include <botan/des.h>
+ #include <botan/desx.h>
+#endif
+
+#if defined(BOTAN_HAS_GOST_28147_89)
+ #include <botan/gost_28147.h>
+#endif
+
+#if defined(BOTAN_HAS_IDEA)
+ #include <botan/idea.h>
+#endif
+
+#if defined(BOTAN_HAS_IDEA_SSE2)
+ #include <botan/idea_sse2.h>
+#endif
+
+#if defined(BOTAN_HAS_KASUMI)
+ #include <botan/kasumi.h>
+#endif
+
+#if defined(BOTAN_HAS_LION)
+ #include <botan/lion.h>
+#endif
+
+#if defined(BOTAN_HAS_LUBY_RACKOFF)
+ #include <botan/lubyrack.h>
+#endif
+
+#if defined(BOTAN_HAS_MARS)
+ #include <botan/mars.h>
+#endif
+
+#if defined(BOTAN_HAS_MISTY1)
+ #include <botan/misty1.h>
+#endif
+
+#if defined(BOTAN_HAS_NOEKEON)
+ #include <botan/noekeon.h>
+#endif
+
+#if defined(BOTAN_HAS_NOEKEON_SIMD)
+ #include <botan/noekeon_simd.h>
+#endif
+
+#if defined(BOTAN_HAS_RC2)
+ #include <botan/rc2.h>
+#endif
+
+#if defined(BOTAN_HAS_RC5)
+ #include <botan/rc5.h>
+#endif
+
+#if defined(BOTAN_HAS_RC6)
+ #include <botan/rc6.h>
+#endif
+
+#if defined(BOTAN_HAS_SAFER)
+ #include <botan/safer_sk.h>
+#endif
+
+#if defined(BOTAN_HAS_SEED)
+ #include <botan/seed.h>
+#endif
+
+#if defined(BOTAN_HAS_SERPENT)
+ #include <botan/serpent.h>
+#endif
+
+#if defined(BOTAN_HAS_SERPENT_SIMD)
+ #include <botan/serp_simd.h>
+#endif
+
+#if defined(BOTAN_HAS_SKIPJACK)
+ #include <botan/skipjack.h>
+#endif
+
+#if defined(BOTAN_HAS_SQUARE)
+ #include <botan/square.h>
+#endif
+
+#if defined(BOTAN_HAS_TEA)
+ #include <botan/tea.h>
+#endif
+
+#if defined(BOTAN_HAS_TWOFISH)
+ #include <botan/twofish.h>
+#endif
+
+#if defined(BOTAN_HAS_THREEFISH_512)
+ #include <botan/threefish.h>
+#endif
+
+#if defined(BOTAN_HAS_THREEFISH_512_AVX2)
+ #include <botan/threefish_avx2.h>
+#endif
+
+#if defined(BOTAN_HAS_XTEA)
+ #include <botan/xtea.h>
+#endif
+
+#if defined(BOTAN_HAS_XTEA_SIMD)
+ #include <botan/xtea_simd.h>
+#endif
+
+namespace Botan {
+
+BlockCipher::~BlockCipher() {}
+
+#if defined(BOTAN_HAS_AES)
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(AES_128, "AES-128");
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(AES_192, "AES-192");
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(AES_256, "AES-256");
+#endif
+
+#if defined(BOTAN_HAS_AES_NI)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_aes_ni(), AES_128_NI, "AES-128", "aes_ni", 200);
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_aes_ni(), AES_192_NI, "AES-192", "aes_ni", 200);
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_aes_ni(), AES_256_NI, "AES-256", "aes_ni", 200);
+#endif
+
+#if defined(BOTAN_HAS_AES_SSSE3)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_ssse3(), AES_128_SSSE3, "AES-128",
+ "ssse3", BOTAN_SIMD_ALGORITHM_PRIO);
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_ssse3(), AES_192_SSSE3, "AES-192",
+ "ssse3", BOTAN_SIMD_ALGORITHM_PRIO);
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_ssse3(), AES_256_SSSE3, "AES-256",
+ "ssse3", BOTAN_SIMD_ALGORITHM_PRIO);
+#endif
+
+#if defined(BOTAN_HAS_BLOWFISH)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Blowfish);
+#endif
+
+#if defined(BOTAN_HAS_CAMELLIA)
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Camellia_128, "Camellia-128");
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Camellia_192, "Camellia-192");
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Camellia_256, "Camellia-256");
+#endif
+
+#if defined(BOTAN_HAS_CAST)
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(CAST_128, "CAST-128");
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(CAST_256, "CAST-256");
+#endif
+
+#if defined(BOTAN_HAS_DES)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(DES);
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(TripleDES);
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(DESX);
+#endif
+
+#if defined(BOTAN_HAS_GOST_28147_89)
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_1STR(GOST_28147_89, "GOST-28147-89", "R3411_94_TestParam");
+#endif
+
+#if defined(BOTAN_HAS_IDEA)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(IDEA);
+#endif
+
+#if defined(BOTAN_HAS_IDEA_SSE2)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_sse2(), IDEA_SSE2, "IDEA",
+ "sse2", BOTAN_SIMD_ALGORITHM_PRIO);
+#endif
+
+#if defined(BOTAN_HAS_KASUMI)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(KASUMI);
+#endif
+
+#if defined(BOTAN_HAS_MARS)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(MARS);
+#endif
+
+#if defined(BOTAN_HAS_MISTY1)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(MISTY1);
+#endif
+
+#if defined(BOTAN_HAS_NOEKEON)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Noekeon);
+#endif
+
+#if defined(BOTAN_HAS_NOEKEON_SIMD)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(SIMD_32::enabled(), Noekeon_SIMD, "Noekeon",
+ "simd32", BOTAN_SIMD_ALGORITHM_PRIO);
+#endif
+
+#if defined(BOTAN_HAS_RC2)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(RC2);
+#endif
+
+#if defined(BOTAN_HAS_RC5)
+BOTAN_REGISTER_BLOCK_CIPHER_1LEN(RC5, 12);
+#endif
+
+#if defined(BOTAN_HAS_RC6)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(RC6);
+#endif
+
+#if defined(BOTAN_HAS_SAFER)
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_1LEN(SAFER_SK, "SAFER-SK", 10);
+#endif
+
+#if defined(BOTAN_HAS_SEED)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(SEED);
+#endif
+
+#if defined(BOTAN_HAS_SERPENT)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Serpent);
+#endif
+
+#if defined(BOTAN_HAS_SERPENT_SIMD)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(SIMD_32::enabled(), Serpent_SIMD, "Serpent",
+ "simd32", BOTAN_SIMD_ALGORITHM_PRIO);
+#endif
+
+#if defined(BOTAN_HAS_TEA)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(TEA);
+#endif
+
+#if defined(BOTAN_HAS_TWOFISH)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Twofish);
+#endif
+
+#if defined(BOTAN_HAS_THREEFISH_512)
+BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Threefish_512, "Threefish-512");
+#endif
+
+#if defined(BOTAN_HAS_THREEFISH_512_AVX2)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_avx2(), Threefish_512_AVX2, "Threefish-512",
+ "avx2", BOTAN_SIMD_ALGORITHM_PRIO);
+#endif
+
+#if defined(BOTAN_HAS_XTEA)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(XTEA);
+#endif
+
+#if defined(BOTAN_HAS_XTEA_SIMD)
+BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(SIMD_32::enabled(), XTEA_SIMD, "XTEA",
+ "simd32", BOTAN_SIMD_ALGORITHM_PRIO);
+#endif
+
+#if defined(BOTAN_HAS_CASCADE)
+BOTAN_REGISTER_NAMED_T(BlockCipher, "Cascade", Cascade_Cipher, Cascade_Cipher::make);
+#endif
+
+#if defined(BOTAN_HAS_LION)
+BOTAN_REGISTER_NAMED_T(BlockCipher, "Lion", Lion, Lion::make);
+#endif
+
+}
diff --git a/src/lib/block/block_cipher.h b/src/lib/block/block_cipher.h
index 08bf18fd3..3f017dc89 100644
--- a/src/lib/block/block_cipher.h
+++ b/src/lib/block/block_cipher.h
@@ -141,6 +141,8 @@ class BOTAN_DLL BlockCipher : public SymmetricAlgorithm
* @return new object representing the same algorithm as *this
*/
virtual BlockCipher* clone() const = 0;
+
+ virtual ~BlockCipher();
};
/**
diff --git a/src/lib/block/block_utils.h b/src/lib/block/block_utils.h
index 89f8a3dd3..c1eee27b1 100644
--- a/src/lib/block/block_utils.h
+++ b/src/lib/block/block_utils.h
@@ -1,20 +1,15 @@
/*
-* Block Cipher Utility Header
+* Internal Block Cipher Utility Header
* (C) 2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#ifndef BOTAN_BLOCK_CIPHER_UTILS_H__
-#define BOTAN_BLOCK_CIPHER_UTILS_H__
+#ifndef BOTAN_INTERNAL_BLOCK_CIPHER_UTILS_H__
+#define BOTAN_INTERNAL_BLOCK_CIPHER_UTILS_H__
#include <botan/block_cipher.h>
#include <botan/internal/algo_registry.h>
-#include <botan/loadstor.h>
-#include <botan/rotate.h>
-#include <botan/internal/xor_buf.h>
-#include <algorithm>
-#include <functional>
namespace Botan {
diff --git a/src/lib/block/blowfish/blowfish.cpp b/src/lib/block/blowfish/blowfish.cpp
index 63838929d..2488838c3 100644
--- a/src/lib/block/blowfish/blowfish.cpp
+++ b/src/lib/block/blowfish/blowfish.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/blowfish.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Blowfish);
-
/*
* Blowfish Encryption
*/
diff --git a/src/lib/block/camellia/camellia.cpp b/src/lib/block/camellia/camellia.cpp
index 887878910..dc57e26bc 100644
--- a/src/lib/block/camellia/camellia.cpp
+++ b/src/lib/block/camellia/camellia.cpp
@@ -5,16 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/camellia.h>
#include <botan/internal/camellia_sbox.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Camellia_128, "Camellia-128");
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Camellia_192, "Camellia-192");
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Camellia_256, "Camellia-256");
-
namespace Camellia_F {
namespace {
diff --git a/src/lib/block/cascade/cascade.cpp b/src/lib/block/cascade/cascade.cpp
index 3b59a4362..66ff293ff 100644
--- a/src/lib/block/cascade/cascade.cpp
+++ b/src/lib/block/cascade/cascade.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/cascade.h>
+#include <botan/lookup.h>
namespace Botan {
-BOTAN_REGISTER_NAMED_T(BlockCipher, "Cascade", Cascade_Cipher, Cascade_Cipher::make);
-
Cascade_Cipher* Cascade_Cipher::make(const BlockCipher::Spec& spec)
{
std::unique_ptr<BlockCipher> c1(get_block_cipher(spec.arg(0)));
diff --git a/src/lib/block/cast/cast128.cpp b/src/lib/block/cast/cast128.cpp
index e19c6dcb1..3973418a3 100644
--- a/src/lib/block/cast/cast128.cpp
+++ b/src/lib/block/cast/cast128.cpp
@@ -5,14 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/cast128.h>
#include <botan/internal/cast_sboxes.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(CAST_128, "CAST-128");
-
namespace {
/*
diff --git a/src/lib/block/cast/cast256.cpp b/src/lib/block/cast/cast256.cpp
index bbb9894e7..7178dc5c1 100644
--- a/src/lib/block/cast/cast256.cpp
+++ b/src/lib/block/cast/cast256.cpp
@@ -5,14 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/cast256.h>
#include <botan/internal/cast_sboxes.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(CAST_256, "CAST-256");
-
namespace {
/*
diff --git a/src/lib/block/des/des.cpp b/src/lib/block/des/des.cpp
index c1013b9af..6d2bcfe1e 100644
--- a/src/lib/block/des/des.cpp
+++ b/src/lib/block/des/des.cpp
@@ -8,14 +8,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/des.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(DES);
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(TripleDES);
-
namespace {
/*
diff --git a/src/lib/block/des/desx.cpp b/src/lib/block/des/desx.cpp
index 0e19460fc..4ab568638 100644
--- a/src/lib/block/des/desx.cpp
+++ b/src/lib/block/des/desx.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/desx.h>
+#include <botan/internal/xor_buf.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(DESX);
-
/*
* DESX Encryption
*/
diff --git a/src/lib/block/gost_28147/gost_28147.cpp b/src/lib/block/gost_28147/gost_28147.cpp
index 90bf9328d..b8c3b7280 100644
--- a/src/lib/block/gost_28147/gost_28147.cpp
+++ b/src/lib/block/gost_28147/gost_28147.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/gost_28147.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_1STR(GOST_28147_89, "GOST-28147-89", "R3411_94_TestParam");
-
byte GOST_28147_89_Params::sbox_entry(size_t row, size_t col) const
{
byte x = sboxes[4 * col + (row / 2)];
diff --git a/src/lib/block/idea/idea.cpp b/src/lib/block/idea/idea.cpp
index 764115013..ddfd8e5fb 100644
--- a/src/lib/block/idea/idea.cpp
+++ b/src/lib/block/idea/idea.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/idea.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(IDEA);
-
namespace {
/*
diff --git a/src/lib/block/idea_sse2/idea_sse2.cpp b/src/lib/block/idea_sse2/idea_sse2.cpp
index 8549d74d7..a2a54ac32 100644
--- a/src/lib/block/idea_sse2/idea_sse2.cpp
+++ b/src/lib/block/idea_sse2/idea_sse2.cpp
@@ -5,16 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/idea_sse2.h>
#include <botan/cpuid.h>
#include <emmintrin.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_sse2(), IDEA_SSE2, "IDEA",
- "sse2", BOTAN_SIMD_ALGORITHM_PRIO);
-
namespace {
inline __m128i mul(__m128i X, u16bit K_16)
diff --git a/src/lib/block/kasumi/kasumi.cpp b/src/lib/block/kasumi/kasumi.cpp
index d0233cf5c..604d2d21a 100644
--- a/src/lib/block/kasumi/kasumi.cpp
+++ b/src/lib/block/kasumi/kasumi.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/kasumi.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(KASUMI);
-
namespace {
/*
diff --git a/src/lib/block/lion/lion.cpp b/src/lib/block/lion/lion.cpp
index a487e3eb0..336828d89 100644
--- a/src/lib/block/lion/lion.cpp
+++ b/src/lib/block/lion/lion.cpp
@@ -5,15 +5,14 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/lion.h>
+#include <botan/lookup.h>
#include <botan/parsing.h>
+#include <botan/internal/xor_buf.h>
namespace Botan {
-namespace {
-
-Lion* make_lion(const BlockCipher::Spec& spec)
+Lion* Lion::make(const BlockCipher::Spec& spec)
{
if(spec.arg_count_between(2, 3))
{
@@ -29,10 +28,6 @@ Lion* make_lion(const BlockCipher::Spec& spec)
return nullptr;
}
-}
-
-BOTAN_REGISTER_NAMED_T(BlockCipher, "Lion", Lion, make_lion);
-
/*
* Lion Encryption
*/
diff --git a/src/lib/block/lion/lion.h b/src/lib/block/lion/lion.h
index d03d1d1a0..116fa911b 100644
--- a/src/lib/block/lion/lion.h
+++ b/src/lib/block/lion/lion.h
@@ -39,6 +39,8 @@ class BOTAN_DLL Lion : public BlockCipher
std::string name() const override;
BlockCipher* clone() const override;
+ static Lion* make(const Spec&);
+
/**
* @param hash the hash to use internally
* @param cipher the stream cipher to use internally
diff --git a/src/lib/block/mars/mars.cpp b/src/lib/block/mars/mars.cpp
index 50f264861..becbbf2db 100644
--- a/src/lib/block/mars/mars.cpp
+++ b/src/lib/block/mars/mars.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/mars.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(MARS);
-
namespace {
/**
diff --git a/src/lib/block/misty1/misty1.cpp b/src/lib/block/misty1/misty1.cpp
index 23233e02f..490eec826 100644
--- a/src/lib/block/misty1/misty1.cpp
+++ b/src/lib/block/misty1/misty1.cpp
@@ -5,14 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/misty1.h>
+#include <botan/loadstor.h>
#include <botan/parsing.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(MISTY1);
-
namespace {
static const byte MISTY1_SBOX_S7[128] = {
diff --git a/src/lib/block/noekeon/noekeon.cpp b/src/lib/block/noekeon/noekeon.cpp
index fb1a215fe..d63ec3129 100644
--- a/src/lib/block/noekeon/noekeon.cpp
+++ b/src/lib/block/noekeon/noekeon.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/noekeon.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Noekeon);
-
namespace {
/*
diff --git a/src/lib/block/noekeon_simd/noekeon_simd.cpp b/src/lib/block/noekeon_simd/noekeon_simd.cpp
index a51c6bc8f..07fcf19ff 100644
--- a/src/lib/block/noekeon_simd/noekeon_simd.cpp
+++ b/src/lib/block/noekeon_simd/noekeon_simd.cpp
@@ -5,15 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/noekeon_simd.h>
#include <botan/internal/simd_32.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(SIMD_32::enabled(), Noekeon_SIMD, "Noekeon",
- "simd32", BOTAN_SIMD_ALGORITHM_PRIO);
-
/*
* Noekeon's Theta Operation
*/
diff --git a/src/lib/block/rc2/rc2.cpp b/src/lib/block/rc2/rc2.cpp
index d1fc8a2e6..bcd8475e3 100644
--- a/src/lib/block/rc2/rc2.cpp
+++ b/src/lib/block/rc2/rc2.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/rc2.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(RC2);
-
/*
* RC2 Encryption
*/
diff --git a/src/lib/block/rc5/rc5.cpp b/src/lib/block/rc5/rc5.cpp
index 27fa0e14d..a32efd775 100644
--- a/src/lib/block/rc5/rc5.cpp
+++ b/src/lib/block/rc5/rc5.cpp
@@ -5,14 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/rc5.h>
+#include <botan/loadstor.h>
#include <botan/parsing.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_1LEN(RC5, 12);
-
/*
* RC5 Encryption
*/
diff --git a/src/lib/block/rc6/rc6.cpp b/src/lib/block/rc6/rc6.cpp
index e9aa5fe8b..48fb1c32e 100644
--- a/src/lib/block/rc6/rc6.cpp
+++ b/src/lib/block/rc6/rc6.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/rc6.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(RC6);
-
/*
* RC6 Encryption
*/
diff --git a/src/lib/block/safer/safer_sk.cpp b/src/lib/block/safer/safer_sk.cpp
index f5996a986..a8781697d 100644
--- a/src/lib/block/safer/safer_sk.cpp
+++ b/src/lib/block/safer/safer_sk.cpp
@@ -5,16 +5,14 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/safer_sk.h>
+#include <botan/rotate.h>
#include <botan/parsing.h>
namespace Botan {
namespace {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_1LEN(SAFER_SK, "SAFER-SK", 10);
-
const byte EXP[256] = {
0x01, 0x2D, 0xE2, 0x93, 0xBE, 0x45, 0x15, 0xAE, 0x78, 0x03, 0x87, 0xA4,
0xB8, 0x38, 0xCF, 0x3F, 0x08, 0x67, 0x09, 0x94, 0xEB, 0x26, 0xA8, 0x6B,
diff --git a/src/lib/block/seed/seed.cpp b/src/lib/block/seed/seed.cpp
index 316ef1e04..833f9943f 100644
--- a/src/lib/block/seed/seed.cpp
+++ b/src/lib/block/seed/seed.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/seed.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(SEED);
-
/*
* SEED G Function
*/
diff --git a/src/lib/block/serpent/serpent.cpp b/src/lib/block/serpent/serpent.cpp
index b809e602c..c0a65ed33 100644
--- a/src/lib/block/serpent/serpent.cpp
+++ b/src/lib/block/serpent/serpent.cpp
@@ -5,14 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/serpent.h>
+#include <botan/loadstor.h>
#include <botan/internal/serpent_sbox.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Serpent);
-
namespace {
/*
diff --git a/src/lib/block/serpent_simd/serp_simd.cpp b/src/lib/block/serpent_simd/serp_simd.cpp
index 56747dd16..02fe7d6d9 100644
--- a/src/lib/block/serpent_simd/serp_simd.cpp
+++ b/src/lib/block/serpent_simd/serp_simd.cpp
@@ -5,16 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/serp_simd.h>
#include <botan/internal/serpent_sbox.h>
#include <botan/internal/simd_32.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(SIMD_32::enabled(), Serpent_SIMD, "Serpent",
- "simd32", BOTAN_SIMD_ALGORITHM_PRIO);
-
namespace {
#define key_xor(round, B0, B1, B2, B3) \
diff --git a/src/lib/block/tea/tea.cpp b/src/lib/block/tea/tea.cpp
index ef630f715..01f342607 100644
--- a/src/lib/block/tea/tea.cpp
+++ b/src/lib/block/tea/tea.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/tea.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(TEA);
-
/*
* TEA Encryption
*/
diff --git a/src/lib/block/threefish/threefish.cpp b/src/lib/block/threefish/threefish.cpp
index 322f54881..93fd122c2 100644
--- a/src/lib/block/threefish/threefish.cpp
+++ b/src/lib/block/threefish/threefish.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/threefish.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS(Threefish_512, "Threefish-512");
-
#define THREEFISH_ROUND(X0,X1,X2,X3,X4,X5,X6,X7,ROT1,ROT2,ROT3,ROT4) \
do { \
X0 += X4; \
diff --git a/src/lib/block/threefish_avx2/threefish_avx2.cpp b/src/lib/block/threefish_avx2/threefish_avx2.cpp
index 435c75dbf..bed98fafa 100644
--- a/src/lib/block/threefish_avx2/threefish_avx2.cpp
+++ b/src/lib/block/threefish_avx2/threefish_avx2.cpp
@@ -5,16 +5,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/threefish_avx2.h>
#include <botan/cpuid.h>
#include <immintrin.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(CPUID::has_avx2(), Threefish_512_AVX2, "Threefish-512",
- "avx2", BOTAN_SIMD_ALGORITHM_PRIO);
-
namespace {
inline void interleave_epi64(__m256i& X0, __m256i& X1)
diff --git a/src/lib/block/twofish/twofish.cpp b/src/lib/block/twofish/twofish.cpp
index 43ea41bfd..ffdf4b198 100644
--- a/src/lib/block/twofish/twofish.cpp
+++ b/src/lib/block/twofish/twofish.cpp
@@ -8,13 +8,12 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/twofish.h>
+#include <botan/loadstor.h>
+#include <botan/rotate.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(Twofish);
-
/*
* Twofish Encryption
*/
diff --git a/src/lib/block/xtea/xtea.cpp b/src/lib/block/xtea/xtea.cpp
index 9fe265457..59060dff7 100644
--- a/src/lib/block/xtea/xtea.cpp
+++ b/src/lib/block/xtea/xtea.cpp
@@ -5,13 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/xtea.h>
+#include <botan/loadstor.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS(XTEA);
-
namespace {
void xtea_encrypt_4(const byte in[32], byte out[32], const u32bit EK[64])
diff --git a/src/lib/block/xtea_simd/xtea_simd.cpp b/src/lib/block/xtea_simd/xtea_simd.cpp
index a9984ce23..6e50f4ff7 100644
--- a/src/lib/block/xtea_simd/xtea_simd.cpp
+++ b/src/lib/block/xtea_simd/xtea_simd.cpp
@@ -5,15 +5,11 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <botan/internal/block_utils.h>
#include <botan/xtea_simd.h>
#include <botan/internal/simd_32.h>
namespace Botan {
-BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF(SIMD_32::enabled(), XTEA_SIMD, "XTEA",
- "simd32", BOTAN_SIMD_ALGORITHM_PRIO);
-
namespace {
void xtea_encrypt_8(const byte in[64], byte out[64], const u32bit EK[64])