-
Notifications
You must be signed in to change notification settings - Fork 79
299 lines (262 loc) · 10.2 KB
/
make-test-swtpm.yml
File metadata and controls
299 lines (262 loc) · 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
name: WolfTPM Build Tests
on:
push:
branches: [ 'master', 'main', 'release/**' ]
pull_request:
branches: [ '*' ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Defaults (applied when not specified in matrix entries):
# wolfssl_config: --enable-wolftpm --enable-pkcallbacks
# wolfssl_cflags: ""
# wolfssl_ref: master
# wolftpm_config: --enable-swtpm
# wolftpm_cflags: ""
# test_command: "true"
# needs_swtpm: true
# needs_mono: false
# needs_dist: false
# needs_install: false
# csharp_test: false
# wolftpm_cc: ""
include:
# Default build with simulator
- name: default
test_command: "make check && WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh"
needs_dist: true
needs_install: true
# CSharp wrapper tests
- name: csharp
test_command: "true"
needs_mono: true
needs_install: true
csharp_test: true
# No wolfCrypt
- name: no-wolfcrypt
wolftpm_config: --enable-swtpm --disable-wolfcrypt
test_command: "make check && WOLFSSL_PATH=./wolfssl WOLFCRYPT_ENABLE=0 ./examples/run_examples.sh"
# No wrapper
- name: no-wrapper
wolftpm_config: --enable-swtpm --disable-wrapper
test_command: "./examples/native/native_test"
# Small stack
- name: smallstack
wolftpm_config: --enable-swtpm --enable-smallstack
test_command: "make check && WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh"
# Infineon SLB9670
- name: slb9670
wolftpm_config: --enable-infineon=slb9670
# Infineon SLB9672
- name: slb9672
wolftpm_config: --enable-infineon=slb9672
# Infineon SLB9673
- name: slb9673
wolftpm_config: --enable-infineon=slb9673 --enable-i2c
# STMicro ST33KTPM2
- name: st33ktpm2
wolftpm_config: --enable-st33
# Microchip
- name: microchip
wolftpm_config: --enable-microchip
# Nuvoton
- name: nuvoton
wolftpm_config: --enable-nuvoton
# TIS lock
- name: tislock
wolftpm_config: --enable-tislock
needs_swtpm: false
# Debug
- name: debug
wolftpm_config: --enable-debug
needs_swtpm: false
# Debug verbose
- name: debug-verbose
wolftpm_config: --enable-debug=verbose
needs_swtpm: false
# Debug IO
- name: debug-io
wolftpm_config: --enable-debug=io
wolftpm_cflags: "-DWOLFTPM_DEBUG_TIMEOUT"
needs_swtpm: false
# AdvIO
- name: advio
wolftpm_config: --enable-advio
needs_swtpm: false
# Clang ASAN
- name: clang-asan
wolftpm_cflags: "-fsanitize=address -fno-omit-frame-pointer -g"
wolftpm_cc: clang
test_command: "make check && ASAN_OPTIONS=detect_leaks=1:abort_on_error=1 WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh"
# Pedantic
- name: pedantic
wolftpm_config: ""
wolftpm_cflags: "-Wpedantic"
needs_swtpm: false
# Not provisioning
- name: no-provisioning
wolftpm_config: --disable-provisioning
needs_swtpm: false
# Symmetric encryption
- name: symmetric
wolftpm_cflags: "-DWOLFTPM_USE_SYMMETRIC"
test_command: "make check && WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh"
# Software ECDHE
- name: swecdhe
wolftpm_cflags: "-DWOLFTPM2_USE_SW_ECDHE"
test_command: "make check && WOLFSSL_PATH=./wolfssl ./examples/run_examples.sh"
# No ECC
- name: no-ecc
wolfssl_config: --enable-wolftpm --disable-ecc
test_command: "make check && WOLFSSL_PATH=./wolfssl WOLFCRYPT_ECC=0 ./examples/run_examples.sh"
needs_install: true
# No RSA
- name: no-rsa
wolfssl_config: --enable-wolftpm --disable-rsa
test_command: "make check && WOLFSSL_PATH=./wolfssl WOLFCRYPT_RSA=0 ./examples/run_examples.sh"
needs_install: true
# Default configure (no AES CFB, no PKCS7, no crypto cb, no cert gen)
- name: default-configure
wolfssl_config: ""
wolfssl_cflags: "-DWOLFSSL_PUBLIC_MP"
test_command: "make check && WOLFSSL_PATH=./wolfssl WOLFCRYPT_DEFAULT=1 ./examples/run_examples.sh"
needs_install: true
# No filesystem
- name: no-filesystem
wolfssl_config: --enable-wolftpm --disable-filesystem --enable-singlethreaded
test_command: "make check && WOLFSSL_PATH=./wolfssl NO_FILESYSTEM=1 ./examples/run_examples.sh"
needs_install: true
# Old wolfSSL (v4.7.0)
# Builds latest wolfSSL for examples/client/client and examples/server/server
# Builds old wolfSSL (v4.7.0) for linking wolfTPM against older shared library
- name: old-wolfssl
test_command: "make check && WOLFSSL_PATH=./wolfssl NO_PUBASPRIV=1 ./examples/run_examples.sh"
needs_install: true
steps:
- name: Checkout wolfTPM
uses: actions/checkout@master
- name: Checkout wolfSSL
uses: actions/checkout@master
with:
repository: wolfssl/wolfssl
path: wolfssl
ref: ${{ matrix.wolfssl_ref || 'master' }}
- name: Setup wolfSSL
working-directory: ./wolfssl
run: |
./autogen.sh
WOLFSSL_CONFIG="${{ matrix.wolfssl_config || '--enable-wolftpm --enable-pkcallbacks' }}"
WOLFSSL_CFLAGS="${{ matrix.wolfssl_cflags || '' }}"
if [ -n "$WOLFSSL_CFLAGS" ]; then
./configure $WOLFSSL_CONFIG CFLAGS="$WOLFSSL_CFLAGS"
else
./configure $WOLFSSL_CONFIG
fi
make
sudo make install
sudo ldconfig
# For old-wolfssl test: checkout and build old wolfSSL for linking
- name: Checkout old wolfSSL
if: matrix.name == 'old-wolfssl'
uses: actions/checkout@master
with:
repository: wolfssl/wolfssl
path: wolfssl-old
ref: v4.7.0-stable
- name: Apply wolfssl-v4.7.0.patch to old wolfSSL
if: matrix.name == 'old-wolfssl'
working-directory: ./wolfssl-old
run: |
git apply ../.github/workflows/wolfssl-v4.7.0.patch
- name: Setup old wolfSSL for linking
if: matrix.name == 'old-wolfssl'
working-directory: ./wolfssl-old
run: |
./autogen.sh
./configure --enable-wolftpm --disable-examples CFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_TEST_CERT -DWOLFSSL_KEY_GEN -DNO_WRITEV"
make
sudo make install
sudo ldconfig
- name: Setup ibmswtpm2
if: matrix.needs_swtpm == true || matrix.needs_swtpm == null
uses: actions/checkout@master
with:
repository: kgoldman/ibmswtpm2
path: ibmswtpm2
- name: Generate TPM port
if: matrix.needs_swtpm == true || matrix.needs_swtpm == null
run: |
# Generate deterministic port from matrix name (base 40000, spacing 2 for port+1)
MATRIX_HASH=$(echo -n "${{ matrix.name }}" | cksum | cut -d' ' -f1)
TPM_PORT=$((40000 + (MATRIX_HASH % 1000) * 2))
echo "TPM_PORT=$TPM_PORT" >> $GITHUB_ENV
echo "TPM2_SWTPM_PORT=$TPM_PORT" >> $GITHUB_ENV
echo "Generated TPM port: $TPM_PORT (matrix: ${{ matrix.name }})"
- name: Start TPM simulator
if: matrix.needs_swtpm == true || matrix.needs_swtpm == null
working-directory: ./ibmswtpm2/src
run: |
make
echo "Starting TPM simulator on port $TPM_PORT"
./tpm_server -port $TPM_PORT &
- name: Install mono
if: matrix.needs_mono == true
run: |
sudo apt-get install -y mono-mcs mono-tools-devel nunit nunit-console
- name: Build wolfTPM
run: |
./autogen.sh
WOLFTPM_CONFIG="${{ matrix.wolftpm_config || '--enable-swtpm' }}"
WOLFTPM_CFLAGS="${{ matrix.wolftpm_cflags || '' }}"
WOLFTPM_CC="${{ matrix.wolftpm_cc || '' }}"
# Add TPM port to configure if SWTPM is needed
if [ -n "$TPM_PORT" ]; then
WOLFTPM_CONFIG="$WOLFTPM_CONFIG --with-swtpm-port=$TPM_PORT"
fi
if [ -n "$WOLFTPM_CC" ]; then
if [ -n "$WOLFTPM_CFLAGS" ]; then
CC="$WOLFTPM_CC" ./configure $WOLFTPM_CONFIG CFLAGS="$WOLFTPM_CFLAGS"
else
CC="$WOLFTPM_CC" ./configure $WOLFTPM_CONFIG
fi
else
if [ -n "$WOLFTPM_CFLAGS" ]; then
./configure $WOLFTPM_CONFIG CFLAGS="$WOLFTPM_CFLAGS"
else
./configure $WOLFTPM_CONFIG
fi
fi
make
- name: Run tests
if: matrix.test_command && matrix.test_command != 'true'
run: ${{ matrix.test_command }}
- name: Install
if: matrix.needs_install == true
run: |
sudo make install
sudo ldconfig
- name: Build CSharp wrapper
if: matrix.csharp_test == true
working-directory: ./wrapper/CSharp
run: |
mcs wolfTPM.cs wolfTPM-tests.cs -r:/usr/lib/cli/nunit.framework-2.6.3/nunit.framework.dll -t:library
LD_LIBRARY_PATH=../../src/.libs/:../../wolfssl/src/.libs/ nunit-console wolfTPM.dll -run=tpm_csharp_test.WolfTPMTest.TrySelfTest
LD_LIBRARY_PATH=../../src/.libs/:../../wolfssl/src/.libs/ nunit-console wolfTPM.dll
- name: Make dist
if: matrix.needs_dist == true
run: |
make dist
make distcheck
- name: Upload failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: wolftpm-test-logs-${{ matrix.name }}
path: |
run.out
test-suite.log
wolftpm-*/_build/sub/test-suite.log
retention-days: 5