~zooko/cryptopp/trunk

1 by weidai
Initial revision
1
#ifndef CRYPTOPP_SEAL_H
2
#define CRYPTOPP_SEAL_H
3
4
#include "strciphr.h"
5
6
NAMESPACE_BEGIN(CryptoPP)
7
173 by weidai
fix documentation, fix PanamaMAC, fix algorithm names
8
//! _
1 by weidai
Initial revision
9
template <class B = BigEndian>
244 by weidai
port to Borland C++Builder 2006
10
struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV, 4>
1 by weidai
Initial revision
11
{
12
	static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "SEAL-3.0-LE" : "SEAL-3.0-BE";}
13
};
14
15
template <class B = BigEndian>
57 by weidai
add CRYPTOPP_NO_VTABLE
16
class CRYPTOPP_NO_VTABLE SEAL_Policy : public AdditiveCipherConcretePolicy<word32, 256>, public SEAL_Info<B>
1 by weidai
Initial revision
17
{
18
protected:
184 by weidai
port to MSVC .NET 2005 beta 2
19
	void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
20
	void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
412 by weidai
changes for 5.6:
21
	void CipherResynchronize(byte *keystreamBuffer, const byte *IV, size_t length);
401 by weidai
fix infinite recursive call in IsRandomAccess (reported by ASBai)
22
	bool CipherIsRandomAccess() const {return true;}
100 by weidai
fix bugs in 64-bit CPU support
23
	void SeekToIteration(lword iterationCount);
1 by weidai
Initial revision
24
25
private:
26
	FixedSizeSecBlock<word32, 512> m_T;
27
	FixedSizeSecBlock<word32, 256> m_S;
28
	SecBlock<word32> m_R;
29
30
	word32 m_startCount, m_iterationsPerCount;
31
	word32 m_outsideCounter, m_insideCounter;
32
};
33
34
//! <a href="http://www.weidai.com/scan-mirror/cs.html#SEAL-3.0-BE">SEAL</a>
35
template <class B = BigEndian>
36
struct SEAL : public SEAL_Info<B>, public SymmetricCipherDocumentation
37
{
75 by weidai
create DLL version, fix GetNextIV() bug in CTR and OFB modes
38
	typedef SymmetricCipherFinal<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> >, SEAL_Info<B> > Encryption;
1 by weidai
Initial revision
39
	typedef Encryption Decryption;
40
};
41
42
NAMESPACE_END
43
44
#endif