1 // regtest2.cpp - originally written and placed in the public domain by Wei Dai
2 //                regtest.cpp split into 3 files due to OOM kills by JW
3 //                in April 2017. A second split occurred in July 2018.
4 
5 #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
6 
7 #include "cryptlib.h"
8 #include "factory.h"
9 #include "bench.h"
10 #include "cpu.h"
11 
12 // For MAC's
13 #include "hmac.h"
14 #include "cmac.h"
15 #include "dmac.h"
16 #include "vmac.h"
17 #include "ttmac.h"
18 
19 // Ciphers
20 #include "md5.h"
21 #include "keccak.h"
22 #include "sha.h"
23 #include "sha3.h"
24 #include "blake2.h"
25 #include "ripemd.h"
26 #include "chacha.h"
27 #include "poly1305.h"
28 #include "siphash.h"
29 #include "panama.h"
30 
31 // Stream ciphers
32 #include "arc4.h"
33 #include "seal.h"
34 #include "wake.h"
35 #include "chacha.h"
36 #include "salsa.h"
37 #include "rabbit.h"
38 #include "hc128.h"
39 #include "hc256.h"
40 #include "panama.h"
41 #include "sosemanuk.h"
42 
43 // Block for CMAC
44 #include "aes.h"
45 #include "des.h"
46 
47 // Aggressive stack checking with VS2005 SP1 and above.
48 #if (_MSC_FULL_VER >= 140050727)
49 # pragma strict_gs_check (on)
50 #endif
51 
52 #if CRYPTOPP_MSC_VERSION
53 # pragma warning(disable: 4505 4355)
54 #endif
55 
USING_NAMESPACE(CryptoPP)56 USING_NAMESPACE(CryptoPP)
57 
58 // MAC ciphers
59 void RegisterFactories2()
60 {
61 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<Weak::MD5> >();
62 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<RIPEMD160> >();
63 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA1> >();
64 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA224> >();
65 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA256> >();
66 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA384> >();
67 	RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA512> >();
68 	RegisterDefaultFactoryFor<MessageAuthenticationCode, TTMAC>();
69 	RegisterDefaultFactoryFor<MessageAuthenticationCode, VMAC<AES> >();
70 	RegisterDefaultFactoryFor<MessageAuthenticationCode, VMAC<AES, 64> >();
71 	RegisterDefaultFactoryFor<MessageAuthenticationCode, Weak::PanamaMAC<LittleEndian> >();
72 	RegisterDefaultFactoryFor<MessageAuthenticationCode, Weak::PanamaMAC<BigEndian> >();
73 	RegisterDefaultFactoryFor<MessageAuthenticationCode, CMAC<AES> >();
74 	RegisterDefaultFactoryFor<MessageAuthenticationCode, DMAC<AES> >();
75 	RegisterDefaultFactoryFor<MessageAuthenticationCode, Poly1305<AES> >();
76 	RegisterDefaultFactoryFor<MessageAuthenticationCode, Poly1305TLS>();
77 	RegisterDefaultFactoryFor<MessageAuthenticationCode, CMAC<DES_EDE3> >();
78 	RegisterDefaultFactoryFor<MessageAuthenticationCode, BLAKE2s>();
79 	RegisterDefaultFactoryFor<MessageAuthenticationCode, BLAKE2b>();
80 	RegisterDefaultFactoryFor<MessageAuthenticationCode, SipHash<2,4> >();
81 	RegisterDefaultFactoryFor<MessageAuthenticationCode, SipHash<4,8> >();
82 }
83 
84 // Stream ciphers
RegisterFactories3()85 void RegisterFactories3()
86 {
87 	RegisterSymmetricCipherDefaultFactories<Weak::MARC4>();
88 	RegisterSymmetricCipherDefaultFactories<SEAL<> >();
89 	RegisterSymmetricCipherDefaultFactories<SEAL<LittleEndian> >();
90 	RegisterSymmetricCipherDefaultFactories<WAKE_OFB<LittleEndian> >();
91 	RegisterSymmetricCipherDefaultFactories<WAKE_OFB<BigEndian> >();
92 	RegisterSymmetricCipherDefaultFactories<PanamaCipher<LittleEndian> >();
93 	RegisterSymmetricCipherDefaultFactories<PanamaCipher<BigEndian> >();
94 
95 	RegisterSymmetricCipherDefaultFactories<Salsa20>();
96 	RegisterSymmetricCipherDefaultFactories<XSalsa20>();
97 	RegisterSymmetricCipherDefaultFactories<ChaCha>();
98 	RegisterSymmetricCipherDefaultFactories<ChaChaTLS>();
99 	RegisterSymmetricCipherDefaultFactories<XChaCha20>();
100 	RegisterSymmetricCipherDefaultFactories<Sosemanuk>();
101 	RegisterSymmetricCipherDefaultFactories<Rabbit>();
102 	RegisterSymmetricCipherDefaultFactories<RabbitWithIV>();
103 	RegisterSymmetricCipherDefaultFactories<HC128>();
104 	RegisterSymmetricCipherDefaultFactories<HC256>();
105 }
106