14#if defined(CRYPTOPP_DEBUG) && !defined(CRYPTOPP_DOXYGEN_PROCESSING)
15void SEAL_TestInstantiations()
24 : H(5), Z(5), D(16), lastIndex(0xffffffff)
27 std::memset(D, 0, 64);
39 if (shaIndex != lastIndex)
41 std::memcpy(Z, H, 20);
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;
Interface for retrieving values given their names.
CRYPTOPP_DLL int GetIntValueWithDefault(const char *name, int defaultValue) const
Get a named value with type int, with default.
SEAL stream cipher operation.
static void Transform(HashWordType *digest, const HashWordType *data)
Operate the hash.
Secure memory block with allocator and cleanup.
iterator begin()
Provides an iterator pointing to the first element in the memory block.
SymmetricCipher implementation.
unsigned int word32
32-bit unsigned datatype
word64 lword
Large word type.
Functions for CPU features and intrinsics.
@ BIG_ENDIAN_ORDER
byte order is big-endian
Utility functions for the Crypto++ library.
bool IsAlignedOn(const void *ptr, unsigned int alignment)
Determines whether ptr is aligned to a minimum value.
void GetUserKey(ByteOrder order, T *out, size_t outlen, const byte *in, size_t inlen)
Copy bytes in a buffer to an array of elements in big-endian order.
Crypto++ library namespace.
const char * IV()
ConstByteArrayParameter, also accepts const byte * for backwards compatibility.
Classes for SEAL stream cipher.
Classes and functions for secure memory allocations.
Classes for SHA-1 and SHA-2 family of message digests.
#define CRYPTOPP_KEYSTREAM_OUTPUT_SWITCH(x, y)
Helper macro to implement OperateKeystream.
KeystreamOperation
Keystream operation flags.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.