When I was growing up, one of my favorite movies was The Pink Panther (2006). Though there are quite a few classic exchanges in the film, one in particular has stuck with me over the years.

Ponton: He was just found dead in the training facility locker room. Shot in the head.

Clouseau: Was it fatal?

Ponton: Yes.

Clouseau: How fatal?

Ponton: (confused) Completely.

Clouseau: I want to talk to him now.

Ponton: He’s dead.

Clouseau: Ah!

Non-gradable adjectives, such as “fatal”, are useful because they are unambiguous. When it comes to mortality, we are all operating under the same context; there is no scenario in our universe in which a human can survive or return to life from a fatal event. Therein lies the comedy of Clouseau’s clarification. However, sometimes clarification is required in the use of a non-gradable adjective.

In my most recent post, I wrote about the complexity of secure manufacturing and device provisioning. A key component to building a secure system is establishing a root of trust (RoT). In order for a RoT to be trusted, there needs to be some mechanism that enforces immutability of the code and data that it is comprised of. It is fairly obvious that you cannot trust a component if that component can be arbitrarily modified. For this reason, you will frequently see the first stage of a RoT referred to as an Immutable Root of Trust (IRoT).

In order for any system to offer immutable qualities, the underlying substrate must expose features to configure the mutability of data. For example, many programming languages support immutable data types or bindings. In Rust, for example, all variables are immutable by default. Depending on whether the language is compiled or interpreted, immutability properties may be enforced by the compiler or the runtime.

When it comes to devices, the underlying substrate is the hardware. In order for the first instructions that run on the processor to be trusted, the hardware must expose some functionality that allows for making those instructions, and typically some of the data they access, immutable. However, because hardware architecture varies from one silicon vendor to another, and even from one part to another within a single vendor, immutability may be enforced through very different mechanisms. While one mechanism is not strictly better than another, understanding how each behaves is important when performing threat modeling.

The Mechanisms of Hardware-Enforced Immutability Link to heading

The first, and perhaps most intuitive, mechanism is mask ROM. Mask ROM encodes data into the circuitry of silicon at time of fabrication. Just like the instruction set architecture of a CPU, or the registers of a peripheral, it is the same across every unit and cannot be modified. Because of this, mask ROM is most commonly used for initialization or bootloader code rather than public key material or other data that may differ across customers1 or even individual units.

Though mask ROM is technically fixed, the ramifications of shipping code that contains a bug frequently causes silicon vendors to offer the ability to patch the ROM code at runtime. This is a good example of a threat vector that may be overlooked without a deep understanding of a part. In fact, in the NXP LPC55S69 MCU that Oxide, the company I wrote about in the aforementioned post, uses for its hardware RoT, there is a ROM patching capability that Oxide engineers discovered could leave the part vulnerable to attack because it was exposed to the TrustZone-M non-secure processing environment (NSPE).

One time programmable (OTP) memory is a slightly more flexible option for hardware-enforced immutability. Rather than being fixed across every unit, OTP, which is typically implemented as antifuses or eFuses, can be written once, causing a physical change to the circuitry that cannot be reversed2. This makes it a natural candidate for storing something like a public signing key that may be used by an initial bootloader stored in mask ROM to verify that the next code to execute is signed by the silicon vendor’s customer. It could also be used by a silicon vendor to program values that differ from one unit to the next after fabrication (e.g. a unique identifier).

The term OTP is used fairly liberally in datasheets, and it may not always mean that you are literally blowing fuses. For example, at Nordic Semiconductor3, we use the term emulated OTP to describe the common User Information Configuration Registers (UICR) that are present in many of our products and allow the customer to configure access port protection, erase protection, signing keys, immutable bootloader regions, and more. In this case, programming the registers does not physically change the hardware, but rather causes the memory controller to prevent subsequent writes to the region. This offers immutability with an arguably more friendly user experience; the customer can erase the memory, including the OTP regions, and write to it again, but only if they erase the entire device and only if erase protection has not been enabled. It also gives the customer more visibility into exactly what instructions are being executed at boot, as they are responsible for installing the immutable bootloader.

One downside to this solution, as opposed to true OTP or mask ROM, is that the customer must ensure that they configure the device correctly. For example, if access port and erase protection is not enabled, an attacker could erase all memory, then program malicious firmware onto a device in the possession of an end user. One could make a valid argument that a customer programming mistake bricking a device is a superior scenario to leaving a device vulnerable. However, mask ROM and OTP do not eliminate the possibility of a customer leaving a device unprotected. In other words, the memory technology is not the only attribute that must be considered when evaluating protection capabilities of the hardware.

