Revert "optimize zuc"

This reverts commit 74d4a07ade.
This commit is contained in:
Zhi Guan
2018-07-06 23:13:33 +08:00
parent 74d4a07ade
commit 83c62961db

View File

@@ -124,24 +124,6 @@ static const uint8_t S1[256] = {
{int j; for (j=0; j<15;j++) LFSR[j]=LFSR[j+1];} \
LFSR[15] = V
/* FIXME: check if uint64_t is supported */
#if 1
#define LFSRWithWorkMode() \
{ \
int j; \
uint64_t a = LFSR[0]; \
a += ((uint64_t)LFSR[0]) << 8; \
a += ((uint64_t)LFSR[4]) << 20; \
a += ((uint64_t)LFSR[10]) << 21; \
a += ((uint64_t)LFSR[13]) << 17; \
a += ((uint64_t)LFSR[15]) << 15; \
a = (a & 0x7fffffff) + (a >> 31); \
a = (a & 0x7fffffff) + (a >> 31); \
for (j = 0; j < 15; j++) \
LFSR[j] = LFSR[j+1]; \
LFSR[15] = a; \
}
#else
#define LFSRWithWorkMode() \
V = LFSR[0]; \
ADD31(V, ROT31(LFSR[0], 8)); \
@@ -151,7 +133,6 @@ static const uint8_t S1[256] = {
ADD31(V, ROT31(LFSR[15], 15)); \
{int j; for (j=0; j<15;j++) LFSR[j]=LFSR[j+1];} \
LFSR[15] = V
#endif
#define BitReconstruction2(X1,X2) \
X1 = ((LFSR[11] & 0xFFFF) << 16) | (LFSR[9] >> 15); \
@@ -195,7 +176,6 @@ static const uint8_t S1[256] = {
(X0 ^ R1) + R2; \
F_(X1, X2)
void ZUC_set_key(ZUC_KEY *key, const unsigned char *user_key, const unsigned char *iv)
{
ZUC_UINT31 *LFSR = key->LFSR;