Reproducible builds of Pico FIDO2 firmware for the RP2350

I wanted a hardware security key and after some searching decided to build one myself, based on an open source project and a €10 Waveshare RP2350-One. The build worked on the first try, but it reached out to the network while building, and I realized I didn’t much like not knowing exactly what I was flashing onto my device every time. So I thought maybe Nix could help.

The flake linked above pins every upstream requirement in flake.lock. Nothing is vendored, and the upstream tree isn’t patched. The two mid-build fetches, picotool from git and a git checkout of mbedtls, are supplied from those pinned inputs instead, which is what makes a sandboxed build possible at all.

What surprised me most was that the builds come out bit-identical. Most MCU builds bake in a timestamp or a build path somewhere, so I expected to spend a while patching that out. nix run .#verify rebuilds and diffs against the store.

The flake also includes helpers to flash the board, sign images, and burn the OTP for secure boot. The signing key lives in pass and never enters the store. One of my blog’s readers on Fedora let me know they got it working with nix-user-chroot and successfully flashed their board.

Any feedback or experiences with this form of packaging are very welcome.

3 Likes

Nice!

TIL these projects. Very cool to be able to get FIDO2 and OpenPGP on a $10 USB dongle.

Very handy to see a Nix packaging of this.

If anyone knows of something similar in the Yubikey 5 Nano form factor, let me know!

1 Like

I only know of Somu | Crowd Supply but it doesn’t mention GPG anywhere so I suspect it’s not powerful enough for that… neat project nonetheless.

2 Likes