]> git.ipfire.org Git - thirdparty/openssl.git/commit
riscv: fix IS_IN_DEPEND_VECTOR range check
authorChristoph Müllner <christoph.muellner@vrull.eu>
Tue, 7 Apr 2026 19:28:47 +0000 (21:28 +0200)
committerTomas Mraz <tomas@openssl.foundation>
Thu, 16 Apr 2026 17:03:19 +0000 (19:03 +0200)
commitf34f715d03d52face2307dc2c4333c45cd59ef04
tree4847f4172a809751d12e18a654d0b43f75541633
parent004e9255e4e70454c9e9f46dad181d4c6a20c294
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)
include/crypto/riscv_arch.h