Mitigating Randomness Leakage in SM2 White-Box Implementations via Trusted Execution Environments
Abstract
:1. Introduction
- (1)
- TEE-Based Random Number Protection Mechanism: A robust approach is designed to secure the generation and handling of random numbers within the TEE, leveraging secure memory environments and protected instructions to prevent attackers from inferring the private key.
- (2)
- Affine Transform Coding-Based Lookup Table Scheme: To improve performance under the white-box model, we propose a scheme that uses affine transform coding to create efficient and space-saving lookup tables, enhancing the performance of the SM2 white-box method and preventing key extraction by attackers.
- (3)
- Effective Experimental Validation: Comprehensive tests evaluated our SM2 white-box method in real-world applications, focusing on signature and verification times across various platforms. Compared to the standard SM2 implementation, our method maintains practical performance, with signature times 2–3 times longer and verification times about twice as long. Security assessments confirmed the robustness of our method, ensuring the protection of the private key and improving computational performance compared to existing SM2 white-box algorithms.
2. Threat Model
3. Related Work
4. Preliminaries
4.1. White-Box Cryptography
4.2. SM2 Algorithm
- The characteristic p of , p is is a 256-bit prime number.
- Elements a and b in satisfy the curve equation , with .
- The base point is not the point at infinity.
- The order of the base point in is a 256-bit prime number.
4.3. TEE
5. Methodology
5.1. Overall Framework
5.2. TEE-Based Random Number Protection
- Secure Memory Initialization: The secure memory management module initializes the safety attributes of the secure memory. It first calculates the size of the required secure memory based on the physical memory size, requests the corresponding memory, and sets this memory to secure attributes—readable and writable in the secure world, and read-only in the non-secure world—via the TZC controller.
- Page Table Request Forwarding: When the kernel modifies the page table data, the page table protection module intercepts the corresponding page table operation. It analyzes the specific type of the kernel’s operation on the page table (requesting, releasing, or modifying) and the page table address. The kernel layer in the non-secure world sends the type of page table operation and the page table address to the secure world through SMC calls.
- Page Table Data Modification: Upon receiving the forwarded page table request, the secure world first verifies the legitimacy of the request. It then simulates the execution of the operation corresponding to the legitimate page table request. The page table protection module modifies the page table data in the secure memory by calling the appropriate interface of the security management module.
5.3. Lookup Table Based Key Hiding
5.3.1. Lookup Table Generation
- Affine Transformation: The tables and are generated by applying affine transformations on the elliptic curve points. Each row of these tables contains a point and its corresponding transformation, where is a random number generated for each row. The affine transformations used to generate the lookup tables are defined by the following general form:
- Random Number Generation: The random numbers are generated using the high-entropy random number generator within the Trusted Execution Environment (TEE). This ensures that the random numbers are difficult to predict or replicate by attackers. These numbers are used to populate the elliptic curve points in and .
- Key Hiding Transformation: The third table is generated by applying a transformation that hides the private key . This operation is performed outside the TEE, within the REE, to support efficient processing of less critical computations. The formula used to generate each entry in is
5.3.2. Lookup Table Mapping
- Generate according to the “SM2 Elliptic Curve Public Key Cryptographic Algorithm” document and calculate , where , H is the hash function, and is the hash value of the user’s identifiable information, some elliptic curve system parameters, and the user’s public key.
- Uniformly generate a -bit 0-1 random string k, denoted as . For all i values where , sum the corresponding i rows in Table to obtain .
- Calculate . If r = 0 or or , re-execute step 2. Otherwise, proceed to step 4. Here, refers to the identity element in the elliptic curve group.
- For all i values where , sum the corresponding i rows in to obtain .
- Represent r in binary as . For all i values where , sum the corresponding i rows in Table to obtain . Compute , and generate the signature .
- The signature verification fails if r does not belong to . Otherwise, compute , where .
- Calculate . Represent r in binary as . For all i values where , sum the corresponding i rows in Table to obtain , where .
- Calculate . If or , the signature validation fails. Otherwise, proceed to step 4.
- Calculate . The signature verification passes if R = r; otherwise, it fails.
5.3.3. SM2 Private Key Hiding
6. White-Box Security Analysis
6.1. White-Box Diversity and White-Box Ambiguity
6.2. White-Box Security of Equivalent Keys
6.3. Resistance to Known White-Box Attacks
6.4. White-Box Testing and Results
6.4.1. Testing Scheme
6.4.2. Performance Comparison Tests
6.4.3. Expanded Attack Scenarios (APT and Side-Channel Attacks)
6.4.4. Power Consumption and Computational Overhead
6.5. Discussion
7. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Chow, S.; Eisen, P.; Johnson, H.; van Oorschot, P.C.; van Someren, L. White-Box Cryptography and an AES Implementation. In Proceedings of the Ninth Workshop on Selected Areas in Cryptography (SAC 2002), St. John’s, NL, Canada, 15–16 August 2002; Springer: Berlin/Heidelberg, Germany, 2002; pp. 250–270. [Google Scholar]
- Chow, S.; Eisen, P.; Johnson, H.; van Oorschot, P.C.; van Someren, L. A White-Box DES Implementation for DRM Applications. In Digital Rights Management; Springer: Berlin/Heidelberg, Germany, 2003; pp. 1–15. [Google Scholar]
- Jiang, X.; Luo, T. A White-Box Cryptographic SM2 Scheme Based on Space Hardness. In Proceedings of the 5th International Conference on Mechanical, Control and Computer Engineering (ICMCCE), Harbin, China, 25–27 September 2020; IEEE Computer Society: New York, NY, USA, 2020; pp. 1264–1268. [Google Scholar]
- Mo, F.; Shamsabadi, A.S.; Katevas, K.; Demetriou, S.; Leontiadis, I.; Cavallaro, A.; Haddadi, H. Darknetz: Towards model privacy at the edge using trusted execution environments. In Proceedings of the 18th International Conference on Mobile Systems, Applications, and Services, Toronto, ON, Canada, 15–19 June 2020; pp. 161–174. [Google Scholar]
- Zhang, Z.; Gong, C.; Cai, Y.; Yuan, Y.; Liu, B.; Li, D.; Guo, Y.; Chen, C. No privacy left outside: On the (in-) security of tee-shielded dnn partition for on-device ml. In Proceedings of the 2024 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 19–23 May 2024; pp. 3327–3345. [Google Scholar]
- Lu, Z. Research on Software Anti-Tampering Technology Based on White-Box Encryption Algorithms. Master’s Thesis, Shanghai Jiao Tong University, Shanghai, China, 2012. [Google Scholar]
- Jacob, M.; Boneh, D.; Felten, E. Attacking an Obfuscated Cipher by Injecting Faults. In Digital Rights Management; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2003; Volume 2696, pp. 16–31. [Google Scholar]
- Goubin, L.; Masereel, J.M.; Quisquater, M. Cryptanalysis of White Box DES Implementations. In Selected Areas in Cryptography; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2007; Volume 4876, pp. 278–295. [Google Scholar]
- Wyseur, B.; Michiels, W.; Gorissen, P.; Preneel, B. Cryptanalysis of White-Box DES Implementations with Arbitrary External Encodings. In Selected Areas in Cryptography; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 2007; Volume 4876, pp. 264–277. [Google Scholar]
- Bringer, J.; Chabanne, H.; Dottax, E. White Box Cryptography: Another Attempt. In IACR Cryptology ePrint Archive; Cryptology ePrint Archive: Cambridge, MA, USA, 2006; p. 468. [Google Scholar]
- Xiao, Y.; Lai, X. A Secure Implementation of White-Box AES. In Proceedings of the 2nd International Conference on Computer Science and its Applications (CSA 2009), Jeju Island, Republic of Korea, 10–12 December 2009; IEEE: New York, NY, USA, 2009; pp. 1–6. [Google Scholar]
- Karroumi, M. Protecting White-Box AES with Dual Ciphers. In Information Security and Cryptology—ICISC 2010; Springer: Berlin/Heidelberg, Germany, 2011; pp. 278–291. [Google Scholar]
- Bogdanov, A.; Isobe, T. White-Box Cryptography Revisited: Space-Hard Ciphers. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security, Denver, CO, USA, 12–16 October 2015; ACM: New York, NY, USA, 2015; pp. 1058–1069. [Google Scholar]
- Hoogerbrugge, J.; Michiels, W. Protecting the Input/Output of Modular Encoded White-Box RSA. U.S. Patent US2016328543, 10 November 2016. [Google Scholar]
- China Electronics Technology Group Corporation; The 30th Research Institute. An Implementation Method of SM2 White-Box Digital Signature Based on Residue System. China Patent CN201611202646.3, 3 May 2017. [Google Scholar]
- Zhang, M.; Liu, L. Confidential Computing: An Overview and Its Applications in Cloud Security. IEEE Trans. Dependable Secur. Comput. 2024, 21, 76–89. [Google Scholar] [CrossRef]
- Yang, X.; Wu, Y. The Role of Trusted Execution Environments in Data Privacy. J. Cloud Comput. 2023, 12, 150–164. [Google Scholar] [CrossRef]
- Smith, J.; Brown, A.; Zhao, T. Security of White-box Cryptography Integrated with Trusted Execution Environments. J. Cryptogr. Eng. 2023, 14, 135–147. [Google Scholar] [CrossRef]
- Lee, K.; Park, J. Evaluating the Security and Efficiency of TEE-based White-box Cryptography in IoT Devices. IEEE Internet Things J. 2023, 10, 1800–1812. [Google Scholar] [CrossRef]
- Liu, D.; Chen, S. Secure Memory Encryption for Trusted Execution Environments. ACM Comput. Surv. 2024, 57, 26:1–26:15. [Google Scholar] [CrossRef]
- Wang, Y.; Zhang, Z. Challenges in Securing Trusted Execution Environments and Their Applications. Secur. Priv. 2023, 16, e2768. [Google Scholar] [CrossRef]
- Bock, E.A.; Brzuska, C.; Lai, R.W.F. On Provable White-Box Security in the Strong Incompressibility Model. IACR Trans. Cryptogr. Hardw. Embed. Syst. 2023, 2023, 167–187. [Google Scholar] [CrossRef]
- Bai, K.P.; Wu, C.K.; Zhang, Z.F. Protect White-Box AES to Resist Table Composition Attacks. IET Inf. Secur. 2018, 12, 305–313. [Google Scholar] [CrossRef]
- Wang, J.G.; Wang, J.; Li, M.; Neel, S. Pandora’s White-Box: Increased Training Data Leakage in Open LLMs. arXiv 2024, arXiv:2402.17012. [Google Scholar]
- Lin, T.; Lai, X. White-Box Cryptography Research. J. Cryptologic Res. 2015, 2, 258–267. [Google Scholar]
- Yao, S.; Chen, J. A New Method for White-Box Implementation of SM4 Algorithm. J. Cryptologic Res. 2020, 7, 358–374. [Google Scholar]
- Nidhra, S.; Dondeti, J. Black Box and White Box Testing Techniques: A Literature Review. Int. J. Embed. Syst. Appl. (IJESA) 2012, 2, 29–50. [Google Scholar] [CrossRef]
- Henard, C.; Papadakis, M.; Harman, M.; Jia, Y.; Le Traon, Y. Comparing White-Box and Black-Box Test Prioritization. In Proceedings of the 38th International Conference on Software Engineering, Austin, TX, USA, 14–22 May 2016; IEEE: New York, NY, USA, 2016. [Google Scholar]
- Khan, M.E.; Khan, F. A Comparative Study of White Box, Black Box and Grey Box Testing Techniques. Int. J. Adv. Comput. Sci. Appl. 2012, 3, 12–15. [Google Scholar]
- Xingqi, W.; Fei, S. Cipher Based Data Security Sharing Scheme. In Proceedings of the 2024 7th International Conference on Artificial Intelligence and Big Data (ICAIBD), Chengdu, China, 24–27 May 2024; pp. 302–306. [Google Scholar]
= 500 | = 650 | = 800 | |
---|---|---|---|
White-box diversity | |||
White-box ambiguity |
Device | Time for λ = 500, 650, 800 Generating (s) | SM2 White-Box Signature Time (s) | SM2 White-Box Verification Time (s) | Standard SM2 Signature Time (s) | Standard SM2 Verification Time (s) | ||
---|---|---|---|---|---|---|---|
500 | 650 | 800 | |||||
Huawei Honor 4A | 5.2164 | 6.3618 | 7.2143 | 0.0213 | 0.0134 | 0.0076 | 0.0076 |
Apple iPhone 6 | 1.3109 | 1.5364 | 1.7696 | 0.0071 | 0.0091 | 0.0047 | 0.0047 |
Laptop (i5) | 0.9533 | 1.0324 | 1.2652 | 0.0089 | 0.0041 | 0.0016 | 0.0017 |
Server (i7) | 0.4326 | 0.5248 | 0.6216 | 0.0045 | 0.0012 | 0.0006 | 0.0006 |
Device | Scheme | TEE Enabled | Signature Time (s) | Verification Time (s) | Resistance to Random Number Leakage | Resistance to Memory Attacks |
---|---|---|---|---|---|---|
Server (i7) | SM2 White-Box Method Based on Spatial Hardness | No | 0.2318 | 0.1016 | Low | Low |
Our SM2 White-Box Method | Yes | 0.0045 | 0.0012 | High | High | |
Laptop (i5) | SM2 White-Box Method Based on Spatial Hardness | No | 0.2618 | 0.1243 | Low | Low |
Our SM2 White-Box Method | Yes | 0.0089 | 0.0041 | High | High |
Device | CPU | Memory | Operating System |
---|---|---|---|
Apple iPhone 6 | ARM v8 | 1G | iOS 8.4 |
Huawei Honor 4A | ARMv7 MSM8909 | 2G | Android 5.1 |
Laptop (i5) | Intel i5-8750H | 4G | Ubuntu 16.04 |
Server (i7) | Intel i7-9750H | 32G | Ubuntu 16.04 |
Attack Type | Attack Duration | Attack Success Rate | Impact on Key Extraction | TEE Isolation Effectiveness |
---|---|---|---|---|
Social Engineering | 30 days | 15% | Key extraction successful 2% of the time | 100% key isolation |
Zero-day Exploit | 60 days | 30% | Key extraction successful 5% of the time | 99.9% key isolation |
APT with Malware | 90 days | 45% | Key extraction successful 7% of the time | 99.9% key isolation |
Attack Type | Power Consumption Analysis | Attack Success Rate (No TEE) | Attack Success Rate (With TEE) | Key Leakage |
---|---|---|---|---|
DPA (No TEE) | Measured power consumption during signing process | 95% | 10% | 95% leakage |
DPA (With TEE) | Power consumption masked by TEE’s isolation | 10% | 0% | 0% leakage |
EMA (No TEE) | Measured electromagnetic radiation | 85% | 15% | 85% leakage |
EMA (With TEE) | Masked by TEE’s isolation | 5% | 0% | 0% leakage |
Platform | Signature Time (No TEE) (s) | Signature Time (With TEE) (s) | Verification Time (No TEE) (s) | Verification Time (With TEE) (s) | Memory Usage (With TEE) |
---|---|---|---|---|---|
Raspberry Pi 3 | 0.050 | 0.080 | 0.005 | 0.010 | 25 MB |
Android (Snapdragon) | 0.020 | 0.035 | 0.003 | 0.008 | 30 MB |
Intel i7 (Server) | 0.005 | 0.007 | 0.0006 | 0.0012 | 50 MB |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhu, H.; Song, Y.; Li, Y.; Luo, W.; Tian, J.; Yang, F.; Liu, W.; Gong, Y.; Li, D. Mitigating Randomness Leakage in SM2 White-Box Implementations via Trusted Execution Environments. Electronics 2025, 14, 301. https://doi.org/10.3390/electronics14020301
Zhu H, Song Y, Li Y, Luo W, Tian J, Yang F, Liu W, Gong Y, Li D. Mitigating Randomness Leakage in SM2 White-Box Implementations via Trusted Execution Environments. Electronics. 2025; 14(2):301. https://doi.org/10.3390/electronics14020301
Chicago/Turabian StyleZhu, Hongyu, Yubo Song, Yang Li, Weiqiang Luo, Jianwei Tian, Fangliao Yang, Wenchang Liu, Yi Gong, and Ding Li. 2025. "Mitigating Randomness Leakage in SM2 White-Box Implementations via Trusted Execution Environments" Electronics 14, no. 2: 301. https://doi.org/10.3390/electronics14020301
APA StyleZhu, H., Song, Y., Li, Y., Luo, W., Tian, J., Yang, F., Liu, W., Gong, Y., & Li, D. (2025). Mitigating Randomness Leakage in SM2 White-Box Implementations via Trusted Execution Environments. Electronics, 14(2), 301. https://doi.org/10.3390/electronics14020301