types/ci: scope 16-bit word64 to WIDE_BYTE and add portable split-64 Keccak host test

pull/10724/head
David Garske 2026-07-09 12:34:36 -07:00
parent 8d34ef4bde
commit f067cd88a2
2 changed files with 34 additions and 9 deletions

View File

@ -19,7 +19,7 @@ on:
- '.github/workflows/ti-c2000-compile.yml'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [ '*' ]
branches: [ '**' ]
paths:
- 'wolfcrypt/src/**'
- 'wolfssl/wolfcrypt/**'
@ -105,3 +105,25 @@ jobs:
run: |
CGT_ROOT="${{ steps.find-cl.outputs.cgt_root }}" \
IDE/C2000/compile.sh
# Portable regression guard for the WC_SHA3_SPLIT64 Keccak permutation added
# for CHAR_BIT != 8 targets. It is pure C and runs on any host, so force it
# on a normal x86-64 build and run the crypto KATs (SHA-3/SHAKE plus the
# SHAKE-heavy ML-DSA/ML-KEM) that exercise it. No hardware or TI CGT needed,
# so unlike the compile-only guard above this always runs.
sha3_split64_host:
name: SHA-3 split-64 host test
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
name: Checkout wolfSSL
- name: Build + run crypto KATs with WC_SHA3_SPLIT64 forced
run: |
./autogen.sh
./configure --enable-dilithium --enable-mlkem --enable-experimental \
--enable-shake128 --enable-shake256 CPPFLAGS="-DWC_SHA3_SPLIT64"
make
./wolfcrypt/test/testwolfcrypt

View File

@ -443,15 +443,18 @@ typedef const char wcchar[];
#elif defined(WC_16BIT_CPU)
/* WC_16BIT_CPU selects 16-bit int (word16=unsigned int, word32=unsigned
* long). It historically also assumes no native 64-bit type, but targets
* like the TI C2000 C28x are 16-bit-int yet have a 64-bit long long, so
* keep WORD64_AVAILABLE when one genuinely exists. Porting note: any other
* 16-bit-int target with a 64-bit long/long long now keeps the 64-bit paths
* (SHA-512, word64 rotates) that were previously force-disabled here. */
* long). Historically every WC_16BIT_CPU build (except MICROCHIP_PIC24)
* force-disabled WORD64_AVAILABLE. The TI C2000 C28x is 16-bit-int yet has
* a 64-bit long long and needs the 64-bit paths (SHA-512, ML-DSA/ML-KEM),
* so keep WORD64_AVAILABLE for CHAR_BIT != 8 (WOLFSSL_WIDE_BYTE) targets
* that genuinely have a 64-bit type. All other 16-bit-int targets (e.g.
* MSP430) retain the historical behavior, so this is not a silent ABI or
* code-path change for existing non-C28x ports. */
#if !defined(MICROCHIP_PIC24) && \
!(defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)) && \
!(defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)) && \
!(defined(__SIZEOF_LONG_LONG__) && (__SIZEOF_LONG_LONG__ == 8))
!(defined(WOLFSSL_WIDE_BYTE) && \
((defined(SIZEOF_LONG) && (SIZEOF_LONG == 8)) || \
(defined(SIZEOF_LONG_LONG) && (SIZEOF_LONG_LONG == 8)) || \
(defined(__SIZEOF_LONG_LONG__) && (__SIZEOF_LONG_LONG__ == 8))))
#undef WORD64_AVAILABLE
#endif
typedef word16 wolfssl_word;