13 #if !defined(NDEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 14 void SEAL_TestInstantiations()
23 : H(5), Z(5), D(16), lastIndex(0xffffffff)
25 GetUserKey(BIG_ENDIAN_ORDER, H.
begin(), 5, key, 20);
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);
78 m_outsideCounter = IV ? GetWord<word32>(
false, BIG_ENDIAN_ORDER,
IV) : 0;
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;
96 for (
size_t iteration = 0; iteration < iterationCount; ++iteration)
98 #define Ttab(x) *(word32 *)((byte *)m_T.begin()+x) 100 a = m_outsideCounter ^ m_R[4*m_insideCounter];
101 b =
rotrFixed(m_outsideCounter, 8U) ^ m_R[4*m_insideCounter+1];
102 c =
rotrFixed(m_outsideCounter, 16U) ^ m_R[4*m_insideCounter+2];
103 d =
rotrFixed(m_outsideCounter, 24U) ^ m_R[4*m_insideCounter+3];
105 for (
unsigned int j=0; j<2; j++)
124 n1 = d, n2 = b, n3 = a, n4 = c;
143 for (
unsigned int i=0; i<64; i++)
181 #define SEAL_OUTPUT(x) \ 182 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, b + m_S[4*i+0]);\ 183 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 1, c ^ m_S[4*i+1]);\ 184 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 2, d + m_S[4*i+2]);\ 185 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 3, a ^ m_S[4*i+3]); 187 CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(SEAL_OUTPUT, 4*4);
205 if (++m_insideCounter == m_iterationsPerCount)
212 a = b = c = d = n1 = n2 = n3 = n4 = 0;
Utility functions for the Crypto++ library.
Classes and functions for secure memory allocations.
int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
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.
Crypto++ library namespace.
T rotrFixed(T x, unsigned int y)
Performs a right rotate.
Interface for retrieving values given their names.