aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tcrypt.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 58ad4fe5d208..5cf2ccb1540c 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -809,7 +809,7 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
809 struct cipher_speed_template *template, 809 struct cipher_speed_template *template,
810 unsigned int tcount, u8 *keysize) 810 unsigned int tcount, u8 *keysize)
811{ 811{
812 unsigned int ret, i, j, iv_len; 812 unsigned int ret, i, j, k, iv_len;
813 struct tcrypt_result tresult; 813 struct tcrypt_result tresult;
814 const char *key; 814 const char *key;
815 char iv[128]; 815 char iv[128];
@@ -883,11 +883,23 @@ static void test_acipher_speed(const char *algo, int enc, unsigned int sec,
883 } 883 }
884 884
885 sg_init_table(sg, TVMEMSIZE); 885 sg_init_table(sg, TVMEMSIZE);
886 sg_set_buf(sg, tvmem[0] + *keysize, 886
887 k = *keysize + *b_size;
888 if (k > PAGE_SIZE) {
889 sg_set_buf(sg, tvmem[0] + *keysize,
887 PAGE_SIZE - *keysize); 890 PAGE_SIZE - *keysize);
888 for (j = 1; j < TVMEMSIZE; j++) { 891 k -= PAGE_SIZE;
889 sg_set_buf(sg + j, tvmem[j], PAGE_SIZE); 892 j = 1;
890 memset(tvmem[j], 0xff, PAGE_SIZE); 893 while (k > PAGE_SIZE) {
894 sg_set_buf(sg + j, tvmem[j], PAGE_SIZE);
895 memset(tvmem[j], 0xff, PAGE_SIZE);
896 j++;
897 k -= PAGE_SIZE;
898 }
899 sg_set_buf(sg + j, tvmem[j], k);
900 memset(tvmem[j], 0xff, k);
901 } else {
902 sg_set_buf(sg, tvmem[0] + *keysize, *b_size);
891 } 903 }
892 904
893 iv_len = crypto_ablkcipher_ivsize(tfm); 905 iv_len = crypto_ablkcipher_ivsize(tfm);
@@ -1520,6 +1532,14 @@ static int do_test(int m)
1520 speed_template_16_24_32); 1532 speed_template_16_24_32);
1521 test_acipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0, 1533 test_acipher_speed("ctr(aes)", DECRYPT, sec, NULL, 0,
1522 speed_template_16_24_32); 1534 speed_template_16_24_32);
1535 test_acipher_speed("cfb(aes)", ENCRYPT, sec, NULL, 0,
1536 speed_template_16_24_32);
1537 test_acipher_speed("cfb(aes)", DECRYPT, sec, NULL, 0,
1538 speed_template_16_24_32);
1539 test_acipher_speed("ofb(aes)", ENCRYPT, sec, NULL, 0,
1540 speed_template_16_24_32);
1541 test_acipher_speed("ofb(aes)", DECRYPT, sec, NULL, 0,
1542 speed_template_16_24_32);
1523 break; 1543 break;
1524 1544
1525 case 501: 1545 case 501:
@@ -1535,6 +1555,18 @@ static int do_test(int m)
1535 test_acipher_speed("cbc(des3_ede)", DECRYPT, sec, 1555 test_acipher_speed("cbc(des3_ede)", DECRYPT, sec,
1536 des3_speed_template, DES3_SPEED_VECTORS, 1556 des3_speed_template, DES3_SPEED_VECTORS,
1537 speed_template_24); 1557 speed_template_24);
1558 test_acipher_speed("cfb(des3_ede)", ENCRYPT, sec,
1559 des3_speed_template, DES3_SPEED_VECTORS,
1560 speed_template_24);
1561 test_acipher_speed("cfb(des3_ede)", DECRYPT, sec,
1562 des3_speed_template, DES3_SPEED_VECTORS,
1563 speed_template_24);
1564 test_acipher_speed("ofb(des3_ede)", ENCRYPT, sec,
1565 des3_speed_template, DES3_SPEED_VECTORS,
1566 speed_template_24);
1567 test_acipher_speed("ofb(des3_ede)", DECRYPT, sec,
1568 des3_speed_template, DES3_SPEED_VECTORS,
1569 speed_template_24);
1538 break; 1570 break;
1539 1571
1540 case 502: 1572 case 502:
@@ -1546,6 +1578,14 @@ static int do_test(int m)
1546 speed_template_8); 1578 speed_template_8);
1547 test_acipher_speed("cbc(des)", DECRYPT, sec, NULL, 0, 1579 test_acipher_speed("cbc(des)", DECRYPT, sec, NULL, 0,
1548 speed_template_8); 1580 speed_template_8);
1581 test_acipher_speed("cfb(des)", ENCRYPT, sec, NULL, 0,
1582 speed_template_8);
1583 test_acipher_speed("cfb(des)", DECRYPT, sec, NULL, 0,
1584 speed_template_8);
1585 test_acipher_speed("ofb(des)", ENCRYPT, sec, NULL, 0,
1586 speed_template_8);
1587 test_acipher_speed("ofb(des)", DECRYPT, sec, NULL, 0,
1588 speed_template_8);
1549 break; 1589 break;
1550 1590
1551 case 503: 1591 case 503: