Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poly1305 Intel Assembly code - AVX and AVX2 #1079

Merged
merged 2 commits into from
Aug 9, 2017

Conversation

SparkiDev
Copy link
Contributor

No description provided.

@dgarske
Copy link
Contributor

dgarske commented Aug 3, 2017

Looks like a Poly1305 issue still:

./configure --enable-chacha --enable-poly1305 --enable-debug --enable-intelasm --disable-aesgcm && make
./wolfcrypt/test/testwolfcrypt
Chacha test passed!
POLY1305 test failed!
error = -3614

./wolfcrypt/benchmark/benchmark
wolfCrypt Benchmark (block bytes 1048576, min 1.0 sec each)
RNG 100 MB took 1.021 seconds, 97.984 MB/s Cycles per byte = 34.96
AES-Enc 845 MB took 1.000 seconds, 844.768 MB/s Cycles per byte = 4.05
AES-Dec 5855 MB took 1.000 seconds, 5854.789 MB/s Cycles per byte = 0.59
CHACHA 3215 MB took 1.001 seconds, 3211.548 MB/s Cycles per byte = 1.07

Program received signal SIGSEGV, Segmentation fault.
0x000000000043a271 in poly1305_blocks_avx2 (ctx=0x7fffffffdf50, m=0x7ffff73fd010 "\223\032\005\004K\311\033T\266\222\220U"(@߉\O\002\245\356\300\276jIc3\035\202\223\215\373c", bytes=1048576)
at wolfcrypt/src/poly1305.c:741
741 asm volatile (
(gdb) bt
#0 0x000000000043a271 in poly1305_blocks_avx2 (ctx=0x7fffffffdf50, m=0x7ffff73fd010 "\223\032\005\004K\311\033T\266\222\220U"(@߉\O\002\245\356\300\276jIc3\035\202\223\215\373c", bytes=1048576)
at wolfcrypt/src/poly1305.c:741
#1 0x000000000043cbb7 in wc_Poly1305Update (ctx=0x7fffffffdf50, m=0x7ffff73fd010 "\223\032\005\004K\311\033T\266\222\220U"(@߉\O\002\245\356\300\276jIc3\035\202\223\215\373c", bytes=1048576)
at wolfcrypt/src/poly1305.c:1602
#2 0x0000000000444a70 in calculateAuthTag (inAuthKey=0x7fffffffe210 "\021\231g-\027\224 \370\342W\vTtO\375s'", inAAD=0x0, inAADLen=0,
inCiphertext=0x7ffff73fd010 "\223\032\005\004K\311\033T\266\222\220U"(@߉\O\002\245\356\300\276jIc3\035\202\223\215\373c", inCiphertextLen=1048576, outAuthTag=0x7fffffffe270 "")
at wolfcrypt/src/chacha20_poly1305.c:218
#3 0x0000000000444790 in wc_ChaCha20Poly1305_Encrypt (
inKey=0x476930 <bench_key_buf> "\001#Eg\211\253\315\357\376\336\272\230vT2\020\211\253\315\357\001#Eg\001#Eg\211\253\315\357\022\064Vx\220\253\315\357\001\001\001\001\001\001\001\001\021!1AQaq\201MB",
inIV=0x476950 <bench_iv_buf> "\022\064Vx\220\253\315\357\001\001\001\001\001\001\001\001\021!1AQaq\201MB", inAAD=0x0, inAADLen=0,
inPlaintext=0x7ffff7ee8010 "\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217\364\001\217\036@\302V\024\064\314YA\005\342}\217", <incomplete sequence \364>..., inPlaintextLen=1048576, outCiphertext=0x7ffff73fd010 "\223\032\005\004K\311\033T\266\222\220U"(@߉\O\002\245\356\300\276jIc3\035\202\223\215\373c",
outAuthTag=0x7fffffffe270 "") at wolfcrypt/src/chacha20_poly1305.c:100
#4 0x0000000000402380 in bench_chacha20_poly1305_aead () at wolfcrypt/benchmark/benchmark.c:1667
#5 0x00000000004018ad in benchmarks_do (args=0x0) at wolfcrypt/benchmark/benchmark.c:721
#6 0x0000000000401b55 in benchmark_test (args=0x0) at wolfcrypt/benchmark/benchmark.c:1058
#7 0x0000000000405413 in main (argc=1, argv=0x7fffffffe418) at wolfcrypt/benchmark/benchmark.c:3811

dgarske added a commit to dgarske/wolfssl that referenced this pull request Aug 3, 2017
…e '__m256i'" on some compilers. Fix is to change the `__m128i` and `__m256i` to arrays of `word64` (source Sean PR wolfSSL#1079).
@SparkiDev
Copy link
Contributor Author

Fixed the issue!

@dgarske
Copy link
Contributor

dgarske commented Aug 3, 2017

Poly1305 now passes on CentOS / GCC 7.1 and Mac Clang using AVX/AVX2 speedups.

Copy link
Contributor

@toddouska toddouska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@toddouska toddouska merged commit d12e98e into wolfSSL:master Aug 9, 2017
@dgarske dgarske deleted the poly1305_asm branch August 9, 2017 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants