Skip to content

Commit 44ea63b

Browse files
authored
Merge pull request #47 from TheMaxMur/develop
Release v0.4.0
2 parents 01c11a2 + ec64aeb commit 44ea63b

127 files changed

Lines changed: 6588 additions & 1085 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ rustflags = [
99
"-C", "link-arg=--nmagic",
1010
"-C", "link-arg=-Tlink.x",
1111
"-C", "target-cpu=cortex-m33",
12+
"--cfg", "bp256_backend=\"bigint\"",
13+
"--cfg", "bp384_backend=\"bigint\"",
1214
]

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,21 @@ jobs:
100100
- name: display
101101
args: "--features display"
102102
env: "LED_KIND=none FLASH_SIZE=16M"
103+
# Flash-geometry siblings of the default image (default features, RS-Key
104+
# identity). 2mb shrinks KVMAIN so the image still fits ≥1 MiB of code;
105+
# smoke-building it here catches a link/fit regression in PR CI rather
106+
# than at tag time.
107+
- name: 2mb
108+
args: ""
109+
env: "FLASH_SIZE=2M KVMAIN=896K"
110+
- name: 16mb
111+
args: ""
112+
env: "FLASH_SIZE=16M"
113+
# The strict admin-write posture (historical default). The permissive
114+
# default is what every other row builds; smoke-build this so the
115+
# strict-gated code keeps compiling.
116+
- name: strict-config
117+
args: "--features strict-config"
103118
runs-on: ubuntu-latest
104119
timeout-minutes: 60
105120
steps:

.github/workflows/deep-checks.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
# fuzz — a timed libFuzzer pass over every cargo-fuzz target. The corpus
99
# is carried between runs via the actions cache, so its coverage
1010
# accumulates day over day; crash artifacts are uploaded.
11+
# fuzz-coverage — per-target libFuzzer region/line coverage over that
12+
# accumulated corpus (scripts/fuzz-coverage.sh): a summary table on the
13+
# step page and the per-target HTML uploaded. Advisory, not a gate.
1114
# kani — the #[kani::proof] bounded model-checking harnesses (docs/
1215
# testing.md). Kani is not in nixpkgs and its setup downloads a
1316
# prebuilt CBMC bundle, so this one job is rustup-based, not nix.
@@ -26,6 +29,7 @@
2629
# and self-tests on any push that edits this file. Local equivalents:
2730
# nix develop .#fuzz -c cargo miri test --manifest-path fuzz/Cargo.toml
2831
# nix develop .#fuzz -c cargo fuzz run <target> -- -max_total_time=120
32+
# nix develop .#fuzz -c ./scripts/fuzz-coverage.sh
2933
# cargo kani -p rsk-sdk -p rsk-fs -p rsk-rsa-asm -p rsk-crypto -p rsk-mldsa -p rsk-rescue -p rsk-openpgp -p rsk-otp -p rsk-piv -p rsk-oath -p rsk-usb (cargo install kani-verifier)
3034
# nix develop -c cargo llvm-cov --summary-only --fail-under-lines 80 --target <host> -p rsk-sdk … -p rsk-slip39
3135
# nix develop -c ./scripts/complexity_gate.sh
@@ -43,7 +47,12 @@ on:
4347
push:
4448
branches: [main]
4549
paths:
46-
[".github/workflows/deep-checks.yml", "nix/devshells.nix", "nix/firmware.nix"]
50+
[
51+
".github/workflows/deep-checks.yml",
52+
"nix/devshells.nix",
53+
"nix/firmware.nix",
54+
"scripts/fuzz-coverage.sh",
55+
]
4756

4857
permissions:
4958
contents: read
@@ -146,6 +155,51 @@ jobs:
146155
path: fuzz/corpus
147156
key: fuzz-corpus-${{ github.run_id }}
148157

