File indexing completed on 2025-01-18 09:55:09
0001
0002
0003
0004
0005
0006
0007 #ifndef CRYPTOPP_SOSEMANUK_H
0008 #define CRYPTOPP_SOSEMANUK_H
0009
0010 #include "strciphr.h"
0011 #include "secblock.h"
0012
0013
0014
0015 #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_MIXED_ASM)
0016 # define CRYPTOPP_DISABLE_SOSEMANUK_ASM 1
0017 #endif
0018
0019 NAMESPACE_BEGIN(CryptoPP)
0020
0021
0022
0023 struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16>
0024 {
0025 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Sosemanuk";}
0026 };
0027
0028
0029
0030 class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
0031 {
0032 protected:
0033 std::string AlgorithmProvider() const;
0034 void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
0035 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
0036 void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
0037 bool CipherIsRandomAccess() const {return false;}
0038 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
0039 unsigned int GetAlignment() const;
0040 unsigned int GetOptimalBlockSize() const;
0041 #endif
0042
0043 FixedSizeSecBlock<word32, 25*4> m_key;
0044 FixedSizeAlignedSecBlock<word32, 12> m_state;
0045 };
0046
0047
0048
0049
0050
0051
0052
0053
0054 struct Sosemanuk : public SosemanukInfo, public SymmetricCipherDocumentation
0055 {
0056 typedef SymmetricCipherFinal<ConcretePolicyHolder<SosemanukPolicy, AdditiveCipherTemplate<> >, SosemanukInfo> Encryption;
0057 typedef Encryption Decryption;
0058 };
0059
0060 NAMESPACE_END
0061
0062 #endif