[CRYPTO]: White space and coding style clean up in tcrypt
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
dd7f0b8092
commit
ef2736fc74
177
crypto/tcrypt.c
177
crypto/tcrypt.c
|
@ -66,8 +66,7 @@ static char *check[] = {
|
||||||
"khazad", "wp512", "wp384", "wp256", "tnepres", NULL
|
"khazad", "wp512", "wp384", "wp256", "tnepres", NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void hexdump(unsigned char *buf, unsigned int len)
|
||||||
hexdump(unsigned char *buf, unsigned int len)
|
|
||||||
{
|
{
|
||||||
while (len--)
|
while (len--)
|
||||||
printk("%02x", *buf++);
|
printk("%02x", *buf++);
|
||||||
|
@ -75,20 +74,20 @@ hexdump(unsigned char *buf, unsigned int len)
|
||||||
printk("\n");
|
printk("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void test_hash(char *algo, struct hash_testvec *template,
|
||||||
test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
unsigned int tcount)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int i, j, k, temp;
|
unsigned int i, j, k, temp;
|
||||||
struct scatterlist sg[8];
|
struct scatterlist sg[8];
|
||||||
char result[64];
|
char result[64];
|
||||||
struct crypto_tfm *tfm;
|
struct crypto_tfm *tfm;
|
||||||
struct hash_testvec *hash_tv;
|
struct hash_testvec *hash_tv;
|
||||||
unsigned int tsize;
|
unsigned int tsize;
|
||||||
|
|
||||||
printk("\ntesting %s\n", algo);
|
printk("\ntesting %s\n", algo);
|
||||||
|
|
||||||
tsize = sizeof (struct hash_testvec);
|
tsize = sizeof(struct hash_testvec);
|
||||||
tsize *= tcount;
|
tsize *= tcount;
|
||||||
|
|
||||||
if (tsize > TVMEMSIZE) {
|
if (tsize > TVMEMSIZE) {
|
||||||
|
@ -97,7 +96,7 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tvmem, template, tsize);
|
memcpy(tvmem, template, tsize);
|
||||||
hash_tv = (void *) tvmem;
|
hash_tv = (void *)tvmem;
|
||||||
tfm = crypto_alloc_tfm(algo, 0);
|
tfm = crypto_alloc_tfm(algo, 0);
|
||||||
if (tfm == NULL) {
|
if (tfm == NULL) {
|
||||||
printk("failed to load transform for %s\n", algo);
|
printk("failed to load transform for %s\n", algo);
|
||||||
|
@ -105,70 +104,71 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < tcount; i++) {
|
for (i = 0; i < tcount; i++) {
|
||||||
printk ("test %u:\n", i + 1);
|
printk("test %u:\n", i + 1);
|
||||||
memset (result, 0, 64);
|
memset(result, 0, 64);
|
||||||
|
|
||||||
p = hash_tv[i].plaintext;
|
p = hash_tv[i].plaintext;
|
||||||
sg[0].page = virt_to_page (p);
|
sg[0].page = virt_to_page(p);
|
||||||
sg[0].offset = offset_in_page (p);
|
sg[0].offset = offset_in_page(p);
|
||||||
sg[0].length = hash_tv[i].psize;
|
sg[0].length = hash_tv[i].psize;
|
||||||
|
|
||||||
crypto_digest_init (tfm);
|
crypto_digest_init(tfm);
|
||||||
if (tfm->crt_u.digest.dit_setkey) {
|
if (tfm->crt_u.digest.dit_setkey) {
|
||||||
crypto_digest_setkey (tfm, hash_tv[i].key,
|
crypto_digest_setkey(tfm, hash_tv[i].key,
|
||||||
hash_tv[i].ksize);
|
hash_tv[i].ksize);
|
||||||
}
|
}
|
||||||
crypto_digest_update (tfm, sg, 1);
|
crypto_digest_update(tfm, sg, 1);
|
||||||
crypto_digest_final (tfm, result);
|
crypto_digest_final(tfm, result);
|
||||||
|
|
||||||
hexdump (result, crypto_tfm_alg_digestsize (tfm));
|
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
||||||
printk("%s\n",
|
printk("%s\n",
|
||||||
memcmp(result, hash_tv[i].digest,
|
memcmp(result, hash_tv[i].digest,
|
||||||
crypto_tfm_alg_digestsize(tfm)) ? "fail" :
|
crypto_tfm_alg_digestsize(tfm)) ?
|
||||||
"pass");
|
"fail" : "pass");
|
||||||
}
|
}
|
||||||
|
|
||||||
printk ("testing %s across pages\n", algo);
|
printk("testing %s across pages\n", algo);
|
||||||
|
|
||||||
/* setup the dummy buffer first */
|
/* setup the dummy buffer first */
|
||||||
memset(xbuf, 0, XBUFSIZE);
|
memset(xbuf, 0, XBUFSIZE);
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
for (i = 0; i < tcount; i++) {
|
for (i = 0; i < tcount; i++) {
|
||||||
if (hash_tv[i].np) {
|
if (hash_tv[i].np) {
|
||||||
j++;
|
j++;
|
||||||
printk ("test %u:\n", j);
|
printk("test %u:\n", j);
|
||||||
memset (result, 0, 64);
|
memset(result, 0, 64);
|
||||||
|
|
||||||
temp = 0;
|
temp = 0;
|
||||||
for (k = 0; k < hash_tv[i].np; k++) {
|
for (k = 0; k < hash_tv[i].np; k++) {
|
||||||
memcpy (&xbuf[IDX[k]], hash_tv[i].plaintext + temp,
|
memcpy(&xbuf[IDX[k]],
|
||||||
hash_tv[i].tap[k]);
|
hash_tv[i].plaintext + temp,
|
||||||
|
hash_tv[i].tap[k]);
|
||||||
temp += hash_tv[i].tap[k];
|
temp += hash_tv[i].tap[k];
|
||||||
p = &xbuf[IDX[k]];
|
p = &xbuf[IDX[k]];
|
||||||
sg[k].page = virt_to_page (p);
|
sg[k].page = virt_to_page(p);
|
||||||
sg[k].offset = offset_in_page (p);
|
sg[k].offset = offset_in_page(p);
|
||||||
sg[k].length = hash_tv[i].tap[k];
|
sg[k].length = hash_tv[i].tap[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto_digest_digest (tfm, sg, hash_tv[i].np, result);
|
crypto_digest_digest(tfm, sg, hash_tv[i].np, result);
|
||||||
|
|
||||||
hexdump (result, crypto_tfm_alg_digestsize (tfm));
|
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
||||||
printk("%s\n",
|
printk("%s\n",
|
||||||
memcmp(result, hash_tv[i].digest,
|
memcmp(result, hash_tv[i].digest,
|
||||||
crypto_tfm_alg_digestsize(tfm)) ? "fail" :
|
crypto_tfm_alg_digestsize(tfm)) ?
|
||||||
"pass");
|
"fail" : "pass");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto_free_tfm (tfm);
|
crypto_free_tfm(tfm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_CRYPTO_HMAC
|
#ifdef CONFIG_CRYPTO_HMAC
|
||||||
|
|
||||||
static void
|
static void test_hmac(char *algo, struct hmac_testvec *template,
|
||||||
test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
unsigned int tcount)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
unsigned int i, j, k, temp;
|
unsigned int i, j, k, temp;
|
||||||
|
@ -186,7 +186,7 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
||||||
|
|
||||||
printk("\ntesting hmac_%s\n", algo);
|
printk("\ntesting hmac_%s\n", algo);
|
||||||
|
|
||||||
tsize = sizeof (struct hmac_testvec);
|
tsize = sizeof(struct hmac_testvec);
|
||||||
tsize *= tcount;
|
tsize *= tcount;
|
||||||
if (tsize > TVMEMSIZE) {
|
if (tsize > TVMEMSIZE) {
|
||||||
printk("template (%u) too big for tvmem (%u)\n", tsize,
|
printk("template (%u) too big for tvmem (%u)\n", tsize,
|
||||||
|
@ -195,7 +195,7 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tvmem, template, tsize);
|
memcpy(tvmem, template, tsize);
|
||||||
hmac_tv = (void *) tvmem;
|
hmac_tv = (void *)tvmem;
|
||||||
|
|
||||||
for (i = 0; i < tcount; i++) {
|
for (i = 0; i < tcount; i++) {
|
||||||
printk("test %u:\n", i + 1);
|
printk("test %u:\n", i + 1);
|
||||||
|
@ -224,29 +224,30 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
||||||
for (i = 0; i < tcount; i++) {
|
for (i = 0; i < tcount; i++) {
|
||||||
if (hmac_tv[i].np) {
|
if (hmac_tv[i].np) {
|
||||||
j++;
|
j++;
|
||||||
printk ("test %u:\n",j);
|
printk("test %u:\n",j);
|
||||||
memset (result, 0, 64);
|
memset(result, 0, 64);
|
||||||
|
|
||||||
temp = 0;
|
temp = 0;
|
||||||
klen = hmac_tv[i].ksize;
|
klen = hmac_tv[i].ksize;
|
||||||
for (k = 0; k < hmac_tv[i].np; k++) {
|
for (k = 0; k < hmac_tv[i].np; k++) {
|
||||||
memcpy (&xbuf[IDX[k]], hmac_tv[i].plaintext + temp,
|
memcpy(&xbuf[IDX[k]],
|
||||||
hmac_tv[i].tap[k]);
|
hmac_tv[i].plaintext + temp,
|
||||||
|
hmac_tv[i].tap[k]);
|
||||||
temp += hmac_tv[i].tap[k];
|
temp += hmac_tv[i].tap[k];
|
||||||
p = &xbuf[IDX[k]];
|
p = &xbuf[IDX[k]];
|
||||||
sg[k].page = virt_to_page (p);
|
sg[k].page = virt_to_page(p);
|
||||||
sg[k].offset = offset_in_page (p);
|
sg[k].offset = offset_in_page(p);
|
||||||
sg[k].length = hmac_tv[i].tap[k];
|
sg[k].length = hmac_tv[i].tap[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto_hmac(tfm, hmac_tv[i].key, &klen, sg, hmac_tv[i].np,
|
crypto_hmac(tfm, hmac_tv[i].key, &klen, sg,
|
||||||
result);
|
hmac_tv[i].np, result);
|
||||||
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
||||||
|
|
||||||
printk("%s\n",
|
printk("%s\n",
|
||||||
memcmp(result, hmac_tv[i].digest,
|
memcmp(result, hmac_tv[i].digest,
|
||||||
crypto_tfm_alg_digestsize(tfm)) ? "fail" :
|
crypto_tfm_alg_digestsize(tfm)) ?
|
||||||
"pass");
|
"fail" : "pass");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
@ -255,8 +256,8 @@ out:
|
||||||
|
|
||||||
#endif /* CONFIG_CRYPTO_HMAC */
|
#endif /* CONFIG_CRYPTO_HMAC */
|
||||||
|
|
||||||
static void
|
static void test_cipher(char *algo, int mode, int enc,
|
||||||
test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, unsigned int tcount)
|
struct cipher_testvec *template, unsigned int tcount)
|
||||||
{
|
{
|
||||||
unsigned int ret, i, j, k, temp;
|
unsigned int ret, i, j, k, temp;
|
||||||
unsigned int tsize;
|
unsigned int tsize;
|
||||||
|
@ -270,13 +271,13 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
||||||
if (enc == ENCRYPT)
|
if (enc == ENCRYPT)
|
||||||
strncpy(e, "encryption", 11);
|
strncpy(e, "encryption", 11);
|
||||||
else
|
else
|
||||||
strncpy(e, "decryption", 11);
|
strncpy(e, "decryption", 11);
|
||||||
if (mode == MODE_ECB)
|
if (mode == MODE_ECB)
|
||||||
strncpy(m, "ECB", 4);
|
strncpy(m, "ECB", 4);
|
||||||
else
|
else
|
||||||
strncpy(m, "CBC", 4);
|
strncpy(m, "CBC", 4);
|
||||||
|
|
||||||
printk("\ntesting %s %s %s \n", algo, m, e);
|
printk("\ntesting %s %s %s\n", algo, m, e);
|
||||||
|
|
||||||
tsize = sizeof (struct cipher_testvec);
|
tsize = sizeof (struct cipher_testvec);
|
||||||
tsize *= tcount;
|
tsize *= tcount;
|
||||||
|
@ -288,12 +289,12 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tvmem, template, tsize);
|
memcpy(tvmem, template, tsize);
|
||||||
cipher_tv = (void *) tvmem;
|
cipher_tv = (void *)tvmem;
|
||||||
|
|
||||||
if (mode)
|
if (mode)
|
||||||
tfm = crypto_alloc_tfm (algo, 0);
|
tfm = crypto_alloc_tfm(algo, 0);
|
||||||
else
|
else
|
||||||
tfm = crypto_alloc_tfm (algo, CRYPTO_TFM_MODE_CBC);
|
tfm = crypto_alloc_tfm(algo, CRYPTO_TFM_MODE_CBC);
|
||||||
|
|
||||||
if (tfm == NULL) {
|
if (tfm == NULL) {
|
||||||
printk("failed to load transform for %s %s\n", algo, m);
|
printk("failed to load transform for %s %s\n", algo, m);
|
||||||
|
@ -327,7 +328,7 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
||||||
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
|
crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
|
||||||
crypto_tfm_alg_ivsize (tfm));
|
crypto_tfm_alg_ivsize(tfm));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc)
|
if (enc)
|
||||||
|
@ -345,12 +346,12 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
||||||
hexdump(q, cipher_tv[i].rlen);
|
hexdump(q, cipher_tv[i].rlen);
|
||||||
|
|
||||||
printk("%s\n",
|
printk("%s\n",
|
||||||
memcmp(q, cipher_tv[i].result, cipher_tv[i].rlen) ? "fail" :
|
memcmp(q, cipher_tv[i].result,
|
||||||
"pass");
|
cipher_tv[i].rlen) ? "fail" : "pass");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printk("\ntesting %s %s %s across pages (chunking) \n", algo, m, e);
|
printk("\ntesting %s %s %s across pages (chunking)\n", algo, m, e);
|
||||||
memset(xbuf, 0, XBUFSIZE);
|
memset(xbuf, 0, XBUFSIZE);
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
|
@ -375,18 +376,19 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
||||||
|
|
||||||
temp = 0;
|
temp = 0;
|
||||||
for (k = 0; k < cipher_tv[i].np; k++) {
|
for (k = 0; k < cipher_tv[i].np; k++) {
|
||||||
memcpy (&xbuf[IDX[k]], cipher_tv[i].input + temp,
|
memcpy(&xbuf[IDX[k]],
|
||||||
cipher_tv[i].tap[k]);
|
cipher_tv[i].input + temp,
|
||||||
|
cipher_tv[i].tap[k]);
|
||||||
temp += cipher_tv[i].tap[k];
|
temp += cipher_tv[i].tap[k];
|
||||||
p = &xbuf[IDX[k]];
|
p = &xbuf[IDX[k]];
|
||||||
sg[k].page = virt_to_page (p);
|
sg[k].page = virt_to_page(p);
|
||||||
sg[k].offset = offset_in_page (p);
|
sg[k].offset = offset_in_page(p);
|
||||||
sg[k].length = cipher_tv[i].tap[k];
|
sg[k].length = cipher_tv[i].tap[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
|
crypto_cipher_set_iv(tfm, cipher_tv[i].iv,
|
||||||
crypto_tfm_alg_ivsize (tfm));
|
crypto_tfm_alg_ivsize(tfm));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc)
|
if (enc)
|
||||||
|
@ -417,8 +419,7 @@ out:
|
||||||
crypto_free_tfm(tfm);
|
crypto_free_tfm(tfm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void test_deflate(void)
|
||||||
test_deflate(void)
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char result[COMP_BUF_SIZE];
|
char result[COMP_BUF_SIZE];
|
||||||
|
@ -436,7 +437,7 @@ test_deflate(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tvmem, deflate_comp_tv_template, tsize);
|
memcpy(tvmem, deflate_comp_tv_template, tsize);
|
||||||
tv = (void *) tvmem;
|
tv = (void *)tvmem;
|
||||||
|
|
||||||
tfm = crypto_alloc_tfm("deflate", 0);
|
tfm = crypto_alloc_tfm("deflate", 0);
|
||||||
if (tfm == NULL) {
|
if (tfm == NULL) {
|
||||||
|
@ -473,7 +474,7 @@ test_deflate(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tvmem, deflate_decomp_tv_template, tsize);
|
memcpy(tvmem, deflate_decomp_tv_template, tsize);
|
||||||
tv = (void *) tvmem;
|
tv = (void *)tvmem;
|
||||||
|
|
||||||
for (i = 0; i < DEFLATE_DECOMP_TEST_VECTORS; i++) {
|
for (i = 0; i < DEFLATE_DECOMP_TEST_VECTORS; i++) {
|
||||||
int ilen, ret, dlen = COMP_BUF_SIZE;
|
int ilen, ret, dlen = COMP_BUF_SIZE;
|
||||||
|
@ -497,8 +498,7 @@ out:
|
||||||
crypto_free_tfm(tfm);
|
crypto_free_tfm(tfm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void test_crc32c(void)
|
||||||
test_crc32c(void)
|
|
||||||
{
|
{
|
||||||
#define NUMVEC 6
|
#define NUMVEC 6
|
||||||
#define VECSIZE 40
|
#define VECSIZE 40
|
||||||
|
@ -598,8 +598,7 @@ test_crc32c(void)
|
||||||
printk("crc32c test complete\n");
|
printk("crc32c test complete\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void test_available(void)
|
||||||
test_available(void)
|
|
||||||
{
|
{
|
||||||
char **name = check;
|
char **name = check;
|
||||||
|
|
||||||
|
@ -611,8 +610,7 @@ test_available(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void do_test(void)
|
||||||
do_test(void)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
|
|
||||||
|
@ -623,13 +621,13 @@ do_test(void)
|
||||||
|
|
||||||
//DES
|
//DES
|
||||||
test_cipher ("des", MODE_ECB, ENCRYPT, des_enc_tv_template, DES_ENC_TEST_VECTORS);
|
test_cipher ("des", MODE_ECB, ENCRYPT, des_enc_tv_template, DES_ENC_TEST_VECTORS);
|
||||||
test_cipher ("des", MODE_ECB, DECRYPT, des_dec_tv_template, DES_DEC_TEST_VECTORS);
|
test_cipher ("des", MODE_ECB, DECRYPT, des_dec_tv_template, DES_DEC_TEST_VECTORS);
|
||||||
test_cipher ("des", MODE_CBC, ENCRYPT, des_cbc_enc_tv_template, DES_CBC_ENC_TEST_VECTORS);
|
test_cipher ("des", MODE_CBC, ENCRYPT, des_cbc_enc_tv_template, DES_CBC_ENC_TEST_VECTORS);
|
||||||
test_cipher ("des", MODE_CBC, DECRYPT, des_cbc_dec_tv_template, DES_CBC_DEC_TEST_VECTORS);
|
test_cipher ("des", MODE_CBC, DECRYPT, des_cbc_dec_tv_template, DES_CBC_DEC_TEST_VECTORS);
|
||||||
|
|
||||||
//DES3_EDE
|
//DES3_EDE
|
||||||
test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS);
|
test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS);
|
||||||
test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS);
|
test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS);
|
||||||
|
|
||||||
test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
|
test_hash("md4", md4_tv_template, MD4_TEST_VECTORS);
|
||||||
|
|
||||||
|
@ -726,7 +724,7 @@ do_test(void)
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS);
|
test_cipher ("des3_ede", MODE_ECB, ENCRYPT, des3_ede_enc_tv_template, DES3_EDE_ENC_TEST_VECTORS);
|
||||||
test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS);
|
test_cipher ("des3_ede", MODE_ECB, DECRYPT, des3_ede_dec_tv_template, DES3_EDE_DEC_TEST_VECTORS);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
|
@ -874,8 +872,7 @@ do_test(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init
|
static int __init init(void)
|
||||||
init(void)
|
|
||||||
{
|
{
|
||||||
tvmem = kmalloc(TVMEMSIZE, GFP_KERNEL);
|
tvmem = kmalloc(TVMEMSIZE, GFP_KERNEL);
|
||||||
if (tvmem == NULL)
|
if (tvmem == NULL)
|
||||||
|
|
|
@ -221,7 +221,7 @@ static struct hash_testvec sha384_tv_template[] = {
|
||||||
0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b},
|
0x5f, 0xe9, 0x5b, 0x1f, 0xe3, 0xc8, 0x45, 0x2b},
|
||||||
}, {
|
}, {
|
||||||
.plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
|
.plaintext = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
|
||||||
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
|
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
|
||||||
.psize = 112,
|
.psize = 112,
|
||||||
.digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
|
.digest = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8,
|
||||||
0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
|
0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47,
|
||||||
|
@ -1578,8 +1578,7 @@ static struct cipher_testvec tf_cbc_dec_tv_template[] = {
|
||||||
#define TNEPRES_ENC_TEST_VECTORS 4
|
#define TNEPRES_ENC_TEST_VECTORS 4
|
||||||
#define TNEPRES_DEC_TEST_VECTORS 4
|
#define TNEPRES_DEC_TEST_VECTORS 4
|
||||||
|
|
||||||
static struct cipher_testvec serpent_enc_tv_template[] =
|
static struct cipher_testvec serpent_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
.input = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f },
|
||||||
|
@ -1620,8 +1619,7 @@ static struct cipher_testvec serpent_enc_tv_template[] =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec tnepres_enc_tv_template[] =
|
static struct cipher_testvec tnepres_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{ /* KeySize=128, PT=0, I=1 */
|
{ /* KeySize=128, PT=0, I=1 */
|
||||||
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
.input = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
|
@ -1671,8 +1669,7 @@ static struct cipher_testvec tnepres_enc_tv_template[] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct cipher_testvec serpent_dec_tv_template[] =
|
static struct cipher_testvec serpent_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
|
.input = { 0x12, 0x07, 0xfc, 0xce, 0x9b, 0xd0, 0xd6, 0x47,
|
||||||
0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
|
0x6a, 0xe9, 0x8f, 0xbe, 0xd1, 0x43, 0xa0, 0xe2 },
|
||||||
|
@ -1713,8 +1710,7 @@ static struct cipher_testvec serpent_dec_tv_template[] =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec tnepres_dec_tv_template[] =
|
static struct cipher_testvec tnepres_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97,
|
.input = { 0x41, 0xcc, 0x6b, 0x31, 0x59, 0x31, 0x45, 0x97,
|
||||||
0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 },
|
0x6d, 0x6f, 0xbb, 0x38, 0x4b, 0x37, 0x21, 0x28 },
|
||||||
|
@ -1760,8 +1756,7 @@ static struct cipher_testvec tnepres_dec_tv_template[] =
|
||||||
#define CAST6_ENC_TEST_VECTORS 3
|
#define CAST6_ENC_TEST_VECTORS 3
|
||||||
#define CAST6_DEC_TEST_VECTORS 3
|
#define CAST6_DEC_TEST_VECTORS 3
|
||||||
|
|
||||||
static struct cipher_testvec cast6_enc_tv_template[] =
|
static struct cipher_testvec cast6_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
|
.key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
|
||||||
0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
|
0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
|
||||||
|
@ -1795,8 +1790,7 @@ static struct cipher_testvec cast6_enc_tv_template[] =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec cast6_dec_tv_template[] =
|
static struct cipher_testvec cast6_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
|
.key = { 0x23, 0x42, 0xbb, 0x9e, 0xfa, 0x38, 0x54, 0x2c,
|
||||||
0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
|
0x0a, 0xf7, 0x56, 0x47, 0xf2, 0x9f, 0x61, 0x5d },
|
||||||
|
@ -1915,8 +1909,7 @@ static struct cipher_testvec aes_dec_tv_template[] = {
|
||||||
#define CAST5_ENC_TEST_VECTORS 3
|
#define CAST5_ENC_TEST_VECTORS 3
|
||||||
#define CAST5_DEC_TEST_VECTORS 3
|
#define CAST5_DEC_TEST_VECTORS 3
|
||||||
|
|
||||||
static struct cipher_testvec cast5_enc_tv_template[] =
|
static struct cipher_testvec cast5_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
|
.key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
|
||||||
0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
|
0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
|
||||||
|
@ -1943,8 +1936,7 @@ static struct cipher_testvec cast5_enc_tv_template[] =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec cast5_dec_tv_template[] =
|
static struct cipher_testvec cast5_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
|
.key = { 0x01, 0x23, 0x45, 0x67, 0x12, 0x34, 0x56, 0x78,
|
||||||
0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
|
0x23, 0x45, 0x67, 0x89, 0x34, 0x56, 0x78, 0x9a },
|
||||||
|
@ -1977,8 +1969,7 @@ static struct cipher_testvec cast5_dec_tv_template[] =
|
||||||
#define ARC4_ENC_TEST_VECTORS 7
|
#define ARC4_ENC_TEST_VECTORS 7
|
||||||
#define ARC4_DEC_TEST_VECTORS 7
|
#define ARC4_DEC_TEST_VECTORS 7
|
||||||
|
|
||||||
static struct cipher_testvec arc4_enc_tv_template[] =
|
static struct cipher_testvec arc4_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
|
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
|
||||||
.klen = 8,
|
.klen = 8,
|
||||||
|
@ -2044,8 +2035,7 @@ static struct cipher_testvec arc4_enc_tv_template[] =
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec arc4_dec_tv_template[] =
|
static struct cipher_testvec arc4_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
|
.key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef },
|
||||||
.klen = 8,
|
.klen = 8,
|
||||||
|
@ -2117,8 +2107,7 @@ static struct cipher_testvec arc4_dec_tv_template[] =
|
||||||
#define TEA_ENC_TEST_VECTORS 4
|
#define TEA_ENC_TEST_VECTORS 4
|
||||||
#define TEA_DEC_TEST_VECTORS 4
|
#define TEA_DEC_TEST_VECTORS 4
|
||||||
|
|
||||||
static struct cipher_testvec tea_enc_tv_template[] =
|
static struct cipher_testvec tea_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { [0 ... 15] = 0x00 },
|
.key = { [0 ... 15] = 0x00 },
|
||||||
.klen = 16,
|
.klen = 16,
|
||||||
|
@ -2161,8 +2150,7 @@ static struct cipher_testvec tea_enc_tv_template[] =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec tea_dec_tv_template[] =
|
static struct cipher_testvec tea_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { [0 ... 15] = 0x00 },
|
.key = { [0 ... 15] = 0x00 },
|
||||||
.klen = 16,
|
.klen = 16,
|
||||||
|
@ -2183,8 +2171,8 @@ static struct cipher_testvec tea_dec_tv_template[] =
|
||||||
0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
|
0x51, 0x3a, 0x16, 0x10, 0x0a, 0x08, 0x12, 0x6e },
|
||||||
.klen = 16,
|
.klen = 16,
|
||||||
.input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
|
.input = { 0xbe, 0x7a, 0xbb, 0x81, 0x95, 0x2d, 0x1f, 0x1e,
|
||||||
0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
|
0xdd, 0x89, 0xa1, 0x25, 0x04, 0x21, 0xdf, 0x95 },
|
||||||
.ilen = 16,
|
.ilen = 16,
|
||||||
.result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
|
.result = { 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x5f, 0x74,
|
||||||
0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
|
0x65, 0x73, 0x74, 0x5f, 0x76, 0x65, 0x63, 0x74 },
|
||||||
.rlen = 16,
|
.rlen = 16,
|
||||||
|
@ -2193,9 +2181,9 @@ static struct cipher_testvec tea_dec_tv_template[] =
|
||||||
0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
|
0x5d, 0x04, 0x16, 0x36, 0x15, 0x72, 0x63, 0x2f },
|
||||||
.klen = 16,
|
.klen = 16,
|
||||||
.input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
|
.input = { 0xe0, 0x4d, 0x5d, 0x3c, 0xb7, 0x8c, 0x36, 0x47,
|
||||||
0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
|
0x94, 0x18, 0x95, 0x91, 0xa9, 0xfc, 0x49, 0xf8,
|
||||||
0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
|
0x44, 0xd1, 0x2d, 0xc2, 0x99, 0xb8, 0x08, 0x2a,
|
||||||
0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
|
0x07, 0x89, 0x73, 0xc2, 0x45, 0x92, 0xc6, 0x90 },
|
||||||
.ilen = 32,
|
.ilen = 32,
|
||||||
.result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
|
.result = { 0x54, 0x65, 0x61, 0x20, 0x69, 0x73, 0x20, 0x67,
|
||||||
0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
|
0x6f, 0x6f, 0x64, 0x20, 0x66, 0x6f, 0x72, 0x20,
|
||||||
|
@ -2211,8 +2199,7 @@ static struct cipher_testvec tea_dec_tv_template[] =
|
||||||
#define XTEA_ENC_TEST_VECTORS 4
|
#define XTEA_ENC_TEST_VECTORS 4
|
||||||
#define XTEA_DEC_TEST_VECTORS 4
|
#define XTEA_DEC_TEST_VECTORS 4
|
||||||
|
|
||||||
static struct cipher_testvec xtea_enc_tv_template[] =
|
static struct cipher_testvec xtea_enc_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { [0 ... 15] = 0x00 },
|
.key = { [0 ... 15] = 0x00 },
|
||||||
.klen = 16,
|
.klen = 16,
|
||||||
|
@ -2255,8 +2242,7 @@ static struct cipher_testvec xtea_enc_tv_template[] =
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct cipher_testvec xtea_dec_tv_template[] =
|
static struct cipher_testvec xtea_dec_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { [0 ... 15] = 0x00 },
|
.key = { [0 ... 15] = 0x00 },
|
||||||
.klen = 16,
|
.klen = 16,
|
||||||
|
@ -2697,8 +2683,7 @@ static struct comp_testvec deflate_decomp_tv_template[] = {
|
||||||
*/
|
*/
|
||||||
#define MICHAEL_MIC_TEST_VECTORS 6
|
#define MICHAEL_MIC_TEST_VECTORS 6
|
||||||
|
|
||||||
static struct hash_testvec michael_mic_tv_template[] =
|
static struct hash_testvec michael_mic_tv_template[] = {
|
||||||
{
|
|
||||||
{
|
{
|
||||||
.key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
.key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
|
||||||
.ksize = 8,
|
.ksize = 8,
|
||||||
|
|
Loading…
Reference in New Issue