|
| 1 | +name: PQC Examples (v1.85) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + pqc-examples: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + timeout-minutes: 30 |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout wolfTPM |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Checkout wolfSSL |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + repository: wolfssl/wolfssl |
| 22 | + path: wolfssl |
| 23 | + ref: master |
| 24 | + |
| 25 | + - name: Install build deps + tpm2-tools |
| 26 | + run: | |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install -y tpm2-tools libtss2-tcti-mssim0 |
| 29 | +
|
| 30 | + - name: Build wolfSSL with PQC |
| 31 | + working-directory: ./wolfssl |
| 32 | + run: | |
| 33 | + ./autogen.sh |
| 34 | + ./configure --enable-wolftpm --enable-pkcallbacks --enable-keygen \ |
| 35 | + --enable-dilithium --enable-mlkem --enable-experimental \ |
| 36 | + --enable-harden \ |
| 37 | + CFLAGS="-DWC_RSA_NO_PADDING" |
| 38 | + make |
| 39 | + sudo make install |
| 40 | + sudo ldconfig |
| 41 | +
|
| 42 | + - name: Build wolfTPM with v1.85 + fwTPM + debug |
| 43 | + run: | |
| 44 | + ./autogen.sh |
| 45 | + # --enable-swtpm omitted: it's the Linux configure default |
| 46 | + # (configure.ac:287). Passing it explicitly was redundant. |
| 47 | + # --enable-debug=verbose: full client + fwTPM dispatch logs so |
| 48 | + # CI failures (e.g. keyload integrity) come with TPM-side trace. |
| 49 | + ./configure --enable-v185 --enable-fwtpm --enable-debug=verbose |
| 50 | + make |
| 51 | +
|
| 52 | + # ----- Tier 1: make check ----- |
| 53 | + # Runs unit.test (wrapper) + fwtpm_unit.test (handler) + tpm2-tools |
| 54 | + # compatibility + tests/pqc_mssim_e2e.sh in one shot via fwtpm_check.sh. |
| 55 | + - name: make check (unit + fwtpm_unit + tpm2-tools + pqc_mssim_e2e.sh) |
| 56 | + env: |
| 57 | + WOLFSSL_PATH: ${{ github.workspace }}/wolfssl |
| 58 | + run: | |
| 59 | + FWTPM_USE_FIXED_PORT=1 \ |
| 60 | + sudo -E unshare --net /bin/bash -c ' |
| 61 | + set -e |
| 62 | + ip link set lo up |
| 63 | + make check |
| 64 | + ' |
| 65 | + # make check runs as root via sudo -E unshare; restore ownership of |
| 66 | + # any files left in the workspace so later steps (running as the |
| 67 | + # unprivileged runner) can rewrite them — otherwise stale root-owned |
| 68 | + # blobs (e.g. eccblob.bin) silently break run_examples.sh later. |
| 69 | + sudo chown -R "$(id -u):$(id -g)" . |
| 70 | +
|
| 71 | + # ----- Tier 2: per-example standalone runs ----- |
| 72 | + # Each example gets its own GitHub Actions check so a regression |
| 73 | + # surfaces with a clear failure signal — not buried inside make check. |
| 74 | + - name: Start fwtpm_server for standalone example runs |
| 75 | + run: | |
| 76 | + rm -f fwtpm_nv.bin |
| 77 | + ./src/fwtpm/fwtpm_server > /tmp/fwtpm_server.log 2>&1 & |
| 78 | + echo $! > /tmp/fwtpm_server.pid |
| 79 | + sleep 1 |
| 80 | + kill -0 $(cat /tmp/fwtpm_server.pid) |
| 81 | +
|
| 82 | + - name: PQC keygen — every parameter set |
| 83 | + run: | |
| 84 | + for ps in 44 65 87; do |
| 85 | + ./examples/keygen/keygen mldsa_sk.bin -mldsa=$ps || exit 1 |
| 86 | + ./examples/keygen/keygen hmldsa_sk.bin -hash_mldsa=$ps || exit 1 |
| 87 | + done |
| 88 | + for ps in 512 768 1024; do |
| 89 | + ./examples/keygen/keygen mlkem_sk.bin -mlkem=$ps || exit 1 |
| 90 | + done |
| 91 | +
|
| 92 | + - name: ML-DSA sign + verify example (standalone) |
| 93 | + run: ./examples/pqc/mldsa_sign |
| 94 | + |
| 95 | + - name: ML-KEM encap + decap example (standalone) |
| 96 | + run: ./examples/pqc/mlkem_encap |
| 97 | + |
| 98 | + - name: Stop Tier 2 fwtpm_server (free port 2321 for E2E) |
| 99 | + run: | |
| 100 | + if [ -f /tmp/fwtpm_server.pid ]; then |
| 101 | + kill "$(cat /tmp/fwtpm_server.pid)" 2>/dev/null || true |
| 102 | + rm -f /tmp/fwtpm_server.pid |
| 103 | + fi |
| 104 | + # Defensive: kill any other default-port server lingering. |
| 105 | + pkill -f "fwtpm_server$" 2>/dev/null || true |
| 106 | + sleep 1 |
| 107 | +
|
| 108 | + - name: PQC mssim E2E (MLKEM-768 + HashMLDSA-65 round-trips) |
| 109 | + run: ./tests/pqc_mssim_e2e.sh |
| 110 | + |
| 111 | + - name: Restart fwtpm_server for Tier 5 (run_examples.sh) |
| 112 | + run: | |
| 113 | + # pqc_mssim_e2e.sh started + stopped its own server; Tier 5 needs |
| 114 | + # one again. Reuse the same default-port launch as Tier 2. |
| 115 | + pkill -f "fwtpm_server" 2>/dev/null || true |
| 116 | + sleep 1 |
| 117 | + rm -f fwtpm_nv.bin |
| 118 | + ./src/fwtpm/fwtpm_server > /tmp/fwtpm_server.log 2>&1 & |
| 119 | + echo $! > /tmp/fwtpm_server.pid |
| 120 | + sleep 1 |
| 121 | + kill -0 "$(cat /tmp/fwtpm_server.pid)" |
| 122 | +
|
| 123 | + - name: Doc constants parity check |
| 124 | + run: | |
| 125 | + ./tests/check_doc_constants.sh |
| 126 | + rc=$? |
| 127 | + if [ $rc -eq 77 ]; then |
| 128 | + echo "Step skipped (exit 77 — header or doc missing)" |
| 129 | + exit 0 |
| 130 | + fi |
| 131 | + exit $rc |
| 132 | +
|
| 133 | + # ----- Tier 5: full run_examples.sh sweep ----- |
| 134 | + # run_examples.sh does not start its own TPM — it expects one already |
| 135 | + # listening. Reuse the fwtpm_server started in Tier 2. Trace each |
| 136 | + # command (set -x) so the failing call line is in the CI log; on |
| 137 | + # failure, dump run.out (where the script redirects example stdout). |
| 138 | + - name: run_examples.sh full pass (auto-detects v1.85, runs 18-way matrix) |
| 139 | + env: |
| 140 | + WOLFSSL_PATH: ${{ github.workspace }}/wolfssl |
| 141 | + run: | |
| 142 | + set +e |
| 143 | + bash -x ./examples/run_examples.sh |
| 144 | + rc=$? |
| 145 | + set -e |
| 146 | + if [ $rc -ne 0 ]; then |
| 147 | + echo "=== run.out (last 200 lines) ===" |
| 148 | + tail -200 run.out |
| 149 | + echo "=== fwtpm_server.log (last 100 lines) ===" |
| 150 | + tail -100 /tmp/fwtpm_server.log |
| 151 | + fi |
| 152 | + exit $rc |
| 153 | +
|
| 154 | + - name: Stop fwtpm_server |
| 155 | + if: always() |
| 156 | + run: | |
| 157 | + if [ -f /tmp/fwtpm_server.pid ]; then |
| 158 | + kill $(cat /tmp/fwtpm_server.pid) 2>/dev/null || true |
| 159 | + rm -f /tmp/fwtpm_server.pid |
| 160 | + fi |
| 161 | +
|
| 162 | + - name: Upload failure logs |
| 163 | + if: failure() |
| 164 | + uses: actions/upload-artifact@v4 |
| 165 | + with: |
| 166 | + name: pqc-examples-logs |
| 167 | + path: | |
| 168 | + /tmp/fwtpm_server.log |
| 169 | + /tmp/fwtpm_check_*.log |
| 170 | + test-suite.log |
| 171 | + tests/*.log |
| 172 | + config.log |
| 173 | + run.out |
| 174 | + retention-days: 5 |
0 commit comments