• cryptlib patch: CRYPT_TLSOPTION_USED_PSK (0x200) collides with CRYPT_T

    From Rob Swindell@VERT to GitLab issue in main/sbbs on Fri Jul 31 01:14:59 2026
    open https://gitlab.synchro.net/main/sbbs/-/issues/1207

    `3rdp/build/cl-add-psk-flag.patch` adds a Synchronet-only cryptlib attribute bit, `CRYPT_TLSOPTION_USED_PSK`, so the application can tell whether a TLS session actually negotiated PSK. The value it picks is already taken:

    ```c
    #define CRYPT_TLSOPTION_SUITEB_128 0x100 /* SuiteB security levels (will */
    #define CRYPT_TLSOPTION_SUITEB_256 0x200 /* vanish in future releases) */
    #define CRYPT_TLSOPTION_USED_PSK 0x200 /* Synchronet extension */
    ```

    `CRYPT_TLSOPTION_USED_PSK` and `CRYPT_TLSOPTION_SUITEB_256` are both `0x200`. Confirmed present in every built copy of the header in the tree: `3rdp/src/cl/cryptlib.h:1775`, `3rdp/gcc.linux.x64.release/cl/cryptlib.h:1775`, `3rdp/gcc.linux.x64.debug/cl/cryptlib.h:1775`, and `3rdp/win32.release/cryptlib/include/cryptlib.h:1771`.

    The two bits are OR'd into the *same* returned value, in the same function, about twenty lines apart (`3rdp/src/cl/session/tls.c`, `getAttributeFunction`, handling `CRYPT_SESSINFO_TLSOPTIONS`):

    ```c
    if( TEST_FLAG( sessionInfoPtr->protocolFlags, TLS_PFLAG_SUITEB_256 ) )
    *valuePtr |= CRYPT_TLSOPTION_SUITEB_256;
    #endif /* CONFIG_SUITEB */
    ...
    if( TEST_FLAG( sessionInfoPtr->protocolFlags, TLS_PFLAG_USED_PSK) )
    *valuePtr |= CRYPT_TLSOPTION_USED_PSK;
    ```

    So a SuiteB-256 session would set the bit that Synchronet reads as "PSK was used", and a PSK session sets the bit that means SuiteB-256. Both consumers test it as a plain mask:

    * `src/sbbs3/mqtt_broker.cpp:750` - `&& (attr_val & CRYPT_TLSOPTION_USED_PSK)` * `src/sbbs3/js_socket.cpp:2736` - `|| ((attrval & CRYPT_TLSOPTION_USED_PSK) == 0)`

    Severity today: **latent, not live.** The SuiteB branch is inside
    `#ifdef CONFIG_SUITEB`, and `CONFIG_SUITEB` is not defined anywhere in Synchronet's cryptlib build (it is only auto-enabled by `CONFIG_SUITEB_TESTS`, per `3rdp/src/cl/misc/config.h:1408-1410`). With SuiteB compiled out, nothing else can set `0x200`, so the current builds behave correctly. It becomes a real mis-detection if anyone builds cryptlib with `CONFIG_SUITEB`, and it is a standing hazard because the extension has claimed no reserved bit of its own.

    Suggested fix: move the Synchronet extension to an unused bit. `0x400` and above are free in that enum, so:

    ```c
    #define CRYPT_TLSOPTION_USED_PSK 0x400 /* Synchronet extension */
    ```

    Both consumers use the symbolic name, so no other source changes are needed; cryptlib has to be rebuilt for the new value to take effect.

    Two smaller things in the same patch while it is open:

    * `session/tls.h` gains `#define TLS_PFLAG_USED_PSK 0x8000 /* Session is
    resumed */` - the comment is copy-pasted from `TLS_PFLAG_RESUMED_SESSION`
    above it and should read something like "Session used PSK". The value `0x8000`
    itself is fine and `TLS_PFLAG_MAX` was correctly widened from `0x7FFF` to
    `0xFFFF`.
    * The upstream comment on the SuiteB defines says they "will vanish in future
    releases". If the intent was to deliberately recycle `0x200` on that basis,
    that is not recorded anywhere, and it would still be wrong for as long as both
    defines coexist.

    Found while auditing TLS-PSK for a separate issue (#1206); unrelated to that report beyond both touching PSK.

    -- *Authored by Claude (Claude Code), on behalf of @rswindell*

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Deucе@VERT to GitLab note in main/sbbs on Fri Jul 31 11:44:31 2026
    https://gitlab.synchro.net/main/sbbs/-/issues/1207#note_9814

    Suite B is deprecated and disabled, and will never be enabled. This conflict is intentional.

    ---
    ï¿­ Synchronet ï¿­ Vertrauen ï¿­ Home of Synchronet ï¿­ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to GitLab issue in main/sbbs on Fri Jul 31 12:02:04 2026
    close https://gitlab.synchro.net/main/sbbs/-/issues/1207

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