forked from secure-device-onboard/client-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcDevice_Build.sh
executable file
·68 lines (57 loc) · 3.49 KB
/
cDevice_Build.sh
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
#!/bin/bash -x
set -e -x
export WORKSPACE=`pwd`
BUILDTYPE="release"
if [ -z $1 ]
then
echo "No argument supplied"
else
BUILDTYPE=$1
fi
# Build To Archive into Artifactory
echo "For ecdsa_c_device *******"
mkdir -p ecdsa256_c_device_bin
mkdir -p ecdsa256_c_device_bin/blob_backup
make pristine || true
cmake -DBUILD=${BUILDTYPE} -DPK_ENC=ecdsa -DDA=ecdsa256 -DKEX=ecdh
make -j$(nproc)
cp -a ${WORKSPACE}/build/linux-client ${WORKSPACE}/ecdsa256_c_device_bin
cp -a ${WORKSPACE}/data ${WORKSPACE}/ecdsa256_c_device_bin
cp -a ${WORKSPACE}/data/*.blob ${WORKSPACE}/ecdsa256_c_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_aes_key.bin ${WORKSPACE}/ecdsa256_c_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_hmac_key.bin ${WORKSPACE}/ecdsa256_c_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_iv.bin ${WORKSPACE}/ecdsa256_c_device_bin/blob_backup
echo "For ecdsa_c_device for Supply chain tool*******"
mkdir -p ecdsa256_c_sct_device_bin
mkdir -p ecdsa256_c_sct_device_bin/blob_backup
make pristine || true
cmake -DBUILD=${BUILDTYPE} -DPK_ENC=ecdsa -DDA=ecdsa256 -DMANUFACTURER_TOOLKIT=true -DKEX=ecdh
make -j$(nproc)
cp -a ${WORKSPACE}/build/linux-client ${WORKSPACE}/ecdsa256_c_sct_device_bin
cp -a ${WORKSPACE}/data ${WORKSPACE}/ecdsa256_c_sct_device_bin
cp -a ${WORKSPACE}/data/*.blob ${WORKSPACE}/ecdsa256_c_sct_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_aes_key.bin ${WORKSPACE}/ecdsa256_c_sct_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_hmac_key.bin ${WORKSPACE}/ecdsa256_c_sct_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_iv.bin ${WORKSPACE}/ecdsa256_c_sct_device_bin/blob_backup
mkdir -p ecdsa384_c_sct_device_bin
mkdir -p ecdsa384_c_sct_device_bin/blob_backup
make pristine || true
cmake -DBUILD=${BUILDTYPE} -DPK_ENC=ecdsa -DDA=ecdsa384 -DMANUFACTURER_TOOLKIT=true -DKEX=ecdh384
make -j$(nproc)
cp -a ${WORKSPACE}/build/linux-client ${WORKSPACE}/ecdsa384_c_sct_device_bin
cp -a ${WORKSPACE}/data ${WORKSPACE}/ecdsa384_c_sct_device_bin
cp -a ${WORKSPACE}/data/*.blob ${WORKSPACE}/ecdsa384_c_sct_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_aes_key.bin ${WORKSPACE}/ecdsa384_c_sct_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_hmac_key.bin ${WORKSPACE}/ecdsa384_c_sct_device_bin/blob_backup
cp -a ${WORKSPACE}/data/platform_iv.bin ${WORKSPACE}/ecdsa384_c_sct_device_bin/blob_backup
echo " *****Running Unit Tests*********"
TEST_OUTPUT="build/unit-test-output.txt"
rm -f $TEST_OUTPUT
make pristine || true; cmake -Dunit-test=true -DHTTPPROXY=true -DBUILD=release -DKEX=ecdh -DAES_MODE=ctr -DDA=ecdsa256 -DPK_ENC=ecdsa ; make -j$(nproc) | tee -a $TEST_OUTPUT
make pristine || true; cmake -Dunit-test=true -DHTTPPROXY=true -DBUILD=release -DKEX=ecdh -DAES_MODE=cbc -DDA=ecdsa256 -DPK_ENC=ecdsa ; make -j$(nproc) | tee -a $TEST_OUTPUT
make pristine || true; cmake -Dunit-test=true -DHTTPPROXY=true -DBUILD=release -DKEX=ecdh384 -DAES_MODE=ctr -DDA=ecdsa384 -DPK_ENC=ecdsa ; make -j$(nproc) | tee -a $TEST_OUTPUT
make pristine || true; cmake -Dunit-test=true -DHTTPPROXY=true -DBUILD=release -DKEX=ecdh384 -DAES_MODE=cbc -DDA=ecdsa384 -DPK_ENC=ecdsa ; make -j$(nproc) | tee -a $TEST_OUTPUT
make pristine || true; cmake -Dunit-test=true -DHTTPPROXY=true -DBUILD=release -DKEX=ecdh -DAES_MODE=ctr -DDA=ecdsa256 -DPK_ENC=ecdsa -DDA_FILE=pem ; make -j$(nproc) | tee -a $TEST_OUTPUT
fail_count=$(awk '/Tests Failed :/ {split($0,a,": "); count+=a[2]} END{print count}' $TEST_OUTPUT)
echo "Found $fail_count unit-test failure(s)."
exit $fail_count