Crypto++  7.0
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 due to "Inline assembly operands don't work with .intel_syntax"
14 // https://llvm.org/bugs/show_bug.cgi?id=24232
15 #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_INTEL_ASM)
16 # define CRYPTOPP_DISABLE_SOSEMANUK_ASM
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
31 {
32 protected:
33  void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
34  void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
35  void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
36  bool CipherIsRandomAccess() const {return false;}
37 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64)
38  unsigned int GetAlignment() const;
39  unsigned int GetOptimalBlockSize() const;
40 #endif
41 
44 };
45 
46 /// \brief Sosemanuk stream cipher
47 /// \details is a stream cipher developed by Come Berbain, Olivier Billet, Anne Canteaut, Nicolas Courtois,
48 /// Henri Gilbert, Louis Goubin, Aline Gouget, Louis Granboulan, Cédric Lauradoux, Marine Minier, Thomas
49 /// Pornin and Hervé Sibert. Sosemanuk is one of the final four Profile 1 (software) ciphers selected for
50 /// the eSTREAM Portfolio.
51 /// \sa <a href="http://www.cryptolounge.org/wiki/Sosemanuk">Sosemanuk</a>
52 /// \since Crypto++ 5.5
54 {
56  typedef Encryption Decryption;
57 };
58 
59 NAMESPACE_END
60 
61 #endif
Sosemanuk stream cipher implementation.
Definition: sosemanuk.h:30
Base class for additive stream ciphers.
Definition: strciphr.h:181
virtual unsigned int GetOptimalBlockSize() const
Provides number of ideal bytes to process.
Definition: strciphr.h:122
unsigned int GetAlignment() const
Provides data alignment requirements.
Definition: strciphr.h:191
Sosemanuk stream cipher.
Definition: sosemanuk.h:53
Classes and functions for secure memory allocations.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Definition: cryptlib.h:1237
Interface for algorithms that take byte strings as keys.
Definition: cryptlib.h:599
Sosemanuk stream cipher information.
Definition: sosemanuk.h:23
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:188
Classes for implementing stream ciphers.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher...
Definition: seckey.h:435
KeystreamOperation
Keystream operation flags.
Definition: strciphr.h:88
Crypto++ library namespace.
SymmetricCipher implementation.
Definition: strciphr.h:571
Interface for retrieving values given their names.
Definition: cryptlib.h:290