• src/ssh/kex/curve25519-sh

    From Deuc¿@VERT to Git commit to main/sbbs/m on Tuesday, March 24, 2026 20:58:00
    https://gitlab.synchro.net/main/sbbs/-/commit/a8e8e3d732e1fc2bebf884fb
    Modified Files:
    src/ssh/kex/curve25519-sha256.c dh-gex-sha256.c src/ssh/key_algo/rsa-sha2-256.c src/ssh/ssh-auth.c ssh-trans.c src/ssh/test/test_alloc.c
    Log Message:
    Break sequential allocation chains into per-call checks

    Sequential OpenSSL/allocation calls that all executed regardless of
    which one failed produced identical call counts for consecutive N
    values, triggering false plateau detection in iterate tests. The ossl/kex_server test was exiting after only 3 failure points instead
    of exercising all ~37.

    Break all grouped allocation chains into per-call checks with early
    return on failure:
    - dh-gex: BN_bin2bn(p)+BN_bin2bn(g), BN_CTX_new+3¨BN_new (client+server)
    - curve25519: EVP_PKEY_new_raw_public_key+EVP_PKEY_CTX_new
    - rsa pubkey: malloc(e_buf)+malloc(n_buf)
    - ssh-trans newkeys: 6-alloc key derivation chain
    - ssh-trans init: 4-alloc packet buffer chain
    - ssh-auth KBI: 5-alloc prompt array chain

    Also fix alloc/session_init test where break-after-success fell
    through to error path (masked by the false plateau).

    DH-GEX branch coverage: 57.81%  78.52% (-53 missed branches).
    Overall: 509  449 missed branches (79.79%  82.17%).

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Tuesday, March 24, 2026 20:58:00
    https://gitlab.synchro.net/main/sbbs/-/commit/05740b1cb14b43063d503764
    Modified Files:
    src/ssh/kex/curve25519-sha256.c src/ssh/test/dssh_test_internal.h test_alloc.c test_transport.c
    Log Message:
    curve25519-sha256.c coverage: 80%  97% (40  5 missed branches)

    Source cleanup:
    - Fold int ok = EVP_DigestInit_ex(...) to eliminate dead ok && branch
    - Guard dead dssh_parse_uint32 < 4 checks in Q_S and sig parse chains
    with #ifndef DSSH_TESTING (same pattern as dh-gex and ssh-arch.c)
    - Make compute_exchange_hash_c25519, x25519_exchange, and
    encode_shared_secret DSSH_TESTABLE for direct unit testing

    ossl/kex_client and alloc/kex_client iterate tests now run for ALL
    KEX types (removed dhgex-only skip), covering curve25519 client-side
    ossl and alloc failure paths.

    Curve25519 server targeted tests (6 tests):
    - ka NULL / NULL pubkey / NULL sign function pointers
    - recv failure (no packets)
    - wrong msg_type for ECDH_INIT
    - bad Q_C length (16 instead of 32)

    Curve25519 helper tests (3 tests):
    - encode_shared_secret with leading-zero raw bytes
    - x25519_exchange alloc failure
    - encode_shared_secret alloc failure (both malloc sites)

    Curve25519 client parse tests (7 tests via bad-server thread):
    - recv ECDH_REPLY failure
    - truncated K_S (too short / length overrun)
    - truncated Q_S (too short)
    - bad Q_S length (16 instead of 32)
    - truncated sig (too short / length overrun)

    5 remaining branches: 2 need targeted truncated-data tests,
    3 are server alloc failures likely covered by iterate (profiling noise).

    Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Wednesday, March 25, 2026 23:06:00
    https://gitlab.synchro.net/main/sbbs/-/commit/c4f45ec61d6977c200170917
    Modified Files:
    src/ssh/kex/curve25519-sha256.c dh-gex-sha256.c src/ssh/key_algo/rsa-sha2-256.c src/ssh/ssh-auth.c ssh-chan.c ssh-conn.c ssh-trans.c
    Log Message:
    Guard all arithmetic against overflow and underflow

    Every size computation before malloc is now checked against
    SIZE_MAX to prevent wrapping on platforms with small size_t.
    Cumulative counters (bytes_since_rekey, bytebuf total, msgqueue total_bytes/count) use saturating adds. Channel capacity
    doubling checks SIZE_MAX/2 and SIZE_MAX/sizeof(*).

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deuc¿@VERT to Git commit to main/sbbs/m on Wednesday, March 25, 2026 23:06:00
    https://gitlab.synchro.net/main/sbbs/-/commit/ae4a4c90d0e7cdd7a860cb40
    Modified Files:
    src/ssh/kex/curve25519-sha256.c dh-gex-sha256.c src/ssh/key_algo/rsa-sha2-256.c ssh-ed25519.c src/ssh/ssh-arch.c ssh-auth.c ssh-conn.c ssh-trans.c
    Log Message:
    Check return value of every dssh_serialize/parse call

    Every call to dssh_serialize_uint32, dssh_parse_uint32, and other serialize/parse functions now has its return value checked. Functions
    use a single ret/pv variable declared at function scope, reused for
    each call. Local SER/HASH_U32 macros reduce boilerplate in
    serialization-heavy functions.

    serialize_namelist_from_str changed from void to int.
    Removed #ifndef DSSH_TESTING guards around parse checks in KEX
    modules Ä return values are always checked regardless of build mode.

    Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net