mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-08-10 14:41:21 +02:00
tests/api/test_wolfmath.c gains six DecisionCoverage test functions covering sp_int.c's mp_*/sp_* API: the allocation family (sp_init_size, sp_grow, sp_copy, sp_exch), the shift family (sp_set_bit, sp_2expt, sp_lshd, sp_rshb), the single-digit and multi-precision arithmetic families (sp_add_d/sp_sub_d/sp_mul_d/sp_div_d/sp_mod_d/sp_div_2/ sp_div_2_mod_ct/sp_add/sp_sub/sp_addmod_ct/sp_submod_ct/sp_div, including their WOLFSSL_SP_INT_NEGATIVE sign-path counterparts), the conversion family (sp_div_2d/sp_mod_2d/sp_mul_2d/sp_sqrmod/ sp_mont_red_ex/sp_to_unsigned_bin_len(_ct)/sp_tohex/sp_read_radix), and the sp_invmod/sp_exptmod_ex/sp_gcd/sp_prime_is_prime(_ex) top-level argument and degenerate-input checks. Each exercises an internal size/capacity guard or argument check via a deliberately undersized destination (sp_init_size with a small size) or an out-of-range argument - legitimate, public ways to reach decisions valid-sized RSA/ ECC/DH usage never trips. tests/unit-mcdc/test_sp_int_whitebox.c is a new white-box supplement (compiles sp_int.c in directly) closing the sp_count_bits/sp_cnt_lsb non-normalized-digit trim loops: no public caller can produce that state since every public mutator normalizes via sp_clamp before returning. Part of the ISO 26262 per-module MC/DC campaign's sp-math module (wolfcrypt/src/sp_int.c, Phase 1): 412/547 (75.32%) MC/DC across 6 build-variant axes (WOLFSSL_SP_MATH_ALL vs bare WOLFSSL_SP_MATH, WOLFSSL_SP_SMALL, WOLFSSL_SP_INT_NEGATIVE, WOLFSSL_SP_DIV_WORD_HALF, WOLFSSL_SMALL_STACK) + the white-box, up from a 318/547 baseline. The remaining gaps are deep invmod/exptmod/prime/gcd internal state-machine internals, the SP-accelerated-backend-entangled RSA/DH key-size dispatch, and other structural residuals; campaign-side files (config, module registry, baseline) live in the separate testing repo.
Before creating any new configure files (.conf) read the CONF_FILES_README.md