-
Notifications
You must be signed in to change notification settings - Fork 833
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
Aarch64: make code compile when no hardware crypto avail #8277
Conversation
ada3af9
to
7c9b38d
Compare
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.
Tested on Rpi4 that does not support aes/sha instructions.
./configure --enable-armasm && make
$ ./wolfcrypt/test/testwolfcrypt
Math: Multi-Precision: Wolf(SP) word-size=64 bits=4096 sp_int.c
------------------------------------------------------------------------------
wolfSSL version 5.7.4
------------------------------------------------------------------------------
error test passed!
MEMORY test passed!
base64 test passed!
asn test passed!
Illegal instruction
./configure --enable-armasm CFLAGS="-DWOLFSSL_ARMASM_NO_HW_CRYPTO" && make
CCLD src/libwolfssl.la
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesSetIV':
armv8-aes.c:(.text+0x100): multiple definition of `wc_AesSetIV'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x1620): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesSetKey':
armv8-aes.c:(.text+0x148): multiple definition of `wc_AesSetKey'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x1668): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesCbcEncrypt':
armv8-aes.c:(.text+0x230): multiple definition of `wc_AesCbcEncrypt'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x1e18): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesCbcDecrypt':
armv8-aes.c:(.text+0x2a8): multiple definition of `wc_AesCbcDecrypt'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x1f78): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `GenerateM0':
armv8-aes.c:(.text+0x320): multiple definition of `GenerateM0'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x2f70): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesGcmSetKey':
armv8-aes.c:(.text+0xb60): multiple definition of `wc_AesGcmSetKey'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x37b0): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesGcmEncrypt':
armv8-aes.c:(.text+0xbf8): multiple definition of `wc_AesGcmEncrypt'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x3878): first defined here
/usr/bin/ld: wolfcrypt/src/port/arm/.libs/src_libwolfssl_la-armv8-aes.o: in function `wc_AesGcmDecrypt':
armv8-aes.c:(.text+0xf60): multiple definition of `wc_AesGcmDecrypt'; wolfcrypt/src/.libs/src_libwolfssl_la-aes.o:aes.c:(.text+0x3c28): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:6383: src/libwolfssl.la] Error 1
Need to specify WOLFSSL_ARMASM_NO_HW_CRYPTO to force compilation without use of hardware crypto instructions. |
The second test uses |
df4712f
to
92c74e5
Compare
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.
This works wonderfully now! Anyway to get WOLFSSL_ARMASM_NO_HW_CRYPTO
as a configure option??
Detects availability of instructions for Aarch64.
92c74e5
to
24bb2b7
Compare
Added support for --enable-armasm=no-crypto |
Description
Detects availability of instructions for Aarch64.
Testing
With and without WOLFSSL_ARMASM_NO_HW_CRYPTO
Checklist