From 0b1594c5a7757aaa482b537afc004ab0187b76bf Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Tue, 14 Jul 2026 12:06:47 +0200 Subject: [PATCH] Switch to bookworm test. Signed-off-by: Pol Henarejos --- .github/workflows/test.yml | 2 +- CMakeLists.txt | 4 +-- Dockerfile | 54 -------------------------------- tests/build-in-docker.sh | 4 +-- tests/docker/bookworm/Dockerfile | 50 +++++++++++++++++++++++++++++ tests/docker_env.sh | 2 +- 6 files changed, 55 insertions(+), 61 deletions(-) delete mode 100644 Dockerfile create mode 100644 tests/docker/bookworm/Dockerfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c306b7..db58bb1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,7 +40,7 @@ jobs: - name: Export image run: | mkdir -p artifacts - docker save pico-hsm-test:bullseye -o artifacts/docker-image.tar + docker save pico-hsm-test:bookworm -o artifacts/docker-image.tar - name: Temporarily save image uses: actions/upload-artifact@v4 with: diff --git a/CMakeLists.txt b/CMakeLists.txt index a63d4d4..dfea808 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,7 @@ else() endif() set(USB_ITF_CCID 1) set(USB_ITF_WCID 1) +set(ENABLE_LIBCVC 1) include(pico-keys-sdk/picokeys_sdk_import.cmake) if(NOT ESP_PLATFORM) set(SOURCES ${PICOKEYS_SOURCES}) @@ -137,9 +138,6 @@ if(NOT ESP_PLATFORM) ) endif(APPLE) set(PICO_HSM_EMU_LIBS picokeys_sdk pthread m) - if(NOT SKIP_MBEDTLS_FOR_OPENSSL_EMULATION) - list(APPEND PICO_HSM_EMU_LIBS mbedtls) - endif() target_link_libraries(pico_hsm PRIVATE ${PICO_HSM_EMU_LIBS}) else() pico_add_extra_outputs(${CMAKE_PROJECT_NAME}) diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d3a37bc..0000000 --- a/Dockerfile +++ /dev/null @@ -1,54 +0,0 @@ -FROM debian:bullseye -ENV DEBIAN_FRONTEND noninteractive -RUN apt-get update && apt-get install -y \ - build-essential \ - git \ - cmake \ - gcc-arm-none-eabi \ - libnewlib-arm-none-eabi \ - libstdc++-arm-none-eabi-newlib \ - python3 \ - python3-pip - -RUN useradd -m builduser - -USER builduser - -WORKDIR /home/builduser - -VOLUME /home/builduser/release - -ARG VERSION_PICO_SDK 2.0.0 - -RUN mkdir -p /home/builduser/Devel/pico -RUN cd /home/builduser/Devel/pico \ - && git clone https://github.com/raspberrypi/pico-sdk.git \ - && cd pico-sdk \ - && git checkout $VERSION_PICO_SDK \ - && git submodule update --init --recursive - -RUN pip install cryptography - -ARG VERSION_MAJOR 4 -ARG VERSION_MINOR 2 - -RUN cd /home/builduser \ - && git clone https://github.com/polhenarejos/pico-hsm.git \ - && cd pico-hsm \ - && git checkout v${VERSION_MAJOR}.${VERSION_MINOR} \ - && git submodule update --init --recursive \ - && mkdir build_release - -ENV PICO_SDK_PATH /home/builduser/Devel/pico/pico-sdk - - - -ARG USB_VID 0xfeff -ARG USB_PID 0xfcfd - -ARG PICO_BOARD waveshare_rp2040_zero - -RUN cd /home/builduser/pico-hsm \ - && cd build_release \ - && cmake .. -DPICO_BOARD=$PICO_BOARD -DUSB_VID=${USB_VID} -DUSB_PID=${USB_PID} \ - && make -kj20 diff --git a/tests/build-in-docker.sh b/tests/build-in-docker.sh index 04d4785..0da8e3a 100755 --- a/tests/build-in-docker.sh +++ b/tests/build-in-docker.sh @@ -6,9 +6,9 @@ build_image run_in_docker mkdir -p build_in_docker run_in_docker -w "$PWD/build_in_docker" cmake -DENABLE_EMULATION=1 -D__FOR_CI=1 -DENABLE_EDDSA=1 .. run_in_docker -w "$PWD/build_in_docker" make -j ${NUM_PROC} -docker create --name temp_container pico-hsm-test:bullseye +docker create --name temp_container pico-hsm-test:bookworm docker cp $PWD/build_in_docker/pico_hsm temp_container:/pico_hsm -docker commit temp_container pico-hsm-test:bullseye +docker commit temp_container pico-hsm-test:bookworm docker stop temp_container docker rm temp_container docker image prune -f diff --git a/tests/docker/bookworm/Dockerfile b/tests/docker/bookworm/Dockerfile new file mode 100644 index 0000000..4c818af --- /dev/null +++ b/tests/docker/bookworm/Dockerfile @@ -0,0 +1,50 @@ +FROM debian:bookworm + +ARG DEBIAN_FRONTEND=noninteractive + +RUN apt update && apt upgrade -y +RUN apt install -y apt-utils +RUN apt autoremove -y +RUN rm -rf /var/cache/apt/archives/* +RUN apt install -y libccid \ + libpcsclite-dev \ + git \ + autoconf \ + pkg-config \ + libtool \ + help2man \ + automake \ + gcc \ + make \ + build-essential \ + python3 \ + python3-pip \ + swig \ + libssl-dev \ + cmake \ + libtss2-dev \ + tpm2-tools \ + swtpm \ + vsmartcard-vpcd \ + && rm -rf /var/lib/apt/lists/* +RUN pip install --break-system-packages pytest pycvc cryptography base58 +WORKDIR / +RUN git clone https://github.com/OpenSC/OpenSC +WORKDIR /OpenSC +RUN git checkout tags/0.26.1 +RUN ./bootstrap +RUN ./configure --enable-openssl +RUN make -j `nproc` +RUN make install +RUN make clean +RUN ldconfig +WORKDIR / +RUN git clone https://github.com/CardContact/sc-hsm-embedded +WORKDIR /sc-hsm-embedded +RUN autoreconf -fi +RUN ./configure +RUN make -j `nproc` +RUN make install +RUN cp ./src/tests/sc-hsm-pkcs11-test /usr/local/bin/sc-hsm-pkcs11-test +RUN make clean +WORKDIR / diff --git a/tests/docker_env.sh b/tests/docker_env.sh index c801fb8..e1df341 100755 --- a/tests/docker_env.sh +++ b/tests/docker_env.sh @@ -46,7 +46,7 @@ # default values, can be overridden by the environment -: ${MBEDTLS_DOCKER_GUEST:=bullseye} +: ${MBEDTLS_DOCKER_GUEST:=bookworm} DOCKER_IMAGE_TAG="pico-hsm-test:${MBEDTLS_DOCKER_GUEST}"