14 #if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING) 15 void SEAL_TestInstantiations()
24 : H(5), Z(5), D(16), lastIndex(0xffffffff)
30 word32 Apply(word32 i);
36 word32 SEAL_Gamma::Apply(word32 i)
38 word32 shaIndex = i/5;
39 if (shaIndex != lastIndex)
53 CRYPTOPP_UNUSED(length);
54 m_insideCounter = m_outsideCounter = m_startCount = 0;
57 m_iterationsPerCount = L / 8192;
63 m_T[i] = gamma.Apply(i);
66 m_S[i] = gamma.Apply(0x1000+i);
70 for (i=0; i<m_R.size(); i++)
71 m_R[i] = gamma.Apply(0x2000+i);
77 CRYPTOPP_UNUSED(keystreamBuffer), CRYPTOPP_UNUSED(
IV), CRYPTOPP_UNUSED(length);
81 m_startCount = m_outsideCounter;
88 m_outsideCounter = m_startCount + (
unsigned int)(iterationCount / m_iterationsPerCount);
89 m_insideCounter = (
unsigned int)(iterationCount % m_iterationsPerCount);
95 word32 a, b, c, d, n1, n2, n3, n4;
99 for (
size_t iteration = 0; iteration < iterationCount; ++iteration)
101 #define Ttab(x) *(word32 *)(void*)((byte *)m_T.begin()+x) 103 a = m_outsideCounter ^ m_R[4*m_insideCounter];
104 b = rotrConstant<8>(m_outsideCounter) ^ m_R[4*m_insideCounter+1];
105 c = rotrConstant<16>(m_outsideCounter) ^ m_R[4 * m_insideCounter + 2];
106 d = rotrConstant<24>(m_outsideCounter) ^ m_R[4 * m_insideCounter + 3];
108 for (
unsigned int j=0; j<2; j++)
112 a = rotrConstant<9>(a);
116 b = rotrConstant<9>(b);
120 c = rotrConstant<9>(c);
124 d = rotrConstant<9>(d);
127 n1 = d, n2 = b, n3 = a, n4 = c;
131 a = rotrConstant<9>(a);
135 b = rotrConstant<9>(b);
139 c = rotrConstant<9>(c);
143 d = rotrConstant<9>(d);
146 for (
unsigned int i=0; i<64; i++)
149 a = rotrConstant<9>(a);
154 b = rotrConstant<9>(b);
159 c = rotrConstant<9>(c);
164 d = rotrConstant<9>(d);
170 a = rotrConstant<9>(a);
174 b = rotrConstant<9>(b);
178 c = rotrConstant<9>(c);
181 d = rotrConstant<9>(d);
184 #define SEAL_OUTPUT(x) \ 185 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 0, b + m_S[4*i+0]);\ 186 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 1, c ^ m_S[4*i+1]);\ 187 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 2, d + m_S[4*i+2]);\ 188 CRYPTOPP_KEYSTREAM_OUTPUT_WORD(x, B::ToEnum(), 3, a ^ m_S[4*i+3]); 208 if (++m_insideCounter == m_iterationsPerCount)
215 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.
static void Transform(HashWordType *digest, const HashWordType *data)
Operate the hash.
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.
Functions for CPU features and intrinsics.
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.
Interface for retrieving values given their names.