Crypto++ 8.9 Free C++ class library of cryptographic schemes

sosemanuk.h
Go to the documentation of this file.
1 // sosemanuk.h - originally written and placed in the public domain by Wei Dai
2
3 /// \file sosemanuk.h
4 /// \brief Classes for Sosemanuk stream cipher
5 /// \since Crypto++ 5.5
6
7 #ifndef CRYPTOPP_SOSEMANUK_H
8 #define CRYPTOPP_SOSEMANUK_H
9
10 #include "strciphr.h"
11 #include "secblock.h"
12
13 // Clang 3.3 integrated assembler crash on Linux. Clang 3.4 due to compiler
14 // error with .intel_syntax, http://llvm.org/bugs/show_bug.cgi?id=24232
15 #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_MIXED_ASM)
16 # define CRYPTOPP_DISABLE_SOSEMANUK_ASM 1
17 #endif
18
19 NAMESPACE_BEGIN(CryptoPP)
20
21 /// \brief Sosemanuk stream cipher information
22 /// \since Crypto++ 5.5
23 struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16>
24 {
25 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Sosemanuk";}
26 };
27
28 /// \brief Sosemanuk stream cipher implementation
29 /// \since Crypto++ 5.5
30 class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
31 {
32 protected:
33 std::string AlgorithmProvider() const;
34 void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
35 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
36 void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
37 bool CipherIsRandomAccess() const {return false;}
38 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
39 unsigned int GetAlignment() const;
40 unsigned int GetOptimalBlockSize() const;
41 #endif
42
43 FixedSizeSecBlock<word32, 25*4> m_key;
44 FixedSizeAlignedSecBlock<word32, 12> m_state;
45 };
46
47 /// \brief Sosemanuk stream cipher
48 /// \details is a stream cipher developed by Come Berbain, Olivier Billet, Anne Canteaut, Nicolas Courtois,
49 /// Henri Gilbert, Louis Goubin, Aline Gouget, Louis Granboulan, Cédric Lauradoux, Marine Minier, Thomas
50 /// Pornin and Hervé Sibert. Sosemanuk is one of the final four Profile 1 (software) ciphers selected for
51 /// the eSTREAM Portfolio.
52 /// \sa <a href="http://www.cryptolounge.org/wiki/Sosemanuk">Sosemanuk</a>
53 /// \since Crypto++ 5.5
54 struct Sosemanuk : public SosemanukInfo, public SymmetricCipherDocumentation
55 {
56 typedef SymmetricCipherFinal<ConcretePolicyHolder<SosemanukPolicy, AdditiveCipherTemplate<> >, SosemanukInfo> Encryption;
57 typedef Encryption Decryption;
58 };
59
60 NAMESPACE_END
61
62 #endif
FixedSizeAlignedSecBlock< word32, 12 >
FixedSizeSecBlock< word32, 25 *4 >
NameValuePairs
Interface for retrieving values given their names.
Definition: cryptlib.h:327
SimpleKeyingInterface
Interface for algorithms that take byte strings as keys.
Definition: cryptlib.h:647
SosemanukPolicy
Sosemanuk stream cipher implementation.
Definition: sosemanuk.h:31
SymmetricCipherFinal
SymmetricCipher implementation.
Definition: strciphr.h:684
SymmetricCipher
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode.
Definition: cryptlib.h:1296
VariableKeyLength
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:166
CryptoPP
Crypto++ library namespace.
secblock.h
Classes and functions for secure memory allocations.
strciphr.h
Classes for implementing stream ciphers.
KeystreamOperation
KeystreamOperation
Keystream operation flags.
Definition: strciphr.h:88
AdditiveCipherConcretePolicy
Base class for additive stream ciphers.
Definition: strciphr.h:202
Sosemanuk
Sosemanuk stream cipher.
Definition: sosemanuk.h:55
SosemanukInfo
Sosemanuk stream cipher information.
Definition: sosemanuk.h:24
SymmetricCipherDocumentation
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher.
Definition: seckey.h:414