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