Add basic RISC-V cpuid and OPENSSL_riscvcap
authorHenry Brausen <henry.brausen@vrull.eu>
Fri, 28 Jan 2022 08:28:52 +0000 (01:28 -0700)
committerPauli <pauli@openssl.org>
Thu, 19 May 2022 06:32:49 +0000 (16:32 +1000)
commit360f6dcc5aa1a86ec3ff9a94612b88e3d960ee2e
tree1798a89c4abdce347ba05693df9731d023765f49
parentb3504b600c028a00f36cdbfedc928a48df9818ff
Add basic RISC-V cpuid and OPENSSL_riscvcap

RISC-V cpuid implementation allows bitmanip extensions Zb[abcs] to
be enabled at runtime using OPENSSL_riscvcap environment variable.

For example, to specify 64-bit RISC-V with the G,C,Zba,Zbb,Zbc
extensions, one could write: OPENSSL_riscvcap="rv64gc_zba_zbb_zbc"

Architecture string parsing is still very primitive, but can be
expanded in the future. Currently, only bitmanip extensions Zba, Zbb,
Zbc and Zbs are supported.

Includes implementation of constant-time CRYPTO_memcmp in riscv64 asm,
as well as OPENSSL_cleanse. Assembly implementations are written using
perlasm.

Reviewed-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Signed-off-by: Henry Brausen <henry.brausen@vrull.eu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17640)
crypto/build.info
crypto/riscv64cpuid.pl [new file with mode: 0644]
crypto/riscvcap.c [new file with mode: 0644]
doc/man7/openssl-env.pod
include/crypto/riscv_arch.def [new file with mode: 0644]
include/crypto/riscv_arch.h [new file with mode: 0644]