Files
wolfssl/wolfcrypt
Daniele Lacamera 964cc72c38 mldsa: remove tautological ret operand in wc_MlDsaKey_CheckKey
Premise:  wc_mldsa.c:11544 `if (ret == 0) {` opens the block containing the
          claimed condition.
Claim:    wc_mldsa.c:11589 `if ((ret == 0) && (x != 0))` -- the `ret == 0`
          operand.
Proof:    :11544 dominates :11589 and nothing in between assigns ret: the block
          decodes, NTTs, matrix-multiplies and XOR-accumulates into x through
          mldsa_vec_decode_*, mldsa_vec_ntt_small_full, mldsa_matrix_mul,
          mldsa_vec_red, mldsa_vec_invntt_full, mldsa_vec_add/sub/make_pos --
          all void-returning. A grep of the span for `ret` finds only the two
          conditions themselves. The operand is invariantly true and its
          independence pair is unreachable.
Scope:    the only preprocessor construct in the span is WOLFSSL_MLDSA_SMALL at
          :11566, which adds another void call.
Evidence: llvm-cov MC/DC records this condition as never false
          (reports/mldsa/GAPS.md row 11479:13:11479:35:0, pre-drift numbering).

The nearby `ret == 0` guards at :11485 and :11488 stay: prvKeySet / pubKeySet
are user-controlled and those decisions are live.

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
..