|
| 1 | +name: WolfPKCS11 wolfBoot emulator tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +env: |
| 10 | + WOLFBOOT_REPO: https://github.com/wolfSSL/wolfBoot.git |
| 11 | + WOLFBOOT_BRANCH: master |
| 12 | + |
| 13 | +jobs: |
| 14 | + stm32h5_pkcs11_persist: |
| 15 | + name: stm32h5-pkcs11-persist |
| 16 | + runs-on: ubuntu-latest |
| 17 | + container: |
| 18 | + image: ghcr.io/danielinux/m33mu-ci:1.8 |
| 19 | + timeout-minutes: 25 |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout wolfPKCS11 |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Clone wolfBoot and link tested wolfPKCS11 |
| 26 | + run: | |
| 27 | + set -euxo pipefail |
| 28 | +
|
| 29 | + git config --global --add safe.directory "${GITHUB_WORKSPACE}" |
| 30 | + git clone --depth 1 --branch "${WOLFBOOT_BRANCH}" "${WOLFBOOT_REPO}" wolfboot |
| 31 | + git -C wolfboot config --global --add safe.directory "${GITHUB_WORKSPACE}/wolfboot" |
| 32 | + git -C wolfboot submodule update --init --recursive |
| 33 | + rm -rf wolfboot/lib/wolfPKCS11 |
| 34 | + ln -s "${GITHUB_WORKSPACE}" wolfboot/lib/wolfPKCS11 |
| 35 | + test -L wolfboot/lib/wolfPKCS11 |
| 36 | + test "$(realpath wolfboot/lib/wolfPKCS11)" = "${GITHUB_WORKSPACE}" |
| 37 | +
|
| 38 | + - name: Clean build tree for PKCS11 test (stm32h5) |
| 39 | + working-directory: wolfboot |
| 40 | + run: | |
| 41 | + make clean distclean |
| 42 | +
|
| 43 | + - name: Configure PKCS11 test (stm32h5) |
| 44 | + working-directory: wolfboot |
| 45 | + run: | |
| 46 | + cp config/examples/stm32h5-tz.config .config |
| 47 | +
|
| 48 | + - name: Build persistent PKCS11 test app (stm32h5) |
| 49 | + working-directory: wolfboot |
| 50 | + run: | |
| 51 | + make PKCS11_TESTAPP=1 |
| 52 | +
|
| 53 | + - name: Prepare PKCS11 persistence directory |
| 54 | + run: | |
| 55 | + rm -rf /tmp/m33mu-pkcs11-persist |
| 56 | + mkdir -p /tmp/m33mu-pkcs11-persist |
| 57 | + rm -f /tmp/m33mu-pkcs11-first.log /tmp/m33mu-pkcs11-second.log |
| 58 | +
|
| 59 | + - name: Run PKCS11 first boot (stm32h5) |
| 60 | + run: | |
| 61 | + cd /tmp/m33mu-pkcs11-persist |
| 62 | + m33mu "${GITHUB_WORKSPACE}/wolfboot/wolfboot.bin" \ |
| 63 | + "${GITHUB_WORKSPACE}/wolfboot/test-app/image_v1_signed.bin:0x60000" \ |
| 64 | + --persist --uart-stdout --timeout 120 --expect-bkpt 0x7d \ |
| 65 | + | tee /tmp/m33mu-pkcs11-first.log |
| 66 | +
|
| 67 | + - name: Verify PKCS11 first boot (stm32h5) |
| 68 | + run: | |
| 69 | + grep -q "pkcs11: first boot path, creating persistent objects" /tmp/m33mu-pkcs11-first.log |
| 70 | + grep -q "pkcs11: created persistent PKCS11 objects" /tmp/m33mu-pkcs11-first.log |
| 71 | + grep -q "pkcs11: success" /tmp/m33mu-pkcs11-first.log |
| 72 | + grep -q "\\[BKPT\\] imm=0x7d" /tmp/m33mu-pkcs11-first.log |
| 73 | + grep -q "\\[EXPECT BKPT\\] Success" /tmp/m33mu-pkcs11-first.log |
| 74 | +
|
| 75 | + - name: Run PKCS11 second boot (stm32h5) |
| 76 | + run: | |
| 77 | + cd /tmp/m33mu-pkcs11-persist |
| 78 | + m33mu "${GITHUB_WORKSPACE}/wolfboot/wolfboot.bin" \ |
| 79 | + "${GITHUB_WORKSPACE}/wolfboot/test-app/image_v1_signed.bin:0x60000" \ |
| 80 | + --persist --uart-stdout --timeout 120 --expect-bkpt 0x7f \ |
| 81 | + | tee /tmp/m33mu-pkcs11-second.log |
| 82 | +
|
| 83 | + - name: Verify PKCS11 second boot (stm32h5) |
| 84 | + run: | |
| 85 | + grep -q "pkcs11: second boot path, restoring persistent objects" /tmp/m33mu-pkcs11-second.log |
| 86 | + grep -q "pkcs11: restored persistent PKCS11 objects" /tmp/m33mu-pkcs11-second.log |
| 87 | + grep -q "pkcs11: success" /tmp/m33mu-pkcs11-second.log |
| 88 | + grep -q "\\[BKPT\\] imm=0x7f" /tmp/m33mu-pkcs11-second.log |
| 89 | + grep -q "\\[EXPECT BKPT\\] Success" /tmp/m33mu-pkcs11-second.log |
0 commit comments