Botan  1.10.9
simd_engine.cpp
Go to the documentation of this file.
1 /*
2 * SIMD Engine
3 * (C) 1999-2009 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #include <botan/internal/simd_engine.h>
9 #include <botan/internal/simd_32.h>
10 #include <botan/cpuid.h>
11 
12 #if defined(BOTAN_HAS_AES_SSSE3)
13  #include <botan/aes_ssse3.h>
14 #endif
15 
16 #if defined(BOTAN_HAS_SERPENT_SIMD)
17  #include <botan/serp_simd.h>
18 #endif
19 
20 #if defined(BOTAN_HAS_NOEKEON_SIMD)
21  #include <botan/noekeon_simd.h>
22 #endif
23 
24 #if defined(BOTAN_HAS_XTEA_SIMD)
25  #include <botan/xtea_simd.h>
26 #endif
27 
28 #if defined(BOTAN_HAS_IDEA_SSE2)
29  #include <botan/idea_sse2.h>
30 #endif
31 
32 #if defined(BOTAN_HAS_SHA1_SSE2)
33  #include <botan/sha1_sse2.h>
34 #endif
35 
36 namespace Botan {
37 
38 BlockCipher*
40  Algorithm_Factory&) const
41  {
42 #if defined(BOTAN_HAS_AES_SSSE3)
43  if(request.algo_name() == "AES-128" && CPUID::has_ssse3())
44  return new AES_128_SSSE3;
45  if(request.algo_name() == "AES-192" && CPUID::has_ssse3())
46  return new AES_192_SSSE3;
47  if(request.algo_name() == "AES-256" && CPUID::has_ssse3())
48  return new AES_256_SSSE3;
49 #endif
50 
51 #if defined(BOTAN_HAS_IDEA_SSE2)
52  if(request.algo_name() == "IDEA" && CPUID::has_sse2())
53  return new IDEA_SSE2;
54 #endif
55 
56 #if defined(BOTAN_HAS_NOEKEON_SIMD)
57  if(request.algo_name() == "Noekeon" && SIMD_32::enabled())
58  return new Noekeon_SIMD;
59 #endif
60 
61 #if defined(BOTAN_HAS_SERPENT_SIMD)
62  if(request.algo_name() == "Serpent" && SIMD_32::enabled())
63  return new Serpent_SIMD;
64 #endif
65 
66 #if defined(BOTAN_HAS_XTEA_SIMD)
67  if(request.algo_name() == "XTEA" && SIMD_32::enabled())
68  return new XTEA_SIMD;
69 #endif
70 
71  return 0;
72  }
73 
76  Algorithm_Factory&) const
77  {
78 #if defined(BOTAN_HAS_SHA1_SSE2)
79  if(request.algo_name() == "SHA-160" && CPUID::has_sse2())
80  return new SHA_160_SSE2;
81 #endif
82 
83  return 0;
84  }
85 
86 }
BlockCipher * find_block_cipher(const SCAN_Name &, Algorithm_Factory &) const
Definition: simd_engine.cpp:39
std::string algo_name() const
Definition: scan_name.h:37
static bool has_ssse3()
Definition: cpuid.h:46
HashFunction * find_hash(const SCAN_Name &request, Algorithm_Factory &) const
Definition: simd_engine.cpp:75
static bool has_sse2()
Definition: cpuid.h:40