Skip to content

Commit 08ee5d7

Browse files
committed
Use ubuntu 22.04 in docker image
The cross compilation of the latest psa-crypto sys crate fails for aarch64 target on a ubuntu 18.04 machine. This is due to the 0.63.0 version of bindgen in psa-crypto-sys. The latest bindgen crate has a check which compares size_t, ssize_t with target pointer and aborts if they are unequal when size_t_is_usize flag is set. In ubuntu 18.04 these are read as 4 and 8 bytes respectively which is wrong. This is an issue with the c library mismatchs of target toolchains in 18.04. Hence we are updating the docker test image to 22.04. Also, 18.04 is reaching end of life in April 2023. This commit involves the following changes: - Use ubuntu 22.04 as base image - Dependency packages missing in 22.04 have been added - Tpm library versions have been bumped as 22.04 has openssl > 3.0 - Older version libts used to generate keys has been removed as the missing dependencies for it causes compilation issues. Instead we use parsec 1.0.0 which uses a libts version which is compatible with 22.04 for generating keys for both SQLite and OnDisk KIM. Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com> # OnDisk KIM.
1 parent 14c31cb commit 08ee5d7

File tree

2 files changed

+28
-44
lines changed

2 files changed

+28
-44
lines changed

e2e_tests/docker_image/generate-keys.sh

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ wait_for_killprocess() {
2727
done
2828
}
2929

30-
configure_tpm()
30+
configure_tpm()
3131
{
3232
tpm_server &
3333
wait_for_process "tpm_server"
@@ -63,16 +63,16 @@ save_generated_mappings_keys()
6363
else
6464
mv /var/lib/parsec/kim-mappings $DESTINATION_PATH
6565
fi
66-
66+
6767
mv /tmp/create_keys/parsec/0000000000000002.psa_its $DESTINATION_PATH
6868
mv /tmp/create_keys/parsec/0000000000000003.psa_its $DESTINATION_PATH
6969
}
7070

7171
generate_and_store_keys_for_ondisk_KIM()
7272
{
73-
# This config.toml of parsec version 0.7.0 uses on disk manager. The latest
73+
# This config.toml of parsec version 0.7.0 uses on disk manager. The latest
7474
# one is updated to use SQLite manager.
75-
./target/debug/parsec -c e2e_tests/provider_cfg/all/config.toml &
75+
./target/debug/parsec -c e2e_tests/provider_cfg/all/on-disk-kim-all-providers.toml &
7676
wait_for_process "parsec"
7777
wait_for_file "/tmp/parsec.sock"
7878

@@ -111,7 +111,7 @@ generate_and_store_keys_for_sqlite_KIM()
111111
./target/debug/parsec -c e2e_tests/provider_cfg/all/config.toml &
112112
wait_for_process "parsec"
113113
wait_for_file "/tmp/parsec.sock"
114-
114+
115115
# Generate keys for all providers (trusted-service-provider isn't included)
116116
parsec-tool -p 1 create-rsa-key -k rsa-mbed
117117
parsec-tool -p 1 create-ecc-key -k ecc-mbed
@@ -156,35 +156,8 @@ EOF
156156
save_generated_mappings_keys /tmp/sqlite/ts-keys/
157157
}
158158

159-
# Install an old version mock Trusted Services compatible with old parsec 0.7.0
160-
# used in generate_key.sh script
161-
install_trusted_services_lib_old()
162-
{
163-
git clone https://git.trustedfirmware.org/TS/trusted-services.git --branch integration
164-
pushd trusted-services && git reset --hard 35c6d643b5f0c0387702e22bf742dd4878ca5ddd && popd
165-
# Install correct python dependencies
166-
pip3 install -r trusted-services/requirements.txt
167-
pushd /tmp/trusted-services/deployments/libts/linux-pc/
168-
cmake .
169-
make
170-
cp libts.so nanopb_install/lib/libprotobuf-nanopb.a mbedcrypto_install/lib/libmbedcrypto.a /usr/local/lib/
171-
popd
172-
rm -rf /tmp/trusted-services
173-
}
174159

175-
if [ "$1" == "ondisk" ]; then
176-
install_trusted_services_lib_old
177-
# Use an old version of the Parsec service to make sure keys can still be used
178-
# with today's version.
179-
git clone https://github.com/parallaxsecond/parsec.git --branch 0.7.0 /tmp/create_keys/parsec
180-
elif [ "$1" == "sqlite" ]; then
181-
# Use an old version of the Parsec service to make sure keys can still be used
182-
# with today's version.
183-
git clone https://github.com/parallaxsecond/parsec.git --branch 1.0.0 /tmp/create_keys/parsec
184-
else
185-
echo "Incorrect usage of script"
186-
exit 1
187-
fi
160+
git clone https://github.com/parallaxsecond/parsec.git --branch 1.0.0 /tmp/create_keys/parsec
188161

