Botan 1.10.17

aes.h
Go to the documentation of this file.
1 /*
2 * AES
3 * (C) 1999-2010 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_AES_H__
9 #define BOTAN_AES_H__
10
11 #include <botan/block_cipher.h>
12
13 namespace Botan {
14
15 /**
16 * AES-128
17 */
18 class BOTAN_DLL AES_128 : public Block_Cipher_Fixed_Params<16, 16>
19 {
20 public:
21 AES_128() : EK(40), DK(40), ME(16), MD(16) {}
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
28 std::string name() const { return "AES-128"; }
29 BlockCipher* clone() const { return new AES_128; }
30 private:
31 void key_schedule(const byte key[], size_t length);
32
33 SecureVector<u32bit> EK, DK;
34 SecureVector<byte> ME, MD;
35 };
36
37 /**
38 * AES-192
39 */
40 class BOTAN_DLL AES_192 : public Block_Cipher_Fixed_Params<16, 24>
41 {
42 public:
43 AES_192() : EK(48), DK(48), ME(16), MD(16) {}
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
50 std::string name() const { return "AES-192"; }
51 BlockCipher* clone() const { return new AES_192; }
52 private:
53 void key_schedule(const byte key[], size_t length);
54
55 SecureVector<u32bit> EK, DK;
56 SecureVector<byte> ME, MD;
57 };
58
59 /**
60 * AES-256
61 */
62 class BOTAN_DLL AES_256 : public Block_Cipher_Fixed_Params<16, 32>
63 {
64 public:
65 AES_256() : EK(56), DK(56), ME(16), MD(16) {}
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
72 std::string name() const { return "AES-256"; }
73 BlockCipher* clone() const { return new AES_256; }
74 private:
75 void key_schedule(const byte key[], size_t length);
76
77 SecureVector<u32bit> EK, DK;
78 SecureVector<byte> ME, MD;
79 };
80
81 }
82
83 #endif
Botan::AES_192::name
std::string name() const
Definition: aes.h:50
Botan::AES_128::clone
BlockCipher * clone() const
Definition: aes.h:29
Botan::AES_256::clone
BlockCipher * clone() const
Definition: aes.h:73
Botan::AES_192::AES_192
AES_192()
Definition: aes.h:43
Botan::AES_128
Definition: aes.h:18
Botan::AES_256::AES_256
AES_256()
Definition: aes.h:65
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::AES_192
Definition: aes.h:40
Botan::AES_128::name
std::string name() const
Definition: aes.h:28
Botan::AES_256::name
std::string name() const
Definition: aes.h:72
Botan
Definition: algo_base.h:14
Botan::AES_128::AES_128
AES_128()
Definition: aes.h:21
Botan::AES_256
Definition: aes.h:62
Botan::SecureVector< u32bit >
Botan::Block_Cipher_Fixed_Params
Definition: block_cipher.h:104
Botan::AES_192::clone
BlockCipher * clone() const
Definition: aes.h:51
Botan::BlockCipher
Definition: block_cipher.h:18