aboutsummaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorDavid Barksdale <amatus@amatus.name>2014-08-13 16:29:15 -0500
committerDavid Barksdale <amatus@amatus.name>2014-08-13 16:29:15 -0500
commit205ac4d83fc388c1e2d0bb590a2a36e9a4c2fd78 (patch)
tree1dbd529848c396058dfc9c8a4f402dcbe3546317 /crypto
parentace6c6d243016e272050787c14e27a83ecd94a25 (diff)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tcrypt.c10
-rw-r--r--crypto/testmgr.c38
-rw-r--r--crypto/testmgr.h125
3 files changed, 134 insertions, 39 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index aa3f84ccc78..3092728bf4c 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -883,7 +883,15 @@ static int do_test(int m)
case 399:
break;
-
+ case 400:
+ tcrypt_test("f8(kasumi)");
+ break;
+ case 401:
+ tcrypt_test("kasumi");
+ break;
+ case 402:
+ tcrypt_test("f9(kasumi)");
+ break;
case 1000:
test_available();
break;
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index deacec764fb..01f3f79de7e 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1498,6 +1498,22 @@ static const struct alg_test_desc alg_test_descs_k[] = {
.count = 1
},
.dec = {
+ .vecs = kasumi_f8_dec_template,
+ .count = 1
+ }
+ }
+ }
+ },
+ {
+ .alg = "kasumi",
+ .test = alg_test_skcipher,
+ .suite = {
+ .cipher = {
+ .enc = {
+ .vecs = kasumi_enc_template,
+ .count = 1
+ },
+ .dec = {
.vecs = kasumi_dec_template,
.count = 1
}
@@ -1577,7 +1593,7 @@ static const struct alg_test_desc alg_test_descs_k[] = {
/* Currently disabled all the DTLS testing since,
* the DTLS enc test cases fail due to Random IV generation
*/
-#if 0
+#if 1
{
.alg = "dtls(aes-sha1)",
.test = alg_test_aead,
@@ -2408,7 +2424,18 @@ static const struct alg_test_desc alg_test_descs[] = {
.count = MD4_TEST_VECTORS
}
}
- }, {
+ },
+ {
+ .alg = "f9(kasumi)",
+ .test = alg_test_hash,
+ .suite = {
+ .hash = {
+ .vecs = kasumi_f9_tv_template,
+ .count = 1
+ }
+ }
+ },
+ {
.alg = "md5",
.test = alg_test_hash,
.suite = {
@@ -2709,6 +2736,10 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
int j;
int rc;
+ //printk("Testing alg = %s, driver name: %s\n", alg, driver);
+ if ((strcmp(alg, "kasumi") == 0) || (strcmp(alg, "f8(kasumi)") == 0)){
+ printk("Testing kasumi now\n");
+ }
if ((type & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_CIPHER) {
char nalg[CRYPTO_MAX_ALG_NAME];
@@ -2727,9 +2758,12 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
goto test_done;
}
+
/* Enable these if want to test DTLS, SSL, TLS and TLSV11 and Kasumi */
+
#if 1
for ( i = 0; i < 15; i++) {
+ //printk("Testing special alg = %s, driver = %s\n", alg, driver);
if (strcmp(alg, alg_test_descs_k[i].alg) == 0) {
rc = alg_test_descs_k[i].test(alg_test_descs_k + i, driver,
type, mask);
diff --git a/crypto/testmgr.h b/crypto/testmgr.h
index ade892af4c2..4de793d4bdf 100644
--- a/crypto/testmgr.h
+++ b/crypto/testmgr.h
@@ -2863,53 +2863,106 @@ static struct cipher_testvec cast6_dec_tv_template[] = {
.rlen = 16,
},
};
-
-
-static struct cipher_testvec kasumi_dec_template[] = {
+static struct cipher_testvec kasumi_f8_dec_template[] = {
{
- .key = "\x01\x02\x03\x04\x05\x06\x07"
- "\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10",
- .klen = 16,
- .input = "\xec\xa7\xdb\xe8\xd9\xf4\x93\x2e",
- .ilen = 8,
- .result = "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8",
- .rlen = 8,
+ .key = "\x96\x18\xae\x46\x89\x1f\x86\x57\x8e\xeb\xe9\x0e\xf7\xa1\x20\x2e",
+ .iv = "\xc6\x75\xa6\x4b\x64\x00\x00\x00",
+
+ .result = "\x8d\xaa\x17\xb1\xae\x05\x05\x29\xc6\x82\x7f\x28\xc0\xef\x6a\x12"
+ "\x42\xe9\x3f\x8b\x31\x4f\xb1\x8a\x77\xf7\x90\xae\x04\x9f\xed\xd6"
+ "\x12\x26\x7f\xec\xae\xfc\x45\x01\x74\xd7\x6d\x9f\x9a\xa7\x75\x5a"
+ "\x30\xcd\x90\xa9\xa5\x87\x4b\xf4\x8e\xaf\x70\xee\xa3\xa6\x2a\x25"
+ "\x0a\x8b\x6b\xd8\xd9\xb0\x8b\x08\xd6\x4e\x32\xd1\x81\x77\x77\xfb"
+ "\x54\x4d\x49\xcd\x49\x72\x0e\x21\x9d\xbf\x8b\xbe\xd3\x39\x04\xe1"
+ "\xfd\x40\xa4\x1d\x37\x0a\x1f\x65\x74\x50\x95\x68\x7d\x47\xba\x1d"
+ "\x36\xd2\x34\x9e\x23\xf6\x44\x39\x2c\x8e\xa9\xc4\x9d\x40\xc1\x32"
+ "\x71\xaf\xf2\x64\xd0\xf2\x48\x41\xd6\x46\x5f\x09\x96\xff\x84\xe6"
+ "\x5f\xc5\x17\xc5\x3e\xfc\x33\x63\xc3\x84\x92\xa8",
+ .klen = 16,
+ .ilen = 156,
+ .input = "\xaa\xf8\xe8\xb3\x49\xfb\xab\xb9\x5c\x62\x1d\xe6\xfb\x51\x67\x44"
+ "\x60\x54\xae\x7c\xfa\x94\x6f\x99\x6c\x26\x00\x53\x45\xa1\xa2\xaf"
+ "\x44\xee\xa6\x88\xb7\x59\xff\xe3\xe2\x2d\x6e\x17\xbd\x9e\x70\x79"
+ "\xcc\x54\xe8\xd4\x92\xdb\xfd\xe7\x9e\x84\x04\x38\x49\x82\x1a\x24"
+ "\x7a\x67\xd3\x50\x9b\xa1\x6b\x49\x15\xfd\xdd\xd6\x38\xe2\x52\xf4"
+ "\x37\x1e\x47\x1d\x1b\x39\xb4\x15\x8b\x47\xf1\x4d\x03\x7b\xbd\x28"
+ "\x37\x80\x41\x34\xad\x49\x3b\xfc\x14\x0e\x43\x7f\x5e\xbf\x9c\x29"
+ "\xd5\xd8\xa5\x81\x6f\x92\x6a\xa2\x76\xe9\xa7\x43\xa6\x21\x41\xad"
+ "\xeb\x65\x3b\xd2\x96\x3c\x9f\x54\x1f\x5e\x13\x34\xb7\x75\x92\xb1"
+ "\xad\xed\x44\x36\x72\x28\x28\x01\x32\xa7\x47\xde",
+ .rlen = 156,
},
};
static struct cipher_testvec kasumi_f8_enc_template[] ={
-
- {
-
+ {
.key = "\x2b\xd6\x45\x9f\x82\xc5\xb3\x00"
- "\x95\x2c\x49\x10"
- "\x48\x81\xff\x48",
-
+ "\x95\x2c\x49\x10\x48\x81\xff\x48",
.klen = 16,
-
.iv = "\x72\xa4\xf2\x0f\x64\x00\x00\x00",
-
.input = "\x7e\xc6\x12\x72\x74\x3b\xf1\x61"
- "\x47\x26\x44\x6a\x6c\x38\xce\xd1"
- "\x66, \xf6, \xca, \x76, \xeb, \x54, \x30, \x04"
- "\x42, \x86, \x34, \x6c, \xef, \x13, \x0f, \x92"
- "\x92, \x2b, \x03, \x45, \x0d, \x3a, \x99, \x75, \xe5, \xbd, \x2e, \xa0"
- "\xeb, \x55, \xad, \x8e, \x1b, \x19, \x9e, \x3e, \xc4, \x31, \x60, \x20"
- "\xe9, \xa1, \xb2, \x85, \xe7, \x62, \x79, \x53, \x59, \xb7, \xbd, \xfd, \x39, \xbe, \xf4, \xb2"
- "\x48, \x45, \x83, \xd5,\xaf, \xe0, \x82, \xae,\xe6, \x38, \xbf, \x5f, \xd5, \xa6, \x06, \x19"
- "\x39, \x01, \xa0, \x8f, \x4a, \xb4, \x1a, \xab, \x9b, \x13, \x48, \x80",
-
+ "\x47\x26\x44\x6a\x6c\x38\xce\xd1",
.ilen = 16,
- .result = "\xd1, \xe2, \xde, \x70, \xee, \xf8, \x6c, \x69, \x64, \xfb, \x54, \x2b, \xc2, \xd4, \x60, \xaa"
- "\xbf, \xaa, \x10, \xa4, \xa0, \x93, \x26, \x2b, \x7d, \x19, \x9e, \x70, \x6f, \xc2, \xd4, \x89"
- "\x15, \x53, \x29, \x69, \x10, \xf3, \xa9, \x73, \x01, \x26, \x82, \xe4, \x1c, \x4e, \x2b, \x02"
- "\xbe, \x20, \x17, \xb7, \x25, \x3b, \xbf, \x93, \x09, \xde, \x58, \x19, \xcb, \x42, \xe8, \x19"
- "\x56, \xf4, \xc9, \x9b, \xc9, \x76, \x5c, \xaf, \x53, \xb1, \xd0, \xbb, \x82, \x79, \x82, \x6a"
- "\xdb, \xbc, \x55, \x22, \xe9, \x15, \xc1, \x20, \xa6, \x18, \xa5, \xa7, \xf5, \xe8, \x97, \x08"
- "\x93, \x39, \x65, \x0f",
- .rlen = 10,
- },
+ .result = "\xd1\xe2\xde\x70\xee\xf8\x6c\x69"
+ "\x64\xfb\x54\x2b\xc2\xd4\x60\xaa",
+ .rlen = 16,
+ },
+};
+
+static struct cipher_testvec kasumi_enc_template[] = {
+ {
+ .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
+ "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10",
+ .klen = 16,
+ .input = "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8",
+ .ilen = 8,
+ .result = "\xed\xa7\xdb\xe8\xd9\xf4\x93\x2e",
+ .rlen = 8,
+ },
+};
+
+static struct cipher_testvec kasumi_dec_template[] = {
+ {
+ .key = "\x01\x02\x03\x04\x05\x06\x07\x08"
+ "\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10",
+ .klen = 16,
+ .input = "\xec\xa7\xdb\xe8\xd9\xf4\x93\x2e",
+ .ilen = 8,
+ .result = "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8",
+ .rlen = 8,
+ },
};
+
+static struct hash_testvec kasumi_f9_tv_template[] = {
+ {
+ .key = "\x5d\x0a\x80\xd8\x13\x4a\xe1\x96\x77\x82\x4b\x67\x1e\x83\x8a\xf4",
+ .ksize = 16,
+ .plaintext = "\x78\x27\xfa\xb2\xa5\x6c\x6c\xa2\x01\x00\x00\x00\x00\x00\x00\x00"
+ "\x70\xde\xdf\x2d\xc4\x2c\x5c\xbd\x3a\x96\xf8\xa0\xb1\x14\x18\xb3"
+ "\x60\x8d\x57\x33\x60\x4a\x2c\xd3\x6a\xab\xc7\x0c\xe3\x19\x3b\xb5"
+ "\x15\x3b\xe2\xd3\xc0\x6d\xfd\xb2\xd1\x6e\x9c\x35\x71\x58\xbe\x6a"
+ "\x41\xd6\xb8\x61\xe4\x91\xdb\x3f\xbf\xeb\x51\x8e\xfc\xf0\x48\xd7"
+ "\xd5\x89\x53\x73\x0f\xf3\x0c\x9e\xc4\x70\xff\xcd\x66\x3d\xc3\x42"
+ "\x01\xc3\x6a\xdd\xc0\x11\x1c\x35\xb3\x8a\xfe\xe7\xcf\xdb\x58\x2e"
+ "\x37\x31\xf8\xb4\xba\xa8\xd1\xa8\x9c\x06\xe8\x11\x99\xa9\x71\x62"
+ "\x27\xbe\x34\x4e\xfc\xb4\x36\xdd\xd0\xf0\x96\xc0\x64\xc3\xb5\xe2"
+ "\xc3\x99\x99\x3f\xc7\x73\x94\xf9\xe0\x97\x20\xa8\x11\x85\x0e\xf2"
+ "\x3b\x2e\xe0\x5d\x9e\x61\x73\x60\x9d\x86\xe1\xc0\xc1\x8e\xa5\x1a"
+ "\x01\x2a\x00\xbb\x41\x3b\x9c\xb8\x18\x8a\x70\x3c\xd6\xba\xe3\x1c"
+ "\xc6\x7b\x34\xb1\xb0\x00\x19\xe6\xa2\xb2\xa6\x90\xf0\x26\x71\xfe"
+ "\x7c\x9e\xf8\xde\xc0\x09\x4e\x53\x37\x63\x47\x8d\x58\xd2\xc5\xf5"
+ "\xb8\x27\xa0\x14\x8c\x59\x48\xa9\x69\x31\xac\xf8\x4f\x46\x5a\x64"
+ "\xe6\x2c\xe7\x40\x07\xe9\x91\xe3\x7e\xa8\x23\xfa\x0f\xb2\x19\x23"
+ "\xb7\x99\x05\xb7\x33\xb6\x31\xe6\xc7\xd6\x86\x0a\x38\x31\xac\x35"
+ "\x1a\x9c\x73\x0c\x52\xff\x72\xd9\xd3\x08\xee\xdb\xab\x21\xfd\xe1"
+ "\x43\xa0\xea\x17\xe2\x3e\xdc\x1f\x74\xcb\xb3\x63\x8a\x20\x33\xaa"
+ "\xa1\x54\x64\xea\xa7\x33\x38\x5d\xbb\xeb\x6f\xd7\x35\x09\xb8\x57"
+ "\xe6\xa4\x19\xdc\xa1\xd8\x90\x7a\xf9\x77\xfb\xac\x4d\xfa\x35\xec",
+ .psize = 336,
+ .digest = "\x04\x91\x20\x48\x82\x37\xc4\x1a",
+ },
+};
+
/*
* AES test vectors.
*/