45
by weidai
add new algorithms (Kevin Springle) |
1 |
#ifndef CRYPTOPP_CAMELLIA_H
|
2 |
#define CRYPTOPP_CAMELLIA_H
|
|
3 |
||
4 |
#include "config.h" |
|
5 |
||
6 |
/** \file
|
|
7 |
*/
|
|
8 |
||
9 |
#include "seckey.h" |
|
10 |
#include "secblock.h" |
|
11 |
||
12 |
NAMESPACE_BEGIN(CryptoPP) |
|
13 |
||
173
by weidai
fix documentation, fix PanamaMAC, fix algorithm names |
14 |
//! _
|
45
by weidai
add new algorithms (Kevin Springle) |
15 |
struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8> |
16 |
{
|
|
17 |
static const char *StaticAlgorithmName() {return "Camellia";} |
|
18 |
};
|
|
19 |
||
20 |
/// <a href="http://www.weidai.com/scan-mirror/cs.html#Camellia">Camellia</a>
|
|
21 |
class Camellia : public Camellia_Info, public BlockCipherDocumentation |
|
22 |
{
|
|
75
by weidai
create DLL version, fix GetNextIV() bug in CTR and OFB modes |
23 |
class CRYPTOPP_NO_VTABLE Base : public BlockCipherImpl<Camellia_Info> |
45
by weidai
add new algorithms (Kevin Springle) |
24 |
{
|
25 |
public: |
|
232
by weidai
port to GCC 4, reorganize implementations of SetKey |
26 |
void UncheckedSetKey(const byte *key, unsigned int keylen, const NameValuePairs ¶ms); |
45
by weidai
add new algorithms (Kevin Springle) |
27 |
void ProcessAndXorBlock(const byte *inBlock, const byte *xorBlock, byte *outBlock) const; |
28 |
||
29 |
protected: |
|
30 |
static const byte s1[256]; |
|
269
by weidai
optimized Camellia and added defense against timing attacks |
31 |
static const word32 SP[4][256]; |
45
by weidai
add new algorithms (Kevin Springle) |
32 |
|
33 |
unsigned int m_rounds; |
|
269
by weidai
optimized Camellia and added defense against timing attacks |
34 |
SecBlock<word32> m_key; |
45
by weidai
add new algorithms (Kevin Springle) |
35 |
};
|
36 |
||
37 |
public: |
|
75
by weidai
create DLL version, fix GetNextIV() bug in CTR and OFB modes |
38 |
typedef BlockCipherFinal<ENCRYPTION, Base> Encryption; |
39 |
typedef BlockCipherFinal<DECRYPTION, Base> Decryption; |
|
45
by weidai
add new algorithms (Kevin Springle) |
40 |
};
|
41 |
||
42 |
typedef Camellia::Encryption CamelliaEncryption; |
|
43 |
typedef Camellia::Decryption CamelliaDecryption; |
|
44 |
||
45 |
NAMESPACE_END
|
|
46 |
||
47 |
#endif
|