189162
cd /tmp/create_keys/parsec
190163
git submodule update --init --recursive

e2e_tests/docker_image/parsec-service-test-all.Dockerfile

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Copyright 2021 Contributors to the Parsec project.
22
# SPDX-License-Identifier: Apache-2.0
3-
FROM ubuntu:18.04
3+
FROM ubuntu:22.04
44

55
# The specific version of libraries used in this Dockerfile should not change without having
66
# carefully checked that this is not breaking stability.
@@ -9,27 +9,27 @@ FROM ubuntu:18.04
99

1010
ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig
1111

12-
RUN apt update
12+
RUN apt-get update && apt-get -y upgrade
1313
RUN apt install -y autoconf-archive libcmocka0 libcmocka-dev procps
1414
RUN apt install -y iproute2 build-essential git pkg-config gcc libtool automake libssl-dev uthash-dev doxygen libjson-c-dev
1515
RUN apt install -y --fix-missing wget python3 cmake clang
1616
RUN apt install -y libini-config-dev libcurl4-openssl-dev curl libgcc1
17-
RUN apt install -y python3-distutils libclang-6.0-dev protobuf-compiler python3-pip
17+
RUN apt install -y python3-distutils libclang-11-dev protobuf-compiler python3-pip
18+
RUN apt install -y libgcrypt20-dev uuid-dev
1819
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata
1920
WORKDIR /tmp
2021

21-
# Download and install TSS 2.0
22-
RUN git clone https://github.com/tpm2-software/tpm2-tss.git --branch 2.3.3
22+
# Download and install TSS 3.2.0
23+
RUN git clone https://github.com/tpm2-software/tpm2-tss.git --branch 3.2.0
2324
RUN cd tpm2-tss \
2425
&& ./bootstrap \
2526
&& ./configure \
2627
&& make -j$(nproc) \
2728
&& make install \
2829
&& ldconfig
29-
RUN rm -rf tpm2-tss
3030

31-
# Download and install TPM 2.0 Tools verison 4.1.1
32-
RUN git clone https://github.com/tpm2-software/tpm2-tools.git --branch 4.1.1
31+
# Download and install TPM 2.0 Tools verison 5.5
32+
RUN git clone https://github.com/tpm2-software/tpm2-tools.git --branch 5.5
3333
RUN cd tpm2-tools \
3434
&& ./bootstrap \
3535
&& ./configure --prefix=/usr \
@@ -38,9 +38,9 @@ RUN cd tpm2-tools \
3838
RUN rm -rf tpm2-tools
3939

4040
# Download and install software TPM
41-
ARG ibmtpm_name=ibmtpm1637
41+
ARG ibmtpm_name=ibmtpm1682
4242
RUN wget -L "https://downloads.sourceforge.net/project/ibmswtpm2/$ibmtpm_name.tar.gz"
43-
RUN sha256sum $ibmtpm_name.tar.gz | grep ^dd3a4c3f7724243bc9ebcd5c39bbf87b82c696d1c1241cb8e5883534f6e2e327
43+
RUN sha256sum $ibmtpm_name.tar.gz | grep ^3cb642f871a17b23d50b046e5f95f449c2287415fc1e7aeb4bdbb8920dbcb38f
4444
RUN mkdir -p $ibmtpm_name \
4545
&& tar -xvf $ibmtpm_name.tar.gz -C $ibmtpm_name \
4646
&& chown -R root:root $ibmtpm_name \
@@ -123,7 +123,6 @@ ENV PARSEC_SERVICE_ENDPOINT="unix:/tmp/parsec.sock"
123123

124124
# Generate keys for the key mappings test for ondisk KIM
125125
COPY generate-keys.sh /tmp/
126-
RUN ./generate-keys.sh ondisk
127126

128127
# Install mock Trusted Services
129128
RUN git clone https://git.trustedfirmware.org/TS/trusted-services.git --branch integration \
@@ -138,8 +137,20 @@ RUN cd trusted-services/deployments/libts/linux-pc/ \
138137
RUN rm -rf trusted-services
139138

140139
# Generate keys for the key mappings test for sqlite KIM
140+
RUN ./generate-keys.sh ondisk
141141
RUN ./generate-keys.sh sqlite
142142

143+
# Compile latest version of tpm2-tss
144+
RUN cd tpm2-tss \
145+
&& make uninstall \
146+
&& git checkout 4.0.1 \
147+
&& ./bootstrap \
148+
&& ./configure \
149+
&& make -j$(nproc) \
150+
&& make install \
151+
&& ldconfig
152+
RUN rm -rf tpm2-tss
153+
143154
# Import an old version of the e2e tests
144155
COPY import-old-e2e-tests.sh /tmp/
145156
RUN ./import-old-e2e-tests.sh

0 commit comments

Comments
 (0)