[go: up one dir, main page]

CN104734845A - Side-channel attack protection method based on full-encryption algorithm pseudo-operation - Google Patents

Side-channel attack protection method based on full-encryption algorithm pseudo-operation Download PDF

Info

Publication number
CN104734845A
CN104734845A CN201510133523.8A CN201510133523A CN104734845A CN 104734845 A CN104734845 A CN 104734845A CN 201510133523 A CN201510133523 A CN 201510133523A CN 104734845 A CN104734845 A CN 104734845A
Authority
CN
China
Prior art keywords
key
round
sms4
real
keys
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510133523.8A
Other languages
Chinese (zh)
Other versions
CN104734845B (en
Inventor
陆海宁
刘军荣
陈佳超
包斯刚
季欣华
李大为
罗鹏
李国友
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Cryptography Administration Commercial Code Testing Center
Shanghai Huahong Integrated Circuit Co Ltd
Shanghai Jiao Tong University
Original Assignee
State Cryptography Administration Commercial Code Testing Center
Shanghai Huahong Integrated Circuit Co Ltd
Shanghai Jiao Tong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Cryptography Administration Commercial Code Testing Center, Shanghai Huahong Integrated Circuit Co Ltd, Shanghai Jiao Tong University filed Critical State Cryptography Administration Commercial Code Testing Center
Priority to CN201510133523.8A priority Critical patent/CN104734845B/en
Publication of CN104734845A publication Critical patent/CN104734845A/en
Application granted granted Critical
Publication of CN104734845B publication Critical patent/CN104734845B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Storage Device Security (AREA)

Abstract

一种计算机安全技术领域的基于全加密算法伪操作的旁路攻击防护方法,以m个伪密钥和1个真实密钥组成密钥序列进行多次的SMS4加密计算,并将真实密钥参与的SMS4加密计算结果得到所需密文。本发明生成的真实运算的位置随机,使攻击者无法对齐功耗曲线,从而无法实现攻击。另外,伪密钥的使用可以对旁路攻击产生干扰作用,使得旁路攻击失效。此方案分为全硬件实现及软件调用方式实现,对于软件调用方式实现方式可以对硬件无法修改且没有旁路攻击防护的密码电路实施防护。

A side-channel attack protection method based on pseudo-operation of full encryption algorithm in the field of computer security technology, which uses m pseudo-keys and 1 real key to form a key sequence to perform multiple SMS4 encryption calculations, and participates in the real key The SMS4 encryption calculation result obtains the required ciphertext. The position of the real operation generated by the present invention is random, so that the attacker cannot align the power consumption curve, so that the attack cannot be realized. In addition, the use of pseudo-keys can interfere with side-channel attacks, making side-channel attacks ineffective. This solution is divided into full hardware implementation and software call implementation. For the software call implementation, the cryptographic circuit that cannot be modified by the hardware and has no side-channel attack protection can be implemented.

Description

基于全加密算法伪操作的旁路攻击防护方法Side-channel attack protection method based on pseudo-operation of full encryption algorithm

技术领域technical field

本发明涉及的是一种计算机安全领域的技术,具体是一种基于全加密算法伪操作的密码电路旁路攻击防护方法,可适用于SMS4等算法。The invention relates to a technology in the field of computer security, in particular to a password circuit bypass attack protection method based on a pseudo-operation of a full encryption algorithm, which is applicable to algorithms such as SMS4.

背景技术Background technique

在现实中,密码系统通常是以硬件或以硬件为表现形式的软件来实现的,譬如:智能卡、RFID、密码协处理器、SoC密码芯片、密码机等。在这些密码系统的实现环境中,攻击者可以观察和测量密码变换的能量消耗、电磁辐射等信息,利用这些额外的信息有可能实现比传统的数学分析更有效地密码破译。人们通常把这种环境下的攻击称为“旁路攻击(Side ChannelAttack)”。在旁路攻击的方法中,通常包括简单功耗分析(SPA)和差分功耗分析(DPA)。SPA攻击是通过少量的功耗曲线(对应少量的明文),利用密码算法的特征及其反映在功耗曲线上的特点,直接揭示出密钥或者与之相关的敏感信息。DPA攻击是通过记录密码设备对大量不同数据加密或解密操作时的功耗曲线,利用统计方法从功耗曲线中恢复出密码设备中的密钥。In reality, cryptographic systems are usually implemented with hardware or software in the form of hardware, such as: smart cards, RFID, cryptographic coprocessors, SoC cryptographic chips, cryptographic machines, etc. In the implementation environment of these cryptographic systems, attackers can observe and measure information such as energy consumption and electromagnetic radiation of cryptographic transformations, and it is possible to use these additional information to achieve more effective cryptographic deciphering than traditional mathematical analysis. People usually refer to the attack in this environment as "Side Channel Attack (Side Channel Attack)". In the method of side channel attack, it usually includes Simple Power Analysis (SPA) and Differential Power Analysis (DPA). The SPA attack uses a small amount of power consumption curve (corresponding to a small amount of plaintext) to directly reveal the key or sensitive information related to it by using the characteristics of the cryptographic algorithm and the characteristics reflected in the power consumption curve. The DPA attack is to record the power consumption curve of the cryptographic device when encrypting or decrypting a large amount of different data, and use the statistical method to recover the key in the cryptographic device from the power consumption curve.

旁路攻击方法的出现对很多现在的芯片构成了具大的威胁,因此,相应的出现了很多种旁路攻击的防护方法。比较常用的防护技术有隐藏技术和掩码技术。隐藏策略的目标是消除密码设备的功耗与设备所执行的操作和所处理的中间值之间的相关性。而掩码技术是通过随机化消息和密钥,使得无法建立密钥与功耗的关系。在隐藏技术中,其中有时间维度上的隐藏,这包括随机插入伪操作和乱序操作两种隐藏方法。随机插入伪操作是在密码算法执行前后以及执行中随机插入一些假的操作。这种方法可以破坏真实操作的对齐,使得在受到旁路攻击中攻击效果大大降低。乱序操作是在某些密码算法中,特定操作的执行顺序可以任意改变,因而可以通过改变这些操作的执行顺序来引入随机性。The emergence of side-channel attack methods has constituted a great threat to many current chips. Therefore, correspondingly, many kinds of protection methods for side-channel attacks have emerged. The more commonly used protection techniques include hiding techniques and masking techniques. The goal of the concealment strategy is to de-correlate the power consumption of a cryptographic device with the operations performed by the device and the intermediate values processed. The masking technology is to randomize the message and the key, so that the relationship between the key and the power consumption cannot be established. Among the hiding techniques, there is hiding in the time dimension, which includes two hiding methods of randomly inserting pseudo-operations and out-of-order operations. Random insertion of pseudo-operations is to randomly insert some false operations before, after and during the execution of the cryptographic algorithm. This method can destroy the alignment of real operations, making the attack effect greatly reduced in the case of side-channel attacks. Out-of-order operation means that in some cryptographic algorithms, the execution order of specific operations can be changed arbitrarily, so randomness can be introduced by changing the execution order of these operations.

掩码防护方法的缺点在于针对非线性操作(例如S盒)的掩码会使得电路面积变得很大,代价会很高,而且也并不能完全防护住泄露。而隐藏技术只是降低了泄露信号的信噪比,没有从根本上防护旁路攻击。而我们设计的伪操作及乱序操作的组合,一方面将真实密钥真真做到了隐藏,另外一方面也降低了信噪比,另外,也可以与掩码技术相结合来使用,不会产生什么冲突。The disadvantage of the mask protection method is that the mask for nonlinear operations (such as S-box) will make the circuit area larger, the cost will be high, and the leakage cannot be completely protected. The concealment technology only reduces the signal-to-noise ratio of the leaked signal, but does not fundamentally protect against side-channel attacks. The combination of pseudo-operation and out-of-order operation we designed, on the one hand, hides the real key, and on the other hand, it also reduces the signal-to-noise ratio. In addition, it can also be used in combination with masking technology, which will not What conflicts arise.

SM4为基于国家标准GM/T 0002‐2012《SM4分组密码算法》(原SMS4分组密码算法)的加密算法,该算法为对称算法,密钥长度和分组长度均为128位,加密算法与密钥扩展算法都采用32轮非线性迭代结构。解密算法与加密算法的结构相同,只是轮密钥的使用顺序相反,解密轮密钥是加密轮密钥的逆序。SM4 is an encryption algorithm based on the national standard GM/T 0002‐2012 "SM4 Block Cipher Algorithm" (formerly SMS4 Block Cipher Algorithm). The extended algorithm adopts 32 rounds of nonlinear iterative structure. The structure of the decryption algorithm is the same as that of the encryption algorithm, except that the order in which the round keys are used is reversed, and the decryption round key is the reverse order of the encryption round key.

经过对现有技术的检索发现,中国专利文献号CN103546277A公开(公告)日2014.01.29,公开了一种智能卡SM4算法的DPA攻击与密钥还原方法及系统,其方法包括以下步骤:步骤一,对SM4算法加密过程的前4轮进行DPA攻击,获取前4轮的子密钥;步骤二,利用得到的4轮子密钥恢复SM4密钥。采用该技术所述的方法和系统可以实现智能卡上SM4算法的DPA攻击,还原SM4加密密钥,验证智能卡上SM4算法的抗攻击能力。After searching the prior art, it was found that the Chinese Patent Document No. CN103546277A published (announcement) date 2014.01.29 disclosed a DPA attack and key recovery method and system of SM4 algorithm for smart cards. The method includes the following steps: Step 1, Perform DPA attack on the first 4 rounds of the SM4 algorithm encryption process to obtain the subkeys of the first 4 rounds; step 2, use the obtained 4 rounds of subkeys to restore the SM4 key. The method and system described in this technology can realize the DPA attack of the SM4 algorithm on the smart card, restore the SM4 encryption key, and verify the anti-attack capability of the SM4 algorithm on the smart card.

中国专利文献号CN103227717A公开(公告)日2013.07.31,公开了一种选择轮密钥异或输入进行SM4密码算法侧信道能量分析的应用,其核心在于进行SM4密码算法侧信道能量分析过程中,选择S盒或轮函数作为攻击点建立汉明距离模型,以轮密钥异或输入作为汉明距离模型的前续状态v1,对S盒进行攻击时,汉明距离(HD(v1,v2))模型的后继状态v2是S盒输出;对轮函数进行攻击时,汉明距离(HD(v1,v2))模型的后继状态v2是轮函数输出/输入。Chinese Patent Document No. CN103227717A Publication (Announcement) Date 2013.07.31, discloses an application of selective-or input of selection round key for side channel energy analysis of SM4 cipher algorithm, the core of which lies in the process of side channel energy analysis of SM4 cipher algorithm, Select the S-box or round function as the attack point to establish the Hamming distance model, and use the round key XOR input as the previous state v1 of the Hamming distance model. When attacking the S-box, the Hamming distance (HD(v1, v2) ) model's successor state v2 is the S-box output; when attacking the round function, the successor state v2 of the Hamming distance (HD(v1, v2)) model is the round function output/input.

中国专利文献号CN102546157A公开(公告)日2012.07.04,公开了一种抵抗能量分析的随机混合加密系统及其实现方法,该技术系统由伪随机序列PN128生成模块、S盒更新模块、掩码修正值生成模块、明文输入寄存器、伪随机序列PN64生成模块、选通电路A、选通电路B、SMS4加密模块、AES加密模块、多路器、密文输出寄存器十一个部分组成。该技术首次提出了一种抵抗能量分析的随机混合加密系统及其实现方法,通过伪随机序列PN64,对明文随机采用基于掩码技术的AES或者SMS4算法进行加密,算法硬件实现中所有的基本电路单元均通过对称电路实现,从根本上杜绝了简单和差分能量分析,加密系统具有多种工作模式,适用于不同场景。但该技术在某些明确要求使用单一算法如SMS4算法的情况下无法处理,另外,如果只是从算法的混合防护(不考虑掩码)角度来考虑,此防护并不能完全消除DPA攻击,因为我们可以把猜测算法出错作为一种噪声,因此,这种防护方案只是减少了信噪比,增加了DPA攻击的难度而已。Chinese Patent Document No. CN102546157A Publication (Announcement) Day 2012.07.04 discloses a random hybrid encryption system and its implementation method against energy analysis. The technical system consists of a pseudo-random sequence PN128 generation module, an S box update module, and a mask correction It consists of eleven parts: value generation module, plaintext input register, pseudo-random sequence PN64 generation module, gating circuit A, gating circuit B, SMS4 encryption module, AES encryption module, multiplexer, and ciphertext output register. For the first time, this technology proposes a random hybrid encryption system and its implementation method resistant to energy analysis. Through the pseudo-random sequence PN64, the plaintext is randomly encrypted with the AES or SMS4 algorithm based on the mask technology, and all the basic circuits in the algorithm hardware implementation The units are all realized by symmetrical circuits, which fundamentally eliminates simple and differential energy analysis. The encryption system has multiple working modes and is suitable for different scenarios. However, this technology cannot handle certain situations that require the use of a single algorithm such as the SMS4 algorithm. In addition, if we only consider the mixed protection of algorithms (without considering the mask), this protection cannot completely eliminate DPA attacks, because we The error of the guessing algorithm can be regarded as a kind of noise. Therefore, this protection scheme only reduces the signal-to-noise ratio and increases the difficulty of DPA attacks.

中国专利文献号CN102412963A以及CN102360414A分别公开了一种基于随机序列的具有误导功能的加密方法以及一种可修正伪随机序列的可误导的加密方法,该技术可以得到伪密钥,从而可以误导密码分析者,这种误导是决定于内层密钥的,为了可以进行任意的误导,采用长随机序列来产生子密钥,长随机序列可以由量子密钥分配产生。对于文档中的标记采用特别的处理方式,使得即使规定的标记可能出现在文本中,依然不会混淆。加密的时候需要有一个关键词数据库,其内层加密利用数据库进行关键词的扩充,外层加密采用了传统的加密方法。该技术解密时无需数据库的支持,避免了数据库同步的问题。该技术在各种场合加密应用中均具有一定的使用价值,特别是军事上。但该技术针对的是“软磨硬泡”攻击方法,通过误导解密后的明文的可读性来防护。这种方法对于旁路攻击没有效果。Chinese Patent Literature Nos. CN102412963A and CN102360414A respectively disclose a random sequence-based encryption method with misleading functions and a misleading encryption method that can modify pseudo-random sequences. This technology can obtain false keys, which can mislead cryptanalysis Or, this kind of misleading is determined by the inner key. In order to be able to mislead arbitrarily, a long random sequence is used to generate the subkey, and the long random sequence can be generated by quantum key distribution. Markup in the document is treated in a special way so that even though the specified markup may appear in the text, it is still not confusing. When encrypting, a keyword database is required. The inner encryption uses the database to expand the keywords, and the outer encryption adopts the traditional encryption method. This technology does not need the support of the database when decrypting, avoiding the problem of database synchronization. This technology has a certain use value in encryption applications on various occasions, especially in military affairs. However, this technology is aimed at the "soft grinding and hard foam" attack method, which is protected by misleading the readability of the decrypted plaintext. This method is ineffective against side channel attacks.

有时芯片已经流片成型,此时不能修改硬件,需要从软件调用角度,考虑如何来实现防护旁路攻击的目的。Sometimes the chip has been taped out, and the hardware cannot be modified at this time. It is necessary to consider how to achieve the purpose of protecting against side-channel attacks from the perspective of software calls.

发明内容Contents of the invention

本发明针对现有技术存在的上述不足,提出一种基于全加密算法伪操作的旁路攻击防护方法,通过伪密钥执行算法从而大幅度提高破解难度。Aiming at the above-mentioned deficiencies in the prior art, the present invention proposes a side-channel attack protection method based on a pseudo-operation of a full-encryption algorithm, and executes the algorithm through a pseudo-key to greatly increase the difficulty of cracking.

本发明是通过以下技术方案实现的:The present invention is achieved through the following technical solutions:

本发明涉及一种基于全加密算法伪操作的旁路攻击防护方法,整个计算执行了多次的加密算法操作,在这多次的加密操作中,SMS算法的计算所使用的密钥是从m个伪密钥和1个真实密钥所组成的密钥系列中选取的。整个操作得到了多次的加密结果,而只有一次结果是真实的所需要的密文。The present invention relates to a side-channel attack protection method based on a pseudo-operation of a full encryption algorithm. The entire calculation has performed multiple encryption algorithm operations. In these multiple encryption operations, the key used in the calculation of the SMS algorithm is from m selected from the key series consisting of 1 fake key and 1 real key. The entire operation has obtained multiple encryption results, and only one result is the real required ciphertext.

所述的密钥序列通过密钥随机选取电路(或软件即软件调用模式实现,下同)或通过密钥存储器随机打乱机构从密钥存储器中选择得到,具体为:The key sequence is randomly selected from the key memory by a key random selection circuit (or software, i.e. software call mode, the same below) or selected from the key memory by the key memory randomly disrupting mechanism, specifically:

①生成m个伪密钥和一个真实的密钥,然后利用密钥存储器随机打乱机构进行随机打乱,并记录下真实密钥的位置,或① Generate m fake keys and a real key, then use the key memory random scrambling mechanism to perform random scrambling, and record the location of the real key, or

②确定真实密钥执行的序号K,而密钥序列中其它m个伪密钥通过密钥随机选取机构从密钥存储器中选择得到。② Determine the serial number K of the real key execution, and the other m pseudo-keys in the key sequence are selected from the key memory by the key random selection mechanism.

对上述两种密钥序列生成方法中,可以只使得伪密钥的前32位是真实密钥不同,以此节省密钥存储空间,只需达到让第一轮的轮密钥不同的要求即可。For the above two key sequence generation methods, only the first 32 bits of the fake key can be different from the real key, so as to save key storage space, and only need to meet the requirement of making the first round of round keys different. Can.

所述的SMS4加密计算是指:将待加密的明文和各生成的各轮轮密钥进行加密算法的轮函数迭代计算。SMS4算法的轮函数迭代次数为32次。The SMS4 encryption calculation refers to: perform the round function iterative calculation of the encryption algorithm on the plaintext to be encrypted and each generated round key. The round function iteration number of SMS4 algorithm is 32 times.

经过32次的轮函数迭代计算后将真实密钥的计算结果作为密文输出。After 32 round function iterative calculations, the calculation result of the real key is output as ciphertext.

本发明涉及一种实现上述方法的系统,包括:SMS4的轮函数电路模块、密钥选择机构模块、(m+1)个密钥存储器、SMS4的周期轮密钥生成电路模块。其中:(m+1)个密钥存贮器与密钥选择电路相连并传输真假密钥,SMS4的密钥生成电路与SMS4的轮函数电路模块和(m+1)个轮密钥存贮器相连并传输真轮密钥。The present invention relates to a system for realizing the above method, comprising: a round function circuit module of SMS4, a key selection mechanism module, (m+1) key storages, and a periodic round key generation circuit module of SMS4. Wherein: (m+1) key storages are connected with the key selection circuit and transmit true and false keys, the key generation circuit of SMS4 is connected with the round function circuit module of SMS4 and (m+1) round key storage The receptacle is connected and transmits the real round key.

技术效果technical effect

与现有技术相比,本发明执行真实SMS4运算的位置随机,使攻击者无法对齐功耗曲线,从而无法实现攻击。另外,由于采用了伪密钥执行算法,使得在尝试对此防护芯片的攻击时,会对旁路攻击产生干扰作用。Compared with the prior art, the location where the real SMS4 operation is executed in the present invention is random, so that the attacker cannot align the power consumption curve, so that the attack cannot be realized. In addition, due to the use of the pseudo-key execution algorithm, when trying to attack the protection chip, it will interfere with side-channel attacks.

附图说明Description of drawings

图1为实施例1流程示意图。Fig. 1 is the schematic flow chart of embodiment 1.

图2为实施例1排列真假轮密钥采用的对数洗牌示意图。(其中子密钥表示128比特密钥的前32比特)Fig. 2 is a schematic diagram of the logarithmic shuffling adopted in embodiment 1 for arranging true and false round keys. (where the subkey represents the first 32 bits of a 128-bit key)

图3为实施例2流程示意图。Fig. 3 is the schematic flow chart of embodiment 2.

图4为实施例3流程示意图。Fig. 4 is the schematic flow chart of embodiment 3.

图5为实施例4流程示意图。Fig. 5 is a schematic flow chart of embodiment 4.

具体实施方式Detailed ways

下面对本发明的实施例作详细说明,本实施例在以本发明技术方案为前提下进行实施,给出了详细的实施方式和具体的操作过程,但本发明的保护范围不限于下述的实施例。The embodiments of the present invention are described in detail below. This embodiment is implemented on the premise of the technical solution of the present invention, and detailed implementation methods and specific operating procedures are provided, but the protection scope of the present invention is not limited to the following implementation example.

实施例1Example 1

如图1所示,本实施例中N=m+1。N及m分别表示SMS4算法的执行次数及伪密钥数量。As shown in FIG. 1, N=m+1 in this embodiment. N and m represent the execution times of the SMS4 algorithm and the number of pseudo-keys, respectively.

本实施例实现装置包括:基于SMS4的轮函数生成模块、1个真实密钥存贮器、m个伪密钥存储器、密钥存储器随机打乱电路、周期轮密钥生成电路,其中:SMS4的轮函数与周期轮密钥生成电路并传输、密钥储存器与密钥随机打乱电路相连并传输、密钥随机打乱电路与周期轮密钥生成电路相连。The implementation device of this embodiment includes: a round function generation module based on SMS4, 1 real key storage, m false key storages, a key storage random scrambling circuit, and a periodic round key generation circuit, wherein: SMS4 The round function is connected to the periodic round key generation circuit and transmitted, the key storage is connected to the key random scrambling circuit and transmitted, and the key random scrambling circuit is connected to the periodic round key generation circuit.

所述的基于SMS4的轮函数生成模块为:即正常的SMS4轮函数。The SMS4-based round function generation module is: a normal SMS4 round function.

所述的1个真实的密钥存贮器为:4个32位的寄存器,以用来存储128位的密钥。The one real key storage is: four 32-bit registers for storing 128-bit keys.

所述的m个伪密钥存储器为:m个32位的寄存器,以用来存储m个32位的伪密钥。The m pseudo-key memories are: m 32-bit registers for storing m 32-bit pseudo-keys.

所述的轮密钥存储器随机打乱电路为:把m个伪密钥和真实密钥的前32位放在一起然后利用密钥存储器随机打乱电路进行随机打乱,记录下真实轮密钥的位置。并依次把打乱后的32位和真实密钥的后96位一起组成128位的密钥传递给周期轮密钥生成电路,生成轮密钥。The random scrambling circuit of the round key memory is as follows: put the first 32 bits of the m false keys and the real key together and then use the random scrambling circuit of the key memory to randomly scramble, and record the real round key s position. And sequentially pass the 128-bit key composed of the 32 bits after the scrambling and the last 96 bits of the real key to the periodic round key generation circuit to generate the round key.

依上所述,本实施例是指多次执行(N次)SMS4算法,其中的密钥可以是真实密钥或伪密钥替换真实密钥的前32位,本实施例涉及上述装置的工作过程如下:According to the above, the present embodiment refers to multiple executions (N times) of the SMS4 algorithm, wherein the key can be a real key or a false key to replace the first 32 bits of the real key, and this embodiment relates to the work of the above-mentioned device The process is as follows:

1.首先需要保存m个伪密钥,这些伪密钥需要具有以下特点:伪密钥对应的每个字节是不同的,这个用来保证在计算SMS4算法的第一轮时的针对某个S盒的轮密钥是不一样的。1. First, you need to save m pseudo-keys. These pseudo-keys need to have the following characteristics: Each byte corresponding to the pseudo-key is different. This is used to ensure that the first round of the SMS4 algorithm is calculated for a certain The round key of the S box is different.

2.每次加密开始,把m个伪密钥和真实密钥的前32位放在一起然后利用密钥存储器随机打乱电路进行随机打乱,记录下真实轮密钥的位置(即真实轮密钥执行的时刻)。2. At the beginning of each encryption, put the first 32 bits of the m pseudo-keys and the real key together, then use the key memory random scrambling circuit to perform random scrambling, and record the position of the real round key (that is, the real round key moment of key execution).

3.然后依次根据随机打乱的32位密钥及真实密钥的后96位输送给周期轮密钥生成电路,开始执行N次SMS4算法,其中真实的结果保存在R1中,伪操作保存在R2中。3. Then, according to the randomly scrambled 32-bit key and the last 96 bits of the real key, they are sent to the periodic round key generation circuit in turn, and the SMS4 algorithm is executed N times. The real result is stored in R1, and the pseudo-operation is stored in R2.

在执行轮函数前都要执行一次周期轮密钥生成电路生成本轮轮密钥。Before executing the round function, the periodic round key generation circuit must be executed once to generate the current round key.

4.最后取R1中的结果作为密文。4. Finally, take the result in R1 as the ciphertext.

实施例2Example 2

如图3所示,本实施例中N>m。N及m分别表示SMS4算法的执行次数及伪密钥数量。As shown in FIG. 3 , N>m in this embodiment. N and m represent the execution times of the SMS4 algorithm and the number of pseudo-keys, respectively.

本实施例实现装置包括:基于SMS4的轮函数生成模块、(m+1)个密钥存贮器、周期轮密钥生成电路、轮密钥随机选取电路,其中:SMS4的轮函数模块与周期轮密钥生成电路相连并传输,周期轮函数生成模块与密钥储存器相连并传输、伪密钥储存器与周期密钥随机选取电路相连并传输。The implementation device of this embodiment includes: a round function generation module based on SMS4, (m+1) key storages, a periodic round key generation circuit, and a round key random selection circuit, wherein: the round function module of SMS4 is related to the periodic The round key generating circuit is connected and transmitted, the periodic round function generating module is connected and transmitted with the key storage, and the pseudo key storage is connected and transmitted with the periodic key random selection circuit.

所述的密钥随机选取电路为:先定位真实密钥执行SMS4算法的时刻,而其它的伪密钥的选择是从可选伪密钥中随机可重复选取,并取真实密钥的后96位一起组合128位密钥传输给周期轮密钥生成模块。The random selection circuit of the key is as follows: the moment when the real key is first positioned to execute the SMS4 algorithm, and the selection of other false keys is randomly and repeatedly selected from the optional false key, and the last 96 of the real key is taken. The bits are combined together into a 128-bit key and transmitted to the periodic round key generation module.

本实施例与实施例1的区别在于对密钥的选择方法上不同。本实施例选择密钥的方式是先定位真实轮密钥对应的执行SMS4算法的时刻,而其它使用伪密钥的SMS4执行的密钥的选择是从可选伪密钥中随机可重复选取。The difference between this embodiment and Embodiment 1 lies in the selection method of the key. The method of key selection in this embodiment is to first locate the moment corresponding to the real round key to execute the SMS4 algorithm, and the selection of keys for other SMS4 executions using pseudo-keys is to randomly and repeatedly select from the optional pseudo-keys.

实施例3Example 3

实施例3是软件调用方式,其密钥的选取方式与实施例1相同。Embodiment 3 is a software calling method, and the selection method of its key is the same as that of Embodiment 1.

实施例3的应用场景是硬件实施已经不能更改,通过软件调用方式实施与实施例1同样效果的旁路攻击防护方案。The application scenario of Embodiment 3 is that the hardware implementation cannot be changed, and the side-channel attack protection solution with the same effect as Embodiment 1 is implemented through software calling.

实施例4Example 4

实施例4是软件调用方式,其密钥的选取方式与实施例2相同。Embodiment 4 is a software calling method, and the selection method of its key is the same as that of Embodiment 2.

实施例4的应用场景是硬件实施已经不能更改,通过软件调用方式实施与实施例2同样效果的旁路攻击防护方案。The application scenario of Embodiment 4 is that the hardware implementation cannot be changed, and a side-channel attack protection solution with the same effect as Embodiment 2 is implemented through software calling.

效果分析Effectiveness analysis

SMS4全算法伪操旁路攻击作防护方案抵抗DPA攻击的说明:Description of SMS4 full-algorithm pseudo-operation side-channel attack protection scheme against DPA attack:

对于硬件实现的SMS4来说,由于密钥混淆的存在,每一轮的寄存器中的中间值和32位轮密钥都有关系。若要进行普通的DPA攻击,必须同时猜测32位轮密钥,在目前的攻击条件下尚不能达到,故目前针对此种硬件实现的SMS4的旁路攻击,已知的DPA方法都是采用选择明文的方式的。For the SMS4 implemented by hardware, due to the existence of key confusion, the intermediate value in the register of each round is related to the 32-bit round key. To carry out ordinary DPA attacks, the 32-bit round key must be guessed at the same time, which cannot be achieved under the current attack conditions. Therefore, the known DPA methods for SMS4 side-channel attacks implemented by this kind of hardware are all using selective in plain text.

采用选择明文方式的DPA攻击方法只能够从第一轮开始攻击SMS4的实现。上述实施例采用了伪操作的方法,使得当攻击者在攻击第一轮的时候,对于实施例1,从理论上来说,得到真实密钥与伪密钥的概率是一样的。因此,无法区别真实的操作和伪操作,做到了真实密钥与伪密钥充分混淆。另外,当伪操作的个数(即安全参数)等于255(最大)的时候,此时攻击者完全无法从DPA攻击中获得任何密钥信息,从而从理论和实际上抵御了针对SMS4硬件实现的DPA。对于实施例2,也可以让m=N–1,此时,从概率上来讲与实施例1相同,只是在实现方式上有所差异。但也可以调节m,使得m<N–1,此时得到伪轮密钥的概率反而要大于真实密钥的概率,给攻击造成假象。The DPA attack method using the chosen plaintext method can only attack the SMS4 implementation from the first round. The above-mentioned embodiment adopts the pseudo-operation method, so that when the attacker is attacking the first round, for embodiment 1, theoretically speaking, the probability of obtaining the real key and the pseudo-key is the same. Therefore, real operations and fake operations cannot be distinguished, and the real key and the fake key are fully confused. In addition, when the number of pseudo-operations (that is, the security parameter) is equal to 255 (maximum), the attacker cannot obtain any key information from the DPA attack at all, thus resisting the attack on SMS4 hardware in theory and in practice. DPA. For Embodiment 2, m=N−1 may also be set. In this case, it is the same as Embodiment 1 in terms of probability, but there are differences in implementation. However, m can also be adjusted so that m<N–1. At this time, the probability of obtaining a false round key is greater than the probability of the real key, which creates a false impression for the attack.

方案中隐含的另外一个防护方案是随机插入伪操作。由于真实轮密钥的使用位置是随机的,因此,相当于使用了随机插入伪操作防护措施。随机插入伪操作将导致真实的操作无法实现对齐。在本实施例中,只要真实操作执行的位置是符合随机均匀分布的,那么,真实操作在那个时刻的可能只有1/N。这将大大降低旁路攻击的信噪比。Another protection scheme implicit in the scheme is random insertion of pseudo-operations. Since the location of the real round key is random, it is equivalent to using a random insertion pseudo-operation protection measure. Random insertion of dummy operations will cause real operations to fail to achieve alignment. In this embodiment, as long as the location where the actual operation is performed conforms to a random uniform distribution, then the possibility of the actual operation at that moment is only 1/N. This will greatly reduce the signal-to-noise ratio of side-channel attacks.

防护方案另外一个优点是,对于某些已知流片成型而未加旁路攻击防护的芯片,可以使用这种方法来实现防护,因为些种防护措施不需要修改硬件,只需要多次调用SMS4算法的加密过程,并使用不同的密钥即可。Another advantage of the protection scheme is that this method can be used to achieve protection for some chips that are known to be taped out without side-channel attack protection, because these protection measures do not need to modify the hardware, only need to call SMS4 multiple times Algorithm encryption process, and use different keys.

Claims (7)

1.一种基于全加密算法伪操作的旁路攻击防护方法,其特征在于,以m个伪密钥和1个真实密钥组成密钥序列进行多次的SMS4加密计算,并将真实密钥参与的SMS4加密计算结果得到所需密文。1. A side-channel attack protection method based on pseudo-operation of full encryption algorithm, characterized in that, multiple SMS4 encryption calculations are performed with m pseudo-keys and 1 real key to form a key sequence, and the real key Participated in the SMS4 encryption calculation results to obtain the required ciphertext. 2.根据权利要求1所述的方法,其特征是,所述的密钥序列通过密钥随机选取机构或通过密钥存储器随机打乱机构从密钥存储器中选择得到。2. The method according to claim 1, wherein the key sequence is selected from the key memory through a key random selection mechanism or through a key memory random scrambling mechanism. 3.根据权利要求1或2所述的方法,其特征是,所述的密钥序列具体通过以下任意一种方式得到:3. The method according to claim 1 or 2, wherein the key sequence is specifically obtained by any of the following methods: ①生成m个伪密钥和一个真实轮密钥,然后利用密钥存储器随机打乱电路进行随机打乱,并记录下真实密钥的位置,或① Generate m fake keys and a real round key, then use the key memory random scrambling circuit to perform random scrambling, and record the position of the real key, or ②确定真实密钥执行的序号k,而密钥序列中其它m个伪密钥通过密钥随机选取电路从密钥存储器中选择得到,或② Determine the serial number k of the real key execution, and the other m pseudo-keys in the key sequence are selected from the key memory through the key random selection circuit, or ③生成m个伪密钥和一个真实轮密钥,然后利用软件实现方式随机打乱其顺序,并记录下真实密钥的位置,或③Generate m dummy keys and a real round key, then use software to randomly shuffle their order, and record the location of the real key, or ④确定真实密钥执行的序号k,而密钥序列中其它m个伪密钥通过软件实现的随机选取方式从密钥存储器中选择得到。④ Determine the serial number k of the real key execution, and the other m pseudo-keys in the key sequence are selected from the key memory through the random selection method implemented by software. 4.根据权利要求1所述的方法,其特征是,所述的SMS4加密计算是指:将待加密的明文与密钥序列通过周期轮密钥生成模块生成的轮密钥依次进行轮函数迭代计算,并取真实密钥执行的结果作为密文输出。4. The method according to claim 1, characterized in that, said SMS4 encryption calculation refers to: the plaintext to be encrypted and the key sequence are subjected to round function iterations successively through the round keys generated by the periodic round key generation module Calculate, and take the result of the real key execution as the ciphertext output. 5.根据权利要求1所述的方法,其特征是,所述的SMS4加密计算是指将待加密的明文与密钥序列传输给硬件密码电路,并取真实密钥执行的结果作为密文输出。5. The method according to claim 1, wherein said SMS4 encryption calculation refers to transmitting the plaintext to be encrypted and the key sequence to the hardware encryption circuit, and getting the result of the execution of the real key as the ciphertext output . 6.一种实现上述任一权利要求所述方法的系统,其特征在于,包括:SMS4周期轮函数电路模块、密钥选择电路模块、(m+1)个轮密钥寄存器、SMS4的轮密钥生成电路模块,其中:(m+1)个密钥存贮器与密钥选择电路相连并传输真假轮密钥,SMS4的轮密钥生成电路与SMS4的轮函数电路模块和(m+1)个密钥存贮器相连并传输真假密钥。6. A system for realizing the method described in any preceding claim, comprising: SMS4 periodic round function circuit module, key selection circuit module, (m+1) round key registers, SMS4 round secret Key generation circuit module, wherein: (m+1) key storages are connected with the key selection circuit and transmit true and false round keys, the round key generation circuit of SMS4 and the round function circuit module of SMS4 and (m+ 1) Two key storages are connected and transmit true and false keys. 7.一种实现上述任一权利要求所述方法的系统,软件调用实现的特征在于,包括:SMS4算法电路模块、密钥选择电路模块、(m+1)个轮密钥寄存器,其中:(m+1)个密钥存贮器与密钥选择电路相连并传输真假轮密钥,SMS4算法电路模块和(m+1)个密钥存贮器相连并传输真假密钥。7. A system that realizes the method described in any of the preceding claims, the software call is characterized in that it includes: SMS4 algorithm circuit module, key selection circuit module, (m+1) round key registers, wherein: ( The m+1) key storages are connected with the key selection circuit and transmit the true and false round keys, and the SMS4 algorithm circuit module is connected with the (m+1) key storages and transmit the true and false keys.
CN201510133523.8A 2015-03-25 2015-03-25 Bypass attack means of defence based on full Encryption Algorithm pseudo-operation Active CN104734845B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510133523.8A CN104734845B (en) 2015-03-25 2015-03-25 Bypass attack means of defence based on full Encryption Algorithm pseudo-operation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510133523.8A CN104734845B (en) 2015-03-25 2015-03-25 Bypass attack means of defence based on full Encryption Algorithm pseudo-operation

Publications (2)

Publication Number Publication Date
CN104734845A true CN104734845A (en) 2015-06-24
CN104734845B CN104734845B (en) 2018-11-23

Family

ID=53458308

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510133523.8A Active CN104734845B (en) 2015-03-25 2015-03-25 Bypass attack means of defence based on full Encryption Algorithm pseudo-operation

Country Status (1)

Country Link
CN (1) CN104734845B (en)

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209457A (en) * 2016-07-14 2016-12-07 北京工业大学 Tackle method for secret protection and the system of bypass attack in smart home environment
CN107980212A (en) * 2017-09-06 2018-05-01 福建联迪商用设备有限公司 Encryption method against DPA attack and computer-readable storage medium
CN108123792A (en) * 2017-12-19 2018-06-05 武汉瑞纳捷电子技术有限公司 A kind of power consumption method for scrambling of SM4 algorithms circuit
CN108847924A (en) * 2018-04-22 2018-11-20 平安科技(深圳)有限公司 Encryption method, device, computer equipment and storage medium
CN109257395A (en) * 2018-12-07 2019-01-22 四川长虹电器股份有限公司 The system for resisting bypass attack
CN111294199A (en) * 2018-12-06 2020-06-16 新唐科技股份有限公司 Encryption and decryption system, encryption device, decryption device, and encryption and decryption method
CN113742759A (en) * 2021-11-04 2021-12-03 国网浙江省电力有限公司 Data encryption method and device for financial accounting system
US11258579B2 (en) * 2018-02-26 2022-02-22 Stmicroelectronics (Rousset) Sas Method and circuit for implementing a substitution table
US11265145B2 (en) 2018-02-26 2022-03-01 Stmicroelectronics (Rousset) Sas Method and device for performing substitution table operations
CN115606148A (en) * 2020-04-06 2023-01-13 美国莱迪思半导体公司(Us) Information leakage mitigation associated with elliptic curve operation
CN116743379A (en) * 2023-08-11 2023-09-12 国网天津市电力公司电力科学研究院 Encryption transmission scheme determining method for power network data
US11824969B2 (en) 2018-02-26 2023-11-21 Stmicroelectronics (Rousset) Sas Method and circuit for performing a substitution operation
CN117614608A (en) * 2024-01-22 2024-02-27 南京航空航天大学 NTT (network time Table) defense method for resisting energy analysis attack

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101371480A (en) * 2005-11-21 2009-02-18 爱特梅尔公司 Encryption protection method
US20120069997A1 (en) * 2010-09-21 2012-03-22 Takeshi Kawabata Encription device and decryption device
CN102447556A (en) * 2010-10-14 2012-05-09 上海华虹集成电路有限责任公司 DES encryption method for resisting differential power analysis based on random offset
CN102970132A (en) * 2011-08-31 2013-03-13 北京中电华大电子设计有限责任公司 Protection method for preventing power analysis and electromagnetic radiation analysis on grouping algorithm
CN103138917A (en) * 2013-01-25 2013-06-05 国家密码管理局商用密码检测中心 Application method of Hamming distance model on SM4 cryptographic algorithm lateral information channel energy analysis and based on S box input
CN104202145A (en) * 2014-09-04 2014-12-10 成都信息工程学院 Plaintext or ciphertext selection based side channel power analysis attack method on round function output of SM4 cipher algorithm
CN104378196A (en) * 2014-11-07 2015-02-25 昆腾微电子股份有限公司 Method and device for safely executing encryption and decryption algorithm

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101371480A (en) * 2005-11-21 2009-02-18 爱特梅尔公司 Encryption protection method
US20120069997A1 (en) * 2010-09-21 2012-03-22 Takeshi Kawabata Encription device and decryption device
CN102447556A (en) * 2010-10-14 2012-05-09 上海华虹集成电路有限责任公司 DES encryption method for resisting differential power analysis based on random offset
CN102970132A (en) * 2011-08-31 2013-03-13 北京中电华大电子设计有限责任公司 Protection method for preventing power analysis and electromagnetic radiation analysis on grouping algorithm
CN103138917A (en) * 2013-01-25 2013-06-05 国家密码管理局商用密码检测中心 Application method of Hamming distance model on SM4 cryptographic algorithm lateral information channel energy analysis and based on S box input
CN104202145A (en) * 2014-09-04 2014-12-10 成都信息工程学院 Plaintext or ciphertext selection based side channel power analysis attack method on round function output of SM4 cipher algorithm
CN104378196A (en) * 2014-11-07 2015-02-25 昆腾微电子股份有限公司 Method and device for safely executing encryption and decryption algorithm

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106209457B (en) * 2016-07-14 2019-03-12 北京工业大学 Privacy protection method and system for side-channel attacks in smart home environment
CN106209457A (en) * 2016-07-14 2016-12-07 北京工业大学 Tackle method for secret protection and the system of bypass attack in smart home environment
CN107980212A (en) * 2017-09-06 2018-05-01 福建联迪商用设备有限公司 Encryption method against DPA attack and computer-readable storage medium
WO2019047062A1 (en) * 2017-09-06 2019-03-14 福建联迪商用设备有限公司 Anti-dpa attack encryption method and computer-readable storage medium
CN108123792B (en) * 2017-12-19 2021-05-18 武汉瑞纳捷电子技术有限公司 Power consumption scrambling method of SM4 algorithm circuit
CN108123792A (en) * 2017-12-19 2018-06-05 武汉瑞纳捷电子技术有限公司 A kind of power consumption method for scrambling of SM4 algorithms circuit
US11824969B2 (en) 2018-02-26 2023-11-21 Stmicroelectronics (Rousset) Sas Method and circuit for performing a substitution operation
US11258579B2 (en) * 2018-02-26 2022-02-22 Stmicroelectronics (Rousset) Sas Method and circuit for implementing a substitution table
US11265145B2 (en) 2018-02-26 2022-03-01 Stmicroelectronics (Rousset) Sas Method and device for performing substitution table operations
CN108847924A (en) * 2018-04-22 2018-11-20 平安科技(深圳)有限公司 Encryption method, device, computer equipment and storage medium
WO2019205407A1 (en) * 2018-04-22 2019-10-31 平安科技(深圳)有限公司 Encryption method and apparatus, and computer device and storage medium
CN111294199B (en) * 2018-12-06 2023-05-05 新唐科技股份有限公司 Encryption and decryption system, encryption device, decryption device and encryption and decryption method
CN111294199A (en) * 2018-12-06 2020-06-16 新唐科技股份有限公司 Encryption and decryption system, encryption device, decryption device, and encryption and decryption method
CN109257395B (en) * 2018-12-07 2020-10-23 四川长虹电器股份有限公司 System for defending against side-channel attack
CN109257395A (en) * 2018-12-07 2019-01-22 四川长虹电器股份有限公司 The system for resisting bypass attack
CN115606148A (en) * 2020-04-06 2023-01-13 美国莱迪思半导体公司(Us) Information leakage mitigation associated with elliptic curve operation
CN113742759B (en) * 2021-11-04 2022-02-22 国网浙江省电力有限公司 Data encryption method and device for financial accounting system
CN113742759A (en) * 2021-11-04 2021-12-03 国网浙江省电力有限公司 Data encryption method and device for financial accounting system
CN116743379A (en) * 2023-08-11 2023-09-12 国网天津市电力公司电力科学研究院 Encryption transmission scheme determining method for power network data
CN116743379B (en) * 2023-08-11 2023-10-31 国网天津市电力公司电力科学研究院 Method for determining encryption transmission scheme for power network data
CN117614608A (en) * 2024-01-22 2024-02-27 南京航空航天大学 NTT (network time Table) defense method for resisting energy analysis attack
CN117614608B (en) * 2024-01-22 2024-04-16 南京航空航天大学 A NTT defense method against energy analysis attacks

Also Published As

Publication number Publication date
CN104734845B (en) 2018-11-23

Similar Documents

Publication Publication Date Title
CN104734842B (en) Method is resisted in circuits bypass attack based on pseudo-operation
CN104734845B (en) Bypass attack means of defence based on full Encryption Algorithm pseudo-operation
US10439797B2 (en) Methods and devices against a side-channel analysis
KR102628466B1 (en) Block cryptographic method for encrypting/decrypting messages and cryptographic devices for implementing this method
US20150222421A1 (en) Countermeasures against side-channel attacks on cryptographic algorithms
US20200313850A1 (en) Method and apparatus for implementing a white-box cipher
Dassance et al. Combined fault and side-channel attacks on the AES key schedule
US9544132B2 (en) Cryptographic method for protecting a key hardware register against fault attacks
Pan et al. One fault is all it needs: Breaking higher-order masking with persistent fault analysis
WO2001031422A2 (en) Method for protection against analysis of unintended side-channel signals
CN103404073A (en) Protection against passive sniffing
US8958556B2 (en) Method of secure cryptographic calculation, in particular, against attacks of the DFA and unidirectional type, and corresponding component
CN108737073B (en) Method and device for resisting energy analysis attack in block encryption operation
Nissar et al. Implementation of security enhancement in AES by inducting dynamicity in AES s-box
CN106936822B (en) Mask implementation method and system for resisting high-order bypass analysis aiming at SMS4
EP4307155A1 (en) Method and circuit for protecting an electronic device from a side-channel attack
CN107766725A (en) The data transmission method and system of anti-template attack
Liu et al. Improving tag generation for memory data authentication in embedded processor systems
CN118233115A (en) Improved comprehensive protection method based on threshold technology
Liu et al. iCETD: An improved tag generation design for memory data authentication in embedded processor systems
Chen et al. Meet-in-the-middle attack on 4+ 4 rounds of SCARF under single-tweak setting
US20200220708A1 (en) United countermeasure against side-channel attacks
Krishnan et al. Modified AES with Random S box generation to overcome the side channel assaults using cloud
Marpaung et al. Higher-Order Countermeasures against Side-Channel Cryptanalysis on Rabbit Stream Cipher
CN103384197B (en) A kind of defence circuit, chip and method to grouping algorithm Attacks

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant