Files
wolfssl/wolfcrypt
Daniele Lacamera d1ced3d134 mldsa: remove tautological loop operand in mldsa_vec_check_low_c
Premise:  `int ret = 1;` at wc_mldsa.c:5062, and mldsa_check_low (:5028-5046)
          returns only 0 or 1.
Claim:    wc_mldsa.c:5066 `for (i = 0; (ret == 1) && (i < l); i++)` -- the
          `ret == 1` operand.
Proof:    first evaluation: ret is its initialiser 1.
          Re-evaluations: the body's only write is `ret = mldsa_check_low(...)`,
          immediately followed by `if (ret == 0) { break; }` -- so the loop
          condition is re-evaluated only on paths where ret is not 0, and
          mldsa_check_low returns nothing but 0 or 1. Hence ret == 1 whenever
          the operand is evaluated; its false half is unreachable and the
          `break` alone terminates the loop.
Scope:    the function is compiled under
          !WOLFSSL_MLDSA_NO_VERIFY || (!WOLFSSL_MLDSA_NO_SIGN &&
          !WOLFSSL_MLDSA_SIGN_SMALL_MEM); there is no #if inside it. The AVX2
          alternative at :5089 is a separate function and is untouched.
Evidence: llvm-cov MC/DC records this condition as never false
          (reports/mldsa/GAPS.md row 5048:17:5048:38:0, pre-drift numbering).

The guard is dropped rather than the `break`: keeping both would leave the same
dead operand.

Compiler cross-check: gcc -O2 emits byte-identical code for this file before
and after this commit -- the optimiser had already folded the removed
condition, independently confirming it was dead.
2026-08-03 12:23:09 +02:00
..