-
Notifications
You must be signed in to change notification settings - Fork 45
378 lines (345 loc) · 12.4 KB
/
build_CI_FIPS.yml
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
name: FIPS
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
format_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# If any *.c *.h *.md file(except:libspdm) have Tab, the check will fail.
- name: Check code format
run: |
if grep -rn " " * --include=*.c --include=*.h --include=*.md;
then exit 1
fi
gcc_mbedtls_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build
run: |
mkdir build
cd build
cmake -E env CFLAGS="-DLIBSPDM_FIPS_MODE=1 -DLIBSPDM_FIPS_TEST_AT_LOAD=1 -DLIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG=3" cmake -DARCH=x64 -DTOOLCHAIN=GCC -DTARGET=Release -DCRYPTO=mbedtls ..
make copy_sample_key
make -j`nproc`
- name: Emu_Test
run: |
cd build/bin
test_port=2323
TCPListeningnum=`netstat -an | grep ":$test_port " | awk '/^tcp.*/ && $NF == "LISTEN" {print $0}' | wc -l`
UDPListeningnum=`netstat -an | grep ":$test_port " | awk '/^udp.*/ && $NF == "0.0.0.0:*" {print $0}' | wc -l`
Listeningnum=$((TCPListeningnum + UDPListeningnum))
if [ $Listeningnum -eq 0 ]; then
echo "port is not used"
else
echo "port is used"
fi
./spdm_responder_emu &
./spdm_requester_emu >requester.log
filename=./requester.log
if [ ! -f "$filename" ];
then
echo "Gen requester.log fail"
exit 1
fi
if grep "Connect Error - 6f" requester.log
then
sleep 100s
echo -e "\n try connect again!!! \n"
./spdm_responder_emu &
./spdm_requester_emu >requester.log
if [ ! -f "$filename" ];
then
echo "Second Gen requester.log fail"
exit 1
fi
fi
minsize=1070000
if [ `stat -c%s "$filename"` -lt $minsize ] ||
! grep "libspdm_stop_session - (nil)" requester.log;
then
echo "requester run fail"
cat -n "$filename"
echo "requester.log size is `stat -c%s "$filename"`"
exit 1
fi
- name: Responder_validator_Test
run: |
cd build/bin
./spdm_responder_emu &
./spdm_device_validator_sample
- name: Test_RECORD_TRANSCRIPT_DATA_consistent
# open LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT flag
# mkdir build1 folder, gen spdm_requester_emu.exe and spdm_responder_emu.exe
# check the log size and end of log to ensure that hashes/signatures over transcripts are consistent
run: |
sed -i '17a add_definitions(-DLIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT=1)' CMakeLists.txt
mkdir build1
cd build1
cmake -DARCH=x64 -DTOOLCHAIN=GCC -DTARGET=Release -DCRYPTO=mbedtls ..
make copy_sample_key
make -j`nproc`
cd bin
echo "requester (DATA_SUPPORT = 0) <=> responder (DATA_SUPPORT = 1)"
./spdm_responder_emu &
./../../build/bin/spdm_requester_emu >requester.log
filename=./../../build/bin/requester.log
if [ ! -f "$filename" ];
then
echo "Gen requester.log fail"
exit 1
fi
if grep "Connect Error - 6f" requester.log
then
sleep 100s
echo -e "\n try connect again!!! \n"
./spdm_responder_emu &
./../../build/bin/spdm_requester_emu >requester.log
if [ ! -f "$filename" ];
then
echo "Second Gen requester.log fail"
exit 1
fi
fi
minsize=1070000
if [ `stat -c%s "$filename"` -lt $minsize ] ||
! grep "libspdm_stop_session - (nil)" requester.log;
then
echo "requester run fail"
cat -n "$filename"
echo "requester.log size is `stat -c%s "$filename"`"
exit 1
fi
sleep 10s
echo "requester (DATA_SUPPORT = 1) <=> responder (DATA_SUPPORT = 0)"
./../../build/bin/spdm_responder_emu &
./spdm_requester_emu >requester.log
filename=./requester.log
if [ ! -f "$filename" ];
then
echo "Gen requester.log fail"
exit 1
fi
if grep "Connect Error - 6f" requester.log
then
sleep 100s
echo -e "\n try connect again!!! \n"
./../../build/bin/spdm_responder_emu &
./spdm_requester_emu >requester.log
if [ ! -f "$filename" ];
then
echo "Second Gen requester.log fail"
exit 1
fi
fi
minsize=1070000
if [ `stat -c%s "$filename"` -lt $minsize ] ||
! grep "libspdm_stop_session - (nil)" requester.log;
then
echo "requester run fail"
cat -n "$filename"
echo "requester.log size is `stat -c%s "$filename"`"
exit 1
fi
gcc_openssl_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Build
run: |
mkdir build
cd build
cmake -E env CFLAGS="-DLIBSPDM_FIPS_MODE=1 -DLIBSPDM_FIPS_TEST_AT_LOAD=0 -DLIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG=3" cmake -DARCH=x64 -DTOOLCHAIN=GCC -DTARGET=Release -DCRYPTO=openssl ..
make copy_sample_key
make -j`nproc`
- name: Emu_Test
run: |
cd build/bin
test_port=2323
TCPListeningnum=`netstat -an | grep ":$test_port " | awk '/^tcp.*/ && $NF == "LISTEN" {print $0}' | wc -l`
UDPListeningnum=`netstat -an | grep ":$test_port " | awk '/^udp.*/ && $NF == "0.0.0.0:*" {print $0}' | wc -l`
Listeningnum=$((TCPListeningnum + UDPListeningnum))
if [ $Listeningnum -eq 0 ]; then
echo "port is not used"
else
echo "port is used"
fi
./spdm_responder_emu &
./spdm_requester_emu >requester.log
filename=./requester.log
if [ ! -f "$filename" ];
then
echo "Gen requester.log fail"
exit 1
fi
if grep "Connect Error - 6f" requester.log
then
sleep 100s
echo -e "\n try connect again!!! \n"
./spdm_responder_emu &
./spdm_requester_emu >requester.log
if [ ! -f "$filename" ];
then
echo "Second Gen requester.log fail"
exit 1
fi
fi
minsize=1070000
if [ `stat -c%s "$filename"` -lt $minsize ] ||
! grep "libspdm_stop_session - (nil)" requester.log;
then
echo "requester run fail"
cat -n "$filename"
echo "requester.log size is `stat -c%s "$filename"`"
exit 1
fi
- name: Responder_validator_Test
run: |
cd build/bin
./spdm_responder_emu &
./spdm_device_validator_sample
- name: Test_RECORD_TRANSCRIPT_DATA_consistent
# open LIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT flag
# mkdir build1 folder, gen spdm_requester_emu.exe and spdm_responder_emu.exe
# check the log size and the end of log to ensure that hashes/signatures over transcripts are consistent
run: |
sed -i '17a add_definitions(-DLIBSPDM_RECORD_TRANSCRIPT_DATA_SUPPORT=1)' CMakeLists.txt
mkdir build1
cd build1
cmake -DARCH=x64 -DTOOLCHAIN=GCC -DTARGET=Release -DCRYPTO=openssl ..
make copy_sample_key
make -j`nproc`
cd bin
echo "requester (DATA_SUPPORT = 0) <=> responder (DATA_SUPPORT = 1)"
./spdm_responder_emu &
./../../build/bin/spdm_requester_emu >requester.log
filename=./../../build/bin/requester.log
if [ ! -f "$filename" ];
then
echo "Gen requester.log fail"
exit 1
fi
if grep "Connect Error - 6f" requester.log
then
sleep 100s
echo -e "\n try connect again!!! \n"
./spdm_responder_emu &
./../../build/bin/spdm_requester_emu >requester.log
if [ ! -f "$filename" ];
then
echo "Second Gen requester.log fail"
exit 1
fi
fi
minsize=1070000
if [ `stat -c%s "$filename"` -lt $minsize ] ||
! grep "libspdm_stop_session - (nil)" requester.log;
then
echo "requester run fail"
cat -n "$filename"
echo "requester.log size is `stat -c%s "$filename"`"
exit 1
fi
sleep 10s
echo "requester (DATA_SUPPORT = 1) <=> responder (DATA_SUPPORT = 0)"
./../../build/bin/spdm_responder_emu &
./spdm_requester_emu >requester.log
filename=./requester.log
if [ ! -f "$filename" ];
then
echo "Gen requester.log fail"
exit 1
fi
if grep "Connect Error - 6f" requester.log
then
sleep 100s
echo -e "\n try connect again!!! \n"
./../../build/bin/spdm_responder_emu &
./spdm_requester_emu >requester.log
if [ ! -f "$filename" ];
then
echo "Second Gen requester.log fail"
exit 1
fi
fi
minsize=1070000
if [ `stat -c%s "$filename"` -lt $minsize ] ||
! grep "libspdm_stop_session - (nil)" requester.log;
then
echo "requester run fail"
cat -n "$filename"
echo "requester.log size is `stat -c%s "$filename"`"
exit 1
fi
VS2019_mbedtls_build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
#ilammy/msvc-dev-cmd@v1 is GitHub Action for configuring Developer Command Prompt for Microsoft Visual Studio on Windows.
#This sets up the environment for compiling C/C++ code from command line.
- name: Add msbuild to PATH
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Build
run: |
mkdir build
cd build
cmake -E env CFLAGS="-DLIBSPDM_FIPS_MODE=1 -DLIBSPDM_FIPS_TEST_AT_LOAD=0 -DLIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG=3" cmake -G"NMake Makefiles" -DARCH=x64 -DTOOLCHAIN=VS2019 -DTARGET=Release -DCRYPTO=mbedtls ..
nmake copy_sample_key
nmake
- name: Emu_Test
run: |
cd build/bin
./spdm_responder_emu &
./spdm_requester_emu
- name: Responder_validator_Test
run: |
cd build/bin
./spdm_responder_emu &
./spdm_device_validator_sample
VS2019_openssl_build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
#ilammy/msvc-dev-cmd@v1 is GitHub Action for configuring Developer Command Prompt for Microsoft Visual Studio on Windows.
#This sets up the environment for compiling C/C++ code from command line.
- name: Add msbuild to PATH
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Build
run: |
mkdir build
cd build
cmake -E env CFLAGS="-DLIBSPDM_FIPS_MODE=1 -DLIBSPDM_FIPS_TEST_AT_LOAD=1 -DLIBSPDM_DEBUG_LIBSPDM_ASSERT_CONFIG=3" cmake -G"NMake Makefiles" -DARCH=x64 -DTOOLCHAIN=VS2019 -DTARGET=Release -DCRYPTO=openssl ..
nmake copy_sample_key
nmake
- name: Emu_Test
run: |
cd build/bin
./spdm_responder_emu &
./spdm_requester_emu
- name: Responder_validator_Test
run: |
cd build/bin
./spdm_responder_emu &
./spdm_device_validator_sample