13 #if CRYPTOPP_DEBUG && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 14 void SEAL_TestInstantiations()
23 : H(5), Z(5), D(16), lastIndex(0xffffffff)
29 word32 Apply(word32 i);
35 word32 SEAL_Gamma::Apply(word32 i)
37 word32 shaIndex = i/5;
38 if (shaIndex != lastIndex)
51 CRYPTOPP_UNUSED(length);
52 m_insideCounter = m_outsideCounter = m_startCount = 0;
55 m_iterationsPerCount = L / 8192;
61 m_T[i] = gamma.Apply(i);
64 m_S[i] = gamma.Apply(0x1000+i);
68 for (i=0; i<m_R.size(); i++)
69 m_R[i] = gamma.Apply(0x2000+i);
75 CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(IV), CRYPTOPP_UNUSED(length);
79 m_startCount = m_outsideCounter;
86 m_outsideCounter = m_startCount + (
unsigned int)(iterationCount / m_iterationsPerCount);
87 m_insideCounter = (
unsigned int)(iterationCount % m_iterationsPerCount);
93 word32 a, b, c, d, n1, n2, n3, n4;
97 for (
size_t iteration = 0; iteration < iterationCount; ++iteration)
99 #define Ttab(x) *(word32 *)(void*)((byte *)m_T.begin()+x) 101 a = m_outsideCounter ^ m_R[4*m_insideCounter];
102 b =
rotrFixed(m_outsideCounter, 8U) ^ m_R[4*m_insideCounter+1];
103 c =
rotrFixed(m_outsideCounter, 16U) ^ m_R[4*m_insideCounter+2];
104 d =
rotrFixed(m_outsideCounter, 24U) ^ m_R[4*m_insideCounter+3];
106 for (
unsigned int j=0; j<2; j++)
125 n1 = d, n2 = b, n3 = a, n4 = c;
144 for (
unsigned int i=0; i<64; i++)
182 #define SEAL_OUTPUT(x) \ 183 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, b + m_S[4*i+0]);\ 184 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 1, c ^ m_S[4*i+1]);\ 185 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 2, d + m_S[4*i+2]);\ 186 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 3, a ^ m_S[4*i+3]); 206 if (++m_insideCounter == m_iterationsPerCount)
213 a = b = c = d = n1 = n2 = n3 = n4 = 0;
SEAL stream cipher operation.
int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
Utility functions for the Crypto++ library.
#define CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(x, y)
Helper macro to implement OperateKeystream.
Classes and functions for secure memory allocations.
bool IsAlignedOn(const void *ptr, unsigned int alignment)
Determines whether ptr is aligned to a minimum value.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.
Classes for SEAL stream cipher.
Classes for SHA-1 and SHA-2 family of message digests.
iterator begin()
Provides an iterator pointing to the first element in the memory block.
const char * IV()
ConstByteArrayParameter, also accepts const byte * for backwards compatibility.
KeystreamOperation
Keystream operation flags.
Crypto++ library namespace.
SymmetricCipher implementation.
T rotrFixed(T x, unsigned int y)
Performs a right rotate.
Interface for retrieving values given their names.