The same mechanism that enables emulated OTP functionality can also be used for general configurable immutability4. While the memory addresses of the UICRs themselves are always enforced as an immutable region by the hardware, the addresses programmed by the customer into that region, such as the value stored in the BOOTCONF UICR on the nRF54LM20, may cause the hardware to enforce immutability of a region before the device comes out of reset (i.e. before the first instruction is executed). In the case of the nRF54LM20, the emulated OTP of the BOOTCONF UICR and the configurable immutability of the address region programmed into the BOOTCONF UICR combine to provide an immutable RoT. The former restricts changing the configured location of the immutable bootloader, while the latter restricts changing the immutable bootloader code itself5.

The final hardware mechanism that can be used to enforce immutability is runtime immutability6. Once again powered by features of memory controller hardware, runtime immutability enables software to configure immutable regions at, well, runtime. This sounds a lot like configurable immutability, with the primary difference being that any immutability configured at runtime is cleared on device reset. A common use case for this functionality is protection of a second stage bootloader. Looking at the nRF54LM20 again, the RRAMC (resistive random access memory controller) includes REGION[n].ADDRESS and REGION[n].CONFIG registers. If using the standard nRF Secure Immutable Bootloader (NSIB or b0), MCUboot, and TrustedFirmware-M setup, NSIB, which is immutable due to prior provisioning of the BOOTCONF register, will validate the MCUboot image, then can configure additional read and execute protection to its own region, before finally applying write protection to the MCUboot region. The protections in both of these cases are necessary to be applied at runtime. The CPU must be able to read and execute the NSIB code on reset, and only the active MCUboot slot should be locked for writing. The latter is shown below.

static int disable_next_w(const uint32_t address)
{
	uint32_t region_size_kb = 0;

	if (address == S0_IMAGE_ADDRESS) {
		region_size_kb = S0_IMAGE_SIZE / NRF_RRAM_REGION_SIZE_UNIT;
	} else if (address == S1_IMAGE_ADDRESS) {
		region_size_kb = S1_IMAGE_SIZE / NRF_RRAM_REGION_SIZE_UNIT;
	} else {
		return -EINVAL;
	}

	nrf_rramc_region_config_t config = {
		.address = address,
		.permissions =  NRF_RRAMC_REGION_PERM_READ_MASK |
				NRF_RRAMC_REGION_PERM_EXECUTE_MASK,
		.writeonce = false,
		/* There are no issues with locking the region here,
		 * as the next stage can still impose more strict
		 * protection by writing 0 to R/X disable bits.
		 */
		.lock = true,
		.size_kb = region_size_kb,
	};

	nrf_rramc_region_config_set(NRF_RRAMC, RRAMC_REGION_FOR_NEXT_W, &config);
	nrf_rramc_region_config_get(NRF_RRAMC, RRAMC_REGION_FOR_NEXT_W, &config);
	if (config.permissions & (NRF_RRAMC_REGION_PERM_WRITE_MASK)) {
		return -ENOSPC;
	}
	if (config.size_kb != region_size_kb) {
		return -ENOSPC;
	}

	return 0;
}

While there are good reasons why each of these mechanisms are leveraged, the complexity they introduce can sometimes get in the way of accomplishing the ultimate goal: building a secure system. Reiterating the call to action from my last post, it is not enough for those of us working in the semiconductor industry to make it possible for customers to build secure systems. We must make building securely easier than not. On our way there, join me in sharing more publicly about how these mechanisms work, and how your organization is going about building secure systems.


  1. “Customer”, used extensively throughout this post, refers to the customer of a silicon vendor. The customer of the silicon vendor’s customer (i.e. the purchaser of the final good) is referred to as the “end user”. ↩︎

  2. With enough time and money, almost anything can be compromised when it comes to hardware security. ↩︎

  3. Disclaimer: I work here! ↩︎

  4. This is my own moniker, rather than an industry standard term. Most silicon vendors do not make strong distinctions between these types of hardware mechanisms. ↩︎

  5. While certainly not the only thing to look for, determining whether you can mutate code or data, or mutate the pointer to the code or data, constitutes a large portion of RoT threat modeling. ↩︎

  6. This is again my own term for the functionality. ↩︎