网络与信息安全学报 ›› 2022, Vol. 8 ›› Issue (6): 29-38.doi: 10.11959/j.issn.2096-109x.2022080

• 专题:密码学技术与应用 • 上一篇    下一篇

低功耗嵌入式平台的SM2国密算法优化实现

刘赣秦, 李晖, 朱辉, 黄煜坤, 刘兴东   

  1. 西安电子科技大学网络与信息安全学院,陕西 西安 710071
  • 修回日期:2022-07-05 出版日期:2022-12-15 发布日期:2023-01-16
  • 作者简介:刘赣秦(1998- ),男,江西莲花人,西安电子科技大学硕士生,主要研究方向为密码算法的高性能优化
    李晖(1968- ),男,河南灵宝人,博士,西安电子科技大学教授、博士生导师,主要研究方向为密码学、无线网络安全、云计算安全、信息论与编码理论
    朱辉(1981- ),男,河南周口人,博士,西安电子科技大学教授、博士生导师,主要研究方向为数据安全与隐私保护、安全方案及协议设计、网络及应用安全
    黄煜坤(1998- ),男,湖北襄阳人,西安电子科技大学硕士生,主要研究方向为密码算法的高性能优化
    刘兴东(1992- ),男,湖南衡阳人,西安电子科技大学硕士生,主要研究方向为网络空间安全、可信执行环境、密码算法优化
  • 基金资助:
    国家自然科学基金(61972304);国家自然科学基金(61932015);陕西省重点产业创新链项目(2020ZDLGY08-04)

Public key cryptographic algorithm SM2 optimized implementation on low power embedded platform

Ganqin LIU, Hui LI, Hui ZHU, Yukun HUANG, Xingdong LIU   

  1. School of Cyber Engineering, Xidian University, Xi’an 710071, China
  • Revised:2022-07-05 Online:2022-12-15 Published:2023-01-16
  • Supported by:
    The National Natural Science Foundation of China(61972304);The National Natural Science Foundation of China(61932015);Natural Science Foundation of Shaanxi Province(2020ZDLGY08-04)

摘要:

随着无线通信技术的发展和智能终端的普及,越来越多的密码算法被应用到物联网设备中以保障通信安全和数据安全,其中,由国家密码管理局提出的 SM2 椭圆曲线公钥密码算法作为我国自主研发的椭圆曲线公钥密码算法具有安全性高、密钥短的优点,已在通信系统中广泛部署,应用于身份认证、密钥协商等关键环节。然而,由于算法涉及有限域上的大整数运算,计算开销较大,在低功耗嵌入式平台下的执行严重影响用户体验。因此,面向ARM-m系列处理器提出了一种低功耗嵌入式平台的SM2算法的高效实现方案。具体来说,通过 Thumb-2 指令集提供的支持处理进位和节省寻址周期,对大整数的模加、模减等基础运算进行优化,并结合平台可用寄存器的数量构建高效的基础运算模块;基于ARM-m系列处理器乘累加指令周期短的特点,优化蒙哥马利乘法实现,并结合CIOS算法设计高效的模乘方案,方案不再局限于梅森素数,极大地提高了模乘计算的速度和灵活性;在理论分析和实验测试的基础上,给出了嵌入式平台上多倍点标量乘法 wNAF 滑动窗法的窗长选取方法。实验测试结果表明,可有效提升资源受限的低功耗嵌入式平台中SM2 算法的计算效率,不做预计算的情况下在 Cortex-M3 处理器上测试签名速度可达 0.204 秒/次,验签速度0.388秒/次,加密速度0.415秒/次,解密速度0.197秒/次。

关键词: 信息安全, 椭圆曲线密码体制, SM2, 嵌入式平台, 优化

Abstract:

With the development of wireless communication technology and the popularization of intelligent terminals, more and more cryptographic algorithms are applied to IoT devices to ensure the security of communication and data.Among them, the SM2 elliptic curve public key cryptography proposed by the State Cryptography Administration is an elliptic curve public key cryptography algorithm developed domestically, which has the advantages of high security and short key.SM2 has been widely deployed in various communication systems and is used in essential parts such as identity authentication and key negotiation.However, since SM2 involves large integer operations on finite fields, the computational cost is high, and its execution on a low-power embedded platform seriously affects the user experience.Therefore, an efficient implementation scheme of SM2 algorithm for low-power embedded platform was proposed for ARM-m series processors.Specifically, Thumb-2 instruction set was adopted to handle carry and save addressing cycles, basic operations such as modulo addition and sub-traction of large integers were optimized, and the number of available registers on the platform was combined to build efficient basic operations.Besides, based on the short multiplication and accumulation instruction cycle of ARM-m series processors, the implementation of Montgomery multiplication was optimized, and an efficient modular multiplication scheme was designed in combination with the CIOS algorithm.The scheme was no longer limited to Mersenne primes, and greatly improved the speed and flexibility of modular multiplication.Based on the theoretical analysis and experimental test, the window length selection method of the multiple point-scalar multiplication wNAF sliding window method on the embedded platform was given.The experimental test results show that the proposed scheme can effectively improve the computational efficiency of the SM2 algorithm on the resource-constrained low-power embedded platform.Without pre-calculation, the test signature speed can reach 0.204s/time, the signature verification speed is 0.388s/time, the encryption speed is 0.415s/time, and the decryption speed is 0.197s/time.

Key words: information security, elliptic curve cryptosystem, SM2, embedded platform, optimization

中图分类号: 

No Suggested Reading articles found!