Botan 1.10.17

aes_isa_engine.cpp
Go to the documentation of this file.
1 /*
2 * Engine for AES instructions
3 * (C) 2009 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #include <botan/internal/aes_isa_engine.h>
9 #include <botan/cpuid.h>
10
11 #if defined(BOTAN_HAS_AES_NI)
12 #include <botan/aes_ni.h>
13 #endif
14
15 namespace Botan {
16
17 BlockCipher*
18 AES_ISA_Engine::find_block_cipher(const SCAN_Name& request,
19 Algorithm_Factory&) const
20 {
21 #if defined(BOTAN_HAS_AES_NI)
22 if(CPUID::has_aes_ni())
23 {
24 if(request.algo_name() == "AES-128")
25 return new AES_128_NI;
26 if(request.algo_name() == "AES-192")
27 return new AES_192_NI;
28 if(request.algo_name() == "AES-256")
29 return new AES_256_NI;
30 }
31 #endif
32
33 return 0;
34 }
35
36 }
Botan::Algorithm_Factory
Definition: algo_factory.h:34
Botan::AES_128_NI
Definition: aes_ni.h:18
Botan::CPUID::has_aes_ni
static bool has_aes_ni()
Definition: cpuid.h:70
Botan
Definition: algo_base.h:14
Botan::AES_256_NI
Definition: aes_ni.h:62
Botan::SCAN_Name
Definition: scan_name.h:21
Botan::AES_192_NI
Definition: aes_ni.h:40
Botan::AES_ISA_Engine::find_block_cipher
BlockCipher * find_block_cipher(const SCAN_Name &, Algorithm_Factory &) const
Definition: aes_isa_engine.cpp:18
Botan::SCAN_Name::algo_name
std::string algo_name() const
Definition: scan_name.h:37