aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/tcrypt.c
diff options
context:
space:
mode:
authorJohannes Goetzfried <Johannes.Goetzfried@informatik.stud.uni-erlangen.de>2012-05-28 09:54:24 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-06-12 04:46:07 -0400
commit107778b592576c0c8e8d2ca7a2aa5415a4908223 (patch)
tree0e07f6abd2acaf69bf25efacf520584d748c860b /crypto/tcrypt.c
parent4d03c5047a07a62563e1a8fa798ea258f048bfde (diff)
crypto: twofish - add x86_64/avx assembler implementation
This patch adds a x86_64/avx assembler implementation of the Twofish block cipher. The implementation processes eight blocks in parallel (two 4 block chunk AVX operations). The table-lookups are done in general-purpose registers. For small blocksizes the 3way-parallel functions from the twofish-x86_64-3way module are called. A good performance increase is provided for blocksizes greater or equal to 128B. Patch has been tested with tcrypt and automated filesystem tests. Tcrypt benchmark results: Intel Core i5-2500 CPU (fam:6, model:42, step:7) twofish-avx-x86_64 vs. twofish-x86_64-3way 128bit key: (lrw:256bit) (xts:256bit) size ecb-enc ecb-dec cbc-enc cbc-dec ctr-enc ctr-dec lrw-enc lrw-dec xts-enc xts-dec 16B 0.96x 0.97x 1.00x 0.95x 0.97x 0.97x 0.96x 0.95x 0.95x 0.98x 64B 0.99x 0.99x 1.00x 0.99x 0.98x 0.98x 0.99x 0.98x 0.99x 0.98x 256B 1.20x 1.21x 1.00x 1.19x 1.15x 1.14x 1.19x 1.20x 1.18x 1.19x 1024B 1.29x 1.30x 1.00x 1.28x 1.23x 1.24x 1.26x 1.28x 1.26x 1.27x 8192B 1.31x 1.32x 1.00x 1.31x 1.25x 1.25x 1.28x 1.29x 1.28x 1.30x 256bit key: (lrw:384bit) (xts:512bit) size ecb-enc ecb-dec cbc-enc cbc-dec ctr-enc ctr-dec lrw-enc lrw-dec xts-enc xts-dec 16B 0.96x 0.96x 1.00x 0.96x 0.97x 0.98x 0.95x 0.95x 0.95x 0.96x 64B 1.00x 0.99x 1.00x 0.98x 0.98x 1.01x 0.98x 0.98x 0.98x 0.98x 256B 1.20x 1.21x 1.00x 1.21x 1.15x 1.15x 1.19x 1.20x 1.18x 1.19x 1024B 1.29x 1.30x 1.00x 1.28x 1.23x 1.23x 1.26x 1.27x 1.26x 1.27x 8192B 1.31x 1.33x 1.00x 1.31x 1.26x 1.26x 1.29x 1.29x 1.28x 1.30x twofish-avx-x86_64 vs aes-asm (8kB block): 128bit 256bit ecb-enc 1.19x 1.63x ecb-dec 1.18x 1.62x cbc-enc 0.75x 1.03x cbc-dec 1.23x 1.67x ctr-enc 1.24x 1.65x ctr-dec 1.24x 1.65x lrw-enc 1.15x 1.53x lrw-dec 1.14x 1.52x xts-enc 1.16x 1.56x xts-dec 1.16x 1.56x Signed-off-by: Johannes Goetzfried <Johannes.Goetzfried@informatik.stud.uni-erlangen.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r--crypto/tcrypt.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 750cce44bad6..2af879786e75 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -1566,6 +1566,29 @@ static int do_test(int m)
1566 speed_template_32_64); 1566 speed_template_32_64);
1567 break; 1567 break;
1568 1568
1569 case 504:
1570 test_acipher_speed("ecb(twofish)", ENCRYPT, sec, NULL, 0,
1571 speed_template_16_24_32);
1572 test_acipher_speed("ecb(twofish)", DECRYPT, sec, NULL, 0,
1573 speed_template_16_24_32);
1574 test_acipher_speed("cbc(twofish)", ENCRYPT, sec, NULL, 0,
1575 speed_template_16_24_32);
1576 test_acipher_speed("cbc(twofish)", DECRYPT, sec, NULL, 0,
1577 speed_template_16_24_32);
1578 test_acipher_speed("ctr(twofish)", ENCRYPT, sec, NULL, 0,
1579 speed_template_16_24_32);
1580 test_acipher_speed("ctr(twofish)", DECRYPT, sec, NULL, 0,
1581 speed_template_16_24_32);
1582 test_acipher_speed("lrw(twofish)", ENCRYPT, sec, NULL, 0,
1583 speed_template_32_40_48);
1584 test_acipher_speed("lrw(twofish)", DECRYPT, sec, NULL, 0,
1585 speed_template_32_40_48);
1586 test_acipher_speed("xts(twofish)", ENCRYPT, sec, NULL, 0,
1587 speed_template_32_48_64);
1588 test_acipher_speed("xts(twofish)", DECRYPT, sec, NULL, 0,
1589 speed_template_32_48_64);
1590 break;
1591
1569 case 1000: 1592 case 1000:
1570 test_available(); 1593 test_available();
1571 break; 1594 break;