Design and Implementation of a Global Masked SM4 Against Power Analysis Attacks Based on a Loop Architecture
-
摘要: 信息时代下,安全芯片是硬件防护的核心载体,SM4国密算法作为安全芯片主流加密算法之一,发挥着关键的底层安全防护作用。针对SM4在硬件实现中面积开销与安全防护难以兼顾的问题,该文实现一种循环结构的全局掩码SM4硬件方案。首先,基于组合逻辑优化技术实现一种低面积开销的掩码S盒,为电路安全防护提供基础支撑;同时采用全局掩码对明文和密钥全过程进行防护,在可接受的面积开销内提升电路的抗侧信道攻击能力;为实现面积与性能之间的平衡,该文采用循环架构,通过密钥扩展与加密模块并行执行的方式实现电路稳定吞吐率与低延迟分组加密。基于硅前仿真生成的波形记录文件对第一轮S盒单输出份额进行单点采样,在汉明重量功耗模型下,采集
10000 条功耗迹并实施一阶相关功耗攻击,实验结果表明所提方案在该攻击条件下无法恢复密钥,与基于复合域实现的掩码S盒相比实现了更优的面积开销。在密钥动态更新的安全加密场景下,与相同工艺(SMIC 0.18um)的紧凑型掩码SM4方案对比,加密延迟周期降低了55.1%,吞吐率提升至2.43倍。Abstract:Objective In the digital information era, the domestic SM4 block cipher algorithm has become a mainstream cryptographic algorithm deployed inside security chips to deliver foundational security protection for data encryption. Nevertheless, existing SM4 hardware implementations suffer from a prominent bottleneck: hardware area overhead and side-channel security performance cannot be synchronously optimized. Conventional masked SM4 designs usually adopt composite-field masked S-box structures to resist power analysis attacks, which makes their circuit architectures constrained by selected mathematical field and results in poor flexibility. At the architectural level, lightweight designs commonly adopt cyclic reused S-boxes to minimize area, at the cost of throughput and latency; high-performance implementations rely on pipelines, which boost performance but introduce substantial resource overhead. Current research primarily focuses on local S-box optimization, yet neglects the coordinated design of global masking completeness, low-overhead nonlinear implementation, and holistic architecture integration. Under such circumstances, it is urgently necessary to explore a novel SM4 hardware design scheme that harmonizes low area cost, high performance and resistance to power analysis attacks, so as to fill the technical gap between hardware resource limitation and full-process cryptographic security protection for SM4 implementations. Methods This paper proposes a global masked SM4 hardware design built upon loop architecture, aiming to achieve high performance and strong resistance to power analysis attacks while maintaining low area overhead. First, combinational logic optimization is exploited to construct a novel masked S-box featured with reduced hardware resource occupation, which lays the core circuit foundation for subsequent side-channel security protection. Second, a full-process global masking mechanism is introduced to cover both plaintext and secret key throughout the entire encryption workflow, which strengthens the circuit’s capability against side-channel power analysis attacks within a controllable extra area overhead range. Moreover, a loop hardware framework is configured to balance hardware footprint and encryption efficiency, where the key expansion module and core encryption computing module are scheduled to execute in parallel. This parallel collaborative design ensures stable data throughput and low-latency block cipher computation for SM4 encryption circuits. Results and Discussions To verify the feasibility of the design, functional correctness is validated through RTL simulation, followed by security analysis of both the S-box and the overall circuit. Finally, the proposed SM4 circuit is synthesized and compared with existing designs in terms of performance. Based on the waveform traces generated from pre-silicon simulation, a single-point sample is taken from the first-round S-box output share, and 10000 power traces are collected under the Hamming weight power model. The results demonstrate that the secret key cannot be recovered under first-order CPA with single-point sampling at the first-round S-box output share (Fig.10 ). Compared with traditional composite-field masked S-box implementations, the proposed design achieves better area overhead (Table 1 ). For the practical application scenario with dynamic secret key updates, compared with a SM4 design synthesized under the same SMIC 0.18um process, the proposed parallel loop architecture decreases encryption latency cycles by 55.1%, and increases throughput to 2.43 times (Table 2 ). With the area of the random number generator taken into account, the area-normalized throughput is still comparable, yet the results demonstrate a significant improvement in throughput performance without compromising area efficiency, thereby achieving a superior area-performance trade-off.Conclusions This work puts forward a global masked SM4 hardware implementation scheme adopting loop parallel architecture, which effectively addresses the long-standing trade-off challenge between hardware area and side-channel attack resistance in SM4 hardware realization. Benefiting from the optimized low-cost masked S-box, full-process global masking protection and parallel execution of key expansion and encryption, the proposed design achieves remarkable advantages in throughput performance and power-attack resistance. However, this work is based on architectural-level simulation and does not account for physical side-channel leaks induced by routing-induced glitches and share coupling. Moreover, the random number overhead grows significantly with masking order, becoming a key bottleneck for high-order masking adoption. Future work will explore low-overhead masking schemes under more realistic physical leakage models to enhance security without proportionally increasing randomness cost. -
Key words:
- Masked S-box /
- Global Mask /
- Loop Architecture /
- Parallel Execution
-
表 1 S盒综合资源分析
方法 工艺 时延(ns) 等效门(gate) 随机数消耗 安全模型 无掩码查找表S盒 Smic 0.18/TT 5.017 604 / / Liu等人无掩码复合域S盒[15] Smic 0.18 4.180 368 / / 本文无掩码S盒 Smic 0.18/FF 3.317 305 / / Smic 0.18/TT 5.217 305 / / Tang等人掩码S盒[9] / / / 60安全与门(180bit) 二阶CPA Liu等人掩码S盒[15] Smic 0.18/1.8V / 1240 / 一阶DPA Bu掩码S盒[17] Smic 0.18 6.100 1089 / 一阶DPA 本文掩码S盒 Smic 0.18/FF 4.895 1051 34安全与门(34bit) 一阶CPA Smic 0.18/TT 7.304 1052 -
[1] 龚锐, 石伟, 刘威, 等. 基于NAND Flash的CPU安全启动设计与实现[J]. 计算机工程与科学, 2022, 44(6): 971–978. doi: 10.3969/j.issn.1007-130X.2022.06.003.GONG Rui, SHI Wei, LIU Wei, et al. Design and implementation of CPU secure boot based on NAND Flash[J]. Computer Engineering & Science, 2022, 44(6): 971–978. doi: 10.3969/j.issn.1007-130X.2022.06.003. [2] 石伟, 刘威, 龚锐, 等. 微处理器内安全子系统的安全增强技术[J]. 计算机工程与科学, 2021, 43(8): 1353–1359. doi: 10.3969/j.issn.1007-130X.2021.08.003.SHI Wei, LIU Wei, GONG Rui, et al. Security enhancement technologies of security subsystem in microprocessors[J]. Computer Engineering & Science, 2021, 43(8): 1353–1359. doi: 10.3969/j.issn.1007-130X.2021.08.003. [3] 付杰, 张肖强, 林信南, 等. 面向SM4侧信道攻击的高效方案的设计与实现[J]. 青岛大学学报: 工程技术版, 2026, 41(1): 93–101. doi: 10.13306/j.1006-9798.2026.01.012.FU Jie, ZHANG Xiaoqiang, LIN Xinnan, et al. Design and implementation of an efficient scheme for SM4 side-channel attacks[J]. Journal of Qingdao University: Engineering & Technology Edition, 2026, 41(1): 93–101. doi: 10.13306/j.1006-9798.2026.01.012. [4] 赵毅强, 闫明凯, 张启智, 等. 基于多阶段相关功耗分析的SM4-XTS侧信道分析方法[J]. 电子与信息学报, 2024, 46(11): 4161–4169. doi: 10.11999/JEIT240183.ZHAO Yiqiang, YAN Mingkai, ZHANG Qizhi, et al. SM4-XTS side channel analysis method based on multi-stage CPA[J]. Journal of Electronics & Information Technology, 2024, 46(11): 4161–4169. doi: 10.11999/JEIT240183. [5] 陈华, 习伟, 范丽敏, 等. 密码产品的侧信道分析与评估[J]. 电子与信息学报, 2020, 42(8): 1836–1845. doi: 10.11999/JEIT190853.CHEN Hua, XI Wei, FAN Limin, et al. Side channel analysis and evaluation on cryptographic products[J]. Journal of Electronics & Information Technology, 2020, 42(8): 1836–1845. doi: 10.11999/JEIT190853. [6] 沈炜, 刘诗宇, 杨光, 等. 面向密码芯片设计阶段的仿真侧信道安全性分析方法研究[J]. 电子技术应用, 2024, 50(10): 98–104. doi: 10.16157/j.issn.0258-7998.245035.SHEN Wei, LIU Shiyu, YANG Guang, et al. Research on side channel security analysis technology of cryptographic chip based on simulation[J]. Application of Electronic Technique, 2024, 50(10): 98–104. doi: 10.16157/j.issn.0258-7998.245035. [7] 严迎建, 汪晶, 刘燕江. 基于塔域的通用循环移位掩码设计方法[J]. 电子与信息学报, 2021, 43(9): 2489–2497. doi: 10.11999/JEIT210588.YAN Yingjian, WANG Jing, and LIU Yanjiang. Design method of generic cyclic shift mask based on tower field[J]. Journal of Electronics & Information Technology, 2021, 43(9): 2489–2497. doi: 10.11999/JEIT210588. [8] 裴超. 一种SM4掩码方法和抗DPA攻击分析[J]. 密码学报, 2016, 3(1): 79–90. doi: 10.13868/j.cnki.jcr.000111.PEI Chao. A method of masking SM4 and analysis against DPA attacks[J]. Journal of Cryptologic Research, 2016, 3(1): 79–90. doi: 10.13868/j.cnki.jcr.000111. [9] 唐啸霖, 冯燕, 李明达, 等. 秘密共享: 高阶掩码S盒和有限域安全乘法设计[J]. 电子与信息学报, 2024, 46(8): 3400–3409. doi: 10.11999/JEIT231272.TANG Xiaolin, FENG Yan, LI Mingda, et al. Secret sharing: Design of higher-order masking S-box and secure multiplication in galois field[J]. Journal of Electronics & Information Technology, 2024, 46(8): 3400–3409. doi: 10.11999/JEIT231272. [10] BOYAR J and PERALTA R. A new combinational logic minimization technique with applications to cryptology[C]. 9th International Symposium on Experimental Algorithms, Ischia Island, Italy, 2010: 178–189. doi: 10.1007/978-3-642-13193-6_16. [11] SAARINEN M J O. A lightweight ISA extension for AES and SM4[EB/OL]. https://arxiv.org/abs/2002.07041v1, 2020. doi: 10.48550/arXiv.2002.07041. [12] 隋谦, 周佳运, 祝一豪, 等. 一种非常紧凑的掩码AES的硬件设计与实现[J]. 密码学报, 2024, 11(3): 662–680. doi: 10.13868/j.cnki.jcr.000701.SUI Qian, ZHOU Jiayun, ZHU Yihao, et al. A compact implementation of masked AES encryption[J]. Journal of Cryptologic Research, 2024, 11(3): 662–680. doi: 10.13868/j.cnki.jcr.000701. [13] 朱麒瑾, 陈小文, 鲁建壮. 可变流水级SM4加解密算法硬件设计及FPGA实现[J]. 计算机工程与科学, 2024, 46(4): 606–614. doi: 10.3969/j.issn.1007-130X.2024.04.005.ZHU Qijin, CHEN Xiaowen, and LU Jianzhuang. Hardware design and FPGA implementation of a variable pipeline stage SM4 encryption and decryption algorithm[J]. Computer Engineering & Science, 2024, 46(4): 606–614. doi: 10.3969/j.issn.1007-130X.2024.04.005. [14] 张宏科, 袁浩楠, 丁文秀, 等. 基于FPGA的SM4算法高效实现方案[J]. 通信学报, 2024, 45(5): 140–150. doi: 10.11959/j.issn.1000-436x.2024053.ZHANG Hongke, YUAN Haonan, DING Wenxiu, et al. Efficient implementation scheme of SM4 algorithm based on FPGA[J]. Journal on Communications, 2024, 45(5): 140–150. doi: 10.11959/j.issn.1000-436x.2024053. [15] LIU Yaoping and ZHAO Huichao. Hardware implementation of compact reconfigurable AES/SM4 encryption circuit against differential power attact[C]. Proceedings of the 2nd International Conference on Information Economy, Data Modeling and Cloud Computing, Nanchang, China, 2023. doi: 10.4108/eai.2-6-2023.2334594. [16] BOYAR J and PERALTA R. A small depth-16 circuit for the AES S-box[C]. 27th IFIP TC 11 Information Security and Privacy Conference on Information Security and Privacy Research, Heraklion, Greece, 2012: 287–298. doi: 10.1007/978-3-642-30436-1_24. [17] 卜祥利. 抗旁路攻击的紧凑型SM4加解密电路研究与设计[D]. [硕士论文], 南京航空航天大学, 2020. doi: 10.27239/d.cnki.gnhhu.2020.000041.BU Xiangli. Research and design of compact SM4 encryption and decryption circuit resisting bypass attack[D]. [Master dissertation], Nanjing University of Aeronautics and Astronautics, 2020. doi: 10.27239/d.cnki.gnhhu.2020.000041. [18] ISHAI Y, SAHAI A, and WAGNER D. Private circuits: Securing hardware against probing attacks[C]. 23rd Annual International Cryptology Conference on Advances in Cryptology -- CRYPTO 2003, Santa Barbara, USA, 2003: 463–481. doi: 10.1007/978-3-540-45146-4_27. [19] SUSANTI B H, JIMMY J, and ARDYANI M W. ENT randomness test on DM-PRESENT-80 and DM-PRESENT-128-based pseudorandom number generator[C]. 2021 4th International Seminar on Research of Information Technology and Intelligent Systems (ISRITI), Yogyakarta, Indonesia, 2021: 324–328. doi: 10.1109/ISRITI54043.2021.9702862. [20] 唐啸霖, 冯燕, 李志强, 等. 针对SM4的选择明文攻击: 线性运算带来的难题与对策[J]. 电子与信息学报, 2025, 47(8): 2791–2799. doi: 10.11999/JEIT250014.TANG Xiaolin, FENG Yan, LI Zhiqiang, et al. A chosen-plaintext method on SM4: Linear operation challenges and the countermeasures[J]. Journal of Electronics & Information Technology, 2025, 47(8): 2791–2799. doi: 10.11999/JEIT250014. [21] SHARMA A and WEN Shaofang. An evidence-based framework for hardware security evaluation using side-channel analysis: Leakage detection, key-recovery validation, and robustness assessment[J]. Electronics, 2026, 15(18): 4324. doi: 10.3390/electronics15184324. [22] SCHNEIDER T and MORADI A. Leakage assessment methodology: A clear roadmap for side-channel evaluations[C]. 17th International Workshop on Cryptographic Hardware and Embedded Systems -- CHES 2015, Saint-Malo, France, 2015: 495–513. doi: 10.1007/978-3-662-48324-4_25. [23] Opensource-toolkit. Download of SMIC180 process library resources[DB/OL]. https://gitcode.com/open-source-toolkit/c06a4, 2026.(查阅网上资料,未找到本条文献作者及英文信息,请确认). [24] GIGERL B, KLUG F, MANGARD S, et al. Smooth passage with the guards: Second-order hardware masking of the AES with low randomness and low latency[J]. IACR Transactions on Cryptographic Hardware and Embedded Systems, 2024(1): 309–335. doi: 10.46586/tches.v2024.i1.309-335. -
下载: