mirror of
https://github.com/openssl/openssl.git
synced 2026-05-07 20:12:39 +00:00
riscv: fix IS_IN_DEPEND_VECTOR range check
The macro checked (ZVX_MIN >= offset) which is equivalent to (offset <= ZVX_MIN), making it true for offsets 0-15 instead of the intended range [ZVX_MIN, ZVX_MAX] = [15, 23]. The practical effect in hwprobe_to_cap() was inverted: - Scalar extensions (ZBA..ZKT, offsets 0-14) were incorrectly treated as vector-dependent and suppressed when VECTOR_CAPABLE was false, preventing their detection via hwprobe. - Vector extensions ZVBC..ZVKSH (offsets 16-23) were not treated as vector-dependent, allowing them to be enabled via hwprobe even when the V extension was absent. Fix by changing >= to <= so the macro correctly tests whether offset falls in [ZVX_MIN, ZVX_MAX]. Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu> Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> MergeDate: Thu Apr 16 17:03:40 2026 (Merged from https://github.com/openssl/openssl/pull/30713)
This commit is contained in:
committed by
Tomas Mraz
parent
004e9255e4
commit
f34f715d03
@@ -27,7 +27,7 @@ extern unsigned int OPENSSL_riscv_hwcap_P;
|
||||
#define VECTOR_CAPABLE (OPENSSL_riscv_hwcap_P & COMPAT_HWCAP_ISA_V)
|
||||
#define ZVX_MIN 15
|
||||
#define ZVX_MAX 23
|
||||
#define IS_IN_DEPEND_VECTOR(offset) ((ZVX_MIN >= offset) && (offset <= ZVX_MAX))
|
||||
#define IS_IN_DEPEND_VECTOR(offset) ((ZVX_MIN <= offset) && (offset <= ZVX_MAX))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user