Crypto++  5.6.5
Free C++ class library of cryptographic schemes
sosemanuk.h
Go to the documentation of this file.
1 // sosemanuk.h - 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 //! \class SosemanukInfo
22 //! \brief Sosemanuk stream cipher information
23  //! \since Crypto++ 5.5
24 struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterface::UNIQUE_IV, 16>
25 {
26  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Sosemanuk";}
27 };
28 
29 //! \class SosemanukPolicy
30 //! \brief Sosemanuk stream cipher implementation
31 //! \since Crypto++ 5.5
33 {
34 protected:
35  void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
36  void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
37  void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
38  bool CipherIsRandomAccess() const {return false;}
39 #if (CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64) && !defined(CRYPTOPP_DISABLE_SOSEMANUK_ASM)
40  unsigned int GetAlignment() const;
41  unsigned int GetOptimalBlockSize() const;
42 #endif
43 
46 };
47 
48 //! \class Sosemanuk
49 //! \brief Sosemanuk stream cipher
50 //! \details is a stream cipher developed by Come Berbain, Olivier Billet, Anne Canteaut, Nicolas Courtois,
51 //! Henri Gilbert, Louis Goubin, Aline Gouget, Louis Granboulan, Cédric Lauradoux, Marine Minier, Thomas
52 //! Pornin and Hervé Sibert. Sosemanuk is one of the final four Profile 1 (software) ciphers selected for
53 //! the eSTREAM Portfolio.
54 //! \sa <a href="http://www.cryptolounge.org/wiki/Sosemanuk">Sosemanuk</a>
55 //! \since Crypto++ 5.5
57 {
59  typedef Encryption Decryption;
60 };
61 
62 NAMESPACE_END
63 
64 #endif
virtual unsigned int GetOptimalBlockSize() const
Provides number of ideal bytes to process.
Definition: strciphr.h:125
Sosemanuk stream cipher implementation.
Definition: sosemanuk.h:32
unsigned int GetAlignment() const
Provides data alignment requirements.
Definition: strciphr.h:196
Base class for additive stream ciphers.
Definition: strciphr.h:186
Sosemanuk stream cipher.
Definition: sosemanuk.h:56
Classes and functions for secure memory allocations.
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Definition: cryptlib.h:1103
Interface for algorithms that take byte strings as keys.
Definition: cryptlib.h:524
Sosemanuk stream cipher information.
Definition: sosemanuk.h:24
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:169
Classes for implementing stream ciphers.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher...
Definition: seckey.h:424
KeystreamOperation
Keystream operation flags.
Definition: strciphr.h:90
Crypto++ library namespace.
SymmetricCipher implementation.
Definition: strciphr.h:584
Interface for retrieving values given their names.
Definition: cryptlib.h:279