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 clear()24 void clear() { zeroise(EK); zeroise(DK); } name()25 std::string name() const { return "AES-128"; } clone()26 BlockCipher* clone() const { return new AES_128_SSSE3; } 27 AES_128_SSSE3()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 clear()44 void clear() { zeroise(EK); zeroise(DK); } name()45 std::string name() const { return "AES-192"; } clone()46 BlockCipher* clone() const { return new AES_192_SSSE3; } 47 AES_192_SSSE3()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 clear()64 void clear() { zeroise(EK); zeroise(DK); } name()65 std::string name() const { return "AES-256"; } clone()66 BlockCipher* clone() const { return new AES_256_SSSE3; } 67 AES_256_SSSE3()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 78