summaryrefslogtreecommitdiff
path: root/regtest1.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2017-04-13 21:45:21 -0400
committerJeffrey Walton <noloader@gmail.com>2017-04-13 21:45:21 -0400
commitbf92cb00395b71a942e4b785c6848f038a961c3a (patch)
treeb562674aec0107c8cdc1ebc5fc792d663b4140e6 /regtest1.cpp
parentbae30d6767ffd2da1271e50387614340371591df (diff)
downloadcryptopp-git-bf92cb00395b71a942e4b785c6848f038a961c3a.tar.gz
Split regtest.cpp into regtest{1|2|3}.cpp
regtest.cpp is where ciphers register by name. The library has added a number of ciphers over the last couple of years and the source file has experienced bloat. Most of the ARM and MIPS test borads were suffering Out of Memory (OOM) kills as the compiler processed the source fille and the included header files. This won't stop the OOM kills, but it will help the situation. An early BeagleBoard with 512 MB of RAM is still going to have trouble, but it can be worked around by building with 1 make job as opposed to 2 or 4.
Diffstat (limited to 'regtest1.cpp')
-rw-r--r--regtest1.cpp117
1 files changed, 117 insertions, 0 deletions
diff --git a/regtest1.cpp b/regtest1.cpp
new file mode 100644
index 00000000..e30ff353
--- /dev/null
+++ b/regtest1.cpp
@@ -0,0 +1,117 @@
+// regtest1.cpp - originally written and placed in the public domain by Wei Dai
+// regtest.cpp split into 3 files due to OOM kills by JW in April 2017
+
+#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
+
+#include "cryptlib.h"
+#include "factory.h"
+#include "bench.h"
+#include "cpu.h"
+
+#include "crc.h"
+#include "adler32.h"
+#include "md2.h"
+#include "md5.h"
+#include "keccak.h"
+#include "sha3.h"
+#include "blake2.h"
+#include "sha.h"
+#include "tiger.h"
+#include "ripemd.h"
+#include "panama.h"
+#include "whrlpool.h"
+
+#include "osrng.h"
+#include "drbg.h"
+#include "mersenne.h"
+#include "rdrand.h"
+
+#include "modes.h"
+#include "aes.h"
+
+// Aggressive stack checking with VS2005 SP1 and above.
+#if (CRYPTOPP_MSC_VERSION >= 1410)
+# pragma strict_gs_check (on)
+#endif
+
+USING_NAMESPACE(CryptoPP)
+
+// Unkeyed ciphers
+void RegisterFactories1();
+// Shared key ciphers
+void RegisterFactories2();
+// Public key ciphers
+void RegisterFactories3();
+
+void RegisterFactories(Test::TestClass suites)
+{
+ static bool s_registered = false;
+ if (s_registered)
+ return;
+
+ if ((suites & Test::Unkeyed) == Test::Unkeyed)
+ RegisterFactories1();
+
+ if ((suites & Test::SharedKey) == Test::SharedKey)
+ RegisterFactories2();
+
+ if ((suites & Test::PublicKey) == Test::PublicKey)
+ RegisterFactories3();
+
+ s_registered = true;
+}
+
+// Unkeyed ciphers
+void RegisterFactories1()
+{
+ RegisterDefaultFactoryFor<HashTransformation, CRC32>();
+ RegisterDefaultFactoryFor<HashTransformation, CRC32C>();
+ RegisterDefaultFactoryFor<HashTransformation, Adler32>();
+ RegisterDefaultFactoryFor<HashTransformation, Weak::MD5>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA1>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA224>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA256>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA384>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA512>();
+ RegisterDefaultFactoryFor<HashTransformation, Whirlpool>();
+ RegisterDefaultFactoryFor<HashTransformation, Tiger>();
+ RegisterDefaultFactoryFor<HashTransformation, RIPEMD160>();
+ RegisterDefaultFactoryFor<HashTransformation, RIPEMD320>();
+ RegisterDefaultFactoryFor<HashTransformation, RIPEMD128>();
+ RegisterDefaultFactoryFor<HashTransformation, RIPEMD256>();
+ RegisterDefaultFactoryFor<HashTransformation, Weak::PanamaHash<LittleEndian> >();
+ RegisterDefaultFactoryFor<HashTransformation, Weak::PanamaHash<BigEndian> >();
+ RegisterDefaultFactoryFor<HashTransformation, Keccak_224>();
+ RegisterDefaultFactoryFor<HashTransformation, Keccak_256>();
+ RegisterDefaultFactoryFor<HashTransformation, Keccak_384>();
+ RegisterDefaultFactoryFor<HashTransformation, Keccak_512>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA3_224>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA3_256>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA3_384>();
+ RegisterDefaultFactoryFor<HashTransformation, SHA3_512>();
+ RegisterDefaultFactoryFor<HashTransformation, BLAKE2s>();
+ RegisterDefaultFactoryFor<HashTransformation, BLAKE2b>();
+
+#ifdef BLOCKING_RNG_AVAILABLE
+ RegisterDefaultFactoryFor<RandomNumberGenerator, BlockingRng>();
+#endif
+#ifdef NONBLOCKING_RNG_AVAILABLE
+ RegisterDefaultFactoryFor<RandomNumberGenerator, NonblockingRng>();
+#endif
+#ifdef OS_RNG_AVAILABLE
+ RegisterDefaultFactoryFor<RandomNumberGenerator, AutoSeededRandomPool>();
+ RegisterDefaultFactoryFor<RandomNumberGenerator, AutoSeededX917RNG<AES> >();
+#endif
+ RegisterDefaultFactoryFor<RandomNumberGenerator, MT19937>();
+#if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
+ if (HasRDRAND())
+ RegisterDefaultFactoryFor<RandomNumberGenerator, RDRAND>();
+ if (HasRDSEED())
+ RegisterDefaultFactoryFor<RandomNumberGenerator, RDSEED>();
+#endif
+ RegisterDefaultFactoryFor<RandomNumberGenerator, OFB_Mode<AES>::Encryption >("AES/OFB RNG");
+ RegisterDefaultFactoryFor<NIST_DRBG, Hash_DRBG<SHA1> >("Hash_DRBG(SHA1)");
+ RegisterDefaultFactoryFor<NIST_DRBG, Hash_DRBG<SHA256> >("Hash_DRBG(SHA256)");
+ RegisterDefaultFactoryFor<NIST_DRBG, HMAC_DRBG<SHA1> >("HMAC_DRBG(SHA1)");
+ RegisterDefaultFactoryFor<NIST_DRBG, HMAC_DRBG<SHA256> >("HMAC_DRBG(SHA256)");
+}