Loading [MathJax]/jax/output/SVG/jax.js
  • 中国精品科技期刊
  • CCF推荐A类中文期刊
  • 计算领域高质量科技期刊T1类
高级检索

SeChain: 基于国密算法的RISC-V安全启动机制设计与实现

芮志清, 梅瑶, 陈振哲, 吴敬征, 凌祥, 罗天悦, 武延军

芮志清, 梅瑶, 陈振哲, 吴敬征, 凌祥, 罗天悦, 武延军. SeChain: 基于国密算法的RISC-V安全启动机制设计与实现[J]. 计算机研究与发展, 2024, 61(6): 1458-1475. DOI: 10.7544/issn1000-1239.202440088
引用本文: 芮志清, 梅瑶, 陈振哲, 吴敬征, 凌祥, 罗天悦, 武延军. SeChain: 基于国密算法的RISC-V安全启动机制设计与实现[J]. 计算机研究与发展, 2024, 61(6): 1458-1475. DOI: 10.7544/issn1000-1239.202440088
Rui Zhiqing, Mei Yao, Chen Zhenzhe, Wu Jingzheng, Ling Xiang, Luo Tianyue, Wu Yanjun. SeChain: Design and Implementation of RISC-V Secure Boot Mechanism Based on Domestic Cryptographic Algorithms[J]. Journal of Computer Research and Development, 2024, 61(6): 1458-1475. DOI: 10.7544/issn1000-1239.202440088
Citation: Rui Zhiqing, Mei Yao, Chen Zhenzhe, Wu Jingzheng, Ling Xiang, Luo Tianyue, Wu Yanjun. SeChain: Design and Implementation of RISC-V Secure Boot Mechanism Based on Domestic Cryptographic Algorithms[J]. Journal of Computer Research and Development, 2024, 61(6): 1458-1475. DOI: 10.7544/issn1000-1239.202440088
芮志清, 梅瑶, 陈振哲, 吴敬征, 凌祥, 罗天悦, 武延军. SeChain: 基于国密算法的RISC-V安全启动机制设计与实现[J]. 计算机研究与发展, 2024, 61(6): 1458-1475. CSTR: 32373.14.issn1000-1239.202440088
引用本文: 芮志清, 梅瑶, 陈振哲, 吴敬征, 凌祥, 罗天悦, 武延军. SeChain: 基于国密算法的RISC-V安全启动机制设计与实现[J]. 计算机研究与发展, 2024, 61(6): 1458-1475. CSTR: 32373.14.issn1000-1239.202440088
Rui Zhiqing, Mei Yao, Chen Zhenzhe, Wu Jingzheng, Ling Xiang, Luo Tianyue, Wu Yanjun. SeChain: Design and Implementation of RISC-V Secure Boot Mechanism Based on Domestic Cryptographic Algorithms[J]. Journal of Computer Research and Development, 2024, 61(6): 1458-1475. CSTR: 32373.14.issn1000-1239.202440088
Citation: Rui Zhiqing, Mei Yao, Chen Zhenzhe, Wu Jingzheng, Ling Xiang, Luo Tianyue, Wu Yanjun. SeChain: Design and Implementation of RISC-V Secure Boot Mechanism Based on Domestic Cryptographic Algorithms[J]. Journal of Computer Research and Development, 2024, 61(6): 1458-1475. CSTR: 32373.14.issn1000-1239.202440088

SeChain: 基于国密算法的RISC-V安全启动机制设计与实现

