" env:%s", env);
# elif defined(__riscv)
const char *env;
- char sep = '=';
+ size_t i;
BIO_snprintf(ossl_cpu_info_str, sizeof(ossl_cpu_info_str),
- CPUINFO_PREFIX "OPENSSL_riscvcap");
- for (size_t i = 0; i < kRISCVNumCaps; ++i) {
+ CPUINFO_PREFIX "OPENSSL_riscvcap=RV"
+# if __riscv_xlen == 32
+ "32"
+# elif __riscv_xlen == 64
+ "64"
+# elif __riscv_xlen == 128
+ "128"
+# endif
+# if defined(__riscv_i) && defined(__riscv_m) && defined(__riscv_a) \
+ && defined(__riscv_f) && defined(__riscv_d) \
+ && defined(__riscv_zicsr) && defined(__riscv_zifencei)
+ "G" /* shorthand for IMAFD_Zicsr_Zifencei */
+# else
+# ifdef __riscv_i
+ "I"
+# endif
+# ifdef __riscv_m
+ "M"
+# endif
+# ifdef __riscv_a
+ "A"
+# endif
+# ifdef __riscv_f
+ "F"
+# endif
+# ifdef __riscv_d
+ "D"
+# endif
+# endif
+# ifdef __riscv_c
+ "C"
+# endif
+ );
+ for (i = 0; i < kRISCVNumCaps; i++) {
if (OPENSSL_riscvcap_P[RISCV_capabilities[i].index]
- & (1 << RISCV_capabilities[i].bit_offset)) {
+ & (1 << RISCV_capabilities[i].bit_offset))
/* Match, display the name */
BIO_snprintf(ossl_cpu_info_str + strlen(ossl_cpu_info_str),
sizeof(ossl_cpu_info_str) - strlen(ossl_cpu_info_str),
- "%c%s", sep, RISCV_capabilities[i].name);
- /* Only the first sep is '=' */
- sep = '_';
- }
+ "_%s", RISCV_capabilities[i].name);
}
- /* If no capability is found, add back the = */
- if (sep == '=') {
+ if (RISCV_HAS_V())
BIO_snprintf(ossl_cpu_info_str + strlen(ossl_cpu_info_str),
sizeof(ossl_cpu_info_str) - strlen(ossl_cpu_info_str),
- "%c", sep);
- }
+ " vlen:%lu", riscv_vlen());
if ((env = getenv("OPENSSL_riscvcap")) != NULL)
BIO_snprintf(ossl_cpu_info_str + strlen(ossl_cpu_info_str),
sizeof(ossl_cpu_info_str) - strlen(ossl_cpu_info_str),
Check currently detected capabilities
$ openssl info -cpusettings
- OPENSSL_riscvcap=ZBA_ZBB_ZBC_ZBS_V
+ OPENSSL_riscvcap=RV64GC_ZBA_ZBB_ZBC_ZBS_V vlen:256
+
+Note: The first word in the displayed capabilities is the RISC-V base
+architecture value, which is derived from the compiler configuration.
+It is therefore not overridable by the environment variable.
+When the V extension is given the riscv_vlen value is always displayed,
+there is no way to override the riscv_vlen by the environment variable.
Disables all instruction set extensions:
- OPENSSL_riscvcap="rv64gc"
+ export OPENSSL_riscvcap="rv64gc"
Only enable the vector extension:
- OPENSSL_riscvcap="rv64gc_v"
+ export OPENSSL_riscvcap="rv64gc_v"
=head1 COPYRIGHT