00001 #ifndef CRYPTOPP_RIJNDAEL_H
00002 #define CRYPTOPP_RIJNDAEL_H
00003
00004
00005
00006
00007 #include "seckey.h"
00008 #include "secblock.h"
00009
00010 NAMESPACE_BEGIN(CryptoPP)
00011
00012
00013 struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
00014 {
00015 CRYPTOPP_DLL static const char * CRYPTOPP_API StaticAlgorithmName() {return CRYPTOPP_RIJNDAEL_NAME;}
00016 };
00017
00018
00019 class CRYPTOPP_DLL Rijndael : public Rijndael_Info, public BlockCipherDocumentation
00020 {
00021 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Rijndael_Info>
00022 {
00023 public:
00024 void UncheckedSetKey(const byte *userKey, unsigned int length, const NameValuePairs ¶ms);
00025
00026 protected:
00027
00028 CRYPTOPP_L1_CACHE_ALIGN(static const byte Se[256]);
00029 CRYPTOPP_L1_CACHE_ALIGN(static const byte Sd[256]);
00030 CRYPTOPP_L1_CACHE_ALIGN(static const word32 Te0[256]);
00031 static const word32 Te1[256];
00032 static const word32 Te2[256];
00033 static const word32 Te3[256];
00034 CRYPTOPP_L1_CACHE_ALIGN(static const word32 Td0[256]);
00035 static const word32 Td1[256];
00036 static const word32 Td2[256];
00037 static const word32 Td3[256];
00038
00039 static const word32 rcon[];
00040
00041 unsigned int m_rounds;
00042 SecBlock<word32> m_key;
00043 };
00044
00045 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Enc : public Base
00046 {
00047 public:
00048 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00049 };
00050
00051 class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Dec : public Base
00052 {
00053 public:
00054 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
00055 };
00056
00057 public:
00058 typedef BlockCipherFinal<ENCRYPTION, Enc> Encryption;
00059 typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
00060 };
00061
00062 typedef Rijndael::Encryption RijndaelEncryption;
00063 typedef Rijndael::Decryption RijndaelDecryption;
00064
00065 NAMESPACE_END
00066
00067 #endif