Definition
Arrival authentication is the check a device makes when an update arrives: it verifies a cryptographic tag, such as a digital signature §5.14, over the received bytes, showing that a holder of the right key produced them. Boot validation is the check made at each start-up on the stored copy, before it is run or loaded. The difference is time: arrival authentication vouches for the bytes received at one moment; boot validation decides about the bytes stored now, which equal the received bytes only if nothing has changed them since.
The idea
An update is received, its signature checks out, and it is written to flash memory §6.6, where it stays for years and is started at every reset. Between the arrival and each later start, many things can happen to the stored bytes. Power can fail in the middle of writing them. A flash cell can lose its charge. A software fault can write into the wrong region. An attacker can reach the flash through a debug interface, or through a flaw that lets the attacker’s code write storage. The check at arrival happened before all of these and says nothing about them.
Airport security is a fair picture. Passengers are screened once at the checkpoint, and inside the secure area nobody screens them again; the area is trusted because there is no way in except through the checkpoint. A device can work the same way, trusting what is in its flash because nothing can write the flash except through the checked update path. Or it can screen again at the gate, by checking the stored copy again at every start-up. The picture stops at cost. Screening every passenger again at every gate would be slow, whereas checking a stored image again usually costs one hash computation and one signature check per start-up, and the design must weigh that cost against what can reach the flash.
How it works
Follow an update through three moments.
Arrival, at time . The bytes sit in a receive buffer in RAM. Arrival authentication computes their cryptographic hash §5.1, a short fixed-length digest of the bytes, and verifies the signature over that hash with a public key the device trusts.
Storage, at time . The bytes are written into flash. The device then reads them back and checks them again, because a write can fail silently, and the checked bytes in the buffer and the stored bytes in flash are different copies.
Boot, at time and every later start. The bootloader §6.30, the first program to run after reset, reads the selection record §8.21 that names the image to start, and starts that image.
At step 3 a design takes one of two approaches.
Repeat the check. The bootloader recomputes the hash of the stored image and verifies its signature again, with a key held in storage the attacker cannot change. Checking code in this way at every start-up, before running it, is the core of secure boot §6.31. An unauthorized change to the signed bytes makes verification fail under the signature scheme’s security assumptions. A different image signed under a trusted key can still pass. This design keeps the signature with the image and spends time verifying it at every start-up. It also applies the trust rules in force at boot time, so an image whose key has been retired since arrival is now refused.
Rely on the storage. The bootloader starts the stored image without verifying the signature again, perhaps after checking a flag written at arrival. This is correct only if nothing outside the trusted code can write the image, the flag or the selection record between and . Typical protections are flash regions locked against writing until the next reset, debug access disabled, and no code path that writes arbitrary flash. A flag proves nothing about the bytes unless it is bound to them, for example by the device-key check described next.
A middle way exists. At arrival, after verifying the vendor’s signature, the device computes a message authentication code §5.7 (MAC) over the image with a secret key that only the device holds, and stores the MAC with the image. At boot it recomputes the MAC and compares, which is usually cheaper than verifying a public-key signature. An attacker who can write the flash but cannot read the device key cannot produce a matching MAC for altered bytes.
Boot also needs checks that are not about origin. A magic number, a fixed value at the start of the image header, and a length that fits the slot confirm the layout. A cyclic redundancy check §4.32 (CRC) or another checksum detects accidental damage. A comparison with the stored version floor refuses rollback. Compatibility checks confirm that the image fits the hardware and the stored data. None of these establishes origin: an attacker who can write flash can also write a matching magic number, length and CRC. Conversely, a valid signature does not make an image safe to load if it is too large for its slot or expects a different data format.
Worked example
Image X is 200 KiB long. At it arrives with a signature over its SHA-256 §5.2 (Secure Hash Algorithm with a 256-bit output) hash, and the signature verifies. At it is written to slot B, together with a header outside the signed bytes that holds a flag verified = 1 and a CRC-32 checksum of the image. Later, an attacker who has found a flaw that writes flash changes 4 bytes of the stored image, which turns it into image Y, and recomputes the CRC-32. At the device restarts.
A bootloader that relies on the flag and the CRC finds
verified = 1and a matching CRC, and starts Y, which was never authenticated.A bootloader that repeats the check computes the SHA-256 hash of Y. It differs from the hash of X that the signature covers, so the signature check fails, and the bootloader refuses Y and falls back to slot A.
Now change the failure. Power dips at , and one 4 KiB flash sector of the image stays erased, so it reads as bytes 0xff. No attacker is involved. A bootloader that trusts only the flag starts a broken image. A bootloader that checks the CRC, or repeats the signature check, refuses it. Reading the image back at would have caught the failure before the flag was ever written.
The cost of repeating the check: assume the processor computes SHA-256 at 20 megabytes per second, where a megabyte is bytes. The image is bytes, so hashing takes s, about 10 ms, at each start-up, plus one signature verification. Whether that is affordable depends on how often the device starts and how quickly it must be ready.
Stated precisely
Let be the bytes received and the signature that arrived with them, and let be true when is a valid signature over under the public key . Let be the bytes stored at time in the location the bootloader will start. Arrival authentication establishes that is true at time . Starting at time is justified by one of two conditions.
Repeated check: is true at , where is a key the device trusts at , and the other boot checks, such as the version floor and the layout, pass.
Protected storage: . This equality holds if (a) the write at stored exactly , confirmed by reading it back; (b) no party outside the trusted code can write that location at any time between and , whether through software, a debug interface or physical reprogramming; and (c) the record that selects which location to start is protected in the same way.
Condition 2 rests on the storage, not on cryptography. Arrival authentication followed by a boot without a check is the stored form of the time-of-check to time-of-use §9.26 (TOCTOU) problem: the check at concerns , the use at concerns , and nothing in the check itself makes the two equal.
Limits and common mistakes
Repeating the check at boot detects damage; it does not repair it. A refused image needs a recovery fallback §8.29, such as a second slot or a recovery mode, or the device does not start at all.
Repeating the check uses the trust rules in force at boot time. After a key rotation §5.29 that retires the old signing key, every stored image signed with that key is refused at the next start-up. That is the point of retiring a key, but the device must hold an image signed with a current key before the old key is retired.
A checksum or CRC is not authentication §1.6. It detects accidental damage, and anyone who can change the bytes can recompute it.
Authenticity is not safety. A correctly signed image can still be too large for its slot, expect a different data format or contain a fault; the boot checks of layout, version and compatibility are needed whether or not the signature is checked again.
Every boot check is only as trustworthy as the bootloader that runs it and the key it uses. Both belong in storage that no update and no attacker can change, which makes them the root of trust §1.33 of the device.
An image executed in place, meaning read directly from flash while it runs, is covered by a check at boot only if nothing can write that flash while the image runs. A check made at start-up covers the bytes at that instant only.
Arrival authentication is still needed when boot repeats the check. Without it, anyone who can reach the update path can fill the update slot with unchecked bytes: each attempt wears the flash, may overwrite a fallback image, and is discovered only at the next start-up.
Questions answered
Does boot repeat the origin tag check or rely on trusted flash contents?
It depends on the design: both approaches are in use, and they promise different things. The origin tag is the digital signature or message authentication code that shows who produced an update. A device checks it when the update arrives; the question is whether the bootloader, the first program to run at each start-up, checks it again on the stored copy.
Repeating the check, the approach called secure boot, recomputes the hash of the stored image and verifies the tag at every start-up. The check detects corruption or unauthorized modification of the authenticated bytes, subject to the strength of the tag, and applies the keys trusted at boot time. Detecting substitution of an older, valid image also requires a freshness rule. It costs a hash and a verification per start-up and needs the tag to be stored with the image.
Relying on the flash contents starts the stored image because it passed the arrival check. That is sound only if nothing outside the trusted update code can write the image, any “verified” flag or the record that selects the image between arrival and boot. This requires write-locked flash, disabled debug access and no software path that writes arbitrary flash.
Which approach a given device uses has to be read from its boot code; it cannot be inferred from the fact that updates are authenticated on arrival. If an attacker or a fault can change flash between arrival and boot, only a repeated check keeps the guarantee that what runs is what was authenticated. That check can be the original signature, or a message authentication code computed at arrival with a key that only the device holds.
Related entries: Authentication coverage (§5.41), Time-of-check to time-of-use (TOCTOU) (§9.26), Commit record and selector (§8.21), Secure boot (§6.31), Root of trust (§1.33), Checksum versus CRC (§4.32), Recovery fallback (§8.29).