158+
fuzz-coverage:
159+
runs-on: ubuntu-latest
160+
timeout-minutes: 120
161+
steps:
162+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
163+
164+
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
165+
166+
- uses: nix-community/cache-nix-action@7df957e333c1e5da7721f60227dbba6d06080569 # v7.0.2
167+
with:
168+
primary-key: nix-fuzz-${{ runner.os }}-${{ hashFiles('flake.lock') }}
169+
restore-prefixes-first-match: |
170+
nix-fuzz-${{ runner.os }}-
171+
nix-${{ runner.os }}-
172+
173+
# The instrumented coverage build lives in fuzz/coverage/.build (a distinct
174+
# target-dir from the fuzzing build), so cache it under its own key.
175+
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
176+
with:
177+
path: |
178+
~/.cargo/registry
179+
~/.cargo/git
180+
fuzz/coverage/.build
181+
key: fuzz-cov-${{ runner.os }}-${{ hashFiles('fuzz/Cargo.lock', 'flake.lock') }}
182+
restore-keys: fuzz-cov-${{ runner.os }}-
183+
184+
# Read (never write) the corpus the `fuzz` job accumulated on the previous
185+
# run: coverage measures those saved inputs, not a fresh fuzzing pass.
186+
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
187+
with:
188+
path: fuzz/corpus
189+
key: fuzz-corpus-${{ github.run_id }}
190+
restore-keys: fuzz-corpus-
191+
192+
- name: per-target libFuzzer coverage over the accumulated corpus
193+
run: nix develop .#fuzz -c ./scripts/fuzz-coverage.sh
194+
195+
- name: upload the per-target HTML reports
196+
if: always()
197+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
198+
with:
199+
name: fuzz-coverage-${{ github.run_id }}
200+
path: fuzz/coverage/*/html
201+
if-no-files-found: ignore
202+
149203
kani:
150204
runs-on: ubuntu-latest
151205
timeout-minutes: 120
@@ -230,8 +284,8 @@ jobs:
230284
nix develop -c cargo llvm-cov --summary-only --fail-under-lines 80 \
231285
--target x86_64-unknown-linux-gnu \
232286
-p rsk-sdk -p rsk-fs -p rsk-usb -p rsk-crypto -p rsk-fido -p rsk-openpgp \
233-
-p rsk-rsa-asm -p rsk-mgmt -p rsk-oath -p rsk-otp -p rsk-piv -p rsk-rescue \
234-
-p rsk-led -p rsk-ui -p rsk-bip39 -p rsk-slip39
287+
-p rsk-rsa-asm -p rsk-sha512 -p rsk-ec -p rsk-mldsa -p rsk-mgmt -p rsk-oath -p rsk-otp -p rsk-piv \
288+
-p rsk-rescue -p rsk-led -p rsk-ui -p rsk-bip39 -p rsk-slip39 -p rsk-bench
235289
236290
complexity:
237291
runs-on: ubuntu-latest

.github/workflows/release-build.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
# an inline `attest-build-provenance` step can prove, i.e. Build L2).
1313
# See https://docs.github.com/actions/security-guides/using-artifact-attestations-and-reusable-workflows-to-achieve-slsa-v1-build-level-3
1414
#
15-
# This job: builds the 11 shipped firmware flavors reproducibly via `nix build`,
16-
# GATES on a bit-identical rebuild of all eleven (a non-reproducible image fails the
15+
# This job: builds the 14 shipped firmware flavors reproducibly via `nix build`,
16+
# GATES on a bit-identical rebuild of all fourteen (a non-reproducible image fails the
1717
# job before anything is published), generates a CycloneDX SBOM, hashes everything
1818
# into SHA256SUMS, attests GitHub build provenance for every .uf2, signs the
1919
# checksums with keyless cosign (sigstore/Fulcio via OIDC — no private key), and
@@ -84,20 +84,23 @@ jobs:
8484
echo "tag=$tag" >> "$GITHUB_OUTPUT"
8585
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
8686
87-
- name: build the 11 reproducible firmware flavors
87+
- name: build the 14 reproducible firmware flavors
8888
run: |
8989
tag="${{ steps.tag.outputs.tag }}"
9090
mkdir -p dist
9191
# The ten touch-required flavors (default/pqc, fips/fips-pqc, the
9292
# strong-pin PIN-hardening pair, and the always-uv / strict-up behavior
9393
# pairs) plus the trusted-display flavor (its on-screen Approve/Deny is
94-
# the physical-consent gate). `strict-up` ships with a caveat: it is not
95-
# spec-conformant for the up:false pre-flight (docs/releases.md). The
96-
# `no-touch` flavors auto-confirm user presence (test-only; see
97-
# firmware/Cargo.toml "Never ship a no-touch build") and MUST NOT be
98-
# published — a signed no-touch asset would remove the physical-consent
99-
# gate from an end-user build.
100-
for pkg in firmware firmware-pqc firmware-fips firmware-fips-pqc firmware-strong-pin firmware-strong-pin-pqc firmware-always-uv firmware-always-uv-pqc firmware-strict-up firmware-strict-up-pqc firmware-display; do
94+
# the physical-consent gate) and the two flash-geometry siblings of the
95+
# default image (2mb / 16mb — same features + RS-Key identity, only the
96+
# flash map differs, for boards whose chip is not the 4 MB default).
97+
# `strict-up` ships with a caveat: it is not spec-conformant for the
98+
# up:false pre-flight (docs/releases.md). The `no-touch` flavors
99+
# auto-confirm user presence (test-only; see firmware/Cargo.toml
100+
# "Never ship a no-touch build") and MUST NOT be published — a signed
101+
# no-touch asset would remove the physical-consent gate from an
102+
# end-user build.
103+
for pkg in firmware firmware-pqc firmware-fips firmware-fips-pqc firmware-strong-pin firmware-strong-pin-pqc firmware-always-uv firmware-always-uv-pqc firmware-strict-up firmware-strict-up-pqc firmware-display firmware-2mb firmware-16mb firmware-strict-config; do
101104
echo "::group::nix build .#$pkg"
102105
out="$(nix build ".#$pkg" --no-link --print-out-paths)"
103106
label="${pkg#firmware}"; label="${label#-}"
@@ -107,17 +110,17 @@ jobs:
107110
done
108111
ls -l dist
109112
110-
- name: reproducibility gate — rebuild all 5, require bit-identical
113+
- name: reproducibility gate — rebuild all 14, require bit-identical
111114
run: |
112115
# `nix build --rebuild` recompiles the derivation already in the store
113116
# and fails with a hash mismatch if the output is not bit-identical.
114117
# A non-reproducible flavor fails here, before the release is created.
115-
for pkg in firmware firmware-pqc firmware-fips firmware-fips-pqc firmware-strong-pin firmware-strong-pin-pqc firmware-always-uv firmware-always-uv-pqc firmware-strict-up firmware-strict-up-pqc firmware-display; do
118+
for pkg in firmware firmware-pqc firmware-fips firmware-fips-pqc firmware-strong-pin firmware-strong-pin-pqc firmware-always-uv firmware-always-uv-pqc firmware-strict-up firmware-strict-up-pqc firmware-display firmware-2mb firmware-16mb firmware-strict-config; do
116119
echo "::group::nix build .#$pkg --rebuild"
117120
nix build ".#$pkg" --rebuild --no-link
118121
echo "::endgroup::"
119122
done
120-
echo "all 11 flavors rebuilt bit-identical"
123+
echo "all 14 flavors rebuilt bit-identical"
121124
122125
- name: generate the CycloneDX SBOM
123126
run: |

0 commit comments

Comments
 (0)