2021年7月15日 星期四

Comparing the TEE to integrated HSMs

Source: https://www.trustonic.com/technical-articles/comparing-the-tee-to-integrated-hsms/


Introduction 

As more and more devices become connected so the need for ever greater security and protection of critical assets increases. Traditionally such support has been provided by a Hardware Security Module (HSM) but over the last decade the use of Trusted Execution Environments (TEE) has grown significantly. This article aims to provide the reader with an understanding of the difference between these two solutions and their suitability for different scenarios. 

HSM V TEE

Generically, a HSM provides key management and cryptographic functionality for other applications. 

A TEE also provides this functionality, along with enabling application (or security focused parts of applications) to execute inside its isolation environment. 

For example, in modern Android mobile devices, the TEE is already unknowingly used every day, by millions of people as an HSM equivalent, through the use of a Trusted Application (TA) providing the Android KeyMaster functionality. 

Regular Execution Environment (REE) is the term in the TEE community for everything in a device that is outside a particular TEE. Technically, from a particular TEEs point of view, all components that are outside of its security boundary live in the REE. Having said that, for simplification of the big picture, a device with multiple TEEs, SIMs, HSMs or other high trust components, may have those separated out from the REE. The REE houses the Regular OS, which in combination with the rest of that execution environment, does not have sufficient security to meet a task needed by the device. 

For more background on terminology like TEE and REE please have a look in “What is a TEE?” 

For more information on the ARM TrustZone hardware security behind the TEE have a look in “What is a TrustZone?” 

How a HSM solves your problems… 

In compact devices with integrated HSM, the software architecture looks something like this: 

Comparing the TEE to integrated HSMs

The HSM provides Cryptographic Services to your security focused task. 

The “Secure” task in the REE has data. The HSM can receive that data and encrypt or decrypt that data, before handing it back to the issuer task in the REE. 

How is this done using a TEE? 

Here is how we support HSM functionality in a TEE enabled device today: 

Comparing the TEE to integrated HSMs

In an Android device, the above HSM will typically be replaced by a TA, within the TEE, implementing Keymaster functionality and an Android specific REE stack rather than OpenSSL/PKCS#11

In the above case, with a simpler Regular OS as might be found in an Engine Control Unit (ECU), a generic TA has been specifically written to provide the functionality of a typical HSM. 

Of course, with a TEE you can always do better than that

A TEE need not be used as a fixed purpose service provider like an HSM, it can also host the tasks directly. 

Comparing the TEE to integrated HSMs

Here we move the task into the TEE and manipulation of the unencrypted data can occur, in a place inaccessible to activity in the REE. 

As an example of what we gain:  

  • A device typically supports other tasks like complicated communication protocols (e.g., CAN BusIPBlueTooth or even 5G).  
  • These communication mechanisms may, or may not, be used by a particular secure task. 
  • What is important, is that by placing the secure task somewhere isolated from that communication software (e.g., in a TEE), security issues in the communication software no longer potentially drag down the security of the secure task. 

Some HSMs can load code to execute through proprietary extensions, but a GlobalPlatform compliant TEE uses standardised interfaces, enabling tasks developed for one TEE, to execute on another. Such tasks, executing in the TEE, are called “Trusted Applications”. 

What you cannot do with a HSM, but can do with a TEE in a well-designed SoC

HSM’s cannot directly protect the I/O ports providing sensor data, or controlling actuators, from software attacks in, for example, the REE of the ECU of a vehicle. 

Comparing the TEE to integrated HSMs

Unlike an HSM, on a correctly designed System-On-Chip (SoC) a TEE can also interface to peripherals. This enables the creation of a secure task, housed safely inside the TEE,  that can be used to substantially enhance the critical tasks’ security.  

Comparing the TEE to integrated HSMs

What do we gain here?  

Well, consider an example, from the automotive industry, of a fuel throttle. If the throttles’ I/O control port on the ECU is exposed in the REE software then it does not matter how much security the REE “Secure” task use of the HSM brings; you would not be using an HSM if you had high confidence in the security of the REE itself, and so you cannot have confidence that the software in the REE cannot be attacked.  

If the REE is open to attack, that means that attacked REE software can potentially gain unauthorised access to that I/O port, no matter how good the HSM is.  

In the TEE (like in an HSM), we do not have the generic load of software tasks unrelated to security. A task in the TEE can interface to hardware control ports without risk of other software making unauthorised access. 

If I only have an HSM in the above example, then all I can do is protect the data traffic to a device, not the decision making in the device. With a TEE, I can do both. 

Physical Attacks: TEE vs HSM 

As we have seen above, one issue with the use of an HSM is the exposure of data communications before any encryption has occurred. 

  • This impacts the data while it is in software, where it can be extracted or modified by a corrupted REE before the HSM has had a chance to act upon it.  
  • This also impacts the hardware attack profile. 

Fundamentally, device integrated HSMs might go as far as to use on-SoC hardware methods to protect their keys from extraction that are stronger than those of a TEE. However, the method to transfer data to the HSM for protection by those keys is no more strongly protected, than that used by a TEE and can be far weaker.  

Consider the following PCB-attached HSM in comparison to a typical TEE which will be using a stacked die (Package on a Package) to protect its much higher speed traffic: 

Comparing the TEE to integrated HSMs
Physical attacks

Stronger TEEs do not even use external RAM, as shown above, but can use on-SoC RAM instead. 

Comparing the TEE to integrated HSMs
TEE using On-SoC RAM

In this case, the benefit of using a TEE to provide traditional HSM functionality is a significant reduction in the exposure of unprotected data and therefore an enhancement of the overall security for the platform. 

Ultimately, if you are concerned about key extraction, it is advised that designs keep the key batch size small, whether using a TEE or an HSM. 

It is worth noting that in the EVITA standards, some HSM types reside on the same SoC as the REE, but in those cases their hardware protection methods are typically the same as a TEE (see the EVITA HSM levels). 

Conclusions 

In fast moving new innovation areas, such as connected vehicles and robotics, as well as consumer electronics devices, a TEE provides a cost effective and future proofed alternative to using an HSM. 

In addition to the potential of providing typical HSM functionality, a GlobalPlatform compliant TEE can also protect the critical tasks directly and has standardised methods for enabling over-the-air updating of critical systems. 

Fundamentally, a typical HSM is an attack-resistant cryptographic device designed to perform a specific set of cryptographic functions by the HSM designer. It provides the confidence of non-interference inside the scope defined by the relevant protection profile. A standardised TEE can do the same, and significantly more without the need to add additional hardware. As the TEE resides on the existing SoC integrated MMUs and TrustZone enabled hardware, the overall hardware bill of materials can be reduced and as components are being removed, and incidentally reducing risks of hardware failure.  

The development of TEEs is driven by standards, such as GlobalPlatform, and this brings predictability and interoperability. This means that device OEMs and third parties, can develop Trusted Applications to support an ever-growing list of platform security requirements.    

沒有留言: