aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate/engine/asm_engine/asm_engine.cpp
blob: 9f113b1ce9c85435bcd77b11b74a1f39b24ab3fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*************************************************
* Assembly Implementation Engine Header File     *
* (C) 1999-2007 Jack Lloyd                       *
*************************************************/

#include <botan/asm_engine.h>
#include <botan/hash.h>

#if defined(BOTAN_HAS_SERPENT_IA32)
  #include <botan/serp_ia32.h>
#endif

#if defined(BOTAN_HAS_MD4_IA32)
  #include <botan/md4_ia32.h>
#endif

#if defined(BOTAN_HAS_MD5_IA32)
  #include <botan/md5_ia32.h>
#endif

#if defined(BOTAN_HAS_SHA1_IA32)
  #include <botan/sha1_ia32.h>
#endif

#if defined(BOTAN_HAS_SHA1_SSE2)
  #include <botan/sha1_sse2.h>
#endif

#if defined(BOTAN_HAS_SHA1_AMD64)
  #include <botan/sha1_amd64.h>
#endif

namespace Botan {

BlockCipher*
Assembler_Engine::find_block_cipher(const SCAN_Name& request,
                                  Algorithm_Factory&) const
   {
#if defined(BOTAN_HAS_SERPENT_IA32)
   if(request.algo_name() == "Serpent")
      return new Serpent_IA32;
#endif

   return 0;
   }

HashFunction* Assembler_Engine::find_hash(const SCAN_Name& request,
                                          Algorithm_Factory&) const
   {
#if defined(BOTAN_HAS_MD4_IA32)
   if(request.algo_name() == "MD4")
      return new MD4_IA32;
#endif

#if defined(BOTAN_HAS_MD5_IA32)
   if(request.algo_name() == "MD5")
      return new MD5_IA32;
#endif

#if defined(BOTAN_HAS_SHA1_SSE2) || \
    defined(BOTAN_HAS_SHA1_AMD64) || \
    defined(BOTAN_HAS_SHA1_IA32)

   if(request.algo_name() == "SHA-160")
      {
#if defined(BOTAN_HAS_SHA1_SSE2)
      return new SHA_160_SSE2;
#elif defined(BOTAN_HAS_SHA1_AMD64)
      return new SHA_160_AMD64;
#elif defined(BOTAN_HAS_SHA1_IA32)
      return new SHA_160_IA32;
#endif
      }
#endif

   return 0;
   }

}