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