diff options
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r-- | crypto/tcrypt.c | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index d671e8942b1f..f5e9da319ece 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * Software Foundation; either version 2 of the License, or (at your option) | 12 | * Software Foundation; either version 2 of the License, or (at your option) |
13 | * any later version. | 13 | * any later version. |
14 | * | 14 | * |
15 | * 2006-12-07 Added SHA384 HMAC and SHA512 HMAC tests | ||
15 | * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>) | 16 | * 2004-08-09 Added cipher speed tests (Reyk Floeter <reyk@vantronix.net>) |
16 | * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt | 17 | * 2003-09-14 Rewritten by Kartikey Mahendra Bhatt |
17 | * | 18 | * |
@@ -71,7 +72,8 @@ static char *check[] = { | |||
71 | "des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish", | 72 | "des", "md5", "des3_ede", "rot13", "sha1", "sha256", "blowfish", |
72 | "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6", | 73 | "twofish", "serpent", "sha384", "sha512", "md4", "aes", "cast6", |
73 | "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", | 74 | "arc4", "michael_mic", "deflate", "crc32c", "tea", "xtea", |
74 | "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", NULL | 75 | "khazad", "wp512", "wp384", "wp256", "tnepres", "xeta", "fcrypt", |
76 | "camellia", NULL | ||
75 | }; | 77 | }; |
76 | 78 | ||
77 | static void hexdump(unsigned char *buf, unsigned int len) | 79 | static void hexdump(unsigned char *buf, unsigned int len) |
@@ -765,7 +767,7 @@ static void test_deflate(void) | |||
765 | memcpy(tvmem, deflate_comp_tv_template, tsize); | 767 | memcpy(tvmem, deflate_comp_tv_template, tsize); |
766 | tv = (void *)tvmem; | 768 | tv = (void *)tvmem; |
767 | 769 | ||
768 | tfm = crypto_alloc_tfm("deflate", 0); | 770 | tfm = crypto_alloc_comp("deflate", 0, CRYPTO_ALG_ASYNC); |
769 | if (tfm == NULL) { | 771 | if (tfm == NULL) { |
770 | printk("failed to load transform for deflate\n"); | 772 | printk("failed to load transform for deflate\n"); |
771 | return; | 773 | return; |
@@ -964,6 +966,26 @@ static void do_test(void) | |||
964 | test_cipher("ecb(xeta)", DECRYPT, xeta_dec_tv_template, | 966 | test_cipher("ecb(xeta)", DECRYPT, xeta_dec_tv_template, |
965 | XETA_DEC_TEST_VECTORS); | 967 | XETA_DEC_TEST_VECTORS); |
966 | 968 | ||
969 | //FCrypt | ||
970 | test_cipher("pcbc(fcrypt)", ENCRYPT, fcrypt_pcbc_enc_tv_template, | ||
971 | FCRYPT_ENC_TEST_VECTORS); | ||
972 | test_cipher("pcbc(fcrypt)", DECRYPT, fcrypt_pcbc_dec_tv_template, | ||
973 | FCRYPT_DEC_TEST_VECTORS); | ||
974 | |||
975 | //CAMELLIA | ||
976 | test_cipher("ecb(camellia)", ENCRYPT, | ||
977 | camellia_enc_tv_template, | ||
978 | CAMELLIA_ENC_TEST_VECTORS); | ||
979 | test_cipher("ecb(camellia)", DECRYPT, | ||
980 | camellia_dec_tv_template, | ||
981 | CAMELLIA_DEC_TEST_VECTORS); | ||
982 | test_cipher("cbc(camellia)", ENCRYPT, | ||
983 | camellia_cbc_enc_tv_template, | ||
984 | CAMELLIA_CBC_ENC_TEST_VECTORS); | ||
985 | test_cipher("cbc(camellia)", DECRYPT, | ||
986 | camellia_cbc_dec_tv_template, | ||
987 | CAMELLIA_CBC_DEC_TEST_VECTORS); | ||
988 | |||
967 | test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS); | 989 | test_hash("sha384", sha384_tv_template, SHA384_TEST_VECTORS); |
968 | test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS); | 990 | test_hash("sha512", sha512_tv_template, SHA512_TEST_VECTORS); |
969 | test_hash("wp512", wp512_tv_template, WP512_TEST_VECTORS); | 991 | test_hash("wp512", wp512_tv_template, WP512_TEST_VECTORS); |
@@ -980,6 +1002,10 @@ static void do_test(void) | |||
980 | HMAC_SHA1_TEST_VECTORS); | 1002 | HMAC_SHA1_TEST_VECTORS); |
981 | test_hash("hmac(sha256)", hmac_sha256_tv_template, | 1003 | test_hash("hmac(sha256)", hmac_sha256_tv_template, |
982 | HMAC_SHA256_TEST_VECTORS); | 1004 | HMAC_SHA256_TEST_VECTORS); |
1005 | test_hash("hmac(sha384)", hmac_sha384_tv_template, | ||
1006 | HMAC_SHA384_TEST_VECTORS); | ||
1007 | test_hash("hmac(sha512)", hmac_sha512_tv_template, | ||
1008 | HMAC_SHA512_TEST_VECTORS); | ||
983 | 1009 | ||
984 | test_hash("xcbc(aes)", aes_xcbc128_tv_template, | 1010 | test_hash("xcbc(aes)", aes_xcbc128_tv_template, |
985 | XCBC_AES_TEST_VECTORS); | 1011 | XCBC_AES_TEST_VECTORS); |
@@ -1177,6 +1203,28 @@ static void do_test(void) | |||
1177 | XETA_DEC_TEST_VECTORS); | 1203 | XETA_DEC_TEST_VECTORS); |
1178 | break; | 1204 | break; |
1179 | 1205 | ||
1206 | case 31: | ||
1207 | test_cipher("pcbc(fcrypt)", ENCRYPT, fcrypt_pcbc_enc_tv_template, | ||
1208 | FCRYPT_ENC_TEST_VECTORS); | ||
1209 | test_cipher("pcbc(fcrypt)", DECRYPT, fcrypt_pcbc_dec_tv_template, | ||
1210 | FCRYPT_DEC_TEST_VECTORS); | ||
1211 | break; | ||
1212 | |||
1213 | case 32: | ||
1214 | test_cipher("ecb(camellia)", ENCRYPT, | ||
1215 | camellia_enc_tv_template, | ||
1216 | CAMELLIA_ENC_TEST_VECTORS); | ||
1217 | test_cipher("ecb(camellia)", DECRYPT, | ||
1218 | camellia_dec_tv_template, | ||
1219 | CAMELLIA_DEC_TEST_VECTORS); | ||
1220 | test_cipher("cbc(camellia)", ENCRYPT, | ||
1221 | camellia_cbc_enc_tv_template, | ||
1222 | CAMELLIA_CBC_ENC_TEST_VECTORS); | ||
1223 | test_cipher("cbc(camellia)", DECRYPT, | ||
1224 | camellia_cbc_dec_tv_template, | ||
1225 | CAMELLIA_CBC_DEC_TEST_VECTORS); | ||
1226 | break; | ||
1227 | |||
1180 | case 100: | 1228 | case 100: |
1181 | test_hash("hmac(md5)", hmac_md5_tv_template, | 1229 | test_hash("hmac(md5)", hmac_md5_tv_template, |
1182 | HMAC_MD5_TEST_VECTORS); | 1230 | HMAC_MD5_TEST_VECTORS); |
@@ -1192,6 +1240,16 @@ static void do_test(void) | |||
1192 | HMAC_SHA256_TEST_VECTORS); | 1240 | HMAC_SHA256_TEST_VECTORS); |
1193 | break; | 1241 | break; |
1194 | 1242 | ||
1243 | case 103: | ||
1244 | test_hash("hmac(sha384)", hmac_sha384_tv_template, | ||
1245 | HMAC_SHA384_TEST_VECTORS); | ||
1246 | break; | ||
1247 | |||
1248 | case 104: | ||
1249 | test_hash("hmac(sha512)", hmac_sha512_tv_template, | ||
1250 | HMAC_SHA512_TEST_VECTORS); | ||
1251 | break; | ||
1252 | |||
1195 | 1253 | ||
1196 | case 200: | 1254 | case 200: |
1197 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, | 1255 | test_cipher_speed("ecb(aes)", ENCRYPT, sec, NULL, 0, |
@@ -1260,6 +1318,17 @@ static void do_test(void) | |||
1260 | des_speed_template); | 1318 | des_speed_template); |
1261 | break; | 1319 | break; |
1262 | 1320 | ||
1321 | case 205: | ||
1322 | test_cipher_speed("ecb(camellia)", ENCRYPT, sec, NULL, 0, | ||
1323 | camellia_speed_template); | ||
1324 | test_cipher_speed("ecb(camellia)", DECRYPT, sec, NULL, 0, | ||
1325 | camellia_speed_template); | ||
1326 | test_cipher_speed("cbc(camellia)", ENCRYPT, sec, NULL, 0, | ||
1327 | camellia_speed_template); | ||
1328 | test_cipher_speed("cbc(camellia)", DECRYPT, sec, NULL, 0, | ||
1329 | camellia_speed_template); | ||
1330 | break; | ||
1331 | |||
1263 | case 300: | 1332 | case 300: |
1264 | /* fall through */ | 1333 | /* fall through */ |
1265 | 1334 | ||