Skip to content

Commit 5a5e3d7

Browse files
committed
types/ci: scope 16-bit word64 to WIDE_BYTE and add portable split-64 Keccak host test
1 parent b5ca40a commit 5a5e3d7

2 files changed

Lines changed: 34 additions & 9 deletions

File tree

.github/workflows/ti-c2000-compile.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
- '.github/workflows/ti-c2000-compile.yml'
2020
pull_request:
2121
types: [opened, synchronize, reopened, ready_for_review]
22-
branches: [ '*' ]
22+
branches: [ '**' ]
2323
paths:
2424
- 'wolfcrypt/src/**'
2525
- 'wolfssl/wolfcrypt/**'
@@ -105,3 +105,25 @@ jobs:
105105
run: |
106106
CGT_ROOT="${{ steps.find-cl.outputs.cgt_root }}" \
107107
IDE/C2000/compile.sh
108+
109+
# Portable regression guard for the WC_SHA3_SPLIT64 Keccak permutation added
110+
# for CHAR_BIT != 8 targets. It is pure C and runs on any host, so force it
111+
# on a normal x86-64 build and run the crypto KATs (SHA-3/SHAKE plus the
112+
# SHAKE-heavy ML-DSA/ML-KEM) that exercise it. No hardware or TI CGT needed,
113+
# so unlike the compile-only guard above this always runs.
114+
sha3_split64_host:
115+
name: SHA-3 split-64 host test
116+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
117+
runs-on: ubuntu-22.04
118+
timeout-minutes: 20
119+
steps:
120+
- uses: actions/checkout@v4
121+
name: Checkout wolfSSL
122+
123+
- name: Build + run crypto KATs with WC_SHA3_SPLIT64 forced
124+
run: |
125+
./autogen.sh
126+
./configure --enable-dilithium --enable-mlkem --enable-experimental \
127+
--enable-shake128 --enable-shake256 CPPFLAGS="-DWC_SHA3_SPLIT64"
128+
make
129+
./wolfcrypt/test/testwolfcrypt

wolfssl/wolfcrypt/types.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,18 @@ typedef const char wcchar[];
443443

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

0 commit comments

Comments
 (0)