Skip to content

Commit 6605060

Browse files
committed
CI: more smoke coverage + header self-sufficiency
- Add AddressSanitizer entry to smoke matrix (--enable-all + -fsanitize=address). - Add check-headers workflow: 214 public wolfssl/*.h compile standalone. - Fix quic.h, rng_bank.h, Renesas/renesas-fspsm-crypt.h to be self-sufficient. - Remove no-tls.yml (its single config is already covered by os-check.yml).
1 parent 7f80896 commit 6605060

7 files changed

Lines changed: 171 additions & 63 deletions

File tree

.github/scripts/check-headers.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env bash
2+
#
3+
# check-headers.sh
4+
#
5+
# Verifies that every public-facing wolfSSL header compiles standalone
6+
# from a fresh consumer's perspective:
7+
#
8+
# #include <wolfssl/options.h>
9+
# #include <wolfssl/...the header...>
10+
# int main(void) { return 0; }
11+
#
12+
# Catches the common breakage where a header silently relies on a
13+
# transitive include from an earlier `.c` file and stops compiling
14+
# when downstream code includes it first.
15+
#
16+
# Requires:
17+
# * ./configure has been run (so wolfssl/options.h exists).
18+
# * gcc and standard build env.
19+
#
20+
# Usage:
21+
# .github/scripts/check-headers.sh # scan default header set
22+
# .github/scripts/check-headers.sh <files> # scan a specific list
23+
24+
set -u
25+
26+
ROOT="$(git rev-parse --show-toplevel)"
27+
cd "$ROOT" || exit 2
28+
29+
if [ ! -f wolfssl/options.h ]; then
30+
echo "::error::wolfssl/options.h not found - run ./configure first" >&2
31+
exit 2
32+
fi
33+
34+
CC="${CC:-gcc}"
35+
GHA="${GITHUB_ACTIONS:-}"
36+
37+
emit() {
38+
local file="$1" msg="$2"
39+
if [ -n "$GHA" ]; then
40+
printf '::error file=%s,line=1,title=header-self-include::%s\n' "$file" "$msg"
41+
else
42+
printf '%s: %s\n' "$file" "$msg"
43+
fi
44+
}
45+
46+
# Default scope: public wolfssl headers excluding vendor/port subdirs and
47+
# files that are intentionally not standalone-includable.
48+
if [ "$#" -gt 0 ]; then
49+
HEADERS=("$@")
50+
else
51+
# Exclusions:
52+
# * generated / private / test-data headers.
53+
# * wolfcrypt math backends (tfm vs sp_int are mutually exclusive).
54+
# * port/* headers whose first-line vendor SDK include can't be
55+
# satisfied in a generic CI environment (mcapi.h, kcapi.h,
56+
# em_device.h, fsl_dcp.h, hw/inout.h, etc.) or that reference
57+
# vendor-only types. Fix the offending header's vendor #include
58+
# with an #ifdef guard and drop the exclusion in a follow-up.
59+
mapfile -t HEADERS < <(
60+
git ls-files 'wolfssl/*.h' 'wolfssl/wolfcrypt/*.h' \
61+
'wolfssl/wolfcrypt/port/**/*.h' 'wolfssl/openssl/*.h' \
62+
| grep -vE '^wolfssl/(options|internal|certs_test|certs_test_sm|debug-trace-error-codes|debug-untrace-error-codes)\.h$' \
63+
| grep -vE '^wolfssl/wolfcrypt/(fips_test|selftest|tfm)\.h$' \
64+
| grep -vE '^wolfssl/wolfcrypt/port/aria/aria-crypt(ocb)?\.h$' \
65+
| grep -vE '^wolfssl/wolfcrypt/port/autosar/(CryIf|Crypto)\.h$' \
66+
| grep -vE '^wolfssl/wolfcrypt/port/caam/(caam_driver|caam_qnx|wolfcaam_hash)\.h$' \
67+
| grep -vE '^wolfssl/wolfcrypt/port/kcapi/' \
68+
| grep -vE '^wolfssl/wolfcrypt/port/nxp/(dcp_port|se050_port)\.h$' \
69+
| grep -vE '^wolfssl/wolfcrypt/port/Renesas/(renesas_fspsm_internal|renesas-rx64-hw-crypt|renesas-tsip-crypt|renesas_tsip_internal)\.h$' \
70+
| grep -vE '^wolfssl/wolfcrypt/port/silabs/silabs_aes\.h$'
71+
)
72+
fi
73+
74+
TMPDIR="$(mktemp -d)"
75+
trap 'rm -rf "$TMPDIR"' EXIT
76+
77+
FAIL=0
78+
PASS=0
79+
for h in "${HEADERS[@]}"; do
80+
[ -f "$h" ] || continue
81+
cat > "$TMPDIR/test.c" <<EOF
82+
#include <wolfssl/options.h>
83+
#include <$h>
84+
int main(void) { return 0; }
85+
EOF
86+
if out="$("$CC" -I. -c -o /dev/null "$TMPDIR/test.c" 2>&1)"; then
87+
PASS=$((PASS + 1))
88+
else
89+
FAIL=$((FAIL + 1))
90+
first_err="$(printf '%s' "$out" | grep -E 'error:' | head -1 | sed 's/.*error: //')"
91+
emit "$h" "header does not compile standalone: ${first_err:-(see build log)}"
92+
if [ -z "$GHA" ]; then
93+
printf '%s\n' "$out" | head -8 | sed 's/^/ /'
94+
fi
95+
fi
96+
done
97+
98+
echo "check-headers: $PASS pass, $FAIL fail"
99+
[ "$FAIL" -eq 0 ]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Check Headers
2+
3+
# Verifies every public-facing wolfSSL header compiles standalone with
4+
# only wolfssl/options.h included first. Catches the common breakage
5+
# where a header silently relies on a transitive include from an
6+
# earlier .c file and stops compiling from a fresh consumer.
7+
#
8+
# Runs on drafts (fast static check).
9+
10+
on:
11+
push:
12+
branches: [ master, main ]
13+
pull_request:
14+
types: [opened, synchronize, reopened, ready_for_review]
15+
branches: [ master, main ]
16+
17+
concurrency:
18+
group: check-headers-${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
check:
26+
runs-on: ubuntu-24.04
27+
timeout-minutes: 10
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Install dependencies
32+
uses: ./.github/actions/install-apt-deps
33+
with:
34+
packages: autoconf automake libtool build-essential
35+
36+
- name: autogen
37+
run: ./autogen.sh
38+
39+
- name: configure --enable-all
40+
run: ./configure --enable-all
41+
42+
- name: Run check-headers
43+
run: ./.github/scripts/check-headers.sh

.github/workflows/no-tls.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/smoke-test.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ jobs:
6262
args: "--enable-psk --enable-dtls --enable-dtls13 --enable-dtls-mtu --enable-aesccm --enable-opensslextra"
6363
- name: integration
6464
args: "--enable-openssh --enable-lighty --enable-stunnel --enable-opensslextra"
65+
# AddressSanitizer (UBSAN excluded - current master has known
66+
# left-shift UB in auto-generated SP math).
67+
- name: sanitize-asan
68+
args: "--enable-all"
69+
cflags: "-fsanitize=address -fno-omit-frame-pointer -g -O1"
70+
ldflags: "-fsanitize=address"
6571
env:
6672
MAKE_CFLAGS: "-Werror"
6773
steps:
@@ -111,10 +117,20 @@ jobs:
111117
if: steps.merge_check.outputs.skip != 'true'
112118
run: ./configure ${{ matrix.config.args }}
113119

114-
- name: make (CFLAGS=-Werror)
120+
- name: make
115121
if: steps.merge_check.outputs.skip != 'true'
116-
run: make -j$(nproc) CFLAGS="$MAKE_CFLAGS"
122+
env:
123+
ENTRY_CFLAGS: ${{ matrix.config.cflags }}
124+
ENTRY_LDFLAGS: ${{ matrix.config.ldflags }}
125+
run: |
126+
FLAGS="${ENTRY_CFLAGS:-$MAKE_CFLAGS}"
127+
make -j"$(nproc)" CFLAGS="$FLAGS" LDFLAGS="$ENTRY_LDFLAGS"
117128
118-
- name: make check (CFLAGS=-Werror)
129+
- name: make check
119130
if: steps.merge_check.outputs.skip != 'true'
120-
run: make check CFLAGS="$MAKE_CFLAGS"
131+
env:
132+
ENTRY_CFLAGS: ${{ matrix.config.cflags }}
133+
ENTRY_LDFLAGS: ${{ matrix.config.ldflags }}
134+
run: |
135+
FLAGS="${ENTRY_CFLAGS:-$MAKE_CFLAGS}"
136+
make check CFLAGS="$FLAGS" LDFLAGS="$ENTRY_LDFLAGS"

wolfssl/quic.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,23 @@
3535
#ifndef NO_STDINT_H
3636
#include <stdint.h>
3737
#endif
38+
#include <stddef.h> /* size_t */
3839

