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

Aarch64 ASM: check CPU features before hw crypto instr use #8314

Merged

Conversation

SparkiDev
Copy link
Contributor

Description

For SHA-256, SHA-512 and SHA3, get the CPU features to see if hardware crypto is available. If not then fallback to an alternate implementation.

Testing

Regression tested Aarch64 and ARM32 assembly code.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

For SHA-256, SHA-512 and SHA3, get the CPU features to see if hardware
crypto is available. If not then fallback to an alternate
implementation.
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

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

This is great work! Getting much closer. This gets past the SHA2/SHA3 now. We could merge this change as-is.

It's the AES GCM failing next.

Program received signal SIGILL, Illegal instruction.
0x0000005555638b6c in GMULT_AARCH64 (X=0x7ffffff250 "\376\355\372\316ޭ\276\357\376\355\372\316ޭ\276", <incomplete sequence \357>,
    Y=0x7fffffef70 "\254\276\362\005y\264\270\353Έ\233\254\207\062\332", <incomplete sequence \327>) at wolfcrypt/src/port/arm/armv8-aes.c:1513
1513	    __asm__ volatile (
(gdb) bt
#0  0x0000005555638b6c in GMULT_AARCH64 (X=0x7ffffff250 "\376\355\372\316ޭ\276\357\376\355\372\316ޭ\276", <incomplete sequence \357>,
    Y=0x7fffffef70 "\254\276\362\005y\264\270\353Έ\233\254\207\062\332", <incomplete sequence \327>) at wolfcrypt/src/port/arm/armv8-aes.c:1513
#1  0x000000555562f96c in GHASH_UPDATE (aes=0x7fffffee40, a=0x7fffffe998 "\376\355\372\316ޭ\276\357\376\355\372\316ޭ\276\357\253\255\332", <incomplete sequence \322>, aSz=20,
    c=0x7fffffe758 "R-\301\360\231V}\a\364\177\067\243*\204B}d:\214ܿ\345\300\311u\230\242\275%UѪ\214\260\216HY\r\273=\247\260\213\020V\202\210\070\305\366\036c\223\272z\n\274\311\366b", cSz=60)
    at wolfcrypt/src/aes.c:8063
#2  0x00000055556310b4 in wc_AesGcmEncryptUpdate (aes=0x7fffffee40,
    out=0x7fffffe758 "R-\301\360\231V}\a\364\177\067\243*\204B}d:\214ܿ\345\300\311u\230\242\275%UѪ\214\260\216HY\r\273=\247\260\213\020V\202\210\070\305\366\036c\223\272z\n\274\311\366b",
    in=0x7fffffe9b0 "\331\061\062%\370\204\006\345\245Y\tů\365&\232\206\247\251S\025\064\367\332.L0=\212\061\212r\034<\f\225\225h\tS/\317\016$I\246\265%\261j\355\365\252\r\346W\272c{9", sz=60,
    authIn=0x7fffffe998 "\376\355\372\316ޭ\276\357\376\355\372\316ޭ\276\357\253\255\332", <incomplete sequence \322>, authInSz=20) at wolfcrypt/src/aes.c:10343
#3  0x0000005555577274 in aesgcm_test () at wolfcrypt/test/test.c:15581
#4  0x000000555555d560 in wolfcrypt_test (args=0x7ffffff340) at wolfcrypt/test/test.c:2016
#5  0x000000555555e1a4 in wolfcrypt_test_main (argc=1, argv=0x7ffffff4c8) at wolfcrypt/test/test.c:2609
#6  0x000000555555e0d4 in main (argc=1, argv=0x7ffffff4c8) at wolfcrypt/test/test.c:2517
(gdb)

@dgarske dgarske removed their assignment Dec 24, 2024
@JacobBarthelmeh JacobBarthelmeh merged commit 838fe22 into wolfSSL:master Dec 24, 2024
149 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants