Skip to content

deps: enable OpenSSL asm support for riscv64#62606

Open
JamieMagee wants to merge 1 commit intonodejs:mainfrom
JamieMagee:riscv64-openssl-asm
Open

deps: enable OpenSSL asm support for riscv64#62606
JamieMagee wants to merge 1 commit intonodejs:mainfrom
JamieMagee:riscv64-openssl-asm

Conversation

@JamieMagee
Copy link
Copy Markdown

When riscv64 was added to the OpenSSL config in 2021 (#40063), OpenSSL had no RISC-V assembly at all, so it went into NO_ASM_ARCHS. OpenSSL 3.5.x now has perlasm generators for AES, SHA-256/512, GHASH/GCM, ChaCha, SM3, SM4, and CPUID. All with runtime extension detection via riscvcap.c and the Linux hwprobe syscall, so there's no risk on hardware without the crypto extensions.

This moves linux64-riscv64 from NO_ASM_ARCHS to ASM_ARCHS in deps/openssl/config/Makefile, regenerates the config (adding asm/ and asm_avx2/ variants with 16 generated assembly files each), and adds riscv64 entries to the six gypi selector files.

Generated with nix shell nixpkgs#nasm -c make linux64-riscv64 in deps/openssl/config/.

Refs: nodejs/build#4099

Move linux64-riscv64 from NO_ASM_ARCHS to ASM_ARCHS in the OpenSSL
config Makefile and regenerate the configuration. This adds asm/ and
asm_avx2/ config variants alongside the existing no-asm/ variant.

When riscv64 was first added to the OpenSSL config in 2021 (nodejs#40063),
OpenSSL had no RISC-V assembly support. OpenSSL 3.5.x now ships 17
perlasm generators covering AES (zvkned, zvkb, zkn), SHA-256/512
(zvknha, zvknhb), GHASH/GCM (zvkg, zvbc), ChaCha (v, zbb), SM3
(zvksh), SM4 (zvksed), and CPUID detection. Runtime capability
detection via riscvcap.c and the Linux hwprobe syscall ensures safe
fallback to generic C code on hardware without these extensions.

Also add riscv64 entries to the six asm gypi selector files:
openssl_asm.gypi, openssl_asm_avx2.gypi, openssl-cl_asm.gypi,
openssl-cl_asm_avx2.gypi, openssl-fips_asm.gypi, and
openssl-fips_asm_avx2.gypi.

Refs: nodejs/build#4099
Signed-off-by: Jamie Magee <jamie.magee@gmail.com>
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run. openssl Issues and PRs related to the OpenSSL dependency. labels Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file. needs-ci PRs that need a full CI run. openssl Issues and PRs related to the OpenSSL dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants