openssl/openssl

Riscv extension detection is broken on musl

Aperta

#28.118 aperta il 29 lug 2025

 (4 commenti) (0 reazioni) (0 assegnatari)C (11.262 fork)batch import
help wantedtriaged: bug

Metriche repository

Star
 (30.157 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I noticed that on my OrangePi RV2, openssl speed -evp chacha20 is notably faster on glibc than on musl. I have determined that this is because the runtime check RISCV_HAS_ZBB() is erroneously returning false when compiled against musl. If I introduce an error in the riscv asm code, the test still passes. If I comment out the ZBB check on this line the test fails as expected.

I don't understand enough of what include/crypto/riscv_arch.h is doing to debug this further.

Also a related FR: can RISCV_HAS_* first do a compile time check for presence of the extension?

Guida contributor