00001
00002
00003
00004
00005
00006 #ifndef CRYPTOPP_SOSEMANUK_H
00007 #define CRYPTOPP_SOSEMANUK_H
00008
00009 #include "strciphr.h"
00010 #include "secblock.h"
00011
00012
00013
00014 #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_INTEL_ASM)
00015 # define CRYPTOPP_DISABLE_SOSEMANUK_ASM
00016 #endif
00017
00018 NAMESPACE_BEGIN(CryptoPP)
00019
00020
00021 struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16>
00022 {
00023 static const char * StaticAlgorithmName() {return "Sosemanuk";}
00024 };
00025
00026
00027 class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
00028 {
00029 protected:
00030 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
00031 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
00032 void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
00033 bool CipherIsRandomAccess() const {return false;}
00034 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) && !defined(CRYPTOPP_DISABLE_SOSEMANUK_ASM)
00035 unsigned int GetAlignment() const;
00036 unsigned int GetOptimalBlockSize() const;
00037 #endif
00038
00039 FixedSizeSecBlock<word32, 25*4> m_key;
00040 FixedSizeAlignedSecBlock<word32, 12> m_state;
00041 };
00042
00043
00044 struct Sosemanuk : public SosemanukInfo, public SymmetricCipherDocumentation
00045 {
00046 typedef SymmetricCipherFinal<ConcretePolicyHolder<SosemanukPolicy, AdditiveCipherTemplate<> >, SosemanukInfo> Encryption;
00047 typedef Encryption Decryption;
00048 };
00049
00050 NAMESPACE_END
00051
00052 #endif