Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:54

0001 // camellia.h - originally written and placed in the public domain by Wei Dai

0002 
0003 /// \file camellia.h

0004 /// \brief Classes for the Camellia block cipher

0005 
0006 #ifndef CRYPTOPP_CAMELLIA_H
0007 #define CRYPTOPP_CAMELLIA_H
0008 
0009 #include "config.h"
0010 #include "seckey.h"
0011 #include "secblock.h"
0012 
0013 NAMESPACE_BEGIN(CryptoPP)
0014 
0015 /// \brief Camellia block cipher information

0016 struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
0017 {
0018     CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Camellia";}
0019 };
0020 
0021 /// \brief Camellia block cipher

0022 /// \sa <a href="http://www.cryptopp.com/wiki/Camellia">Camellia</a>

0023 class Camellia : public Camellia_Info, public BlockCipherDocumentation
0024 {
0025     class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Camellia_Info>
0026     {
0027     public:
0028         void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs &params);
0029         void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
0030 
0031     protected:
0032         CRYPTOPP_ALIGN_DATA(4) static const byte s1[256];
0033         static const word32 SP[4][256];
0034 
0035         unsigned int m_rounds;
0036         SecBlock<word32> m_key;
0037     };
0038 
0039 public:
0040     typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
0041     typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
0042 };
0043 
0044 typedef Camellia::Encryption CamelliaEncryption;
0045 typedef Camellia::Decryption CamelliaDecryption;
0046 
0047 NAMESPACE_END
0048 
0049 #endif