SM Algorithms
Introduction
Since TEE OS 1.6.2, the confidential OS starts to support SM cryptographic algorithms in TA encryption, secure storage, and hardware-based acceleration.
Figure 1 SM algorithms
- SM algorithms for TA compilation: The default algorithm for TA compilation is AES-CBC. You can use SM4-CBC instead.
- SM algorithms for secure storage: When the secure storage GP API is invoked, the TEE OS uses the AES-XTS and SHA256 algorithms for data encryption and digesting by default. You can use SM4-CBC and SM3 instead.
- SM algorithms for hardware-based acceleration: Hardware-based acceleration can be enabled when invoking the GP API to implement SM4 encryption and decryption.
For details about how to configure SM algorithms, see SM Algorithms.
Restrictions
Hardware-based acceleration:
- Only SM4-CBC and SM4-ECB are supported for hardware-based acceleration. ECB is not recommended because it is insecure.
- To use hardware-based acceleration, set the GP API level for TA compilation to 3. In the manifest.txt file, set gpd.ta.dma_allocable to true to enable the Direct Memory Access (DMA) memory.
- A maximum of 32 concurrent threads can use hardware-based acceleration in the TEE.
- When 64 global resources in the queue are occupied, no queue resource is available. As a result, the hardware-based acceleration function is unavailable. To resolve this problem, use software computing instead. If you still want to use hardware-based acceleration, restart the server.
- The HUK key derivation function also uses queue resources. When no queue resource is available, the HUK API is unavailable, and secure storage and remote attestation cannot be used.
Secure storage:
- To use secure storage, a single file read/write cannot exceed 4 MB and each file cannot exceed 4 MB.
- A subthread created in a TA cannot access secure storage.
Parent topic: Key Features