-
Notifications
You must be signed in to change notification settings - Fork 832
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
Kyber Aarch64: assembly implementations of functions #7998
Conversation
436df89
to
b829134
Compare
configure.ac
Outdated
@@ -2977,7 +2977,7 @@ then | |||
AM_CPPFLAGS="$AM_CPPFLAGS+sm4" | |||
fi | |||
else | |||
AM_CPPFLAGS="$AM_CPPFLAGS -mcpu=generic+crypto" | |||
AM_CPPFLAGS="$AM_CPPFLAGS -march=armv8.1-a+crypto" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Customers target is not v8.1. Needs to be v8.0 -march=armv8-a+crypto
, however that does not allow sqrdmlsh
. Is there a way to not use sqrdmlsh
?
CC wolfcrypt/src/src_libwolfssl_la-dilithium.lo
wolfcrypt/src/port/arm/armv8-kyber-asm.S: Assembler messages:
wolfcrypt/src/port/arm/armv8-kyber-asm.S:266: Error: selected processor does not support `sqrdmlsh v21.8h,v29.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:267: Error: selected processor does not support `sqrdmlsh v22.8h,v30.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:274: Error: selected processor does not support `sqrdmlsh v23.8h,v29.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:275: Error: selected processor does not support `sqrdmlsh v24.8h,v30.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:282: Error: selected processor does not support `sqrdmlsh v25.8h,v29.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:283: Error: selected processor does not support `sqrdmlsh v26.8h,v30.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:290: Error: selected processor does not support `sqrdmlsh v27.8h,v29.8h,v4.h[0]'
wolfcrypt/src/port/arm/armv8-kyber-asm.S:291: Error: selected processor does not support `sqrdmlsh v28.8h,v30.8h,v4.h[0]'
FYI: When I run on ZCU102 A53 I get:
./configure --host=aarch64 CC="aarch64-linux-gnu-gcc" AR="aarch64-linux-gnu-ar" RANLIB="aarch64-linux-gnu-ranlib" --enable-sp=yes,asm --enable-keygen --enable-armasm --enable-experimental --enable-kyber --enable-dilithium --enable-keygen --enable-lms --enable-xmss --enable-curve25519 --enable-ed25519 --enable-curve448 --enable-ed448 --disable-shared --enable-static --disable-dh --disable-filesystem && make
./benchmark -kyber
------------------------------------------------------------------------------
wolfSSL version 5.7.2
------------------------------------------------------------------------------
Math: Multi-Precision: Wolf(SP) word-size=64 bits=4096 sp_int.c
Single Precision: ecc 256 384 521 rsa 2048 3072 4096 asm sp_arm64.c
wolfCrypt Benchmark (block bytes 1048576, min 1.0 sec each)
Illegal instruction
CURVE448 test passed!
ED448 test passed!
Illegal instruction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the code to not use instruction when WOLFSSL_AARCH64_NO_SQRMLSH is defined.
Using the instruction is quicker so I want it used by default.
Aarch64 assembly implementation of Kyber functions. SHA-3 assembly implementations when not hardware crypto.
b829134
to
de65778
Compare
Tested on Xilinx UltraScale+ ZCU102: Master:
PR 7998:
Cross compiled using: |
Description
Aarch64 assembly implementation of Kyber functions.
SHA-3 assembly implementations when not hardware crypto.
Testing
Tested on M1 Mac.
Inline assembly tested as well.
Checklist