This commit is contained in:
Zhi Guan
2016-06-06 22:04:44 +02:00
parent 2bf25bd29f
commit 2cb43b7f80
142 changed files with 7768 additions and 1678 deletions

View File

@@ -1,250 +1,70 @@
#include <assert.h>
#include "../modes/modes_lcl.h"
#include "zuc.h"
/* crypto/zuc/zuc.c */
/* ====================================================================
* Copyright (c) 2015 - 2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
/*
* this file includes code written by YOU for the GmSSL project
*/
#include <string.h>
#include <openssl/zuc.h>
static uint8_t S0[256] = {
0x3e,0x72,0x5b,0x47,0xca,0xe0,0x00,0x33,0x04,0xd1,0x54,0x98,0x09,0xb9,0x6d,0xcb,
0x7b,0x1b,0xf9,0x32,0xaf,0x9d,0x6a,0xa5,0xb8,0x2d,0xfc,0x1d,0x08,0x53,0x03,0x90,
0x4d,0x4e,0x84,0x99,0xe4,0xce,0xd9,0x91,0xdd,0xb6,0x85,0x48,0x8b,0x29,0x6e,0xac,
0xcd,0xc1,0xf8,0x1e,0x73,0x43,0x69,0xc6,0xb5,0xbd,0xfd,0x39,0x63,0x20,0xd4,0x38,
0x76,0x7d,0xb2,0xa7,0xcf,0xed,0x57,0xc5,0xf3,0x2c,0xbb,0x14,0x21,0x06,0x55,0x9b,
0xe3,0xef,0x5e,0x31,0x4f,0x7f,0x5a,0xa4,0x0d,0x82,0x51,0x49,0x5f,0xba,0x58,0x1c,
0x4a,0x16,0xd5,0x17,0xa8,0x92,0x24,0x1f,0x8c,0xff,0xd8,0xae,0x2e,0x01,0xd3,0xad,
0x3b,0x4b,0xda,0x46,0xeb,0xc9,0xde,0x9a,0x8f,0x87,0xd7,0x3a,0x80,0x6f,0x2f,0xc8,
0xb1,0xb4,0x37,0xf7,0x0a,0x22,0x13,0x28,0x7c,0xcc,0x3c,0x89,0xc7,0xc3,0x96,0x56,
0x07,0xbf,0x7e,0xf0,0x0b,0x2b,0x97,0x52,0x35,0x41,0x79,0x61,0xa6,0x4c,0x10,0xfe,
0xbc,0x26,0x95,0x88,0x8a,0xb0,0xa3,0xfb,0xc0,0x18,0x94,0xf2,0xe1,0xe5,0xe9,0x5d,
0xd0,0xdc,0x11,0x66,0x64,0x5c,0xec,0x59,0x42,0x75,0x12,0xf5,0x74,0x9c,0xaa,0x23,
0x0e,0x86,0xab,0xbe,0x2a,0x02,0xe7,0x67,0xe6,0x44,0xa2,0x6c,0xc2,0x93,0x9f,0xf1,
0xf6,0xfa,0x36,0xd2,0x50,0x68,0x9e,0x62,0x71,0x15,0x3d,0xd6,0x40,0xc4,0xe2,0x0f,
0x8e,0x83,0x77,0x6b,0x25,0x05,0x3f,0x0c,0x30,0xea,0x70,0xb7,0xa1,0xe8,0xa9,0x65,
0x8d,0x27,0x1a,0xdb,0x81,0xb3,0xa0,0xf4,0x45,0x7a,0x19,0xdf,0xee,0x78,0x34,0x60
};
static uint8_t S1[256] = {
0x55,0xc2,0x63,0x71,0x3b,0xc8,0x47,0x86,0x9f,0x3c,0xda,0x5b,0x29,0xaa,0xfd,0x77,
0x8c,0xc5,0x94,0x0c,0xa6,0x1a,0x13,0x00,0xe3,0xa8,0x16,0x72,0x40,0xf9,0xf8,0x42,
0x44,0x26,0x68,0x96,0x81,0xd9,0x45,0x3e,0x10,0x76,0xc6,0xa7,0x8b,0x39,0x43,0xe1,
0x3a,0xb5,0x56,0x2a,0xc0,0x6d,0xb3,0x05,0x22,0x66,0xbf,0xdc,0x0b,0xfa,0x62,0x48,
0xdd,0x20,0x11,0x06,0x36,0xc9,0xc1,0xcf,0xf6,0x27,0x52,0xbb,0x69,0xf5,0xd4,0x87,
0x7f,0x84,0x4c,0xd2,0x9c,0x57,0xa4,0xbc,0x4f,0x9a,0xdf,0xfe,0xd6,0x8d,0x7a,0xeb,
0x2b,0x53,0xd8,0x5c,0xa1,0x14,0x17,0xfb,0x23,0xd5,0x7d,0x30,0x67,0x73,0x08,0x09,
0xee,0xb7,0x70,0x3f,0x61,0xb2,0x19,0x8e,0x4e,0xe5,0x4b,0x93,0x8f,0x5d,0xdb,0xa9,
0xad,0xf1,0xae,0x2e,0xcb,0x0d,0xfc,0xf4,0x2d,0x46,0x6e,0x1d,0x97,0xe8,0xd1,0xe9,
0x4d,0x37,0xa5,0x75,0x5e,0x83,0x9e,0xab,0x82,0x9d,0xb9,0x1c,0xe0,0xcd,0x49,0x89,
0x01,0xb6,0xbd,0x58,0x24,0xa2,0x5f,0x38,0x78,0x99,0x15,0x90,0x50,0xb8,0x95,0xe4,
0xd0,0x91,0xc7,0xce,0xed,0x0f,0xb4,0x6f,0xa0,0xcc,0xf0,0x02,0x4a,0x79,0xc3,0xde,
0xa3,0xef,0xea,0x51,0xe6,0x6b,0x18,0xec,0x1b,0x2c,0x80,0xf7,0x74,0xe7,0xff,0x21,
0x5a,0x6a,0x54,0x1e,0x41,0x31,0x92,0x35,0xc4,0x33,0x07,0x0a,0xba,0x7e,0x0e,0x34,
0x88,0xb1,0x98,0x7c,0xf3,0x3d,0x60,0x6c,0x7b,0xca,0xd3,0x1f,0x32,0x65,0x04,0x28,
0x64,0xbe,0x85,0x9b,0x2f,0x59,0x8a,0xd7,0xb0,0x25,0xac,0xaf,0x12,0x03,0xe2,0xf2
};
static uint32_t EK_d[16] = {
0x44D7, 0x26BC, 0x626B, 0x135E, 0x5789, 0x35E2, 0x7135, 0x09AF,
0x4D78, 0x2F13, 0x6BC4, 0x1AF1, 0x5E26, 0x3C4D, 0x789A, 0x47AC
};
static inline uint32_t AddM(uint32_t a, uint32_t b)
void zuc_set_key(zuc_key_t *key, const unsigned char *user_key, const unsigned char *iv)
{
uint32_t c = a + b;
return (c & 0x7FFFFFFF) + (c >> 31);
}
#define MulByPow2(x, k) ((((x) << k) | ((x) >> (31 - k))) & 0x7FFFFFFF)
static void LFSRWithInitialisationMode(ZUC_KEY *key, uint32_t u)
void zuc_generate_keystream(zuc_key_t *key, size_t nwords, uint32_t *words)
{
uint32_t f, v;
f = key->LFSR_S0;
v = MulByPow2(key->LFSR_S0, 8);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S4, 20);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S10, 21);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S13, 17);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S15, 15);
f = AddM(f, v);
f = AddM(f, u);
/* update the state */
key->LFSR_S0 = key->LFSR_S1;
key->LFSR_S1 = key->LFSR_S2;
key->LFSR_S2 = key->LFSR_S3;
key->LFSR_S3 = key->LFSR_S4;
key->LFSR_S4 = key->LFSR_S5;
key->LFSR_S5 = key->LFSR_S6;
key->LFSR_S6 = key->LFSR_S7;
key->LFSR_S7 = key->LFSR_S8;
key->LFSR_S8 = key->LFSR_S9;
key->LFSR_S9 = key->LFSR_S10;
key->LFSR_S10 = key->LFSR_S11;
key->LFSR_S11 = key->LFSR_S12;
key->LFSR_S12 = key->LFSR_S13;
key->LFSR_S13 = key->LFSR_S14;
key->LFSR_S14 = key->LFSR_S15;
key->LFSR_S15 = f;
}
/* LFSR with work mode */
static void LFSRWithWorkMode(ZUC_KEY *key)
void zuc_encrypt(zuc_key_t *key, size_t len, const unsigned char *in, unsigned char *out)
{
uint32_t f, v;
f = key->LFSR_S0;
v = MulByPow2(key->LFSR_S0, 8);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S4, 20);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S10, 21);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S13, 17);
f = AddM(f, v);
v = MulByPow2(key->LFSR_S15, 15);
f = AddM(f, v);
/* update the state */
key->LFSR_S0 = key->LFSR_S1;
key->LFSR_S1 = key->LFSR_S2;
key->LFSR_S2 = key->LFSR_S3;
key->LFSR_S3 = key->LFSR_S4;
key->LFSR_S4 = key->LFSR_S5;
key->LFSR_S5 = key->LFSR_S6;
key->LFSR_S6 = key->LFSR_S7;
key->LFSR_S7 = key->LFSR_S8;
key->LFSR_S8 = key->LFSR_S9;
key->LFSR_S9 = key->LFSR_S10;
key->LFSR_S10 = key->LFSR_S11;
key->LFSR_S11 = key->LFSR_S12;
key->LFSR_S12 = key->LFSR_S13;
key->LFSR_S13 = key->LFSR_S14;
key->LFSR_S14 = key->LFSR_S15;
key->LFSR_S15 = f;
memcpy(out, in, len);
}
/* BitReorganization */
static inline void BitReorganization(ZUC_KEY *key)
{
key->BRC_X0 = ((key->LFSR_S15 & 0x7FFF8000) << 1) | (key->LFSR_S14 & 0xFFFF);
key->BRC_X1 = ((key->LFSR_S11 & 0xFFFF) << 16) | (key->LFSR_S9 >> 15);
key->BRC_X2 = ((key->LFSR_S7 & 0xFFFF) << 16) | (key->LFSR_S5 >> 15);
key->BRC_X3 = ((key->LFSR_S2 & 0xFFFF) << 16) | (key->LFSR_S0 >> 15);
}
#define ROT(a, k) (((a) << k) | ((a) >> (32 - k)))
static inline uint32_t L1(uint32_t X)
{
return (X ^ ROT(X, 2) ^ ROT(X, 10) ^ ROT(X, 18) ^ ROT(X, 24));
}
static inline uint32_t L2(uint32_t X)
{
return (X ^ ROT(X, 8) ^ ROT(X, 14) ^ ROT(X, 22) ^ ROT(X, 30));
}
#define MAKEuint32_t(a, b, c, d) (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | ((uint32_t)(d)))
static uint32_t F(ZUC_KEY *key)
{
uint32_t W, W1, W2, u, v;
W = (key->BRC_X0 ^ key->F_R1) + key->F_R2;
W1 = key->F_R1 + key->BRC_X1;
W2 = key->F_R2 ^ key->BRC_X2;
u = L1((W1 << 16) | (W2 >> 16));
v = L2((W2 << 16) | (W1 >> 16));
key->F_R1 = MAKEuint32_t(S0[u >> 24], S1[(u >> 16) & 0xFF], S0[(u >> 8) & 0xFF], S1[u & 0xFF]);
key->F_R2 = MAKEuint32_t(S0[v >> 24], S1[(v >> 16) & 0xFF], S0[(v >> 8) & 0xFF], S1[v & 0xFF]);
return W;
}
#define MAKEU31(a, b, c) (((uint32_t)(a) << 23) | ((uint32_t)(b) << 8) | (uint32_t)(c))
void ZUC_set_key(ZUC_KEY *key, const unsigned char *k, const unsigned char *iv)
{
uint32_t w, nCount;
key->LFSR_S0 = MAKEU31(k[0], EK_d[0], iv[0]);
key->LFSR_S1 = MAKEU31(k[1], EK_d[1], iv[1]);
key->LFSR_S2 = MAKEU31(k[2], EK_d[2], iv[2]);
key->LFSR_S3 = MAKEU31(k[3], EK_d[3], iv[3]);
key->LFSR_S4 = MAKEU31(k[4], EK_d[4], iv[4]);
key->LFSR_S5 = MAKEU31(k[5], EK_d[5], iv[5]);
key->LFSR_S6 = MAKEU31(k[6], EK_d[6], iv[6]);
key->LFSR_S7 = MAKEU31(k[7], EK_d[7], iv[7]);
key->LFSR_S8 = MAKEU31(k[8], EK_d[8], iv[8]);
key->LFSR_S9 = MAKEU31(k[9], EK_d[9], iv[9]);
key->LFSR_S10 = MAKEU31(k[10], EK_d[10], iv[10]);
key->LFSR_S11 = MAKEU31(k[11], EK_d[11], iv[11]);
key->LFSR_S12 = MAKEU31(k[12], EK_d[12], iv[12]);
key->LFSR_S13 = MAKEU31(k[13], EK_d[13], iv[13]);
key->LFSR_S14 = MAKEU31(k[14], EK_d[14], iv[14]);
key->LFSR_S15 = MAKEU31(k[15], EK_d[15], iv[15]);
key->F_R1 = 0;
key->F_R2 = 0;
nCount = 32;
while (nCount > 0) {
BitReorganization(key);
w = F(key);
LFSRWithInitialisationMode(key, w >> 1);
nCount--;
}
BitReorganization(key);
F(key);
LFSRWithWorkMode(key);
}
void ZUC_encrypt(ZUC_KEY *key, size_t inlen, const unsigned char *in, unsigned char *out)
{
#if 0
uint32_t word;
int n = key->buf_index;
assert(n < 4);
while (n && inlen) {
*(out++) = *(in++) ^ key->buf[n];
n = (n + 1) % 4;
inlen--;
}
while (inlen >= 4) {
BitReorganization(key);
word = GETU32(in);
word ^= F(key) ^ key->BRC_X3;
PUTU32(out, word);
LFSRWithWorkMode(key);
inlen -= 4;
in += 4;
out += 4;
}
if (inlen) {
BitReorganization(key);
word = F(key) ^ key->BRC_X3;
LFSRWithWorkMode(key);
PUTU32(key->buf, word);
while (inlen-- > 0) {
out[n] = in[n] ^ key->buf[n];
n++;
}
}
key->buf_index = n;
return;
#endif
}

View File

@@ -1,3 +1,54 @@
/* crypto/zuc/zuc.h */
/* ====================================================================
* Copyright (c) 2015 - 2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
#ifndef HEADER_ZUC_H
#define HEADER_ZUC_H
@@ -10,43 +61,32 @@ extern "C" {
typedef struct {
uint32_t LFSR_S0;
uint32_t LFSR_S1;
uint32_t LFSR_S2;
uint32_t LFSR_S3;
uint32_t LFSR_S4;
uint32_t LFSR_S5;
uint32_t LFSR_S6;
uint32_t LFSR_S7;
uint32_t LFSR_S8;
uint32_t LFSR_S9;
uint32_t LFSR_S10;
uint32_t LFSR_S11;
uint32_t LFSR_S12;
uint32_t LFSR_S13;
uint32_t LFSR_S14;
uint32_t LFSR_S15;
/* the registers of F */
uint32_t F_R1;
uint32_t F_R2;
/* the outputs of BitReorganization */
uint32_t BRC_X0;
uint32_t BRC_X1;
uint32_t BRC_X2;
uint32_t BRC_X3;
/* word buffer */
unsigned char buf[4];
int buf_index;
} ZUC_KEY;
unsigned char zuc_state[100]; /* change what you like */
unsigned char word_buf[4];
} zuc_key_t;
void ZUC_set_key(ZUC_KEY *key, const unsigned char *k, const unsigned char *iv);
void ZUC_encrypt(ZUC_KEY *key, size_t inlen, const unsigned char *in, unsigned char *out);
void zuc_set_key(zuc_key_t *key, const unsigned char *user_key, const unsigned char *iv);
void zuc_generate_keystream(zuc_key_t *key, size_t nwords, uint32_t *words);
void zuc_encrypt(zuc_key_t *key, size_t len, const unsigned char *in, unsigned char *out);
#define EEA3_MIN_BITS 1
#define EEA3_MAX_BITS 65504
/* 128-EEA3
* Input:
* count - the counter
* bearer - the bearer ientity 5-bit
* direction - 0 or 1
* nbits - the length of input message, in [1, 65504]
*/
#if 0
void eea3_set_key(zuc_key_t *key, const unsigned char *user_key,
uint32_t count, uint32_t bearer, uint32_t direction);
void eea3_encrypt(zuc_key_t *key, size_t len, const unsigned char *in, unsigned char *out);
#endif
#ifdef __cplusplus
}

