[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
|
@ -66,8 +66,7 @@ static char *check[] = {
|
|||
"khazad", "wp512", "wp384", "wp256", "tnepres", NULL
|
||||
};
|
||||
|
||||
static void
|
||||
hexdump(unsigned char *buf, unsigned int len)
|
||||
static void hexdump(unsigned char *buf, unsigned int len)
|
||||
{
|
||||
while (len--)
|
||||
printk("%02x", *buf++);
|
||||
|
@ -75,8 +74,8 @@ hexdump(unsigned char *buf, unsigned int len)
|
|||
printk("\n");
|
||||
}
|
||||
|
||||
static void
|
||||
test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
||||
static void test_hash(char *algo, struct hash_testvec *template,
|
||||
unsigned int tcount)
|
||||
{
|
||||
char *p;
|
||||
unsigned int i, j, k, temp;
|
||||
|
@ -124,8 +123,8 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
|||
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
||||
printk("%s\n",
|
||||
memcmp(result, hash_tv[i].digest,
|
||||
crypto_tfm_alg_digestsize(tfm)) ? "fail" :
|
||||
"pass");
|
||||
crypto_tfm_alg_digestsize(tfm)) ?
|
||||
"fail" : "pass");
|
||||
}
|
||||
|
||||
printk("testing %s across pages\n", algo);
|
||||
|
@ -142,7 +141,8 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
|||
|
||||
temp = 0;
|
||||
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].plaintext + temp,
|
||||
hash_tv[i].tap[k]);
|
||||
temp += hash_tv[i].tap[k];
|
||||
p = &xbuf[IDX[k]];
|
||||
|
@ -156,8 +156,8 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
|||
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
||||
printk("%s\n",
|
||||
memcmp(result, hash_tv[i].digest,
|
||||
crypto_tfm_alg_digestsize(tfm)) ? "fail" :
|
||||
"pass");
|
||||
crypto_tfm_alg_digestsize(tfm)) ?
|
||||
"fail" : "pass");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,8 +167,8 @@ test_hash (char * algo, struct hash_testvec * template, unsigned int tcount)
|
|||
|
||||
#ifdef CONFIG_CRYPTO_HMAC
|
||||
|
||||
static void
|
||||
test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
||||
static void test_hmac(char *algo, struct hmac_testvec *template,
|
||||
unsigned int tcount)
|
||||
{
|
||||
char *p;
|
||||
unsigned int i, j, k, temp;
|
||||
|
@ -230,7 +230,8 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
|||
temp = 0;
|
||||
klen = hmac_tv[i].ksize;
|
||||
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].plaintext + temp,
|
||||
hmac_tv[i].tap[k]);
|
||||
temp += hmac_tv[i].tap[k];
|
||||
p = &xbuf[IDX[k]];
|
||||
|
@ -239,14 +240,14 @@ test_hmac(char *algo, struct hmac_testvec * template, unsigned int tcount)
|
|||
sg[k].length = hmac_tv[i].tap[k];
|
||||
}
|
||||
|
||||
crypto_hmac(tfm, hmac_tv[i].key, &klen, sg, hmac_tv[i].np,
|
||||
result);
|
||||
crypto_hmac(tfm, hmac_tv[i].key, &klen, sg,
|
||||
hmac_tv[i].np, result);
|
||||
hexdump(result, crypto_tfm_alg_digestsize(tfm));
|
||||
|
||||
printk("%s\n",
|
||||
memcmp(result, hmac_tv[i].digest,
|
||||
crypto_tfm_alg_digestsize(tfm)) ? "fail" :
|
||||
"pass");
|
||||
crypto_tfm_alg_digestsize(tfm)) ?
|
||||
"fail" : "pass");
|
||||
}
|
||||
}
|
||||
out:
|
||||
|
@ -255,8 +256,8 @@ out:
|
|||
|
||||
#endif /* CONFIG_CRYPTO_HMAC */
|
||||
|
||||
static void
|
||||
test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, unsigned int tcount)
|
||||
static void test_cipher(char *algo, int mode, int enc,
|
||||
struct cipher_testvec *template, unsigned int tcount)
|
||||
{
|
||||
unsigned int ret, i, j, k, temp;
|
||||
unsigned int tsize;
|
||||
|
@ -345,8 +346,8 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
|||
hexdump(q, cipher_tv[i].rlen);
|
||||
|
||||
printk("%s\n",
|
||||
memcmp(q, cipher_tv[i].result, cipher_tv[i].rlen) ? "fail" :
|
||||
"pass");
|
||||
memcmp(q, cipher_tv[i].result,
|
||||
cipher_tv[i].rlen) ? "fail" : "pass");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,7 +376,8 @@ test_cipher(char * algo, int mode, int enc, struct cipher_testvec * template, un
|
|||
|
||||
temp = 0;
|
||||
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].input + temp,
|
||||
cipher_tv[i].tap[k]);
|
||||
temp += cipher_tv[i].tap[k];
|
||||
p = &xbuf[IDX[k]];
|
||||
|
@ -417,8 +419,7 @@ out:
|
|||
crypto_free_tfm(tfm);
|
||||
}
|
||||
|
||||
static void
|
||||
test_deflate(void)
|
||||
static void test_deflate(void)
|
||||
{
|
||||
unsigned int i;
|
||||
char result[COMP_BUF_SIZE];
|
||||
|
@ -497,8 +498,7 @@ out:
|
|||
crypto_free_tfm(tfm);
|
||||
}
|
||||
|
||||
static void
|
||||
test_crc32c(void)
|
||||
static void test_crc32c(void)
|
||||
{
|
||||
#define NUMVEC 6
|
||||
#define VECSIZE 40
|
||||
|
@ -598,8 +598,7 @@ test_crc32c(void)
|
|||
printk("crc32c test complete\n");
|
||||
}
|
||||
|
||||
static void
|
||||
test_available(void)
|
||||
static void test_available(void)
|
||||
{
|
||||
char **name = check;
|
||||
|
||||
|
@ -611,8 +610,7 @@ test_available(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_test(void)
|
||||
static void do_test(void)
|
||||
{
|
||||
switch (mode) {
|
||||
|
||||
|
@ -874,8 +872,7 @@ do_test(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int __init
|
||||
init(void)
|
||||
static int __init init(void)
|
||||
{
|
||||
tvmem = kmalloc(TVMEMSIZE, GFP_KERNEL);
|
||||
if (tvmem == NULL)
|
||||
|
|
|
@ -1578,8 +1578,7 @@ static struct cipher_testvec tf_cbc_dec_tv_template[] = {
|
|||
#define TNEPRES_ENC_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,
|
||||
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 */
|
||||
.input = { 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,
|
||||
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,
|
||||
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_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,
|
||||
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,
|
||||
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_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,
|
||||
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,
|
||||
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_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 },
|
||||
.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 },
|
||||
.klen = 8,
|
||||
|
@ -2117,8 +2107,7 @@ static struct cipher_testvec arc4_dec_tv_template[] =
|
|||
#define TEA_ENC_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 },
|
||||
.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 },
|
||||
.klen = 16,
|
||||
|
@ -2211,8 +2199,7 @@ static struct cipher_testvec tea_dec_tv_template[] =
|
|||
#define XTEA_ENC_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 },
|
||||
.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 },
|
||||
.klen = 16,
|
||||
|
@ -2697,8 +2683,7 @@ static struct comp_testvec deflate_decomp_tv_template[] = {
|
|||
*/
|
||||
#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 },
|
||||
.ksize = 8,
|
||||
|
|
Loading…
Reference in New Issue