Skip to content

Guard the AArch64 Poly1305 and RISC-V AES assembly with their feature macros - #12174

Open
dgarske wants to merge 3 commits into
wolfSSL:masterfrom
dgarske:poly1305_guard
Open

dgarske wants to merge 3 commits into
wolfSSL:masterfrom
dgarske:poly1305_guard

Conversation

@dgarske

@dgarske dgarske commented Nov 18, 2026

Copy link
Copy Markdown
Member

Description

Two generated assembly ports were missing their algorithm guard. Autotools leaves these files out when the algorithm is disabled, but a user_settings.h or IDE build that compiles every file in the port directory did not.

  • armv8-poly1305-asm_c.c, armv8-poly1305-asm.S and armv8-poly1305-asm.asm are now wrapped in HAVE_POLY1305. Without Poly1305 they failed to compile with unknown type name 'Poly1305'. The 32-bit Arm, Thumb-2 and AArch64 ChaCha files already had the guard.
  • riscv-64-aes-asm.S and riscv-64-aes-asm_c.c are now wrapped in !NO_AES, so AES_set_key_RISCV64 is no longer built with AES disabled. This matches the AArch64 and PPC64 AES files.

Regenerated from wolfSSL/scripts PR #.

Testing

Not tested on hardware. Every generated file under wolfcrypt/src was compiled on its own with its architecture selectors set and all algorithms disabled; each now compiles to an empty object. AArch64 cross builds with --enable-armasm and --enable-armasm=inline, with and without Poly1305/ChaCha, pass testwolfcrypt under qemu-aarch64. The RISC-V AES base, scalar-crypto and vector-crypto paths build the same functions as before with AES enabled.

@dgarske dgarske self-assigned this Nov 18, 2026
Copilot AI balanced review requested due to automatic review settings November 18, 2026 15:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Windows ARM64 builds with assembly and Poly1305 enabled omit required Poly1305 symbols because both Visual Studio projects lack the HAVE_POLY1305 assembler definition, causing linker failures.

1 open issue
What changed in this PR

Adds algorithm guards to generated wolfCrypt assembly ports so builds that compile entire port directories can disable Poly1305 or AES without compiling their implementations.

Changes:

  • Wraps AArch64 Poly1305 assembly and inline-C variants in HAVE_POLY1305.
  • Wraps RISC-V AES assembly and inline-C variants in !NO_AES.
File Description
wolfcrypt/​src/​port/​riscv64/​riscv-64-aes-asm.S Guards standalone AES assembly with !NO_AES.
wolfcrypt/​src/​port/​riscv64/​riscv-64-aes-asm_c.c Guards inline AES assembly with !NO_AES.
wolfcrypt/​src/​port/​arm/​armv8-poly1305-asm.S Guards standalone Poly1305 assembly with HAVE_POLY1305.
wolfcrypt/​src/​port/​arm/​armv8-poly1305-asm.asm Adds the Poly1305 guard using ARM assembler syntax.
wolfcrypt/​src/​port/​arm/​armv8-poly1305-asm_c.c Guards inline Poly1305 assembly with HAVE_POLY1305.

Review effort: Balanced

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m0plus

  • FLASH: .text +268 B (+0.4%, 72,120 B / 262,144 B, total: 28% used)

gcc-arm-cortex-m3

  • FLASH: .text +808 B (+0.6%, 133,686 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4

  • FLASH: .text +768 B (+0.4%, 210,989 B / 262,144 B, total: 80% used)

gcc-arm-cortex-m4-baremetal

  • FLASH: .text +256 B (+0.3%, 74,932 B / 262,144 B, total: 29% used)

gcc-arm-cortex-m4-crypto-only

  • FLASH: .text +320 B (+0.2%, 183,824 B / 262,144 B, total: 70% used)

gcc-arm-cortex-m4-dtls13

  • FLASH: .rodata +4 B, .text +832 B (+0.4%, 198,756 B / 1,048,576 B, total: 19% used)

gcc-arm-cortex-m4-min-ecc

  • FLASH: .text +256 B (+0.4%, 69,398 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .rodata +8 B, .text +1,792 B (+0.2%, 808,204 B / 1,048,576 B, total: 77% used)

gcc-arm-cortex-m4-pkcs7

  • FLASH: .text +320 B (+0.1%, 225,041 B / 262,144 B, total: 86% used)

gcc-arm-cortex-m4-pq

  • FLASH: .text +832 B (+0.3%, 316,912 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m4-rsa-only

  • FLASH: .text +1,152 B (+0.3%, 347,432 B / 1,048,576 B, total: 33% used)

gcc-arm-cortex-m4-sp-math

  • FLASH: .text +256 B (+0.4%, 69,398 B / 262,144 B, total: 26% used)

gcc-arm-cortex-m4-tls12

  • FLASH: .text +768 B (+0.6%, 134,414 B / 262,144 B, total: 51% used)

gcc-arm-cortex-m4-tls13

  • FLASH: .text +832 B (+0.3%, 253,639 B / 262,144 B, total: 97% used)

gcc-arm-cortex-m7

  • FLASH: .text +832 B (+0.4%, 211,053 B / 262,144 B, total: 81% used)

gcc-arm-cortex-m7-pq

  • FLASH: .text +832 B (+0.3%, 317,744 B / 1,048,576 B, total: 30% used)

gcc-arm-cortex-m7-tls13

  • FLASH: .text +832 B (+0.3%, 253,639 B / 262,144 B, total: 97% used)

stm32-sim-stm32h753

  • FLASH: .text +392 B (+0.2%, 209,580 B / 2,097,152 B, total: 10% used)

zephyr-frdm_rw612

  • FLASH: rodata +4 B, text +304 B (+0.1%, 296,076 B / 67,108,864 B, total: 0% used)

Catch memory regressions in CI with MemBrowse. Free for open source.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues block the algorithm-guard and Visual Studio configuration changes.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@dgarske dgarske assigned wolfSSL-Bot and SparkiDev and unassigned dgarske Nov 19, 2026
@dgarske
dgarske requested a review from SparkiDev November 19, 2026 02:14
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.

4 participants