1#ifndef CRYPTOPP_SOSEMANUK_H 2#define CRYPTOPP_SOSEMANUK_H 3 4#include "strciphr.h" 5 6NAMESPACE_BEGIN(CryptoPP) 7 8//! algorithm info 9struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16> 10{ 11 static const char * StaticAlgorithmName() {return "Sosemanuk";} 12}; 13 14//! _ 15class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo 16{ 17protected: 18 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length); 19 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount); 20 void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length); 21 bool CipherIsRandomAccess() const {return false;} 22#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64 23 unsigned int GetAlignment() const; 24 unsigned int GetOptimalBlockSize() const; 25#endif 26 27 FixedSizeSecBlock<word32, 25*4> m_key; 28 FixedSizeAlignedSecBlock<word32, 12> m_state; 29}; 30 31//! <a href="http://www.cryptolounge.org/wiki/Sosemanuk">Sosemanuk</a> 32struct Sosemanuk : public SosemanukInfo, public SymmetricCipherDocumentation 33{ 34 typedef SymmetricCipherFinal<ConcretePolicyHolder<SosemanukPolicy, AdditiveCipherTemplate<> >, SosemanukInfo> Encryption; 35 typedef Encryption Decryption; 36}; 37 38NAMESPACE_END 39 40#endif 41