View File

@@ -1,3 +1,512 @@
/* crypto/zuc/zuctest.c */
/* ====================================================================
* Copyright (c) 2015 - 2016 The GmSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GmSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/zuc.h>
#include "../../e_os.h"
typedef struct {
uint32_t *words;
size_t nwords;
} test_words_t;
/* The following test suites are from
*
* ETSI/SAGE Specification
* Specification of the 3GPP Confidentiality and Integrity Algorithms
* 128-EEA3 & 128-EIA3
* Document 3: Implementor's Test Data
* Version 1.1 Date: Jan. 4, 2011
*
* NOTE: eea3_test_count[1] might be error
*/
/* ZUC Test Suits */
static unsigned char zuc_test_key[][16] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
{0x3d, 0x4c, 0x4b, 0xe9, 0x6a, 0x82, 0xfd, 0xae,
0xb5, 0x8f, 0x64, 0x1d, 0xb1, 0x7b, 0x45, 0x5b},
{0x4d, 0x32, 0x0b, 0xfa, 0xd4, 0xc2, 0x85, 0xbf,
0xd6, 0xb8, 0xbd, 0x00, 0xf3, 0x9d, 0x8b, 0x41},
};
static unsigned char zuc_test_iv[][16] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
{0x84, 0x31, 0x9a, 0xa8, 0xde, 0x69, 0x15, 0xca,
0x1f, 0x6b, 0xda, 0x6b, 0xfb, 0xd8, 0xc7, 0x66},
{0x52, 0x95, 0x9d, 0xab, 0xa0, 0xbf, 0x17, 0x6e,
0xce, 0x2d, 0xc3, 0x15, 0x04, 0x9e, 0xb5, 0x74},
};
static uint32_t zuc_test_words[][2] = {
{0x27bede74, 0x018082da},
{0x0657cfa0, 0x7096398b},
{0x14f1c272, 0x3279c419},
{0xed4400e7, 0x0633e5c5},
};
static uint32_t zuc_test4_word1999 = 0x7a574cdb;
/* 128-EEA3 Test Suites */
static unsigned char eea3_test_key[][16] = {
{0x17, 0x3d, 0x14, 0xba, 0x50, 0x03, 0x73, 0x1d,
0x7a, 0x60, 0x04, 0x94, 0x70, 0xf0, 0x0a, 0x29},
{0xe5, 0xbd, 0x3e, 0xa0, 0xeb, 0x55, 0xad, 0xe8,
0x66, 0xc6, 0xac, 0x58, 0xbd, 0x54, 0x30, 0x2a},
{0xd4, 0x55, 0x2a, 0x8f, 0xd6, 0xe6, 0x1c, 0xc8,
0x1a, 0x20, 0x09, 0x14, 0x1a, 0x29, 0xc1, 0x0b},
{0xdb, 0x84, 0xb4, 0xfb, 0xcc, 0xda, 0x56, 0x3b,
0x66, 0x22, 0x7b, 0xfe, 0x45, 0x6f, 0x0f, 0x77},
{0xe1, 0x3f, 0xed, 0x21, 0xb4, 0x6e, 0x4e, 0x7e,
0xc3, 0x12, 0x53, 0xb2, 0xbb, 0x17, 0xb3, 0xe0},
};
static uint32_t eea3_test_count[] = {
0x66035492, /* XXX: ? */0x56823, 0x76452ec1, 0xe4850fe1,
0x2738cdaa,
};
static uint8_t eea3_test_bearer[] = {
0x0f, 0x18, 0x02, 0x10, 0x1a,
};
static int eea3_test_direction[] = {
0, 1, 1, 1 , 0,
};
static int eea3_test_nbits[] = {
193, 800, 1570, 2798, 4019,
};
static uint32_t eea3_test1_plaintext[] = {
0x6cf65340, 0x735552ab, 0x0c9752fa, 0x6f9025fe,
0x0bd675d9, 0x005875b2, 0x00000000,
};
static uint32_t eea3_test1_ciphertext[] = {
0xa6c85fc6, 0x6afb8533, 0xaafc2518, 0xdfe78494,
0x0ee1e4b0, 0x30238cc8, 0x00000000,
};
static uint32_t eea3_test2_plaintext[] = {
0x14a8ef69, 0x3d678507, 0xbbe7270a, 0x7f67ff50,
0x06c3525b, 0x9807e467, 0xc4e56000, 0xba338f5d,
0x42955903, 0x67518222, 0x46c80d3b, 0x38f07f4b,
0xe2d8ff58, 0x05f51322, 0x29bde93b, 0xbbdcaf38,
0x2bf1ee97, 0x2fbf9977, 0xbada8945, 0x847a2a6c,
0x9ad34a66, 0x7554e04d, 0x1f7fa2c3, 0x3241bd8f,
0x01ba220d,
};
static uint32_t eea3_test2_ciphertext[] = {
0x131d43e0, 0xdea1be5c, 0x5a1bfd97, 0x1d852cbf,
0x712d7b4f, 0x57961fea, 0x3208afa8, 0xbca433f4,
0x56ad09c7, 0x417e58bc, 0x69cf8866, 0xd1353f74,
0x865e8078, 0x1d202dfb, 0x3ecff7fc, 0xbc3b190f,
0xe82a204e, 0xd0e350fc, 0x0f6f2613, 0xb2f2bca6,
0xdf5a473a, 0x57a4a00d, 0x985ebad8, 0x80d6f238,
0x64a07b01,
};
static uint32_t eea3_test3_plaintext[] = {
0x38f07f4b, 0xe2d8ff58, 0x05f51322, 0x29bde93b,
0xbbdcaf38, 0x2bf1ee97, 0x2fbf9977, 0xbada8945,
0x847a2a6c, 0x9ad34a66, 0x7554e04d, 0x1f7fa2c3,
0x3241bd8f, 0x01ba220d, 0x3ca4ec41, 0xe074595f,
0x54ae2b45, 0x4fd97143, 0x20436019, 0x65cca85c,
0x2417ed6c, 0xbec3bada, 0x84fc8a57, 0x9aea7837,
0xb0271177, 0x242a64dc, 0x0a9de71a, 0x8edee86c,
0xa3d47d03, 0x3d6bf539, 0x804eca86, 0xc584a905,
0x2de46ad3, 0xfced6554, 0x3bd90207, 0x372b27af,
0xb79234f5, 0xff43ea87, 0x0820e2c2, 0xb78a8aae,
0x61cce52a, 0x0515e348, 0xd196664a, 0x3456b182,
0xa07c406e, 0x4a207912, 0x71cfeda1, 0x65d535ec,
0x5ea2d4df, 0x40000000,
};
static uint32_t eea3_test3_ciphertext[] = {
0x8383b022, 0x9fcc0b9d, 0x2295ec41, 0xc977e9c2,
0xbb72e220, 0x378141f9, 0xc8318f3a, 0x270dfbcd,
0xee6411c2, 0xb3044f17, 0x6dc6e00f, 0x8960f97a,
0xfacd131a, 0xd6a3b49b, 0x16b7babc, 0xf2a509eb,
0xb16a75dc, 0xab14ff27, 0x5dbeeea1, 0xa2b155f9,
0xd52c2645, 0x2d0187c3, 0x10a4ee55, 0xbeaa78ab,
0x4024615b, 0xa9f5d5ad, 0xc7728f73, 0x560671f0,
0x13e5e550, 0x085d3291, 0xdf7d5fec, 0xedded559,
0x641b6c2f, 0x585233bc, 0x71e9602b, 0xd2305855,
0xbbd25ffa, 0x7f17ecbc, 0x042daae3, 0x8c1f57ad,
0x8e8ebd37, 0x346f71be, 0xfdbb7432, 0xe0e0bb2c,
0xfc09bcd9, 0x6570cb0c, 0x0c39df5e, 0x29294e82,
0x703a637f, 0x80000000,
};
static uint32_t eea3_test4_plaintext[] = {
0xe539f3b8, 0x973240da, 0x03f2b8aa, 0x05ee0a00,
0xdbafc0e1, 0x82055dfe, 0x3d7383d9, 0x2cef40e9,
0x2928605d, 0x52d05f4f, 0x9018a1f1, 0x89ae3997,
0xce19155f, 0xb1221db8, 0xbb0951a8, 0x53ad852c,
0xe16cff07, 0x382c93a1, 0x57de00dd, 0xb125c753,
0x9fd85045, 0xe4ee07e0, 0xc43f9e9d, 0x6f414fc4,
0xd1c62917, 0x813f74c0, 0x0fc83f3e, 0x2ed7c45b,
0xa5835264, 0xb43e0b20, 0xafda6b30, 0x53bfb642,
0x3b7fce25, 0x479ff5f1, 0x39dd9b5b, 0x995558e2,
0xa56be18d, 0xd581cd01, 0x7c735e6f, 0x0d0d97c4,
0xddc1d1da, 0x70c6db4a, 0x12cc9277, 0x8e2fbbd6,
0xf3ba52af, 0x91c9c6b6, 0x4e8da4f7, 0xa2c266d0,
0x2d001753, 0xdf089603, 0x93c5d568, 0x88bf49eb,
0x5c16d9a8, 0x0427a416, 0xbcb597df, 0x5bfe6f13,
0x890a07ee, 0x1340e647, 0x6b0d9aa8, 0xf822ab0f,
0xd1ab0d20, 0x4f40b7ce, 0x6f2e136e, 0xb67485e5,
0x07804d50, 0x4588ad37, 0xffd81656, 0x8b2dc403,
0x11dfb654, 0xcdead47e, 0x2385c343, 0x6203dd83,
0x6f9c64d9, 0x7462ad5d, 0xfa63b5cf, 0xe08acb95,
0x32866f5c, 0xa787566f, 0xca93e6b1, 0x693ee15c,
0xf6f7a2d6, 0x89d97417, 0x98dc1c23, 0x8e1be650,
0x733b18fb, 0x34ff880e, 0x16bbd21b, 0x47ac0000,
};
static uint32_t eea3_test4_ciphertext[] = {
0x4bbfa91b, 0xa25d47db, 0x9a9f190d, 0x962a19ab,
0x323926b3, 0x51fbd39e, 0x351e05da, 0x8b8925e3,
0x0b1cce0d, 0x12211010, 0x95815cc7, 0xcb631950,
0x9ec0d679, 0x40491987, 0xe13f0aff, 0xac332aa6,
0xaa64626d, 0x3e9a1917, 0x519e0b97, 0xb655c6a1,
0x65e44ca9, 0xfeac0790, 0xd2a321ad, 0x3d86b79c,
0x5138739f, 0xa38d887e, 0xc7def449, 0xce8abdd3,
0xe7f8dc4c, 0xa9e7b733, 0x14ad310f, 0x9025e619,
0x46b3a56d, 0xc649ec0d, 0xa0d63943, 0xdff592cf,
0x962a7efb, 0x2c8524e3, 0x5a2a6e78, 0x79d62604,
0xef268695, 0xfa400302, 0x7e22e608, 0x30775220,
0x64bd4a5b, 0x906b5f53, 0x1274f235, 0xed506cff,
0x0154c754, 0x928a0ce5, 0x476f2cb1, 0x020a1222,
0xd32c1455, 0xecaef1e3, 0x68fb344d, 0x1735bfbe,
0xdeb71d0a, 0x33a2a54b, 0x1da5a294, 0xe679144d,
0xdf11eb1a, 0x3de8cf0c, 0xc0619179, 0x74f35c1d,
0x9ca0ac81, 0x807f8fcc, 0xe6199a6c, 0x7712da86,
0x5021b04c, 0xe0439516, 0xf1a526cc, 0xda9fd9ab,
0xbd53c3a6, 0x84f9ae1e, 0x7ee6b11d, 0xa138ea82,
0x6c5516b5, 0xaadf1abb, 0xe36fa7ff, 0xf92e3a11,
0x76064e8d, 0x95f2e488, 0x2b5500b9, 0x3228b219,
0x4a475c1a, 0x27f63f9f, 0xfd264989, 0xa1bc0000,
};
static uint32_t eea3_test5_plaintext[] = {
0x8d74e20d, 0x54894e06, 0xd3cb13cb, 0x3933065e,
0x8674be62, 0xadb1c72b, 0x3a646965, 0xab63cb7b,
0x7854dfdc, 0x27e84929, 0xf49c64b8, 0x72a490b1,
0x3f957b64, 0x827e71f4, 0x1fbd4269, 0xa42c97f8,
0x24537027, 0xf86e9f4a, 0xd82d1df4, 0x51690fdd,
0x98b6d03f, 0x3a0ebe3a, 0x312d6b84, 0x0ba5a182,
0x0b2a2c97, 0x09c090d2, 0x45ed267c, 0xf845ae41,
0xfa975d33, 0x33ac3009, 0xfd40eba9, 0xeb5b8857,
0x14b768b6, 0x97138baf, 0x21380eca, 0x49f644d4,
0x8689e421, 0x5760b906, 0x739f0d2b, 0x3f091133,
0xca15d981, 0xcbe401ba, 0xf72d05ac, 0xe05cccb2,
0xd297f4ef, 0x6a5f58d9, 0x1246cfa7, 0x7215b892,
0xab441d52, 0x78452795, 0xccb7f5d7, 0x9057a1c4,
0xf77f80d4, 0x6db2033c, 0xb79bedf8, 0xe60551ce,
0x10c667f6, 0x2a97abaf, 0xabbcd677, 0x2018df96,
0xa282ea73, 0x7ce2cb33, 0x1211f60d, 0x5354ce78,
0xf9918d9c, 0x206ca042, 0xc9b62387, 0xdd709604,
0xa50af16d, 0x8d35a890, 0x6be484cf, 0x2e74a928,
0x99403643, 0x53249b27, 0xb4c9ae29, 0xeddfc7da,
0x6418791a, 0x4e7baa06, 0x60fa6451, 0x1f2d685c,
0xc3a5ff70, 0xe0d2b742, 0x92e3b8a0, 0xcd6b04b1,
0xc790b8ea, 0xd2703708, 0x540dea2f, 0xc09c3da7,
0x70f65449, 0xe84d817a, 0x4f551055, 0xe19ab850,
0x18a0028b, 0x71a144d9, 0x6791e9a3, 0x57793350,
0x4eee0060, 0x340c69d2, 0x74e1bf9d, 0x805dcbcc,
0x1a6faa97, 0x6800b6ff, 0x2b671dc4, 0x63652fa8,
0xa33ee509, 0x74c1c21b, 0xe01eabb2, 0x16743026,
0x9d72ee51, 0x1c9dde30, 0x797c9a25, 0xd86ce74f,
0x5b961be5, 0xfdfb6807, 0x814039e7, 0x137636bd,
0x1d7fa9e0, 0x9efd2007, 0x505906a5, 0xac45dfde,
0xed7757bb, 0xee745749, 0xc2963335, 0x0bee0ea6,
0xf409df45, 0x80160000,
};
static uint32_t eea3_test5_ciphertext[] = {
0x94eaa4aa, 0x30a57137, 0xddf09b97, 0xb25618a2,
0x0a13e2f1, 0x0fa5bf81, 0x61a879cc, 0x2ae797a6,
0xb4cf2d9d, 0xf31debb9, 0x905ccfec, 0x97de605d,
0x21c61ab8, 0x531b7f3c, 0x9da5f039, 0x31f8a064,
0x2de48211, 0xf5f52ffe, 0xa10f392a, 0x04766998,
0x5da454a2, 0x8f080961, 0xa6c2b62d, 0xaa17f33c,
0xd60a4971, 0xf48d2d90, 0x9394a55f, 0x48117ace,
0x43d708e6, 0xb77d3dc4, 0x6d8bc017, 0xd4d1abb7,
0x7b7428c0, 0x42b06f2f, 0x99d8d07c, 0x9879d996,
0x00127a31, 0x985f1099, 0xbbd7d6c1, 0x519ede8f,
0x5eeb4a61, 0x0b349ac0, 0x1ea23506, 0x91756bd1,
0x05c974a5, 0x3eddb35d, 0x1d4100b0, 0x12e522ab,
0x41f4c5f2, 0xfde76b59, 0xcb8b96d8, 0x85cfe408,
0x0d1328a0, 0xd636cc0e, 0xdc05800b, 0x76acca8f,
0xef672084, 0xd1f52a8b, 0xbd8e0993, 0x320992c7,
0xffbae17c, 0x408441e0, 0xee883fc8, 0xa8b05e22,
0xf5ff7f8d, 0x1b48c74c, 0x468c467a, 0x028f09fd,
0x7ce91109, 0xa570a2d5, 0xc4d5f4fa, 0x18c5dd3e,
0x4562afe2, 0x4ef77190, 0x1f59af64, 0x5898acef,
0x088abae0, 0x7e92d52e, 0xb2de5504, 0x5bb1b7c4,
0x164ef2d7, 0xa6cac15e, 0xeb926d7e, 0xa2f08b66,
0xe1f759f3, 0xaee44614, 0x725aa3c7, 0x482b3084,
0x4c143ff8, 0x5b53f1e5, 0x83c50125, 0x7dddd096,
0xb81268da, 0xa303f172, 0x34c23335, 0x41f0bb8e,
0x190648c5, 0x807c866d, 0x71932286, 0x09adb948,
0x686f7de2, 0x94a802cc, 0x38f7fe52, 0x08f5ea31,
0x96d0167b, 0x9bdd02f0, 0xd2a5221c, 0xa508f893,
0xaf5c4b4b, 0xb9f4f520, 0xfd84289b, 0x3dbe7e61,
0x497a7e2a, 0x584037ea, 0x637b6981, 0x127174af,
0x57b471df, 0x4b2768fd, 0x79c1540f, 0xb3edf2ea,
0x22cb69be, 0xc0cf8d93, 0x3d9c6fdd, 0x645e8505,
0x91cca3d6, 0x2c0cc000,
};
static test_words_t eea3_test_plaintext[] = {
{eea3_test1_plaintext, sizeof(eea3_test1_plaintext)/4},
{eea3_test2_plaintext, sizeof(eea3_test2_plaintext)/4},
{eea3_test3_plaintext, sizeof(eea3_test3_plaintext)/4},
{eea3_test4_plaintext, sizeof(eea3_test4_plaintext)/4},
{eea3_test5_plaintext, sizeof(eea3_test5_plaintext)/4},
};
static test_words_t eea3_test_ciphertext[] = {
{eea3_test1_ciphertext, sizeof(eea3_test1_ciphertext)/4},
{eea3_test2_ciphertext, sizeof(eea3_test2_ciphertext)/4},
{eea3_test3_ciphertext, sizeof(eea3_test3_ciphertext)/4},
{eea3_test4_ciphertext, sizeof(eea3_test4_ciphertext)/4},
{eea3_test5_ciphertext, sizeof(eea3_test5_ciphertext)/4},
};
/* 128-EIA3 Test Suites */
static unsigned char eia3_test_key[][16] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x47, 0x05, 0x41, 0x25, 0x56, 0x1e, 0xb2, 0xdd,
0xa9, 0x40, 0x59, 0xda, 0x05, 0x09, 0x78, 0x50},
{0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb,
0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a},
{0xc8, 0xa4, 0x82, 0x62, 0xd0, 0xc2, 0xe2, 0xba,
0xc4, 0xb9, 0x6e, 0xf7, 0x7e, 0x80, 0xca, 0x59},
{0x6b, 0x8b, 0x08, 0xee, 0x79, 0xe0, 0xb5, 0x98,
0x2d, 0x6d, 0x12, 0x8e, 0xa9, 0xf2, 0x20, 0xcb},
};
static uint32_t eia3_test_count[] = {
0x00000000, 0x561eb2dd, 0xa94059da, 0x05097850,
0x561eb2dd,
};
static uint8_t eia3_test_bearer[] = {
0x00, 0x14, 0x0a, 0x10, 0x1c,
};
static int eia3_test_direction[] = {
0, 0, 1, 1, 0,
};
static int eia3_test_nbits[] = {
1, 90, 577, 2079, 5670,
};
static uint32_t eia3_test1_msg[] = {
0x00000000,
};
static uint32_t eia3_test2_msg[] = {
0x00000000, 0x00000000, 0x00000000,
};
static uint32_t eia3_test3_msg[] = {
0x983b41d4, 0x7d780c9e, 0x1ad11d7e, 0xb70391b1,
0xde0b35da, 0x2dc62f83, 0xe7b78d63, 0x06ca0ea0,
0x7e941b7b, 0xe91348f9, 0xfcb170e2, 0x217fecd9,
0x7f9f68ad, 0xb16e5d7d, 0x21e569d2, 0x80ed775c,
0xebde3f40, 0x93c53881, 0x00000000
};
static uint32_t eia3_test4_msg[] = {
0xb546430b, 0xf87b4f1e, 0xe834704c, 0xd6951c36,
0xe26f108c, 0xf731788f, 0x48dc34f1, 0x678c0522,
0x1c8fa7ff, 0x2f39f477, 0xe7e49ef6, 0x0a4ec2c3,
0xde24312a, 0x96aa26e1, 0xcfba5756, 0x3838b297,
0xf47e8510, 0xc779fd66, 0x54b14338, 0x6fa639d3,
0x1edbd6c0, 0x6e47d159, 0xd94362f2, 0x6aeeedee,
0x0e4f49d9, 0xbf841299, 0x5415bfad, 0x56ee82d1,
0xca7463ab, 0xf085b082, 0xb09904d6, 0xd990d43c,
0xf2e062f4, 0x0839d932, 0x48b1eb92, 0xcdfed530,
0x0bc14828, 0x0430b6d0, 0xcaa094b6, 0xec8911ab,
0x7dc36824, 0xb824dc0a, 0xf6682b09, 0x35fde7b4,
0x92a14dc2, 0xf4364803, 0x8da2cf79, 0x170d2d50,
0x133fd494, 0x16cb6e33, 0xbea90b8b, 0xf4559b03,
0x732a01ea, 0x290e6d07, 0x4f79bb83, 0xc10e5800,
0x15cc1a85, 0xb36b5501, 0x046e9c4b, 0xdcae5135,
0x690b8666, 0xbd54b7a7, 0x03ea7b6f, 0x220a5469,
0xa568027e,
};
static uint32_t eia3_test5_msg[] = {
0x5bad7247, 0x10ba1c56, 0xd5a315f8, 0xd40f6e09,
0x3780be8e, 0x8de07b69, 0x92432018, 0xe08ed96a,
0x5734af8b, 0xad8a575d, 0x3a1f162f, 0x85045cc7,
0x70925571, 0xd9f5b94e, 0x454a77c1, 0x6e72936b,
0xf016ae15, 0x7499f054, 0x3b5d52ca, 0xa6dbeab6,
0x97d2bb73, 0xe41b8075, 0xdce79b4b, 0x86044f66,
0x1d4485a5, 0x43dd7860, 0x6e0419e8, 0x059859d3,
0xcb2b67ce, 0x0977603f, 0x81ff839e, 0x33185954,
0x4cfbc8d0, 0x0fef1a4c, 0x8510fb54, 0x7d6b06c6,
0x11ef44f1, 0xbce107cf, 0xa45a06aa, 0xb360152b,
0x28dc1ebe, 0x6f7fe09b, 0x0516f9a5, 0xb02a1bd8,
0x4bb0181e, 0x2e89e19b, 0xd8125930, 0xd178682f,
0x3862dc51, 0xb636f04e, 0x720c47c3, 0xce51ad70,
0xd94b9b22, 0x55fbae90, 0x6549f499, 0xf8c6d399,
0x47ed5e5d, 0xf8e2def1, 0x13253e7b, 0x08d0a76b,
0x6bfc68c8, 0x12f375c7, 0x9b8fe5fd, 0x85976aa6,
0xd46b4a23, 0x39d8ae51, 0x47f680fb, 0xe70f978b,
0x38effd7b, 0x2f7866a2, 0x2554e193, 0xa94e98a6,
0x8b74bd25, 0xbb2b3f5f, 0xb0a5fd59, 0x887f9ab6,
0x8159b717, 0x8d5b7b67, 0x7cb546bf, 0x41eadca2,
0x16fc1085, 0x0128f8bd, 0xef5c8d89, 0xf96afa4f,
0xa8b54885, 0x565ed838, 0xa950fee5, 0xf1c3b0a4,
0xf6fb71e5, 0x4dfd169e, 0x82cecc72, 0x66c850e6,
0x7c5ef0ba, 0x960f5214, 0x060e71eb, 0x172a75fc,
0x1486835c, 0xbea65344, 0x65b055c9, 0x6a72e410,
0x52241823, 0x25d83041, 0x4b40214d, 0xaa8091d2,
0xe0fb010a, 0xe15c6de9, 0x0850973b, 0xdf1e423b,
0xe148a237, 0xb87a0c9f, 0x34d4b476, 0x05b803d7,
0x43a86a90, 0x399a4af3, 0x96d3a120, 0x0a62f3d9,
0x507962e8, 0xe5bee6d3, 0xda2bb3f7, 0x237664ac,
0x7a292823, 0x900bc635, 0x03b29e80, 0xd63f6067,
0xbf8e1716, 0xac25beba, 0x350deb62, 0xa99fe031,
0x85eb4f69, 0x937ecd38, 0x7941fda5, 0x44ba67db,
0x09117749, 0x38b01827, 0xbcc69c92, 0xb3f772a9,
0xd2859ef0, 0x03398b1f, 0x6bbad7b5, 0x74f7989a,
0x1d10b2df, 0x798e0dbf, 0x30d65874, 0x64d24878,
0xcd00c0ea, 0xee8a1a0c, 0xc753a279, 0x79e11b41,
0xdb1de3d5, 0x038afaf4, 0x9f5c682c, 0x3748d8a3,
0xa9ec54e6, 0xa371275f, 0x1683510f, 0x8e4f9093,
0x8f9ab6e1, 0x34c2cfdf, 0x4841cba8, 0x8e0cff2b,
0x0bcc8e6a, 0xdcb71109, 0xb5198fec, 0xf1bb7e5c,
0x531aca50, 0xa56a8a3b, 0x6de59862, 0xd41fa113,
0xd9cd9578, 0x08f08571, 0xd9a4bb79, 0x2af271f6,
0xcc6dbb8d, 0xc7ec36e3, 0x6be1ed30, 0x8164c31c,
0x7c0afc54, 0x1c000000,
};
static test_words_t eia3_test_msg[5] = {
{eia3_test1_msg, sizeof(eia3_test1_msg)/4},
{eia3_test2_msg, sizeof(eia3_test2_msg)/4},
{eia3_test3_msg, sizeof(eia3_test3_msg)/4},
{eia3_test4_msg, sizeof(eia3_test4_msg)/4},
{eia3_test5_msg, sizeof(eia3_test5_msg)/4},
};
static uint32_t eia3_test_mac[5] = {
0xc8a9595e, 0x6719a088, 0xfae8ff0b, 0x004ac4d6,
0x0ca12792,
};
static int test_zuc(int verbose)
{
#if 0
int i;
for (i = 0; i < sizeof(zuc_test_key)/sizeof(zuc_test_key[0]); i++) {
zuc_key_t key;
uint32_t word;
zuc_set_key(&key, zuc_test_key[i], zuc_test_iv[i]);
for (j = 0; j < 2; j++) {
zuc_generate_keystream(&key, 1, &word);
if (word != zuc_test_word[i][j]) {
return 0;
}
}
}
#endif
return 0;
}
static int test_eea3(int verbose)
{
#if 0
zuc_key_t key;
int i;
for (i = 0; i < sizeof(eea3_test_key)/sizeof(eea3_test_key[0]); i++) {
eea3_set_key(&key, eea3_test_count[i], eea3_test_bearer[i], eea3_test_direction[i]);
}
#endif
return 0;
}
static int test_eia3(int verbose)
{
return 0;
}
int main(int argc, char *argv[])
{
return 0;
}