At least for the Pico 2 / RP2350 this is anything but post-quantum secure. From the README:
> Two independent keys protect the chain: the ROM checks microtun boot against the secp256k1 key in OTP,
> and microtun boot checks the application against the FN-DSA-512 (fn-dsa-512-exp) keys compiled into it.
So this is a chained bootloader, break secp256k1 and you can replace the microtun-boot bootloader in flash and the post-quantum signature check never even runs. That makes this entire bootloader pointless - either the attacker can modify flash and thus just remove your bootloader or you assume flash can only changed by the running program in which case you should check the signature of the firmware update at flash time, not during boot. It also doesn't seem to provide any of the features you'd want in such a bootloader, like encryption support or remote attestation.
In theory you could put this bootloader into OTP, but unfortunately the RP2350's bootrom is not designed for that at all. You basically lose all other boot options + hibernate if you do that, if you can manage to fit everything into OTP at all. Right now this bootloader seems to be around 60 KiB while the OTP has a bit under 8 KiB of free space available. I've written about the bootrom shortcomings a bit before on the raspberry forum: https://forums.raspberrypi.com/viewtopic.php?p=2312790#p2312...
I haven't looked at the ESP32 stuff, but I'm guessing it's going to have very similar issues.
I've noted this in another comment, the ESP32 root of trust is RSA-3072 based so it should survive.
We'll have to see if secp256k1 holds up differently than secp256r1 (P-256) but I'm going to assume the Pico 2's secure boot is thoroughly broken and we'll need a new silicon rev.
micro-ecc supports P-384, so maybe there's a reasonable boot rom migration path for the raspberry pi folks.
If "broken" is the common assumption that it still takes > $ 10M to break a key, it's unlikely that it makes a material difference honestly. Given you need physical access (assuming the network updates are signed and verified separately which you should do anyway) it's probably easier and cheaper to just decap the chip and shoot some fancy lasers at it until you unlock debug mode.
So we'll probably have to wait for whatever the successor of the RP2350 will be, would be my guess.
Yeh "Harvest now, decrypt later" is far less of a concern for a piece of hardware that's going to be well and truly obsolete (and in a dumpster somewhere) before anyone can practically attack it.
I really hope the next chip includes flash encryption.
The RP2350 already supports flash encryption. It's not as secure as it could be, because the rom doesn't lock OTP pages, but as long as you don't lose your signing keys it does it's job.
As long as FALCON survives standardization, there's no way it doesn't become popular. Signing is a bit more expensive though so let's see if that holds it back.
For a secure boot implementation, this barely beats SLH-DSA in code size + public key size + signature size. For an application where long-term security is critical, I would strongly prefer a hash-based scheme (SLH) over a lattice-based scheme (Falcon).
Falcon does, however, win pretty dramatically in verification time, which will be important for some but not all applications. (Plenty of microcontroller applications would be fine with taking an extra second to boot as long as they mostly stay booted, entering a low-power mode instead of being turned off.)
FWIW, depending on how everything is laid out in ROM/flash and what parts of ROM/flash are covered by which hardware protections, there may be no security benefit to verifying the signature at boot time as opposed to verifying it at update time. If you can get away with storing a simple hash of a next-stage boot slot in a tamper-resistant area, then you can verify a signature in the trusted code that writes a new hash to the boot slot's descriptor.
In this case, I think Falcon loses basically all its advantages. The highly-secure storage needs to store the hash verifier, a hash per boot slot, and a public key or a public key hash. SLH public keys are already very short. The SLH verifier itself (which does not necessarily need to be stored in flash at all) is very little code beyond the underlying hash. The SLH signature is pretty big, but there is no particular need to store it in flash. The main downside is adding ~1s to the time needed for the actual update operation.
BUT!
All of the above assumes a software implementation. Most of Falcon verification is likely to be done as ordinary software. Most of SLH verification's cost is hash function evaluation, and a whole lot of current-gen microcontrollers have SHA-256 in hardware. And I think that also kills the time advantage of Falcon. (There's a bonus factor of 2 for the SHA-256 variants of SLH if the hardware gives a prepared-prefix SHA-256 operation, which is reasonably common - you get it naturally if the exposed operation is the compression function.)
So I would pretty strongly favor SLH-DSA-SHA2-128s for code signing :)
Very good point, prior to settling on FN-DSA I dug into LMS based on the NIST guidelines (LMS is awful). I was under that hash signing schemes were generally stateful so its nice to see SLH-DSA bucks that trend! I'll definitely look into supporting it!
Verifying at update time can be challenging and there's all sorts of atomicity issues, plus tamper evident storage usually means you are going to be needing some kind of signing or at least AEAD (which actually isn't too bad on hardware).
For the design of microtun-boot I choose to copy mcuboot architecturally, with modern boot rom and otp roots of trust perhaps its a dated design but I thought it was probably the most foolproof way of shipping something.
I've been involved in a lot of x86-specific architectural and security discussions, and for quite a few years I've thought that the whole Secure Boot architecture is ridiculous.
If I were designing a system along these lines, and I had the ability to influence the hardware design, I would do it very differently, like so:
Define a "super-secure" area of flash at the beginning. It has the rule that it's unlocked at reset and that it can be locked. Once locked, nothing (not SMM, not TrustZone, not magic hardware features, not debug -- literally nothing [0]) can write to it until the next full reset. Furthermore, as added hardening, the non-super-secure flash cannot be executed until super-secure is locked.
In super-secure goes a small bootloader and descriptors for at least two boot slots, where each descriptor contains a hash and the location and length of the slot. (The slot's data lives in normal flash.) There is also a reference to an area of flash that can contain an update request.
On boot, the super-secure bootloader checks whether an update is requested, which it does by reading the data referenced by the update request descriptor. If there is one, it processes the update, which it does by reading the update data's hash, verifying the signature, copying the update data to the target boot slot [1] and then writing the verified hash to the corresponding super-secure descriptor.
Then the loader chooses a boot slot to boot, reads the (secure!) hash, verifies it against the data to be booted, sets the super-secure lock bit, and jumps.
In the modern world, I would formally verify the entire secure loader implementation -- it would be very little code and I think it's well within the scope of what current tools cal do.
This completely removes the exposure where untrustworthy code can try to directly attack running TrustZone or SMM code. And it completely removes the exposure where an attacker can try to bypass a complex flash locking scheme to write to supposedly secure space (I've lost count of how many times the latter has happened). (Keep in mind that, in the Secure Boot design as implemented in TianoCore, the OS can literally call into more-privileged code that is allowed to write to secure storage. Securing this is hard, and it's basically impossible given the outrageously low code quality of TianoCore.)
With this design, if you want to do something involving writing to secure storage, you first serialize the request and write it to ordinary insecure storage. Then you do a full reset, which means that the code with actual secure-write permission is running from a truly clean slate.
In this design, there is no point to verifying a signature at boot, as the hash is stored with equal security as the code verifying the hash.
[0] Existing x86 implementations are ridiculous. There are a whole bunch of lock bits (some are even documented!), and the allowability of writing to an address in flash depends on what code requested the write. These are multicore systems -- there are many different parts of the chip that could request a write, and the controller needs to figure out which component (e.g. which CPU core) made the request and what mode it was in to decide whether to allow the write. (Or maybe the initiator filters writes, but the initiator doesn't own the lock bits.) It's an incredible mess. In my model, there is one bit, local to the SPI master or flash controller, and when that bit is set, writes to the protected are are unconditionally denied.
[1] The copy is actually optional. An alternative design would be for non-secure code to put the data in its final location and then ask super-secure to just update the descriptor. This makes the super-secure code simpler but it’s also more fragile.
The git history was squashed prior to public release, this is a solid couple months of human labor.
Yes LLMs were used, but also there was a ton of human design input (nothing agentic), lots of hardware-in-loop testing, and a good dash of manual refactoring.
The way I see it, LLMs just mean the quality bar has been lifted for everyone.
Vibe coded one-shots probably aren't worthy of copyright protection.
With the nature of software going into 2027, do you expect that most new projects with constrained licenses aren’t going to have mostly AI-generated code?
These tools are now the status-quo of the industry, but it doesn’t negate the countless hours of human work that still often goes alongside them
Maybe I am misunderstanding what this fixes, but doesn't this project work towards ensuring esp32's have a chain of trust implementation that uses crypto primitives which are considered safer after anthropic crypto releases earlier this week?
Or are you implying that there isn't a need to move to post quantum crypto on esp32, or that the esp32 shouldn't have chain of trust implementation?
The general argument is that the ESP32 and RP2350 boot roms implement similar functionality so why build an abstraction when you can just work directly with the vendor tools?
Quoting from elsewhere:
> The same could be said about U-Boot, MCUboot or wolfBoot. Microtun boot targets more than just the ESP32. Any chip with signature verification implemented in its boot rom (so that we can establish a trust root) can be targeted.
> Then there's the portable firmware image format, microtun-boot distributes updates as signed MCUboot TLV images.
> I'm personally working on an application that targets both the ESP32 and PICO 2W boards.
I'm working on a zero trust networking solution for the internet of things and needed a cross platform implementation of secure boot. Right now it supports the ESP32 (RISC-V) and Raspberry Pi Pico 2 but support for the STM32H573 (ST-iROT) is planned.
The ESP32 implementation has probably survived the latest security advisory, Espressif choose to thankfully use RSA 3072 in their trust root. The Raspberry Pi Pico 2 is more ambiguous as its based on secp256k1 (like bitcoin) which is 256-bit ECC.
FALCON (fn-dsa) is an incredible signature scheme, sadly its only experimental atm and standardization seems to be delayed. I actually ended up saving ~20KiB of flash versus a legacy P-256 implementation. Little more memory hungry but very modest. I am certain fn-dsa will come to dominate in this space.
If this is the kind of engineering that interests you, whether it's embedded systems, Rust, networking, or making unconventional things work together, I'd love to connect. I'm always looking for like-minded collaborators, especially people interested in building something together in the industrial IoT space, potentially even as co-founders. Feel free to reach out!
4.8 ms verification and ~7 KiB SRAM for FN-DSA-512 on a Pico 2 is genuinely impressive — that fits comfortably inside the boot budget of most real MCU products, and staying compatible with MCUboot's image format makes adoption much more practical than inventing a new layout.
Curious about the planned STM32H573 (ST-iROT) port: do you plan to keep verification purely in software in the bootloader stage, or offload parts like SHAKE256/hashing to hardware crypto peripherals where available?
At least for the Pico 2 / RP2350 this is anything but post-quantum secure. From the README:
> Two independent keys protect the chain: the ROM checks microtun boot against the secp256k1 key in OTP,
> and microtun boot checks the application against the FN-DSA-512 (fn-dsa-512-exp) keys compiled into it.
So this is a chained bootloader, break secp256k1 and you can replace the microtun-boot bootloader in flash and the post-quantum signature check never even runs. That makes this entire bootloader pointless - either the attacker can modify flash and thus just remove your bootloader or you assume flash can only changed by the running program in which case you should check the signature of the firmware update at flash time, not during boot. It also doesn't seem to provide any of the features you'd want in such a bootloader, like encryption support or remote attestation.
In theory you could put this bootloader into OTP, but unfortunately the RP2350's bootrom is not designed for that at all. You basically lose all other boot options + hibernate if you do that, if you can manage to fit everything into OTP at all. Right now this bootloader seems to be around 60 KiB while the OTP has a bit under 8 KiB of free space available. I've written about the bootrom shortcomings a bit before on the raspberry forum: https://forums.raspberrypi.com/viewtopic.php?p=2312790#p2312...
I haven't looked at the ESP32 stuff, but I'm guessing it's going to have very similar issues.
I've noted this in another comment, the ESP32 root of trust is RSA-3072 based so it should survive.
We'll have to see if secp256k1 holds up differently than secp256r1 (P-256) but I'm going to assume the Pico 2's secure boot is thoroughly broken and we'll need a new silicon rev.
micro-ecc supports P-384, so maybe there's a reasonable boot rom migration path for the raspberry pi folks.
If "broken" is the common assumption that it still takes > $ 10M to break a key, it's unlikely that it makes a material difference honestly. Given you need physical access (assuming the network updates are signed and verified separately which you should do anyway) it's probably easier and cheaper to just decap the chip and shoot some fancy lasers at it until you unlock debug mode.
So we'll probably have to wait for whatever the successor of the RP2350 will be, would be my guess.
Yeh "Harvest now, decrypt later" is far less of a concern for a piece of hardware that's going to be well and truly obsolete (and in a dumpster somewhere) before anyone can practically attack it.
I really hope the next chip includes flash encryption.
The RP2350 already supports flash encryption. It's not as secure as it could be, because the rom doesn't lock OTP pages, but as long as you don't lose your signing keys it does it's job.
But only if you are happy executing from sram, so you are quite limited on binary size.
Transparent hardware flash encryption would be nice.
Still waiting for HW roots of trust with PQ signature support to become commonly available.
Unfortunately it will probably be a number of years until that hardware IP finally makes its way into low cost / low power processors.
Post quantum signatures are huge, how much boot time does that cost on a pico
Compact signatures are the selling point of FALCON [1], for fn-dsa-512 (signatures: 666B, keys: 897B).
Benching fn-dsa-512 (NIST Level 1) on the Pico 2,
SIGNATURE VERIFICATION: 4.8ms (1.1ms pub key decoding + 3.7ms verification)
TOTAL SRAM: ~7KiB
As long as FALCON survives standardization, there's no way it doesn't become popular. Signing is a bit more expensive though so let's see if that holds it back.
1. https://csrc.nist.gov/csrc/media/Presentations/2024/falcon/i...
Keygen and signing needing FP doesn't sound ideal.
But I suppose embedded devices are mostly verification (and keygen once if ever).
It looks like NIST is looking towards the usage of fixed-point arithmetic [1] in the final standard (for keygen and signing).
It's early days in the post-quantum space so I guess these kind of teething issues are expected.
1. https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/7z-y...
For a secure boot implementation, this barely beats SLH-DSA in code size + public key size + signature size. For an application where long-term security is critical, I would strongly prefer a hash-based scheme (SLH) over a lattice-based scheme (Falcon).
Falcon does, however, win pretty dramatically in verification time, which will be important for some but not all applications. (Plenty of microcontroller applications would be fine with taking an extra second to boot as long as they mostly stay booted, entering a low-power mode instead of being turned off.)
FWIW, depending on how everything is laid out in ROM/flash and what parts of ROM/flash are covered by which hardware protections, there may be no security benefit to verifying the signature at boot time as opposed to verifying it at update time. If you can get away with storing a simple hash of a next-stage boot slot in a tamper-resistant area, then you can verify a signature in the trusted code that writes a new hash to the boot slot's descriptor.
In this case, I think Falcon loses basically all its advantages. The highly-secure storage needs to store the hash verifier, a hash per boot slot, and a public key or a public key hash. SLH public keys are already very short. The SLH verifier itself (which does not necessarily need to be stored in flash at all) is very little code beyond the underlying hash. The SLH signature is pretty big, but there is no particular need to store it in flash. The main downside is adding ~1s to the time needed for the actual update operation.
BUT!
All of the above assumes a software implementation. Most of Falcon verification is likely to be done as ordinary software. Most of SLH verification's cost is hash function evaluation, and a whole lot of current-gen microcontrollers have SHA-256 in hardware. And I think that also kills the time advantage of Falcon. (There's a bonus factor of 2 for the SHA-256 variants of SLH if the hardware gives a prepared-prefix SHA-256 operation, which is reasonably common - you get it naturally if the exposed operation is the compression function.)
So I would pretty strongly favor SLH-DSA-SHA2-128s for code signing :)
Very good point, prior to settling on FN-DSA I dug into LMS based on the NIST guidelines (LMS is awful). I was under that hash signing schemes were generally stateful so its nice to see SLH-DSA bucks that trend! I'll definitely look into supporting it!
Verifying at update time can be challenging and there's all sorts of atomicity issues, plus tamper evident storage usually means you are going to be needing some kind of signing or at least AEAD (which actually isn't too bad on hardware).
For the design of microtun-boot I choose to copy mcuboot architecturally, with modern boot rom and otp roots of trust perhaps its a dated design but I thought it was probably the most foolproof way of shipping something.
Thanks for the great feedback.
I've been involved in a lot of x86-specific architectural and security discussions, and for quite a few years I've thought that the whole Secure Boot architecture is ridiculous.
If I were designing a system along these lines, and I had the ability to influence the hardware design, I would do it very differently, like so:
Define a "super-secure" area of flash at the beginning. It has the rule that it's unlocked at reset and that it can be locked. Once locked, nothing (not SMM, not TrustZone, not magic hardware features, not debug -- literally nothing [0]) can write to it until the next full reset. Furthermore, as added hardening, the non-super-secure flash cannot be executed until super-secure is locked.
In super-secure goes a small bootloader and descriptors for at least two boot slots, where each descriptor contains a hash and the location and length of the slot. (The slot's data lives in normal flash.) There is also a reference to an area of flash that can contain an update request.
On boot, the super-secure bootloader checks whether an update is requested, which it does by reading the data referenced by the update request descriptor. If there is one, it processes the update, which it does by reading the update data's hash, verifying the signature, copying the update data to the target boot slot [1] and then writing the verified hash to the corresponding super-secure descriptor.
Then the loader chooses a boot slot to boot, reads the (secure!) hash, verifies it against the data to be booted, sets the super-secure lock bit, and jumps.
In the modern world, I would formally verify the entire secure loader implementation -- it would be very little code and I think it's well within the scope of what current tools cal do.
This completely removes the exposure where untrustworthy code can try to directly attack running TrustZone or SMM code. And it completely removes the exposure where an attacker can try to bypass a complex flash locking scheme to write to supposedly secure space (I've lost count of how many times the latter has happened). (Keep in mind that, in the Secure Boot design as implemented in TianoCore, the OS can literally call into more-privileged code that is allowed to write to secure storage. Securing this is hard, and it's basically impossible given the outrageously low code quality of TianoCore.)
With this design, if you want to do something involving writing to secure storage, you first serialize the request and write it to ordinary insecure storage. Then you do a full reset, which means that the code with actual secure-write permission is running from a truly clean slate.
In this design, there is no point to verifying a signature at boot, as the hash is stored with equal security as the code verifying the hash.
[0] Existing x86 implementations are ridiculous. There are a whole bunch of lock bits (some are even documented!), and the allowability of writing to an address in flash depends on what code requested the write. These are multicore systems -- there are many different parts of the chip that could request a write, and the controller needs to figure out which component (e.g. which CPU core) made the request and what mode it was in to decide whether to allow the write. (Or maybe the initiator filters writes, but the initiator doesn't own the lock bits.) It's an incredible mess. In my model, there is one bit, local to the SPI master or flash controller, and when that bit is set, writes to the protected are are unconditionally denied.
[1] The copy is actually optional. An alternative design would be for non-secure code to put the data in its final location and then ask super-secure to just update the descriptor. This makes the super-secure code simpler but it’s also more fragile.
This is quite brilliant, matching MCUboot's format!
This is really cool!
LLM generating a source available project then slapping a non-commercial/contact for commercial use license on it is an interesting choice
The git history was squashed prior to public release, this is a solid couple months of human labor.
Yes LLMs were used, but also there was a ton of human design input (nothing agentic), lots of hardware-in-loop testing, and a good dash of manual refactoring.
The way I see it, LLMs just mean the quality bar has been lifted for everyone.
Vibe coded one-shots probably aren't worthy of copyright protection.
With the nature of software going into 2027, do you expect that most new projects with constrained licenses aren’t going to have mostly AI-generated code?
These tools are now the status-quo of the industry, but it doesn’t negate the countless hours of human work that still often goes alongside them
The times are such that you can just ask for things.
‘Break P-256 ECC’, somewhere in a frontier lab, probably
‘Implement a bootloader with post quantum image signatures’, two days ago, anywhere
Talk about a problem that didn’t need solving
Maybe I am misunderstanding what this fixes, but doesn't this project work towards ensuring esp32's have a chain of trust implementation that uses crypto primitives which are considered safer after anthropic crypto releases earlier this week?
Or are you implying that there isn't a need to move to post quantum crypto on esp32, or that the esp32 shouldn't have chain of trust implementation?
The general argument is that the ESP32 and RP2350 boot roms implement similar functionality so why build an abstraction when you can just work directly with the vendor tools?
Quoting from elsewhere:
> The same could be said about U-Boot, MCUboot or wolfBoot. Microtun boot targets more than just the ESP32. Any chip with signature verification implemented in its boot rom (so that we can establish a trust root) can be targeted.
> Then there's the portable firmware image format, microtun-boot distributes updates as signed MCUboot TLV images.
> I'm personally working on an application that targets both the ESP32 and PICO 2W boards.
I'm working on a zero trust networking solution for the internet of things and needed a cross platform implementation of secure boot. Right now it supports the ESP32 (RISC-V) and Raspberry Pi Pico 2 but support for the STM32H573 (ST-iROT) is planned.
The ESP32 implementation has probably survived the latest security advisory, Espressif choose to thankfully use RSA 3072 in their trust root. The Raspberry Pi Pico 2 is more ambiguous as its based on secp256k1 (like bitcoin) which is 256-bit ECC.
FALCON (fn-dsa) is an incredible signature scheme, sadly its only experimental atm and standardization seems to be delayed. I actually ended up saving ~20KiB of flash versus a legacy P-256 implementation. Little more memory hungry but very modest. I am certain fn-dsa will come to dominate in this space.
If this is the kind of engineering that interests you, whether it's embedded systems, Rust, networking, or making unconventional things work together, I'd love to connect. I'm always looking for like-minded collaborators, especially people interested in building something together in the industrial IoT space, potentially even as co-founders. Feel free to reach out!
This is great! It’s been 5+ years since I’ve hacked around on ESP32s, and you’re making me want to get back into it
4.8 ms verification and ~7 KiB SRAM for FN-DSA-512 on a Pico 2 is genuinely impressive — that fits comfortably inside the boot budget of most real MCU products, and staying compatible with MCUboot's image format makes adoption much more practical than inventing a new layout.
Curious about the planned STM32H573 (ST-iROT) port: do you plan to keep verification purely in software in the bootloader stage, or offload parts like SHAKE256/hashing to hardware crypto peripherals where available?
Comes down to how well the embedded rust hal's support the crypto hardware (I've been burnt badly by esp-hal in the past so I'm a little skittish).
If I implement SLH-DSA support then presumably I'll have to use the SHA accelerator at some point for acceptable performance.
FN-DSA in software is totally fine for now (but it does look like the newer STM32 variants do have SHAKE256 acceleration).
Unfortunately ST-iROT is also P-256 based so is probably cooked for now.