diff options
author | lloyd <[email protected]> | 2014-01-10 03:41:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-10 03:41:59 +0000 |
commit | 6894dca64c04936d07048c0e8cbf7e25858548c3 (patch) | |
tree | 5d572bfde9fe667dab14e3f04b5285a85d8acd95 /src/lib/engine/aes_isa_eng | |
parent | 9efa3be92442afb3d0b69890a36c7f122df18eda (diff) |
Move lib into src
Diffstat (limited to 'src/lib/engine/aes_isa_eng')
-rw-r--r-- | src/lib/engine/aes_isa_eng/aes_isa_engine.cpp | 36 | ||||
-rw-r--r-- | src/lib/engine/aes_isa_eng/aes_isa_engine.h | 30 | ||||
-rw-r--r-- | src/lib/engine/aes_isa_eng/info.txt | 11 |
3 files changed, 77 insertions, 0 deletions
diff --git a/src/lib/engine/aes_isa_eng/aes_isa_engine.cpp b/src/lib/engine/aes_isa_eng/aes_isa_engine.cpp new file mode 100644 index 000000000..956a1ce38 --- /dev/null +++ b/src/lib/engine/aes_isa_eng/aes_isa_engine.cpp @@ -0,0 +1,36 @@ +/* +* Engine for AES instructions +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/internal/aes_isa_engine.h> +#include <botan/cpuid.h> + +#if defined(BOTAN_HAS_AES_NI) + #include <botan/aes_ni.h> +#endif + +namespace Botan { + +BlockCipher* +AES_ISA_Engine::find_block_cipher(const SCAN_Name& request, + Algorithm_Factory&) const + { +#if defined(BOTAN_HAS_AES_NI) + if(CPUID::has_aes_ni()) + { + if(request.algo_name() == "AES-128") + return new AES_128_NI; + if(request.algo_name() == "AES-192") + return new AES_192_NI; + if(request.algo_name() == "AES-256") + return new AES_256_NI; + } +#endif + + return nullptr; + } + +} diff --git a/src/lib/engine/aes_isa_eng/aes_isa_engine.h b/src/lib/engine/aes_isa_eng/aes_isa_engine.h new file mode 100644 index 000000000..3c4d3e936 --- /dev/null +++ b/src/lib/engine/aes_isa_eng/aes_isa_engine.h @@ -0,0 +1,30 @@ +/* +* Engine for AES instructions +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_AES_ISA_ENGINE_H__ +#define BOTAN_AES_ISA_ENGINE_H__ + +#include <botan/engine.h> + +namespace Botan { + +/** +* Engine for implementations that hook into CPU-specific +* AES implementations (eg AES-NI, VIA C7, or AMD Geode) +*/ +class AES_ISA_Engine : public Engine + { + public: + std::string provider_name() const { return "aes_isa"; } + + BlockCipher* find_block_cipher(const SCAN_Name&, + Algorithm_Factory&) const; + }; + +} + +#endif diff --git a/src/lib/engine/aes_isa_eng/info.txt b/src/lib/engine/aes_isa_eng/info.txt new file mode 100644 index 000000000..4284e75bd --- /dev/null +++ b/src/lib/engine/aes_isa_eng/info.txt @@ -0,0 +1,11 @@ +define ENGINE_AES_ISA 20131128 + +load_on dep + +<source> +aes_isa_engine.cpp +</source> + +<header:internal> +aes_isa_engine.h +</header:internal> |