I came across the question: How to protect FPGA/MCU configuration/firmware data stored in external memory from readout/ripoff.
With MCUs and internal flash you can just lock the e.g. JTAG to prevent readout. I guess you can do the same with FPGAs and internal configuration.
But, if the data is stored in an external flash/eeprom you could just unsolder the IC and wire up a tool to download and replicate it.
So i came up with a few solutions, but they are all not optimal in my opinion.
My ideas:
1. Encrypt the firmware image and write it to the external IC. The MCU/FPGA could have a bit-stream decryptor to not limit/decrease speed. But you could till just copy the memory contents, as long as the key does not change.
2. Encrypt the firmware based on a MCU/FPGA device ID. This would prevent just copying the contents as the crypto key would change. But for field updates, the key needs to be known: So managing images gets tricky/messy quick.
My question:
How to protect MCU/FPGA firmware/configuration stored in external flash/eeprom chips from readout/ripoff?
- What are the common approaches?
- What is required? Peripherals, Software, what-not
- What a common pitfalls in deploying "protected software" in mass?
EDIT 1:
A short summary of the current answers:
The simplest Method to protect MCU firmare is to not use an external flash at all. Therefore, it is not possible to clone the external IC - as well as injecting "bad code" is not possible/harder.
FPGA indeed use bitstream encryption based on a private (not readable and not the device-ID) key. This key is introduced to the device during factory programming.
Modern/bigger MCUs provide peripherals aimed at storing crypto data in certain ways (e.g tamper protected volatile memory, or dedicated register preserved during sleep-modes (for battery backup)).
Secure firmware is only required in certain applications. To protect firmware itself is mostly senseless, as "writing new firmware" can be easy compared to developing the actual device. Also, basic IP regulations can be used to protect firmware.
When storing crypto keys (e.g. credit-card reader and what not) dedicated hardware is available - and also backed by a "chain-of-trust".
Deploying "protected software" is a whole process involving multiple steps and having many loop-holes (e.g. a person in the factory stealing the crypto keys, or tampering with the actual firmware image to inject bad code)
When deploying "protected firmware" one must also think about the field-update process - With Updates-Over-The-Air and other transmission protocols, the images can be read-out if not encrypted.