Crypto++ 8.9 Free C++ class library of cryptographic schemes

camellia.h
Go to the documentation of this file.
1 // camellia.h - originally written and placed in the public domain by Wei Dai
2
3 /// \file camellia.h
4 /// \brief Classes for the Camellia block cipher
5
6 #ifndef CRYPTOPP_CAMELLIA_H
7 #define CRYPTOPP_CAMELLIA_H
8
9 #include "config.h"
10 #include "seckey.h"
11 #include "secblock.h"
12
13 NAMESPACE_BEGIN(CryptoPP)
14
15 /// \brief Camellia block cipher information
16 struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
17 {
18 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Camellia";}
19 };
20
21 /// \brief Camellia block cipher
22 /// \sa <a href="http://www.cryptopp.com/wiki/Camellia">Camellia</a>
23 class Camellia : public Camellia_Info, public BlockCipherDocumentation
24 {
25 class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Camellia_Info>
26 {
27 public:
28 void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs &params);
29 void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const;
30
31 protected:
32 CRYPTOPP_ALIGN_DATA(4) static const byte s1[256];
33 static const word32 SP[4][256];
34
35 unsigned int m_rounds;
36 SecBlock<word32> m_key;
37 };
38
39 public:
40 typedef BlockCipherFinal<ENCRYPTION, Base> Encryption;
41 typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
42 };
43
44 typedef Camellia::Encryption CamelliaEncryption;
45 typedef Camellia::Decryption CamelliaDecryption;
46
47 NAMESPACE_END
48
49 #endif
BlockCipherFinal
Provides class member functions to key a block cipher.
Definition: seckey.h:318
BlockCipherImpl
Provides a base implementation of Algorithm and SimpleKeyingInterface for block ciphers.
Definition: seckey.h:306
Camellia
Camellia block cipher.
Definition: camellia.h:24
FixedBlockSize
Inherited by algorithms with fixed block size.
Definition: seckey.h:41
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:327
SecBlock< word32 >
VariableKeyLength
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:166
config.h
Library configuration file.
word32
unsigned int word32
32-bit unsigned datatype
Definition: config_int.h:72
CryptoPP
Crypto++ library namespace.
secblock.h
Classes and functions for secure memory allocations.
seckey.h
Classes and functions for implementing secret key algorithms.
BlockCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a block cipher.
Definition: seckey.h:399
Camellia_Info
Camellia block cipher information.
Definition: camellia.h:17