首页|基于RISC-V指令扩展方式的国密算法SM2、SM3和SM4的高效实现

基于RISC-V指令扩展方式的国密算法SM2、SM3和SM4的高效实现

扫码查看
基于指令扩展的密码算法实现是兼顾性能和面积的轻量级实现方式,特别适用于日益普及的物联网设备.SM2、SM3和SM4等国密算法有利于提高自主可控设备的安全性,但针对这些算法进行指令扩展的相关研究还不够充分.RISC-V由于其开源、简洁及可扩展等优点已成为业界最流行的指令集架构之一,本文主要基于国产开源RISC-V处理器对国密算法SM2、SM3和SM4进行指令扩展和高效实现.本文基于软硬件协同的理念提出总体指令的扩展方案.对相关密码算法进行深入分析和方案对比,分别设计了硬件单元,提出高效的实现方式.设计实现的协处理器具有2级流水线结构,顺序派遣、乱序执行和顺序写回的指令执行模式,以及独立内存访问单元和大位宽寄存器.协处理器统一接管了密码算法的部分控制逻辑,降低硬件资源消耗.实验结果表明,本文设计的密码协处理器硬件结构精简,资源利用率高.SM2、SM3和SM4算法占用资源少,但执行速率相比纯硬件有一定程度下降,资源面积和花费时间的乘积与其他相关文献相比有不同程度的优势.
Efficient Implementation of National Security Algorithms SM2,SM3 and SM4 Based on RISC-V Instruction Extension Method
The implementation of the cryptographic algorithm based on instruction extension is a lightweight scheme that balances both performance and area,which is especially suitable for the increasingly popular Internet of Things devices.The proposal of national cryptographic algorithms such as SM2,SM3,and SM4 is conducive to improving the security of self-controlled devices.However,the relevant research on instruction extensions for these algorithms is insufficient.RISC-V has become one of the most popular instruction set architectures due to its advantages of open source,simplicity,extensi-bility,etc.This paper mainly focuses on the instruction extensions and efficient implementation of the SM2,SM3,and SM4 algorithms based on a domestic open-source RISC-V processor.Specifically,this paper proposes an overall instruction ex-pansion scheme based on the concept of hardware-software co-design;this paper conducts an in-depth analysis of the relat-ed cryptographic algorithms and comparison of the implementation schemes and then proposes efficient implementations of the hardware units,respectively.This paper designs and implements a coprocessor with a two-stage pipeline structure,se-quential dispatching,out-of-order execution,and sequential write-back instruction execution modes,as well as an indepen-dent memory access unit and a large bit-wide register.The coprocessor takes over part of the control logic of the crypto-graphic algorithm,reducing hardware resource consumption.The experimental results show that the hardware structure of the cryptographic coprocessor designed in this paper is simplified,and the utilization of hardware resources is high.SM2,SM3,and SM4 algorithms occupy very few resources,but the execution rate decreases only to a certain extent compared with pure hardware implementation.The product of resource area and time spent has varying degrees of advantages com-pared to other relevant literature.

RISC-Vco-processorsnational cryptographic algorithminstruction extensionshummingbird E203embedded system

王明登、严迎建、郭朋飞、张帆

展开 >

信息工程大学密码工程学院,河南郑州 450001

浙江大学网络空间安全学院,浙江杭州 310058

RISC-V 协处理器 国密算法 指令扩展 蜂鸟E203 嵌入式系统

国家自然科学基金河南省网络空间态势感知重点实验室开放课题

62072398HNTS2022001

2024

电子学报
中国电子学会

电子学报

CSTPCD北大核心
影响因子:1.237
ISSN:0372-2112
年,卷(期):2024.52(8)
  • 16