This commit is contained in:
Zhi Guan
2015-10-07 15:23:34 +08:00
parent 254a1266d6
commit b4ad0da508
27 changed files with 590 additions and 88 deletions

View File

@@ -200,12 +200,27 @@ void ZUC_set_key(ZUC_KEY *key, const unsigned char *k, const unsigned char *iv)
LFSRWithInitialisationMode(key, w >> 1);
nCount--;
}
/* set buffer */
key->buflen = 0;
}
void ZUC_encrypt(ZUC_KEY *key, size_t inlen, const unsigned char *in, unsigned char *out)
{
#if 0
int i;
if (key->buflen) {
int len = inlen < 4 - key->buflen ? inlen : 4 - key->buflen;
memcpy(key->buf + key->buflen, in, len);
inlen -= len;
if (key->buflen == 4) {
}
}
if (inlen < 4) {
}
BitReorganization(key);
F(key); /* discard the output of F */
LFSRWithWorkMode(key);
@@ -216,6 +231,6 @@ void ZUC_encrypt(ZUC_KEY *key, size_t inlen, const unsigned char *in, unsigned c
pKeystream[i] = F(key) ^ key->BRC_X3;
LFSRWithWorkMode(key);
}
#endif
#endif
}

View File

@@ -36,6 +36,10 @@ typedef struct {
uint32_t BRC_X1;
uint32_t BRC_X2;
uint32_t BRC_X3;
/* word buffer */
unsigned char buf[4];
int buflen;
} ZUC_KEY;