Botan
1.11.15
|
00001 /* 00002 * AES using SSSE3 00003 * (C) 2010 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_AES_SSSE3_H__ 00009 #define BOTAN_AES_SSSE3_H__ 00010 00011 #include <botan/block_cipher.h> 00012 00013 namespace Botan { 00014 00015 /** 00016 * AES-128 using SSSE3 00017 */ 00018 class BOTAN_DLL AES_128_SSSE3 : public Block_Cipher_Fixed_Params<16, 16> 00019 { 00020 public: 00021 void encrypt_n(const byte in[], byte out[], size_t blocks) const; 00022 void decrypt_n(const byte in[], byte out[], size_t blocks) const; 00023 00024 void clear(); 00025 std::string name() const { return "AES-128"; } 00026 BlockCipher* clone() const { return new AES_128_SSSE3; } 00027 private: 00028 void key_schedule(const byte[], size_t); 00029 00030 secure_vector<u32bit> EK, DK; 00031 }; 00032 00033 /** 00034 * AES-192 using SSSE3 00035 */ 00036 class BOTAN_DLL AES_192_SSSE3 : public Block_Cipher_Fixed_Params<16, 24> 00037 { 00038 public: 00039 void encrypt_n(const byte in[], byte out[], size_t blocks) const; 00040 void decrypt_n(const byte in[], byte out[], size_t blocks) const; 00041 00042 void clear(); 00043 std::string name() const { return "AES-192"; } 00044 BlockCipher* clone() const { return new AES_192_SSSE3; } 00045 private: 00046 void key_schedule(const byte[], size_t); 00047 00048 secure_vector<u32bit> EK, DK; 00049 }; 00050 00051 /** 00052 * AES-256 using SSSE3 00053 */ 00054 class BOTAN_DLL AES_256_SSSE3 : public Block_Cipher_Fixed_Params<16, 32> 00055 { 00056 public: 00057 void encrypt_n(const byte in[], byte out[], size_t blocks) const; 00058 void decrypt_n(const byte in[], byte out[], size_t blocks) const; 00059 00060 void clear(); 00061 std::string name() const { return "AES-256"; } 00062 BlockCipher* clone() const { return new AES_256_SSSE3; } 00063 private: 00064 void key_schedule(const byte[], size_t); 00065 00066 secure_vector<u32bit> EK, DK; 00067 }; 00068 00069 } 00070 00071 #endif