IOT2050 Secure Boot en en-US
IOT2050 Secure Boot en en-US
Preface
Security information 1
Introduction 2
04/2023
A5E52411777-AA
Legal information
Warning notice system
This manual contains notices you have to observe in order to ensure your personal safety, as well as to prevent
damage to property. The notices referring to your personal safety are highlighted in the manual by a safety alert
symbol, notices referring only to property damage have no safety alert symbol. These notices shown below are
graded according to the degree of danger.
DANGER
indicates that death or severe personal injury will result if proper precautions are not taken.
WARNING
indicates that death or severe personal injury may result if proper precautions are not taken.
CAUTION
indicates that minor personal injury can result if proper precautions are not taken.
NOTICE
indicates that property damage can result if proper precautions are not taken.
If more than one degree of danger is present, the warning notice representing the highest degree of danger will
be used. A notice warning of injury to persons with a safety alert symbol may also include a warning relating to
property damage.
Qualified Personnel
The product/system described in this documentation may be operated only by personnel qualified for the specific
task in accordance with the relevant documentation, in particular its warning notices and safety instructions.
Qualified personnel are those who, based on their training and experience, are capable of identifying risks and
avoiding potential hazards when working with these products/systems.
Proper use of Siemens products
Note the following:
WARNING
Siemens products may only be used for the applications described in the catalog and in the relevant technical
documentation. If products and components from other manufacturers are used, these must be recommended
or approved by Siemens. Proper transport, storage, installation, assembly, commissioning, operation and
maintenance are required to ensure that the products operate safely and without any problems. The permissible
ambient conditions must be complied with. The information in the relevant documentation must be observed.
Trademarks
All names identified by ® are registered trademarks of Siemens AG. The remaining trademarks in this publication
may be trademarks whose use by third parties for their own purposes could violate the rights of the owner.
Disclaimer of Liability
We have reviewed the contents of this publication to ensure consistency with the hardware and software
described. Since variance cannot be precluded entirely, we cannot guarantee full consistency. However, the
information in this publication is reviewed regularly and any necessary corrections are included in subsequent
editions.
Preface
This document contains information for using Secure Boot features for IOT2050.
It is intended both for programming and testing personnel who commission the device and
connect it with other units (automation systems, programming devices), as well as for service
and maintenance personnel who install add-ons or carry out fault/error analyses.
Conventions
The following generic terms are used in this documentation:
Figures
This manual contains figures of the described devices. The supplied device might differ in
some details from the figures. Within some of the figures, one device is used to represent all
devices.
History
The following editions of these operating instructions are published:
Edition Comment
08/2022 First edition
Data protection
Siemens observes the data protection guidelines, especially the requirements regarding data
minimization (privacy by design). This means the following for this SIMATIC product: The
product does not process / save any personal information, but only technical functional data
(e.g. time stamps). If the user links this data to other data (e.g. shift plans) or if the user saves
personal information on the same medium (e.g. hard disk) and therefore creates a personal
reference in the process, the user has to ensure meeting the guidelines regarding data
protection.
Preface ................................................................................................................................................... 3
1 Security information .............................................................................................................................. 6
2 Introduction ........................................................................................................................................... 7
3 Secure Boot Infrastructure..................................................................................................................... 9
3.1 OTP area .............................................................................................................................. 9
3.2 SEBoot ............................................................................................................................... 10
4 Example for IOT2050 Secure Boot ....................................................................................................... 11
4.1 Implementing IOT2050 secure boot example ..................................................................... 11
4.2 Check the example implementation ................................................................................... 13
4.3 Example Kernel .................................................................................................................. 15
5 Secure Boot advanced topics ............................................................................................................... 16
Note
Secure Boot is only for IOT2050 PG2 and PG2 later variants (for example IOT2050 M.2).
Chain of trust
IOT2050 use RSA key pair as cryptographic key which is also the most common
cryptographic algorithm for digital signature in industry.
An RSA key pair has two keys, a public key and a private key. In the digital signature
scenario, the private key signs the binary, meanwhile the device validate the binary with the
public key. The private key must be kept securely. On the contrary, the public key could be
distributed freely.
Private key signs the following items:
• Firmware, including U-Boot, TF-A and OPTee
• The OS loader EFI Boot Guard
• The Linux kernel, and any other UEFI binary that is part of the boot chain
To validate the binary signature, Siemens provides a tool to program the public key hash into
the one time programming (OTP) area into IOT2050.
Chain of trust: During boot, the first bootloader, for example SEBoot, validates the u-boot
with the public key hash stored in OTP area of IOT2050. Then the u-boot validates the EFI
Boot Guard which in turn validates the Linux kernel together with the device tree blobs.
Root of trust: Root of trust refers to the public key hash stored in the device OTP area and the
SEBoot.
Note
The SEBoot is validated against the Siemens public key hash by the ROM bootloader.
Note
Keep private key securely
Once private key leaks, hacker could sign their malicious u-boot or kernel that Secure Boot
could not tell from the proper ones, which may put the device in danger.
Siemens provides three key slots in the OTP area. When the key in-use leaks, you can switch
to the next key in the slots as the key in-use to invalidate the leaked key. Three slots
guarantee that you have two opportunities to save the Secure Boot from key leakage.
Note
If the Secure Boot on IOT2050 is enabled, you cannot disable the Secure Bsotoot.
The Secure Boot enable bit only controls the SEBoot to verify the immediately following
bootloader, which is the combination of TF-A, OPTee and u-boot SPL in most cases.
You can still disable the image validation in SPL to break the chain of the validating
afterwards even if Secure Boot enable bit is flipped.
Secure version
After you implemented the Secure Boot on IOT2050, secure version can detect and prevent
Downgrade Attack.
Secure version is also signed by the private key. Once a newer secure version firmware is
detected and validated, a Non-Volatile (NV) counter on the device is updated with the newer
version number. When the device is attacked by an older buggy firmware which has a lower
secure version, SEBoot will detect and reject the downgrade attack.
The NV counter is also implemented in the extended OTP area. The secure version ranges
from 0 to 127, which means you can have up to 127 security releases to fix the security bugs.
3.2 SEBoot
SEBoot is the first stage bootloader right after the RBL (ROM Boot Loader), for example, the
CPU. It is signed with the Siemens root key and is validated by the RBL. During booting, the
main task for SEBoot is to validate the later stage image that are signed with the customer
key. SEBoot also prevents the downgrade attack by comparing the secure version of the
image and the one defined in the OTP.
Note
For IOT2050, the SEBoot must be the first stage bootloader. Otherwise the device rejects to
boot.
Requirements
• linux machine is ready
• meta-iot2050 repository is cloned
• Two storage media, either SD card or USB stick is OK
• One build image, it can be stored on SD card or USB stick
Procedures
Note
Siemens recommends you use at least two sets of keys, for example MPK and SMPK.
Note
Keep the private keys securely. Do not commit your keys into the git repository.
Note
Before building the signed images, make sure the certificate for the signing key is within
the validity term.
Renew the certificate if it is expired.
Note
Once Secure Boot is enabled, you cannot program new key into OTP, even if empty slot
exists in OTP.
Note
Once secure boot is enabled, to improve security, the u-boot console is disabled.
10.Insert another storage media into the build machine, and make the boot media with the
signed OS image with the following command.
dd if=<path-meta-iot2050>/build/tmp/deploy/images/iot2050/iot2050-
image-swu-example-iot2050-debian-iot2050.wic.img \
of=/dev/<device-name> bs=100M oflag=direct status=progress
11.Insert the boot media with the signed OS image, and boot IOT2050.
Result: Both firmware image and the OS image are signed and validated by the generated
key set.
Boot sequence
All of the mentioned image validations use the same key set as the one programmed into the
OTP area.
1. After the device is turned on, the SEBoot validates the combined image of TF-A, OPTee and
U-Boot SPL.
2. U-Boot SPL validates U-Boot proper, and then U-Boot proper validates the EFI Boot Guard.
3. EFI Boot Guard validates kernel PE image.
Step 1 and 2 mainly use verified boot and X.509 certificate, and step 3 mainly uses UEFI
Secure Boot.
Note
Since the /usr is mounted as read-only and validated, /usr can only be updated with
SWUpdate. Command, such as apt install and upgrade, are not allowed.
TUI way
When the key in-use leaks, you can also switch to the next key set with TUI.
cd <path-meta-iot2050>
./kas-container menu
1. Set Firmware image for PG2 devices as the Image type
2. Check Secure Boot and OTP provisioning in Image features
3. Select OTP provisioning command type
4. Check your selection in generated .config.yaml.
3. Set a higher value for Use specific firmware secure version under Build options.
You must set a higher value than the old value when you need to bump the secure version
to fix secure bug. For example: if the current in-use secure version is 3, you need to use 4
as the new secure version.
4. Navigate to Save & Build and press Enter.
Note
Only SEBoot checks the secure version to validate the tispl container image. By replacing
the tispl container image, a new Secure Boot chain could be established for the rest. This
Secure Boot chain can prevent downgrade attacks for those rest images.
Secure policy Status of Key Status of Secure Validate the im- Behavior when
programmed Boot enable bit age during boot? validation is
failed
none No key pro- No
grammed
soft 1 MPK is pro- Untouched Yes Continues to boot
grammed
enforced Both MPK and Flipped Yes Stops to boot
SMPK are pro-
grammed
1 You can set the device to soft policy as a final gate to check if everything is working as
expected before enabling the Secure Boot.
Note
The default secure status of SEBoot is none.