1 /**
2 * Assembly Implementation Engine
3 * 
4 * Copyright:
5 * (C) 1999-2010 Jack Lloyd
6 * (C) 2014-2015 Etienne Cimon
7 *
8 * License:
9 * Botan is released under the Simplified BSD License (see LICENSE.md)
10 */
11 module botan.engine.asm_engine;
12 
13 import botan.constants;
14 static if (BOTAN_HAS_ENGINE_ASSEMBLER):
15 
16 import botan.engine.engine;
17 
18 static if (BOTAN_HAS_MD4_X86_32)         import botan.hash.md4_x86_32;
19 static if (BOTAN_HAS_MD5_X86_32)         import botan.hash.md5_x86_32;
20 static if (BOTAN_HAS_SHA1_X86_64)        import botan.hash.sha1_x86_64;
21 static if (BOTAN_HAS_SHA1_X86_32)        import botan.hash.sha1_x86_32;
22 
23 /**
24 * Engine for x86-32 specific implementations
25 */
26 final class AssemblerEngine : Engine
27 {
28 public:
29     string providerName() const { return "asm"; }
30 
31     BlockCipher findBlockCipher(in SCANToken request,
32                                 AlgorithmFactory af) const
33     {
34         return null;
35     }
36 
37     HashFunction findHash(in SCANToken request,
38                           AlgorithmFactory af) const
39     {
40         static if (BOTAN_HAS_MD4_X86_32) {
41             if (request.algoName == "MD4")
42                 return new MD4_X86_32;
43         }
44         
45         static if (BOTAN_HAS_MD5_X86_32) {
46             if (request.algoName == "MD5")
47                 return new MD5_X86_32;
48         }
49         
50         if (request.algoName == "SHA-160")
51         {
52             static if (BOTAN_HAS_SHA1_X86_64)
53                 return new SHA160_X86_64;
54             else static if (BOTAN_HAS_SHA1_X86_32)
55                 return new SHA160_X86_32;
56         }
57         
58         return null;
59     }
60 
61     StreamCipher findStreamCipher(in SCANToken algo_spec, AlgorithmFactory af) const
62     { return null; }
63 
64     MessageAuthenticationCode findMac(in SCANToken algo_spec, AlgorithmFactory af) const
65     { return null; }
66 
67     PBKDF findPbkdf(in SCANToken algo_spec, AlgorithmFactory af) const
68     { return null; }
69 
70 
71     KeyedFilter getCipher(in string algo_spec, CipherDir dir, AlgorithmFactory af) const
72     { return null; }
73 
74     static if (BOTAN_HAS_PUBLIC_KEY_CRYPTO):
75 
76     ModularExponentiator modExp(const(BigInt)* n, PowerMod.UsageHints hints) const
77     { return null; }
78 
79     KeyAgreement getKeyAgreementOp(in PrivateKey key, RandomNumberGenerator rng) const
80     { return null; }
81 
82     Signature getSignatureOp(in PrivateKey key, RandomNumberGenerator rng) const
83     { return null; }
84 
85     Verification getVerifyOp(in PublicKey key, RandomNumberGenerator rng) const
86     { return null; }
87 
88     Encryption getEncryptionOp(in PublicKey key, RandomNumberGenerator rng) const
89     { return null; }
90 
91     Decryption getDecryptionOp(in PrivateKey key, RandomNumberGenerator rng) const
92     { return null; }
93 }