// lea.h - written and placed in the public domain by Kim Sung Hee and Jeffrey Walton // Based on "LEA: A 128-Bit Block Cipher for Fast Encryption on Common // Processors" by Deukjo Hong, Jung-Keun Lee, Dong-Chan Kim, Daesung Kwon, // Kwon Ho Ryu, and Dong-Geon Lee. /// \file lea.h /// \brief Classes for the LEA block cipher /// \since Crypto++ 7.1 #ifndef CRYPTOPP_LEA_H #define CRYPTOPP_LEA_H #include "config.h" #include "seckey.h" #include "secblock.h" #include "algparam.h" NAMESPACE_BEGIN(CryptoPP) /// \brief LEA block cipher information /// \since Crypto++ 7.1 struct LEA_Info : public FixedBlockSize<16>, VariableKeyLength<16,16,32,8> { static const std::string StaticAlgorithmName() { // Format is Cipher-Blocksize return "LEA-128"; } }; /// \brief LEA 128-bit block cipher /// \details LEA provides 128-bit block size. The valid key size is 128-bits, 192-bits and 256-bits. /// \note Crypto++ provides a byte oriented implementation /// \sa LEA, /// LEA: A 128-Bit Block Cipher for Fast Encryption on Common Processors /// \since Crypto++ 7.1 class CRYPTOPP_NO_VTABLE LEA : public LEA_Info, public BlockCipherDocumentation { public: /// \brief LEA block cipher transformation functions /// \details Provides implementation common to encryption and decryption /// \since Crypto++ 7.1 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl { protected: void UncheckedSetKey(const byte *userKey, unsigned int keyLength, const NameValuePairs ¶ms); SecBlock m_rkey; mutable SecBlock m_temp; unsigned int m_rounds; }; /// \brief Provides implementation for encryption transformation /// \details Enc provides implementation for encryption transformation. All key and block /// sizes are supported. /// \since Crypto++ 7.1 class CRYPTOPP_NO_VTABLE Enc : public Base { public: void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; }; /// \brief Provides implementation for encryption transformation /// \details Dec provides implementation for decryption transformation. All key and block /// sizes are supported. /// \since Crypto++ 7.1 class CRYPTOPP_NO_VTABLE Dec : public Base { public: void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; }; typedef BlockCipherFinal Encryption; typedef BlockCipherFinal Decryption; }; typedef LEA::Encryption LEAEncryption; typedef LEA::Decryption LEADecryption; NAMESPACE_END #endif // CRYPTOPP_LEA_H