Botan: src/block/aes_ni/aes_ni.h Source File

Botan 1.10.16

aes_ni.h
Go to the documentation of this file.
1 /*
2 * AES using AES-NI instructions
3 * (C) 2009 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_AES_NI_H__
9 #define BOTAN_AES_NI_H__
10
11 #include <botan/block_cipher.h>
12
13 namespace Botan {
14
15 /**
16 * AES-128 using AES-NI
17 */
18 class BOTAN_DLL AES_128_NI : public Block_Cipher_Fixed_Params<16, 16>
19 {
20 public:
21 size_t parallelism() const { return 4; }
22
23 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
24 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
25
26 void clear();
27 std::string name() const { return "AES-128"; }
28 BlockCipher* clone() const { return new AES_128_NI; }
29
30 AES_128_NI() : EK(44), DK(44) { }
31 private:
32 void key_schedule(const byte[], size_t);
33
34 SecureVector<u32bit> EK, DK;
35 };
36
37 /**
38 * AES-192 using AES-NI
39 */
40 class BOTAN_DLL AES_192_NI : public Block_Cipher_Fixed_Params<16, 24>
41 {
42 public:
43 size_t parallelism() const { return 4; }
44
45 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
46 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
47
48 void clear();
49 std::string name() const { return "AES-192"; }
50 BlockCipher* clone() const { return new AES_192_NI; }
51
52 AES_192_NI() : EK(52), DK(52) { }
53 private:
54 void key_schedule(const byte[], size_t);
55
56 SecureVector<u32bit> EK, DK;
57 };
58
59 /**
60 * AES-256 using AES-NI
61 */
62 class BOTAN_DLL AES_256_NI : public Block_Cipher_Fixed_Params<16, 32>
63 {
64 public:
65 size_t parallelism() const { return 4; }
66
67 void encrypt_n(const byte in[], byte out[], size_t blocks) const;
68 void decrypt_n(const byte in[], byte out[], size_t blocks) const;
69
70 void clear();
71 std::string name() const { return "AES-256"; }
72 BlockCipher* clone() const { return new AES_256_NI; }
73
74 AES_256_NI() : EK(60), DK(60) { }
75 private:
76 void key_schedule(const byte[], size_t);
77
78 SecureVector<u32bit> EK, DK;
79 };
80
81 }
82
83 #endif
Botan::AES_256_NI::clone
BlockCipher * clone() const
Definition: aes_ni.h:72
Botan::AES_192_NI::AES_192_NI
AES_192_NI()
Definition: aes_ni.h:52
Botan::AES_128_NI::name
std::string name() const
Definition: aes_ni.h:27
Botan::AES_192_NI::name
std::string name() const
Definition: aes_ni.h:49
Botan::AES_128_NI::AES_128_NI
AES_128_NI()
Definition: aes_ni.h:30
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::AES_128_NI
Definition: aes_ni.h:18
Botan::AES_256_NI::name
std::string name() const
Definition: aes_ni.h:71
Botan
Definition: algo_base.h:14
Botan::AES_256_NI::AES_256_NI
AES_256_NI()
Definition: aes_ni.h:74
Botan::AES_256_NI
Definition: aes_ni.h:62
Botan::AES_192_NI::clone
BlockCipher * clone() const
Definition: aes_ni.h:50
Botan::AES_192_NI
Definition: aes_ni.h:40
Botan::AES_256_NI::parallelism
size_t parallelism() const
Definition: aes_ni.h:65
Botan::SecureVector< u32bit >
Botan::Block_Cipher_Fixed_Params
Definition: block_cipher.h:104
Botan::AES_128_NI::clone
BlockCipher * clone() const
Definition: aes_ni.h:28
Botan::AES_192_NI::parallelism
size_t parallelism() const
Definition: aes_ni.h:43
Botan::AES_128_NI::parallelism
size_t parallelism() const
Definition: aes_ni.h:21
Botan::BlockCipher
Definition: block_cipher.h:18