39-
/* QUIC operates on three encryption levels which determine
40-
* which keys/algos are used for de-/encryption. These are
41-
* kept separately for incoming and outgoing data and.
42-
* Due to the nature of UDP, more than one might be in use
43-
* at the same time due to resends or out-of-order arrivals.
44-
*/
40+
/* Defined before ssl.h: openssl/ssl.h pulls quic.h mid-include and
41+
* references WOLFSSL_ENCRYPTION_LEVEL and WOLFSSL_QUIC_METHOD. */
4542
typedef enum wolfssl_encryption_level_t {
4643
wolfssl_encryption_initial = 0,
4744
wolfssl_encryption_early_data,
4845
wolfssl_encryption_handshake,
4946
wolfssl_encryption_application
5047
} WOLFSSL_ENCRYPTION_LEVEL;
5148

52-
53-
/* All QUIC related callbacks to the application.
54-
*/
5549
typedef struct wolfssl_quic_method_t WOLFSSL_QUIC_METHOD;
5650

51+
#include <wolfssl/ssl.h>
52+
53+
54+
/* All QUIC related callbacks to the application. */
5755
struct wolfssl_quic_method_t {
5856
/**
5957
* Provide secrets to the QUIC stack when they become available in the SSL

wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define __RENESAS_FSPSM_CRYPT_H__
2323

2424
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-types.h>
25+
#include <stdint.h> /* uint8_t */
2526

2627
#ifdef __cplusplus
2728
extern "C" {

wolfssl/wolfcrypt/rng_bank.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define WOLF_CRYPT_RNG_BANK_H
3333

3434
#include <wolfssl/wolfcrypt/types.h>
35+
#include <wolfssl/wolfcrypt/random.h>
3536

3637
#ifdef WC_RNG_BANK_SUPPORT
3738

0 commit comments

Comments
 (0)