基金项目: 中国科学院战略性先导科技专项资助(XDA0320401);本论文得到了源图重大基础设施的支持
详细信息
    作者简介:

    芮志清: 1997年生. 博士研究生. 主要研究方向为系统安全、物联网安全、软件供应链安全

    梅瑶: 2000年生. 硕士. 主要研究方向为信道编码、软件安全

    陈振哲: 1998年生. 博士研究生. 主要研究方向为物理不可克隆函数、网络安全

    吴敬征: 1982年生. 博士,研究员,博士生导师. CCF 高级会员. 主要研究方向为系统安全、漏洞挖掘、操作系统安全

    凌祥: 1992年生. 博士. CCF 会员. 主要研究方向为软件安全、人工智能安全

    罗天悦: 1990年生. 工程师. 主要研究方向为操作系统安全分析、代码漏洞挖掘、人工智能安全

    武延军: 1979年生. 博士,研究员,博士生导师. CCF 杰出会员. 主要研究方向为操作系统、机器学习系统软件、系统安全

    通讯作者:

    吴敬征(jingzheng08@iscas.ac.cn

  • 中图分类号: TP391

SeChain: Design and Implementation of RISC-V Secure Boot Mechanism Based on Domestic Cryptographic Algorithms

Funds: This work was supported by the Strategic Priority Research Program of the Chinese Academy of Sciences (XDA0320401) and the YuanTu Large Research Infrastructure.
More Information
    Author Bio:

    Rui Zhiqing: born in 1997. PhD candidate. His main research interests include system security. Internet of things security, and software supply chain security

    Mei Yao: born in 2000. Master. Her main research interests include channel codes and software security

    Chen Zhenzhe: born in 1998. PhD candidate. His main research interests include physical unclonable functions and network security

    Wu Jingzheng: born in 1982. PhD, professor, professor supervisor. Senior member of CCF. His main research interests include system security, vulnerability mining, and operating system security

    Ling Xiang: born in 1992. PhD. Member of CCF. His main research interests include software security and AI security

    Luo Tianyue: born in 1990. Engineer. His main research interests include operating system security analysis, code vulnerability mining, and AI security

    Wu Yanjun: born in 1979. PhD, professor, PhD supervisor. Distinguished member of CCF. His main research interests include operating systems, machine learning system software, and system security

  • 摘要:

    开源RISC-V指令集为我国建立自主可控物联网生态提供了重大机遇. 然而,物联网设备通常缺乏硬件加固措施,容易遭受物理级的固件篡改攻击,因此保障固件完整性以提高设备安全性至关重要. 为此,已有基于安全启动技术的初步探索,但仍存在3个问题:1)传统软件信任根难以保证物理级可靠性;2)主流硬件级安全启动技术被国际芯片厂商掌握,技术未公开且不支持国密算法,无法保证安全自主可控;3)已有基于RISC-V CPU的安全启动研究缺乏对上层固件的校验机制. 为解决上述3个问题,首次设计并实现基于国密SM9算法的RISC-V安全启动机制——SeChain. 具体而言:1)在RISC-V SoC内部增加了签名计算单元(signature calculation unit,SCU),实现密钥对生成与签名;2)增加了密钥验证单元(key verification unit,KVU),实现验证算法的片内执行及固件完整性验证;3)设计实现基于验证引导的多级安全启动机制,从不可篡改的硬件信任根出发,逐级完成引导程序的完整性校验. 基于上述设计,SeChain实现了信任根的不可篡改和安全可信,构造了一个可信的安全启动链,基于国密SM9算法为设备的安全启动和可信执行提供可靠保障. 为了验证SeChain的有效性、高效性和可靠性,基于VexRiscv CPU在FPGA 硬件平台完成了SeChain仿真验证实验. 实验结果表明,SeChain能够有效抵御各类固件篡改攻击,并能对抗信任根攻击,且平均额外时间开销不超过6.47 s. SeChain适用于资源受限的IoT设备,在满足安全可信启动的同时,能为国产RISC-V生态的安全自主可控提供有力保障.

    Abstract:

    The open-source RISC-V instruction set architecture (ISA) provides a significant opportunity for China to establish an independent and controllable IoT ecosystem. However, IoT devices often lack hardware protections and are vulnerable to physical-level firmware tampering attacks. Therefore, ensuring firmware integrity to improve device security is crucial. Previous researches have focused on secure boot techniques, but several challenges remain: 1) The traditional software-level trusted root can be physically tampered, making it difficult to ensure the reliability of the trusted root; 2) Mainstream hardware-level secure boot technology is controlled by international chip manufacturers, the specific implementation method is not publicly available, and does not support domestic cryptographic algorithms, making it impossible to ensure security independence and controllability for China; 3) Existing research on secure boot mechanisms based on RISC-V CPUs can verify the credibility of executable code but lacks a mechanism for verifying the integrity of upper-level firmware. To solve these challenges, we design and implement SeChain, a RISC-V secure boot mechanism based on the Chinese domestic cryptographic algorithm SM9. Specifically: 1) A signature calculation unit (SCU) is added inside the RISC-V SoC to generate key pairs and signatures; 2) A key verification unit (KVU) is added to perform on-chip execution of verification algorithms and firmware integrity verification; 3) A multi-level secure boot process based on verification boot is designed and implemented, starting from an immutable hardware trust root, completing the integrity verification of the next-stage boot program step by step, and achieving secure boot. Based on this design, SeChain realizes the security and trustworthiness of the trust root in the startup phase and constructs a trusted secure boot chain based on the domestic cryptographic algorithm SM9, providing reliable protection for device secure boot and trusted execution. To verify the effectiveness, efficiency, and security against trust root attacks of SeChain, we complete SeChain simulation verification experiments based on VexRiscv CPU on FPGA hardware platform. The experimental results show that SeChain can resist various firmware tampering attacks, as well as resist trust root attacks, which has an average additional time overhead of no more than 6.47 seconds. SeChain is suitable for resource constrained IoT devices, while meeting secure and trusted boot requirements, it can provide strong protection for domestic RISC-V ecosystem security independence and controllability.

  • 国密SM4算法[1]是一种常用的分组密码算法,广泛应用于数据保护、加密通信等领域. SM4算法常见工作模式有ECB(electronic codebook),CBC(cipher block chaining)等,对于相同的明文块,ECB模式下会产生完全相同的密文,而在CBC模式下,当前的明文块会与前一块的密文异或后进行运算. 因此,即使是完全相同的明文输入也可能会有完全不同的密文输出. 相比于ECB模式,CBC模式提供了更高的安全性和抵抗攻击的能力,有着更高的应用需求. 提高SM4算法在CBC模式下的性能,对于在边缘设备中使用SM4算法是至关重要的. 但是,在CBC模式下存在着难以提高吞吐率的问题:每组的输入必须等待前一组运算结束后才能获得,因而难以使用流水线方法提升吞吐率.

    文献[2]中提到了一种改进方法,将电路中的S盒以外的其他逻辑结构进行预计算,并把预计算的结果与S盒进行融合构成新的查找表,从而提高SM4算法在CBC模式下吞吐率. 本文基于此工作进一步优化了S盒的表示,并针对轮函数的迭代过程进行了优化,最终减少了轮函数关键路径上的2次异或运算,有效提高了算法的性能.

    本文的设计针对CBC模式下的SM4算法,在TSMC 40 nm,SMIC 55 nm工艺下,使用Synopsys Design Compiler分别进行了ASIC综合. 综合结果显示,本文所提出的设计在CBC模式下的吞吐率达到了4.2 Gb/s,同时单位面积吞吐量达到了129.4 Gb·s−1·mm−2,明显优于已发表的类似设计. 这些结果表明本文所提出的化简方法在改进SM4算法性能方面具有很大的潜力.

    本文的结构为:首先介绍了SM4算法及其在CBC模式下存在的性能瓶颈问题. 然后,详细描述了本文提出的2个化简方法,并解释了它们在轮函数迭代和S盒置换过程中的作用. 接下来,介绍了实验设计并给出了实验结果分析和对比. 最后,对进一步改进和应用的方向进行了展望.

    SM4算法是一种对称密钥密码算法,被广泛应用于数据加密和保护领域,它是中国密码算法的标准之一,具有较高的安全性和良好的性能.

    SM4采用了分组密码的设计思想,将明文数据划分为128 b的数据块,并通过密钥对每个数据块进行加密和解密操作. 对单组数据进行加解密的流程如图1所示,分为密钥扩展算法和加解密算法2部分. 图1中的FK是系统预设的参数,与用户密钥进行异或运算后作为密钥扩展算法的输入. 加解密算法接受密钥扩展算法产生的32轮轮密钥rki对明文进行加解密,最后经反序变换输出. 加解密使用的是同一套计算流程,唯一的区别是解密时使用轮密钥的顺序与加密过程相反.

    图  1  SM4算法工作流程
    Figure  1.  Workflow of SM4 algorithm

    密钥扩展算法和加解密算法2部分均由32次轮函数迭代构成,整体结构均采用4路并行的Feistel结构,在计算过程中,以128 b数据为输入、128 b数据为输出,其内部的运算逻辑如图2所示. 输出中的前96 b数据等于输入中的后96 b数据,输出后的32 b数据通过轮函数运算产生.

    图  2  4路并行的Feistel结构
    Figure  2.  Four parallel Feistel structure

    在密钥扩展算法中使用的密钥是算法给定的固定密钥,记作cki. 在加解密算法中使用的密钥是由密钥扩展算法通过用户给的密钥扩展出来的轮密钥,记作rki.

    SM4密钥扩展算法结构如图3所示,密钥扩展的主要过程包括32轮密钥扩展的轮函数,其中,密钥为128 b,FK为SM4标准中规定的一个128 b常数. 二者异或后的值将会作为密钥扩展轮函数的首轮输入,并通过一个选择器进行循环迭代,总计迭代32轮产生32个轮密钥.

    图  3  SM4的密钥扩展算法结构
    Figure  3.  Key expansion algorithm structure of SM4

    设用户输入的密钥为MK,则该密钥对应的32轮轮密钥可以按照式(1)求出:

    {(k0,k1,k2,k3)=MKFK,ki+4=kiF(ki+1ki+2ki+3cki),rki=ki+4, (1)

    其中,cki是系统预设的32 b参数,rki代表第i轮的轮密钥,F代表密钥扩展轮函数,其由S盒置换算法τ:Z322Z322和线性变换算法L(x)=x(x<<<13)(x<<<23)组成,其中<<<表示循环左移运算.

    SM4算法的加解密算法的整体结构与密钥扩展算法类似,均包含32轮的轮函数迭代,区别在于加解密算法中额外包含1次反序变换.

    SM4算法的轮函数迭代流程如图4所示,X1~X4为第1轮的输入,X2~X5为第1轮的输出,同时也是第2轮的输入. rk1为第1轮的轮密钥,T函数代表加解密模块的轮函数. 与密钥扩展部分的轮函数F类似,由S盒置换算法τ和一个线性变换算法L(x)=x(x<<<2)(x<<<10) (x<<<18)(x<<<24)组成.

    图  4  SM4加解密模块轮函数结构
    Figure  4.  Round function structure of SM4 encryption and decryption modules

    通过多轮的迭代过程,SM4算法能够实现高强度的数据加密和解密. 然而,在CBC模式下,由于相邻数据之间的依赖关系,传统的流水线技术难以提高算法的吞吐率. 因此,针对这一问题,本文提出了2种化简方法,以减少关键路径上的运算,从而提高SM4算法在CBC模式下的性能.

    加解密模块的轮函数的结构如图4所示,若不考虑T函数带来的时序延迟,单次轮函数迭代的关键路径上共包含3次异或运算. 以公式的形式描述SM4算法加解密轮函数的迭代关系可得到式(2):

    Xi+4=Xi(Xi+1Xi+2Xi+3rki). (2)

    若考虑相邻的2次轮函数迭代,则有:

    {Xi+4=XiT(Xi+1Xi+2Xi+3rki),Xi+5=XiT(Xi+2Xi+3Xi+4rki+1). (3)

    观察式(1)~(3)不难发现,由于SM4采用了4条数据线路的Feistel结构进行设计,在相邻的2次轮函数迭代过程中,均有96 b的输入是完全一致的,在式(3)的计算过程中,相邻2轮的轮函数将Xi+2Xi+3计算了2次.

    因此,一个简单的优化思路便是,我们在轮函数之间传递数据时,额外传递Xi+2Xi+3rki+1的运算结果,并作用于下一次计算,得到的流程图如图5所示.

    图  5  优化的轮函数结构
    Figure  5.  Optimized round function structure

    相比于图4的运算流程,在计算当前轮次的输出时,二次优化过后的轮函数通过提前获取下一轮次使用的密钥,并利用2轮之间相同的数据提前计算,可以使得在加解密的流程中总计节省32次异或运算的时间.

    S盒是密码学领域的一个基本组件,其功能是实现数据的非线性变换,在DES,AES,SM1,SM4等算法中均有应用. 在SM4算法中,其提供了一个8 b到8 b的非线性变换.

    在SM4算法中,S盒模块通常与另一个线性变换函数L组合使用,即图4图5中的T函数,其位于加解密算法轮函数的关键路径上,因此,如果能找到优化T函数关键路径的方法延时,也可以使得整个加解密模块的延时变小,进而提高运算效率.T函数的内部结构如图6所示,图中的<<<表示对32 b数据进行循环左移,关键路径包括1个S盒和3次异或运算. 在硬件实现中,循环移位可以通过硬件连线来实现,不会带来额外的路径延时.

    图  6  SM4加解密模块T函数结构
    Figure  6.  T function structure of SM4 encryption and decryption modules

    T函数中包含4次异或运算,反映到电路设计中,其关键路径上至少存在3次异或运算. 因此,一个优化思路便是,将算法中的S盒的输入输出修改为8 b输入、32 b输出[2-3] ,并提前将L函数作用于图中的4个S盒,如图7所示. 图7中,通过编码的形式保存其运行结果,将图6中的SBox与后续的线性变换L组合形成exSBox,之后仅需要将4个exSBox的输出异或即可,从而减少了1次异或运算.

    图  7  优化的T函数结构
    Figure  7.  Optimized T-function structure

    虽然修改后的S盒比原先的S盒输出了更多的数据,但在硬件实现中,仍然是通过相同数量的多路选择器查表输出. 因此修改前后的S盒的路径延时及其安全性并未改变.

    图7中的exSBox1为例,使用0xff作为输入展示exSBox1的构造方式,首先获得0xff作用于S盒后的运行结果0x48. 由于exSBox1的输入对应最高四位,因此,将其拓展为32 b数据为0x48000000. 在经过L函数后,得到的值是0x68492121. 如表1所示,表中前5行加粗部分表示传入的数据及其循环移位后所处位置,其余位置在任意输入下都恒等于0.

    表  1  搜索空间降低比率和命中率
    Table  1.  Search Space Reduction Rate and Hit Rate
    原数据 01001000 00000000 00000000 00000000
    <<<2 00100000 00000000 00000000 00000001
    <<<10 00000000 00000000 00000001 00100000
    <<<18 00000000 00000001 00100000 00000000
    <<<24 00000000 01001000 00000000 00000000
    异或和 01101000 01001001 00100001 00100001
    注:加粗部分表示传入的数据及其循环移位后所处位置.
    下载: 导出CSV 
    | 显示表格

    观察表1的运算结果不难发现,除最后一行加粗数字表示的第0~5位,第14,15位由异或运算产生,其余的24位均是输入的8位数据的排列组合,因此在硬件设计时,可以仅使用8 b输入、16 b输出的S盒实现. 对于图7中剩余的3个exSBox,在相同的输入下,可以通过对表1中的数据进行循环移位,得到对应的输出. 上述结论对4个位于不同部位的S盒均成立.

    具体而言,令p为输入的8 b数据,τ(p)为标准SM4算法中S盒的输出. X=(x0,x1,,x15)为exSBox1中存储的16 b数据,Y=(y0,y1,,y31)为优化后的T函数中需要的32 b输出. τ为SM4算法标准中使用的S盒置换函数,其对于8 b输入,产生对应的8 b输出,则X可以由式(4)产生:

    {(x0,x1,,x7)=τ(p),(x8,x9,,x15)=τ(p)(τ(p)<<<2). (4)

    表1可知,Y的取值实际上可以由X经过排列组合得到,对于exSBox2,exSBox3,exSBox4的取值,可以通过Y循环移位得到,且由于该过程中仅包含赋值运算,在电路设计中可以通过物理连线完成. 相比于文献[2]中的设计,节约了1/3的面积消耗. 具体的计算方式如式(5)所示.

    {(y0,y1,,y5)=(x8,x9,,x13)(y6,y7=(x6,x7)(y8,y9,,y13)=(x0,x1,,x5)(y14,y15=(x14,x15)(y16,y17,,y21)=(x2,x3,,x7)(y22,y23=(x0,x1)(y24,y25,,y29)=(x2,x3,,x7)(y30,y31=(x0,x1). (5)

    现场可编程逻辑门阵列(FPGA)和专用集成电路(ASIC)是目前主流使用硬件电路实现密码算法的2个方式. FPGA虽然具有可编程性、灵活性和快速设计等优势,但ASIC相较于FPGA拥有更高的性能,与本文设计追求的高效率目标相符,所以选择在ASIC下实现.

    SM4硬件系统的整体结构设计如图8所示,包括密钥扩展模块、加解密模块和适配CBC工作模式的组合逻辑. 对于单个加解密任务,若明文被分为n组,会执行1次密钥扩展和n次加解密. 因此,优化加解密算法的执行效率是优化SM4硬件设计的重点. 本文所提出的2种化简方法,对于每一组明文输入,可以减少64级异或门的延时,极大地提升了运算效率.

    图  8  SM4硬件整体架构
    Figure  8.  Overall architecture of SM4 hardware

    SM4算法的硬件实现主要有2种方案:一种方案是流水线结构,即通过寄存器连接多个加解密模块同时工作以提高加解密的效率,如图9(a)所示;另一种方案是使用循环迭代的方式. 即一次性提取32个轮函数中的n轮组合成一个组合电路,称为n合1电路,如图9(b)所示. 流水线结构的优势是可以充分利用n个加密核心的性能,在不影响整体工作频率的情况下加速运算. 对于SM4算法而言,在合理范围内堆叠流水线可以实现极高的吞吐量.

    图  9  流水线结构与循环迭代结构
    Figure  9.  Pipeline architecture and loop iteration architecture

    然而,流水线结构仅适用于ECB等数据无前后依赖的工作模式. 在CBC工作模式下,由于需要将前一轮的输出与本轮的输入进行异或运算,相邻的数据存在依赖,故而无法使用流水线加速运算. 因此,在本设计中没有选用流水线结构.

    虽然循环迭代结构会降低整体模块的工作频率,对吞吐量的提升较为有限,但可以同时兼容 ECB,CBC这 2种工作模式. 本设计最终选择了循环迭代的设计方式.

    在SM4算法中,密钥扩展与加解密算法类似,均包含32轮迭代. 密钥扩展模块采用图2所示的单轮组合逻辑电路循环32次来实现32轮迭代.

    在密钥扩展模块的输出端,使用寄存器存放每一轮电路的轮密钥,标号为0~31,如图10所示. 标号从0开始的好处是:在解密时,使用到的密钥顺序相反的,加密的第k轮使用的是第k1号密钥,解密的第k轮使用的是第32k号密钥. 在二进制下,二者的标号可以通过取反操作相互转化.

    图  10  轮密钥的存储与使用
    Figure  10.  Storage and usage of round keys

    为了保证运算结果的准确性,密钥扩展模块还 会向加解密模块发出控制信号表明自己的工作状态,以避免在轮密钥尚未完全更新时使用错误的轮密钥进行加解密.

    在国家标准文档[1]中,并没有针对CBC工作模式给出具体的测试用例. 因此,本文设计方案通过完整的Verilog HDL语言实现,通过在FPGA平台进行综合、仿真和上板验证,以确保功能正确并进行相关性能分析,如图11所示. 具体而言,通过PCIE上位机下发随机的明文数据到FPGA开发板,开发板完成加密后传回上位机,通过与软件对比实现功能验证. 若在循环验证多次后二者的输出均完全相同,则认为设计的SM4电路的功能正确.

    图  11  测试流程
    Figure  11.  Testing procedures

    最终,本文的设计在Zynq 7020 FPGA开发板上完成了上板验证,确保了功能的正确性,工作频率最高可达95 MHz,吞吐量约为1.5 Gb/s.

    ASIC上主要针对2种工艺SMIC 55 nm与 TSMC 40 nm进行了测试、通过Synopsys公司的EDA工具DesignCompiler进行时序等综合约束,我们选择了芯片面积和芯片使用的逻辑门数量(gates)作为评估指标,其结果如表2表3所示,在CBC模式下,本文的设计在3.97 mW的功耗下,单位面积吞吐率达129.4 Gb·s−1·mm−2,明显优于同类设计. 此外,以使用逻辑门的数量为评估标准,本文提出的设计在该指标上也明显优于同类设计,单位面积吞吐率为0.205×10−3 Gb·s−1·gates−1.

    表  2  SM4综合结果与面积效率对比
    Table  2.  Comparison of SM4 Synthesis Results and Area Efficiency
    工艺节点 芯片面积/mm2 吞吐率/(Gb·s−1 单位面积吞吐率/
    (Gb·s−1·mm−2
    功耗/mW
    40 nm* 0.0335 4.34 129.40 3.97
    55 nm* 0.0877 4.41 50.30 10.88
    65 nm[2] 0.1260 5.24 41.59
    180 nm[4] 0.0790 0.10 1.27 5.31
    55 nm[5] 0.0870 0.40 4.59 4.35
    350 nm[6] 0.0270 0.412 15.26
    注:*标注的表示本文的结果.
    下载: 导出CSV 
    | 显示表格
    表  3  SM4综合结果与门效率对比
    Table  3.  Comparison of SM4 Synthesis Results and Gates Efficiency
    工艺节点 gates 吞吐率/(Gb·s−1 单位面积吞吐率/
    (Gb·s−1·gates−1
    40 nm* 21.2×103 4.34 0.205×10−3
    55 nm* 21.1×103 4.41 0.209×10−3
    180 nm[6] 32.0×103 0.80 0.025×10−3
    65 nm[7] 31.0×103 1.23 0.040×10−3
    55 nm[8] 22.0×103 0.27 0.012×10−3
    130 nm[9] 22.0×103 0.80 0.036×10−3
    注:*标注的表示本文的结果.
    下载: 导出CSV 
    | 显示表格

    在不同工艺、电压下对该设计进行综合,可以得到本文设计在不同使用场景下的吞吐率. 在TSMC 40 nm、SMIC 55 nm、SMIC 130 nm下使用不同的工艺角分别对本文的设计进行综合,结果如表4所示.

    表  4  不同工艺角下的SM4综合结果与效率对比
    Table  4.  Comparison of SM4 Synthesis Results and Efficiency with Different Process Corners
    工艺节点 工艺角 面积/gates 吞吐率/(Gb·s−1 功耗/mW
    40 nm 0.99V/125°C/SS 21.0×103 2.40 2.55
    1.1V/25°C/TT 21.2×103 4.34 3.97
    1.21V/0°C/FF 20.9×103 6.96 8.35
    55 nm 1V/25°C/TT 20.0×103 2.78 4.10
    1.2V/25°C/TT 21.1×103 4.41 10.88
    1.32V/0°C/FF 17.8×103 6.84 33.59
    130 nm 1.08V/125°C/SS 20.8×103 1.11 6.86
    1.2V/25°C/TT 21.0×103 1.75 15.70
    1.32V/0°C/FF 21.8×103 2.45 23.03
    下载: 导出CSV 
    | 显示表格

    根据本文提出的2种对SM4加解密模块关键路径进行化简以及降低面积的方法,实现了4合1的SM4电路,并基于Zynq7020开发板进行了功能验证. 此外,ASIC综合结果表明本文的SM4电路相比于其他方案有更高的单位面积吞吐率和更低的功耗. 因此,这种对SM4算法进行的优化是有效的,并且对其他分组算法提高CBC模式下的单位面积吞吐率具有参考价值.

    作者贡献声明:郝泽钰提出研究方案并完成了论文的撰写;代天傲、黄亦成、段岑林协助完成了ASIC平台上的验证实验;董进、吴世勇、张博、王雪岩、贾小涛提出指导意见并修改论文;杨建磊提出指导意见并讨论定稿.

    MSI leak: tips for users, organizations, and developers. https://www.kaspersky.com/blog/msi-firmware-keys-leak/48300/
  • 图  1   安全启动信任链示意图

    Figure  1.   The illustration of trust chain during secure boot

    图  2   SeChain上SoC结构

    Figure  2.   The SoC structure of SeChain

    图  3   SM9算法签名过程

    Figure  3.   The signature process of SM9 algorithm

    图  4   SM9算法验证签名过程

    Figure  4.   The verification signature process of SM9 algorithm

    图  5   SeChain中的签名生成流程

    Figure  5.   The signature generation process in SeChain

    图  6   SeChain中的签名验证流程

    Figure  6.   The signature verification process in SeChain

    图  7   SeChain硬件开销图

    Figure  7.   Hardware overhead diagram of SeChain

    图  8   启动时间增长图对比

    Figure  8.   Comparison of starting time growth diagram

    表  1   基于SM9算法的SeChain安全启动验证实验结果

    Table  1   Experimental Results of SeChain Secure Boot Verification Based on SM9 Algorithm

    攻击位置攻击方式攻击检测结果攻击阻断时间/s无攻击时验证成功时间/s
    boot.c修改调用boot helper函数时传入的地址验证失败,无法启动3.13.9
    将boot helper传入地址硬编码为0x00000验证失败,无法启动3.23.9
    修改boot helper中所有地址为固定值验证失败,无法启动3.24.0
    修改seiral boot 启动时的printf函数验证失败,无法启动4.13.8
    在任意位置插入新的printf调用验证失败,无法启动4.43.9
    删除serial boot的printf函数验证失败,无法启动2.93.7
    main.c修改头部关于litex logo的printf语句验证失败,无法启动3.03.8
    大面积删除不影响编译完整性的printf验证失败,无法启动3.33.9
    修改调用readline函数时传入的参数验证失败,无法启动3.34.0
    删除对readline函数的调用验证失败,无法启动3.83.8
    删除除serial boot外的boot方式验证失败,无法启动3.63.9
    删除将是否进入console的判断语句验证失败,无法启动3.03.7
    删除boot_sequence函数的调用验证失败,无法启动3.83.8
    readline.c修改输入对照哈希表验证失败,无法启动4.33.9
    修改readline中对command的处理方式验证失败,无法启动3.53.9
    增加一个新的command处理结果验证失败,无法启动3.93.8
    cmd_bios.c任意位置增加一行for空循环语句验证失败,无法启动4.23.9
    添加printf函数调用, 打印某不被支持的cmd验证失败,无法启动3.33.7
    删除所有printf函数使无法展示可用cmd验证失败,无法启动2.93.8
    删除获得help cmd后的printf函数验证失败,无法启动3.63.9
    下载: 导出CSV

    表  2   信任根攻击实验结果

    Table  2   Experimental Results of Trust Root Attack

    攻击实验 信任链 信任根位置 攻击方式 攻击检测结果 平均时间/s
    4a 篡改boot.c中的printf函数 无验证,攻击成功 3.3
    4b 软件 闪存 攻击者窃取设备ID,篡改boot.c中的printf函数,使用攻击者
    私钥伪造签名,并修改闪存中的公钥为对应的攻击者公钥
    验证通过,设备启动异常,攻击成功 7.3
    4c 硬件 写入ROM 攻击者窃取设备ID,篡改boot.c中的printf函数,使用攻击者
    私钥伪造签名,并修改闪存中的公钥为对应的攻击者公钥
    验证失败,停止启动,攻击失败 4.3
    4d 硬件 写入ROM 攻击者预先知晓用户私钥与系统参数,篡改boot.c中的printf
    函数后,使用用户私钥伪造签名
    验证通过,设备启动异常,攻击成功 6.8
    下载: 导出CSV
  • [1]

    GSMA. The Mobile Economy [R/OL]. London: GSMA Head Office. 2023 [2023-09-30]. https://www.gsma.com/solutions-and-impact/connectivity-for-good/mobile-economy/wp-content/uploads/2023/03/270223-The-Mobile-Economy-2023.pdf

    [2] 何小庆. RISC-V处理器嵌入式开发概述[J]. 单片机与嵌入式系统应用,2020,20(11):1−6

    He Xiaoqing. RISC-V processor embedded development overview[J]. Microcontrollers & Embedded Systems, 2020, 20(11): 1−6 (in Chinese)

    [3]

    T-Head. T-Head Semiconductor Co. , Ltd[EB/OL]. 2023[2023-08-31]. https://github.com/T-head-Semi.html

    [4]

    EulixOS. EulixOS[EB/OL]. (2022-12-28) [2023-09-15]. https://eulixos.com

    [5]

    OWASP Foundation. OWASP Internet of things[EB/OL]. 2023[2023-08-11]. https://owasp.org/www-project-internet-of-things/

    [6] 杨宏,王晓春,林冠辰,等. 可信物联网技术与标准化研究[J]. 信息技术与标准化,2023,65(5):10−15, 20

    Yang Hong, Wang Xiaochun, Lin Guanchen, et al. Research on trusted Internet of things technology and standardization[J]. Information Technology & Standardization, 2023, 65(5): 10−15, 20 (in Chinese)

    [7] 赵波,费永康,向騻,等. 嵌入式系统的安全启动机制研究与实现[J]. 计算机工程与应用,2014,50(10):72−77

    Zhao Bo, Fei Yongkang, Xiang Shuang, et al. Research and implementation of secure boot mechanism for embedded systems[J]. Computer Engineering and Applications, 2014, 50(10): 72−77 (in Chinese)

    [8] 马洪峰. 基于硬件信任根的物联网设备安全启动设计[J]. 单片机与嵌入式系统应用,2021,21(10):16−17, 21

    Ma Hongfeng. Secure boot design of IoT devices based on hardware root of trust[J]. Microcontrollers & Embedded Systems, 2021, 21(10): 16−17, 21 (in Chinese)

    [9]

    UEFI Forum, inc. Unified extensible firmware interface specification[EB/OL]. (2022-08-29)[2023-08-10]. https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf

    [10]

    Naked Security. Serious Security: TPM 2.0 vulns–is your super-secure data at risk[EB/OL]. (2023-03-07)[2023-9-10]. https://nakedsecurity.sophos.com/2023/03/07/serious-security-tpm-2-0-vulns-is-your-super-secure-data-at-risk

    [11]

    Intel. Intel Hardware Shield Below-the-OS Security: Information technology cybersecurity white paper[EB/OL]. 2022[2023-04-15]. https://www.intel.com/content/dam/www/central-libraries/us/en/documents/below-the-os-security-white-paper.pdf

    [12]

    Jawad H Y, Wong M M, Pudi V, et al. Lightweight secure-boot architecture for RISC-V system-on-chip[C]//Proc of the 20th Int Symp on Quality Electronic Design (ISQED). Piscataway, NJ: IEEE, 2019: 216−223

    [13]

    SpinalHDL. VexRiscv[EB/OL]. (2021-11-16)[2024-03-15]. https://github.com/SpinalHDL/VexRiscv

    [14]

    Rui Zhiqing, Mei Yao. SeChain[EB/OL]. (2024-03-10)[2024-03-15]. https://github.com/m2kar/SeChain

    [15] 陈士伟. 杂凑函数的攻击方法研究[D]. 郑州:解放军信息工程大学,2012

    Chen Shiwei. Research on the attack methods of the Hash functions[D]. Zhengzhou: Information Engineering University of the People’s Liberation Army, 2012

    [16]

    Rivest R. The MD5 message-digest algorithm: RFC1321[R/OL]. 1992[2024-03-15]. https://www.rfc-editor.org/info/rfc1321

    [17]

    Stevens M, Bursztein E, Karpman P, et al. The first collision for full SHA-1[C]//Proc of the 37th Annual Int Cryptology Conf. Berlin: Springer, 2017: 570−596

    [18]

    Dworkin M J. SHA-3 standard: Permutation-based Hash and extendable-output functions: NIST FIPS 202[R/OL]. Gaithersburg, Maryland: National Institute of Standardsand Technology, 2015[2024-03-15]. https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf

    [19] 王小云,于红波. SM3密码杂凑算法[J]. 信息安全研究,2016,2(11):983−994

    Wang Xiaoyun, Yu Hongbo. SM3 cryptographic Hash algorithm[J]. Journal of Information Security Research, 2016, 2(11): 983−994 (in Chinese)

    [20]

    Wang Xiaoyun, Yin Y L, Yu Hongbo. Finding collisions in the full SHA-1[C] //Proc of the 25th Annual Int Cryptology Conf. Berlin: Springer, 2005: 17−36

    [21]

    Wang Xiaoyun, Yu Hongbo. How to break MD5 and other Hash functions[C]//Proc of Annual Int conf on the Theory and Applications of Cryptographic Techniques. Berlin: Springer, 2005: 19−35

    [22]

    Wikipedia. Public-key cryptography[EB/OL]. (2024-02-22)[2024-03-15]. https://en.wikipedia.org/w/index.php?title=Public-key_cryptography&oldid=1209561246#Algorithms

    [23]

    Diffie W, Hellman M E. New directions in cryptography[J]. IEEE Transactions on Information Theory, 1976, 22(6): 644−654 doi: 10.1109/TIT.1976.1055638

    [24] 沈昌祥,张焕国,冯登国,等. 信息安全综述[J]. 中国科学:信息科学,2007,37(2):129−150

    Shen Changxiang, Zhang Huanguo, Feng Dengguo, et al. Summary of information security[J]. SCIENTIA SINICA Informationis, 2007, 37(2): 129−150 (in Chinese)

    [25]

    Hales T C. The NSA back door to NIST[J]. Notices of the American Mathematical Society, 2013, 61(2): 190−192

    [26]

    Schwennesen B, Bray H. Elliptic curve cryptography and government backdoors[EB/OL]. (2016-04-24)[2024-03-15]. https://blkcipher.pl/assets/pdfs/BAS_Paper3_EllipticCurveCryptography.pdf

    [27] 董一潇,全建斌,王明儒,等. 国密SM9算法在物联网安全领域的应用研究[J]. 电信工程技术与标准化,2022,35(9):22−27, 32

    Dong Yixiao, Quan Jianbin, Wang Mingru, et al. Research on the application of SM9 algorithm in the field of Internet of things security[J]. Telecom Engineering Technics and Standardization, 2022, 35(9): 22−27, 32 (in Chinese)

    [28] 宋维平. 基于公开密钥密码体制的数字签名[J]. 中国教育信息化:高教职教,2007,162(15):59−60

    Song Weiping. Digital signatures based on public-key cryptography[J]. Chinese Journal of ICT in Education. 2007, 162(15): 59−60 (in Chinese)

    [29] 殷明. 基于标识的密码算法 SM9 研究综述[J]. 信息技术与信息化,2020,242(5):88−93 doi: 10.3969/j.issn.1672-9528.2020.05.026

    Yin Ming. A review of identity-based cryptographic algorithms SM9[J]. Information Technology and Informatization, 2020, 242(5): 88−93 (in Chinese) doi: 10.3969/j.issn.1672-9528.2020.05.026

    [30] 袁峰,程朝辉. SM9 标识密码算法综述[J]. 信息安全研究,2016,2(11):1008−1027

    Yuan Feng, Cheng Zhaohui. Overview of SM9 identity cryptography algorithms[J]. Journal of Information Security Research, 2016, 2(11): 1008−1027 (in Chinese)

    [31] 边杏宾,马俊明,胡志勇,等. SM9在泛在物联网中的应用研究[J]. 信息技术与网络安全,2022,41(2):27−32

    Bian Xingbin, Ma Junming, Hu Zhiyong, et al. Application research of SM9 in ubiquitous Internet of things[J]. Information Technology & Network Security, 2022, 41(2): 27−32 (in Chinese)

    [32] 杨国强,孔凡玉,徐秋亮. 一种基于FPGA的SM9快速实现方法[J]. 山东大学学报 (理学版),2020,55(9):54−61

    Yang Guoqiang, Kong Fanyu, Xu Qiuliang. A fast implementation method for SM9 based on FPGA[J]. Journal of Shandong University (Natural Science), 2020, 55(9): 54−61 (in Chinese)

    [33]

    Avizienis A, Laprie J C, Randell B, et al. Basic concepts and taxonomy of dependable and secure computing[J]. IEEE Transactions on Dependable and Secure Computing, 2004, 1(1): 11−33 doi: 10.1109/TDSC.2004.2

    [34]

    Tomlinson A. Smart Cards, Tokens, Security and Applications, Introduction to the TPM[M]. Berlin: Springer, 2017

    [35] 沈昌祥,张焕国,王怀民,等. 可信计算的研究与发展[J]. 中国科学:信息科学,2010,40(2):139−166

    Shen Changxiang, Zhang Huanguo, Wang Huaimin, et al. Research and development in trustworthy computing[J]. SCIENTIA SINICA Informationis, 2010, 40((2): ): 139−166 (in Chinese)

    [36]

    Lee R B. Processor architecture for trustworthy computers[C] //Proc of Asia-Pacific Conf on Advances in Computer Systems Architecture. Berlin: Springer, 2005: 1−2

    [37]

    Parno B, Mccune J M, Perrig A. Bootstrapping trust in commodity-computers[C] //Proc of IEEE Symp on Security and Privacy. Piscataway, NJ: IEEE, 2010: 414−429

    [38] 谭良,徐志伟. 基于可信计算平台的信任链传递研究进展[J]. 计算机科学,2008,35(10):15−18 doi: 10.3969/j.issn.1002-137X.2008.10.003

    Tan Liang, Xu Zhiwei. Research progress on trust chain transmission based on trusted computing platform[J]. Computer Science, 2008, 35(10): 15−18 (in Chinese) doi: 10.3969/j.issn.1002-137X.2008.10.003

    [39]

    Dave A, Banerjee N, Patel C. Care: Lightweight attack resilient secure boot architecture with onboard recovery for RISC-V based SoC[C] //Proc of the 22nd Int Symp on Quality Electronic Design (ISQED). Piscataway, NJ: IEEE, 2021: 516−521

    [40]

    Ling Zhen, Yan Huaiyu, Shao Xinhui, et al. Secure boot, trusted boot and remote attestation for ARM TrustZone-based IoT nodes[J/OL]. Journal of Systems Architecture, 2021[2024-03-15]. https://www.sciencedirect.com/science/article/abs/pii/S1383762121001661

    [41]

    Raj H, Saroiu S, Wolman A, et al. fTPM: A software-only implementation of a TPM chip[C/OL] //Proc of the 25th USENIX Security Symp. Berkeley, CA: USENIX Association , 2016: 841−856

    [42] OpenAnolis. 商用密码技术最佳实践白皮书 [EB/OL]. 2022[2023-08-30]. https://openanolis.github.io/whitebook-shangmi/secure_boot.html

    OpenAnolis. Commercial Cryptography Best Practices White Paper [EB/OL]. 2022[2023-08-30]. https://openanolis.github.io/whitebook-shangmi/secure_boot.html (in Chinese)

    [43] 刘畅,武延军,吴敬征,等. RISC-V指令集架构研究综述[J]. 软件学报,2021,32(12):3992−4024

    Liu Chang, Wu Yanjun, Wu Jingzheng, et al. Survey on RISC-V system architecture research[J]. Journal of Software, 2021, 32(12): 3992−4024 (in Chinese)

    [44]

    Menon A, Murugan S, Rebeiro C, et al. Shakti-T: A RISC-V processor with light weight security extensions[C]//Proc of the Hardware and Architectural Support for Security and Privacy. 2017[2024-03-15]. https://dl.acm.org/doi/10.1145/3092627.3092629

    [45]

    Wong M M, Haj-Yahya J, Chattopadhyay A. SMARTS: Secure memory assurance of RISC-V trusted SoC[C] //Proc of the 7th Int Workshop on Hardware and Architectural Support for Security and Privacy. Los Angeles, CA: HASP, 2018: 1−8

    [46]

    Lee D, Kohlbrenner D, Shinde S, et al. Keystone: An open framework for architecting TEEs [EB/OL]. (2022-04-02) [2024-03-15]. http://docs.keystone-enclave.org/en/latest/

    [47]

    Lebedev I, Hogan K, Devadas S. Secure boot and remote attestation in the Sanctum processor[C] //Proc of the 31st Computer Security Foundations Symp(CSF). Piscataway, NJ: IEEE, 2018: 46−60

    [48]

    Nikiema P R, Palumbo A, Aasma A, et al. Towards dependable RISC-V cores for edge computing devices[C]//Proc of the 29th IEEE Int Symp on On-Line Testing and Robust System Design (IOLTS). Piscataway, NJ: IEEE, 2023: 1−7

    [49] 张雨昕,芮志清,李威威,等. 基于 RISC-V 协处理器的内存溢出防御机制[J]. 计算机系统应用,2021,30(11):11–19

    Zhang Yuxin, Rui Zhiqing, Li Weiwei, et al. PEC-V: Memory overflow defense mechanism based on RISC-V coprocessor[J]. Computer Systems & Applications, 2021, 30(11): 11−19 (in Chinese)

    [50]

    Ahn N Y, Lee D H. Forensic issues and techniques to improve security in SSD with flex capacity feature[J]. IEEE Access, 2021, 9: 167067−167075

    [51] 朱留富,李继国,赖建昌,等. 基于商密SM9的属性基在线/离线签名方案[J]. 计算机研究与发展,2023,60(2):362−370

    Zhu Liufu, Li Jiguo, Lai Jianchang, et al. Attribute-based online/offline signature scheme based on SM9[J]. Journal of Computer Research and Development, 2023, 60(2): 362−370 (in Chinese)

  • 期刊类型引用(1)

    1. 石明丰,甘永根,赵玉珂,刘飞飞,何晓蓉. 智能量测开关与智能物联锁具信息交互设计. 中国新技术新产品. 2024(21): 137-139 . 百度学术

    其他类型引用(1)

图(8)  /  表(2)
计量
  • 文章访问数:  453
  • HTML全文浏览量:  41
  • PDF下载量:  113
  • 被引次数: 2
出版历程
  • 收稿日期:  2024-02-01
  • 修回日期:  2024-03-12
  • 网络出版日期:  2024-04-14
  • 刊出日期:  2024-05-31

目录

/

返回文章
返回