Skip to content

Commit 9b4f592

Browse files
committed
CI Workflows Added
Codespell workflow (.github/workflows/codespell.yml) — automated spell checking on push/PR with a project-specific ignore list for common technical abbreviations (e.g., inh, rcv, ser). Multi-compiler workflow (.github/workflows/multi-compiler.yml) — builds and runs unit tests for wolfIP against gcc-11/12/13 and clang-14/15/17 on Ubuntu. Sanitizer workflow (.github/workflows/sanitizers.yml) — runs unit tests and standalone TTL tests under ASan, UBSan, and LeakSan to ensure memory safety and catch undefined behavior. Build System Improvements Makefile updates — added explicit targets for asan, ubsan, and leaksan with the necessary compiler and linker flags for automated testing. Bug Fixes Format Specifier Correction — updated src/port/posix/bsd_socket.c to use the correct %d specifier for getpid() in debug logs.
1 parent e48dc31 commit 9b4f592

6 files changed

Lines changed: 150 additions & 2 deletions

File tree

.github/workflows/codespell.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Codespell
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
codespell:
15+
name: Check spelling
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 5
18+
steps:
19+
- name: Checkout wolfIP
20+
uses: actions/checkout@v4
21+
22+
- name: Run codespell
23+
uses: codespell-project/actions-codespell@v2
24+
with:
25+
skip: .git,./IDE,*.der,*.pem
26+
ignore_words_list: inh,inout,keypair,nd,parm,rcv,ser,tha,HSI,TE,UE
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Multiple Compilers
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
compiler_test:
15+
name: ${{ matrix.cc }}
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- cc: gcc-11
23+
- cc: gcc-12
24+
- cc: gcc-13
25+
- cc: clang-14
26+
- cc: clang-15
27+
- cc: clang-17
28+
29+
steps:
30+
- name: Install compiler
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y ${{ matrix.cc }}
34+
35+
- name: Checkout wolfIP
36+
uses: actions/checkout@v4
37+
with:
38+
submodules: true
39+
40+
- name: Install dependencies
41+
run: |
42+
sudo apt-get install -y libwolfssl-dev check
43+
sudo modprobe tun
44+
45+
- name: Build wolfIP with ${{ matrix.cc }}
46+
run: |
47+
mkdir -p build/port
48+
make CC=${{ matrix.cc }}
49+
50+
- name: Build unit tests
51+
run: make unit CC=${{ matrix.cc }}
52+
53+
- name: Run unit tests
54+
run: ./build/test/unit
55+
56+
- name: Run standalone TTL expired test
57+
run: ./build/test-ttl-expired

.github/workflows/sanitizers.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Sanitizer Tests
2+
3+
on:
4+
push:
5+
branches: [ 'master', 'main', 'release/**' ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
sanitizer_test:
15+
name: ${{ matrix.name }}
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
include:
22+
- name: "ASan"
23+
target: "asan"
24+
- name: "UBSan"
25+
target: "ubsan"
26+
- name: "LeakSan"
27+
target: "leaksan"
28+
29+
steps:
30+
- name: Workaround high-entropy ASLR
31+
run: sudo sysctl vm.mmap_rnd_bits=28
32+
33+
- name: Checkout wolfIP
34+
uses: actions/checkout@v4
35+
with:
36+
submodules: true
37+
38+
- name: Install dependencies
39+
run: |
40+
sudo apt-get update
41+
sudo apt-get install -y libwolfssl-dev check
42+
sudo modprobe tun
43+
44+
- name: Build wolfIP with ${{ matrix.name }}
45+
run: |
46+
mkdir -p build/port
47+
make ${{ matrix.target }}
48+
49+
- name: Build unit tests
50+
run: make unit
51+
52+
- name: Run unit tests
53+
run: ./build/test/unit
54+
55+
- name: Run standalone TTL expired test
56+
run: ./build/test-ttl-expired

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,14 @@ asan: $(EXE) $(LIB)
186186
asan:CFLAGS+=-fsanitize=address
187187
asan:LDFLAGS+=-static-libasan
188188

189+
ubsan: $(EXE) $(LIB)
190+
ubsan:CFLAGS+=-fsanitize=undefined -fno-sanitize-recover=all
191+
ubsan:LDFLAGS+=-fsanitize=undefined
192+
193+
leaksan: $(EXE) $(LIB)
194+
leaksan:CFLAGS+=-fsanitize=leak
195+
leaksan:LDFLAGS+=-fsanitize=leak
196+
189197
ESP_CFLAGS = \
190198
-DWOLFIP_ESP -DWOLFSSL_WOLFIP \
191199
-DDEBUG_IP -DDEBUG_UDP -DDEBUG_ESP

src/port/posix/bsd_socket.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1655,7 +1655,8 @@ void __attribute__((constructor)) init_wolfip_posix() {
16551655
if (!wolfip_mask_str || wolfip_mask_str[0] == '\0') {
16561656
wolfip_mask_str = "255.255.255.0";
16571657
}
1658-
fprintf(stderr, "wolfIP: Serving process PID=%hu, TID=%x\n", getpid(), (unsigned short)pthread_self());
1658+
fprintf(stderr, "wolfIP: Serving process PID=%d, TID=%x\n", getpid(),
1659+
(unsigned short)pthread_self());
16591660
inet_aton(host_stack_ip_str, &host_stack_ip);
16601661
swap_socketcall(socket, "socket");
16611662
swap_socketcall(bind, "bind");

src/wolfesp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ esp_aes_rfc4106_enc(const wolfIP_esp_sa * esp_sa, uint8_t * esp_data,
910910
#endif /*WOLFSSL_AESGCM_STREAM */
911911

912912
/**
913-
* In rfc4543(gcm(aes)) the AAD consists ofthe SPI, Sequence Number,
913+
* In rfc4543(gcm(aes)) the AAD consists of the SPI, Sequence Number,
914914
* and ESP Payload, and the AES-GCM plaintext is zero-length, while in
915915
* rfc4106(gcm(aes)) the AAD consists only of the SPI and Sequence Number,
916916
* and the AES-GCM plaintext consists of the ESP Payload.

0 commit comments

Comments
 (0)