A defense method, system and test method for side channel attack of cryptographic software

By introducing obfuscation algorithms and power consumption randomization algorithms into cryptographic software, the problem of lack of defense against contralateral channel attacks in the prior art is solved, and effective resistance to attacks based on encryption time and power consumption is achieved, which improves the security of cryptographic software.

CN119402171BActive Publication Date: 2025-03-21SICHUAN ELECTRONIC PROD SUPERVISION & INSPECTION INST
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510008993.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-03
Publication Date
2025-03-21
Estimated Expiration
2045-01-03

AI Technical Summary

Technical Problem

Existing cryptographic software lacks a defense solution for contralateral channel attacks, resulting in physical information leaked during encryption that can be used by the attacker to infer keys or other sensitive information.

Method used

By introducing obfuscation algorithms and power consumption randomization algorithms into cryptographic software, the encryption time and power consumption information are obfuscated, making it impossible for attackers to restore the secret key through this information.

Benefits of technology

Effectively resist side channel attacks based on encryption time and encryption power consumption, improve the security of cryptographic software, and adapt to cryptographic software with arbitrary encryption algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402171B_ABST
    Figure CN119402171B_ABST
Patent Text Reader

Abstract

The present invention provides a method, system and test method for defending against side channel attacks of cryptographic software, and relates to the technical field of preventing side channel attacks, wherein the method for defending against side channel attacks of cryptographic software comprises the following steps: step S1, obtaining the start time and end time of the cryptographic software encryption process; step S2: executing the obfuscation algorithm from the end time; the running time of the obfuscation algorithm is the first obfuscation duration; wherein the first obfuscation duration satisfies:; wherein, is the set total duration of disguise encryption, is the set duration threshold constant, is the encryption duration of the cryptographic software,. The method for defending against side channel attacks of cryptographic software of the present invention can effectively resist the side channel attack mode based on encryption time, and can be well adapted to any cryptographic software.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of side channel attack prevention, and in particular to a defense method, system and testing method for side channel attack prevention of cryptographic software. Background Art

[0002] Passwords are the last line of defense against cyber threats. From a security perspective, the more complex the password design, the more secure it is. However, it is obviously difficult for users to remember complex password strings. With the advancement of technology, password and account management software (referred to as password software) has made great progress. Password software can generate long and complex passwords for users and store them in encrypted form. Users only need to remember a master password (the master password can be a biometric password, such as a fingerprint) to open the password software, so that they can obtain all other passwords to more effectively protect users' confidential data.

[0003] However, among the existing cryptographic software attack methods, side channel attacks (also known as side channel attacks or side channel attacks) are a new type of attack method that does not rely on the mathematical weaknesses of the encryption algorithm of the cryptographic software itself. It uses the information leaked by the physical device that implements the encryption process when performing encryption operations, such as power consumption, electromagnetic radiation, running time, etc., to infer the key or other sensitive information of the encryption device. Side channel attacks have the following advantages: first, side channel attacks do not rely on the mathematical weaknesses of the encryption algorithm (therefore, even if the encryption algorithm is extremely powerful, it may still be successfully decrypted), second, side channel attacks are difficult to detect (side channel attacks usually do not require physical contact or damage to the cryptographic software, and can be carried out during the normal operation of the cryptographic software, which is difficult to be detected by users or security systems), and third, side channel attacks can effectively counter encryption hardening measures (even if the encryption algorithm has been hardened, such as using a hardware security module HSM, side channel attacks may still succeed because their attack direction is at the hardware implementation level).

[0004] However, existing cryptographic software does not have a defense solution against side-channel attacks. Therefore, how to make cryptographic software able to resist side-channel attacks has become an urgent problem to be solved. Summary of the invention

[0005] In order to solve the technical problems in the related art, the present invention provides a defense method, system and testing method for side-channel attacks on cryptographic software.

[0006] In order to achieve the above object, the technical solution adopted by the present invention includes:

[0007] According to a first aspect of the present invention, there is provided a method for defending against a side channel attack on cryptographic software, comprising the following steps:

[0008] Step S1: Get the start time of the encryption process of the cryptographic software and end time ;

[0009] Step S2: From the end time The obfuscation algorithm is executed from the beginning; the running time of the obfuscation algorithm is the first obfuscation duration ; Wherein, the first confusion duration satisfy:

[0010]

[0011] In the formula, The total duration of the disguise encryption is set. is the set duration threshold constant, The encryption duration of the cryptographic software. ;

[0012] So that the duration of encryption of different data by the cryptographic software is maintained close to the set total duration of disguise encryption, that is, to Therefore, attackers based on encryption time cannot obtain the difference in encryption time.

[0013] Optionally, the step S2 specifically includes:

[0014] Step S2-1: Calculate the encryption time of the cryptographic software ;

[0015] Step S2-2: From the end time Start by executing the obfuscation algorithm:

[0016]

[0017] In the formula, To confuse the algorithm formula, is the gamma function, is the hyperbolic sine function, is the hyperbolic cosine function, , , and are the set time thresholds, and .

[0018] Optionally, the step S2 specifically includes:

[0019] Step S2-1: Calculate the encryption time of the cryptographic software ;

[0020] Step S2-2: From the end time Start by executing the obfuscation algorithm:

[0021]

[0022] In the formula, To confuse the algorithm formula, , are the set time thresholds, and , is the natural logarithm, is the floor function.

[0023] Optionally, the method for defending against cryptographic software side channel attacks further includes:

[0024] Step S3: from the moment when the obfuscation algorithm is executed, immediately call the power consumption randomization algorithm, wherein the power consumption generated when the power consumption randomization algorithm is executed is random.

[0025] Optionally, step S3 includes:

[0026] Step S3-1: In a predetermined range set In the example, the position parameters are randomly selected. and width parameters ,

[0027] Step S3-2: From the moment when the obfuscation algorithm is executed, the power consumption randomization algorithm is executed:

[0028]

[0029] In the formula, is the power consumption randomization algorithm formula, is a normal number set to adjust the power consumption. is a set positive constant used to control the decay speed of the exponential function. is a set integer, and , so that the exponential function part can produce nonlinear changes, is a positive constant set to adjust the amplitude of the sine function part;

[0030] According to a second aspect of the present invention, there is also provided a cryptographic software side channel attack defense system, which is used to execute the cryptographic software side channel attack defense method as described in any technical solution in the first aspect of the present invention, and the cryptographic software side channel attack defense system comprises:

[0031] Data acquisition module, used to obtain the start time of the encryption process of the cryptographic software and end time ;

[0032] Crypto-time obfuscation module, used to execute the obfuscation algorithm.

[0033] Optionally, the method for defending against side channel attacks on cryptographic software further comprises step S3: from the moment when the obfuscation algorithm is executed, immediately calling a power consumption randomization algorithm, wherein the power consumption generated when the power consumption randomization algorithm is executed is random;

[0034] The defense system for the cryptographic software side channel attack also includes:

[0035] The encrypted power consumption randomization module is used to execute the power consumption randomization algorithm.

[0036] According to a third aspect of the present invention, there is also provided a method for testing a cryptographic software side channel attack defense system, which is used to test the cryptographic software side channel attack defense system described in any one of the technical solutions in the second aspect of the present invention, comprising the following steps:

[0037] Step S4: respectively obtaining the encryption duration and the corresponding encryption power consumption of multiple encryption processes of the cryptographic software;

[0038] Step S5: respectively obtaining the obfuscation duration of the obfuscation algorithm executed corresponding to each encryption process and the random power consumption of the power consumption randomization algorithm executed correspondingly;

[0039] Step S6: respectively calculating the sum of the encryption duration and the obfuscation duration of each encryption process, the average of the encryption duration and the obfuscation duration of multiple encryption processes, and the sum of the encryption power consumption and the random power consumption of each encryption process;

[0040] Step S6: If the difference between the duration sum and the duration mean is less than or equal to the set difference threshold, the obfuscation algorithm is considered qualified; if the power consumption sum changes nonlinearly, the power consumption randomization algorithm is considered qualified.

[0041] According to the fourth aspect of the present invention, there is also provided a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, can implement the steps of the method for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the first aspect of the present invention, and / or, the processor, when executing the computer program, can implement the steps of the method for testing the system for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the third aspect of the present invention.

[0042] According to the fifth aspect of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the steps of the method for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the first aspect of the present invention, and / or, when executed by a processor, can implement the steps of the method for testing a system for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the third aspect of the present invention.

[0043] Beneficial effects:

[0044] 1. First, with respect to the attack method that utilizes encryption time to conduct side channel attacks, the obfuscation algorithm implemented by the present invention can add a first obfuscation time on the basis of the actual encryption time, and obfuscate the actual encryption time of the cryptographic software without affecting the encryption process, so that the encryption time of different data encrypted by the cryptographic software can be maintained near a certain time (i.e., the set total disguised encryption time) in appearance, so that the side channel attacker cannot obtain the relevant information of the encryption process of the cryptographic software for different data from the encryption time, and the side channel attacker based on the encryption time cannot restore the secret key through the difference in encryption time, thereby improving the security of the cryptographic software.

[0045] Second, the obfuscation algorithm of the present invention is independent of the encryption algorithm of the cryptographic software itself, which means that the obfuscation algorithm of the present invention can be adapted to cryptographic software with any encryption algorithm, and there is no need to make any adjustments to the encryption algorithm of the cryptographic software, thus having good versatility.

[0046] In addition, since the defense method for cryptographic software side channel attacks of the present invention adds an obfuscation algorithm on the basis of the encryption algorithm, the two are performed continuously, and the execution of the obfuscation algorithm also has a certain obfuscation power consumption. Therefore, when a side channel attacker based on encryption power consumption collects encryption power consumption information, the obfuscation power consumption can also interfere with the accuracy of the data collected by the side channel attacker to a certain extent, and can also form a certain defense capability against the attacker who adopts a side channel attack method based on encryption power consumption.

[0047] 2. Other beneficial effects or advantages of the present invention will be described in detail in the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative labor.

[0049] in:

[0050] Figure 1 It is a flowchart of the steps of a method for defending against side-channel attacks on cryptographic software provided by an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0052] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0053] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes other steps or units that are not listed, or optionally includes other steps or units that are inherent to these processes, methods, products or devices. It should also be noted that in the embodiments of the present invention, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or design. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0054] In order to facilitate relevant technical personnel to have a clearer and more accurate understanding of the technical solution of the present invention, the side channel attack is first described in more detail below.

[0055] Side channel attacks use the physical information (for example, sound information, temperature information, power consumption information, time information, electromagnetic information, etc.) generated by the corresponding encryption hardware during the encryption process to reveal the secret key used by the encryption hardware through other algorithms.

[0056] For example, in a simple power analysis attack (SPA), an attacker can infer key information by observing the power consumption changes of the encryption software when performing encryption operations. Specifically, an attacker can determine certain operations in the encryption algorithm, such as multiplication or modular operations, by the power consumption peak.

[0057] Another example is a timing attack, where an attacker can infer key information by measuring the time required for encryption operations. Specifically, some operations may take different execution times due to different bits of the key, and the attacker can use this difference to restore the key.

[0058] Among many side channel attack methods, the side channel attack using encryption time or encryption power consumption is the most widely used attack method in this field. This is because other physical information (such as sound information, temperature information, electromagnetic information, etc.) is easily distorted by environmental interference, resulting in low cracking accuracy. The collected encryption time and encryption power consumption related data have less interference and good continuity, which can effectively improve the accuracy of successful cracking.

[0059] In view of this, the present invention provides a brand-new solution, namely, a method, system and testing method for defending against side-channel attacks on cryptographic software of the present invention. The method for defending against side-channel attacks on cryptographic software of the present invention can effectively resist side-channel attacks based on encryption time and encryption power consumption, and can be well adapted to any cryptographic software.

[0060] The technical solution of the present invention is described in detail below with reference to the accompanying drawings.

[0061] Example 1

[0062] like Figure 1 As shown, this embodiment provides a method for defending against a cryptographic software side channel attack, comprising the following steps:

[0063] Step S1: Get the start time of the encryption process of the cryptographic software and end time ;

[0064] Step S2: From the end time The obfuscation algorithm is executed from now on; the running time of the obfuscation algorithm is the first obfuscation duration ; Among them, the first confusion duration satisfy:

[0065]

[0066] In the formula, The total duration of the disguise encryption is set. is the set duration threshold constant, The encryption duration of the cryptographic software. ;

[0067] So that the duration of encryption of different data by the cryptographic software is maintained close to the set total duration of disguise encryption, that is, to Therefore, attackers based on encryption time cannot obtain the difference in encryption time.

[0068] Through the above technical scheme, first, for the attack method that uses encryption time to perform side channel attacks, the obfuscation algorithm executed by the present invention can add a first obfuscation time on the basis of the actual encryption time, and obfuscate the actual encryption time of the cryptographic software without affecting the encryption process, so that the encryption time of different data encrypted by the cryptographic software can be maintained near a certain time (i.e., the set total disguised encryption time) in appearance, so that the side channel attacker cannot obtain relevant information of the encryption process of the cryptographic software for different data from the encryption time, and the side channel attacker based on the encryption time cannot restore the secret key through the difference in encryption time, thereby improving the security of the cryptographic software.

[0069] Second, the obfuscation algorithm of the present invention is independent of the encryption algorithm of the cryptographic software itself, which means that the obfuscation algorithm of the present invention can be adapted to cryptographic software with any encryption algorithm, and there is no need to make any adjustments to the encryption algorithm of the cryptographic software, thus having good versatility.

[0070] In addition, since the defense method for cryptographic software side channel attacks of the present invention adds an obfuscation algorithm on the basis of the encryption algorithm, the two are performed continuously, and the execution of the obfuscation algorithm also has a certain obfuscation power consumption. Therefore, when a side channel attacker based on encryption power consumption collects encryption power consumption information, the obfuscation power consumption can also interfere with the accuracy of the data collected by the side channel attacker to a certain extent, and can also form a certain defense capability against the attacker who adopts a side channel attack method based on encryption power consumption.

[0071] In the present invention, step S2 has multiple optional implementations. For example, in an exemplary implementation of the present invention, step S2 of the present invention may specifically include:

[0072] Step S2-1: Calculate the encryption time of the cryptographic software ;

[0073] Step S2-2: From the end time Start by executing the obfuscation algorithm:

[0074]

[0075] In the formula, To confuse the algorithm formula, is the gamma function, is the hyperbolic sine function, is the hyperbolic cosine function, , , and are the set time thresholds, and .

[0076] In this way, the segmented obfuscation algorithm can be adapted to operations with different encryption durations. For example, when the encryption duration of the cryptographic software is Longer time ( ), the simplest obfuscation algorithm can be used to shorten the execution time of the obfuscation algorithm; when the encryption time of the cryptographic software is short ( ), a more complex obfuscation algorithm can be used to make the execution time of the obfuscation algorithm longer, so that when facing different encryption requirements with different encryption durations, the total encryption duration can be well reduced. approaching the same value.

[0077] Meanwhile, in this embodiment, when hour, , in this expression, as The denominator is gradually reduced. It will gradually decrease and the frequency of reduction will be very fast, which will make the amount of calculation of the entire calculation process larger, and can effectively improve the execution time, thereby ensuring that the first confusion time meets the requirements.

[0078] In another exemplary embodiment of the present invention, step S2 of the present invention may specifically include:

[0079] Step S2-1: Calculate the encryption time of the cryptographic software ;

[0080] Step S2-2: From the end time Start by executing the obfuscation algorithm:

[0081]

[0082] In the formula, To confuse the algorithm formula, , are the set time thresholds, and , is the natural logarithm, is the floor function, The unit is milliseconds or seconds.

[0083] In this way, the segmented obfuscation algorithm can be adapted to operations with different encryption durations. Longer time ( ), the simplest obfuscation algorithm can be used to shorten the execution time of the obfuscation algorithm; for example, when the encryption time of the cryptographic software is short ( ), a more complex obfuscation algorithm can be used to make the execution time of the obfuscation algorithm longer, so that when facing different encryption requirements with different encryption durations, the total encryption duration can be well reduced. approaching the same value.

[0084] At the same time, in this embodiment, when the encryption time of the cryptographic software is short, that is, hour,

[0085]

[0086] This expression includes a fractional part and a summation part, where the fractional part increases with The numerator decreases faster than the denominator, so the value of the fractional part decreases gradually, and the calculation process becomes more complicated; the summation part decreases with As decreases gradually, its value will also decrease gradually. Although the decreasing speed is slow, it will also make the calculation process more complicated. In this way, a more complicated calculation process can be realized through this expression, which can effectively improve the execution time, thereby ensuring that the first confusion duration meets the requirements.

[0087] In addition to the attack method based on encryption time, the attack method based on encryption power consumption is also one of the most widely used side channel attacks. The above technical solution is only designed for the attack method based on encryption time. Although the obfuscation algorithm can interfere with the encryption power consumption to a certain extent, it still cannot ensure that the attacker cannot decrypt based on the collected power consumption information.

[0088] In view of this, in one embodiment of the present invention, the defense method for cryptographic software side channel attacks of the present invention may also include step S3, that is, immediately calling the power consumption randomization algorithm from the moment the obfuscation algorithm is executed, wherein the power consumption generated when the power consumption randomization algorithm is executed is random.

[0089] In this way, on the basis of adding the obfuscation algorithm, the power consumption randomization algorithm is subsequently executed. First, the cryptographic software can execute a power consumption randomization algorithm with random power consumption after encryption. On the basis of not affecting the encryption process, the actual encryption power consumption of the cryptographic software is concealed, so that the encryption power consumption of different data encrypted by the cryptographic software can be randomized in appearance, so that the side channel attacker cannot obtain the power consumption information of the encryption process of the cryptographic software for different data from the encryption power consumption, and the side channel attacker based on the encryption power consumption cannot restore the secret key through the difference in encryption power consumption, thereby improving the security of the cryptographic software.

[0090] Second, the power consumption randomization algorithm of the present invention is independent of the obfuscation algorithm and the encryption algorithm of the cryptographic software itself, which means that the power consumption randomization algorithm of the present invention can be adapted to cryptographic software with any encryption algorithm. At the same time, there is no need to make any adjustments to the encryption algorithm of the cryptographic software, and it has good versatility.

[0091] In an exemplary embodiment of the present invention, step S3 of the present invention may include:

[0092] Step S3-1: In a predetermined range set In the example, the position parameters are randomly selected. and width parameters ,

[0093] Step S3-2: From the moment when the obfuscation algorithm is executed, the power consumption randomization algorithm is executed:

[0094]

[0095] In the formula, is the power consumption randomization algorithm formula, is a normal number set to adjust the power consumption. is a set positive constant used to control the decay speed of the exponential function. is a set integer, and , so that the exponential function part can produce nonlinear changes, A positive constant that is set to adjust the amplitude of the sine function.

[0096] Thus, in this embodiment, it should be noted that the entire power consumption randomization algorithm includes an exponential function part and a sine function part, wherein, for the entire power consumption randomization algorithm, is the amplitude or gain of the control output, which can be used to adjust the power consumption of the power randomization algorithm; for the exponential function part, is a normal constant set to control the decay speed of the exponential function part; is a position parameter used to control the distance of the entire power consumption randomization algorithm in the x-axis direction. is the width parameter, which is used in the exponential part to control the speed of exponential decay. The most important , which is an integer greater than 1, which can make the exponential function part produce nonlinear changes and increase the degree of randomization of power consumption; for the sine function part, is a positive constant set to adjust the amplitude of the sine function. The exponential part is used to control the period of the sine function.

[0097] Through this technical solution, the execution power consumption of the power consumption randomization algorithm can be effectively randomly generated. In this way, the encryption power consumption of the cryptographic software can be effectively randomized in appearance (even if the same data is encrypted, the apparent encryption power consumption generated is random), so that side-channel attackers cannot obtain the power consumption information of the encryption process of the cryptographic software for different data from the encryption power consumption. This also means that side-channel attackers based on encryption power consumption cannot restore the secret key through the difference in encryption power consumption, thereby improving the security of the cryptographic software.

[0098] According to a second aspect of the present invention, there is also provided a cryptographic software side channel attack defense system, which is used to execute the cryptographic software side channel attack defense method according to any one of the technical solutions in the first aspect of the present invention. The cryptographic software side channel attack defense system comprises:

[0099] Data acquisition module, used to obtain the start time of the encryption process of the cryptographic software and end time ;

[0100] Crypto-time obfuscation module, used to execute the obfuscation algorithm.

[0101] In this way, through the above technical solution, the defense system for side channel attacks on cryptographic software of the present invention can effectively resist side channel attacks based on encryption time and can be well adapted to any cryptographic software.

[0102] In one embodiment of the present invention, the defense method for cryptographic software side-channel attacks of the present invention may further include step S3: from the moment the obfuscation algorithm is executed, immediately calling the power consumption randomization algorithm, wherein the power consumption generated when the power consumption randomization algorithm is executed is random; at the same time, the defense system for cryptographic software side-channel attacks of the present invention also includes an encryption power consumption randomization module, which is used to execute the power consumption randomization algorithm.

[0103] In this way, through the above technical solution, the defense system for side channel attacks on cryptographic software of the present invention can effectively resist side channel attacks based on encryption time and / or encryption power consumption, and can be well adapted to any cryptographic software.

[0104] According to a third aspect of the present invention, there is also provided a method for testing a cryptographic software side channel attack defense system, which is used to test the cryptographic software side channel attack defense system of any one of the technical solutions in the second aspect of the present invention, comprising the following steps:

[0105] Step S4: respectively obtaining the encryption duration and the corresponding encryption power consumption of multiple encryption processes of the cryptographic software;

[0106] Step S5: respectively obtaining the obfuscation duration of the obfuscation algorithm executed corresponding to each encryption process and the random power consumption of the power consumption randomization algorithm executed correspondingly;

[0107] Step S6: respectively calculating the sum of the encryption duration and the obfuscation duration of each encryption process, the average of the encryption duration and the obfuscation duration of multiple encryption processes, and the sum of the encryption power consumption and the random power consumption of each encryption process;

[0108] Step S6: If the difference between the duration sum and the duration mean is less than or equal to the set difference threshold, the obfuscation algorithm is considered qualified; if the power consumption sum changes nonlinearly, the power consumption randomization algorithm is considered qualified.

[0109] In this way, when testing the defense system against cryptographic software side-channel attacks, the above steps can be followed to conduct a complete and thorough test on the defense system against cryptographic software side-channel attacks, and the qualification levels of its obfuscation algorithm and power consumption randomization algorithm can be obtained respectively, which is more conducive to targeted optimization and improvement.

[0110] According to the fourth aspect of the present invention, there is also provided a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, can implement the steps of the method for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the first aspect of the present invention, and / or, the processor, when executing the computer program, can implement the steps of the method for testing the system for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the third aspect of the present invention.

[0111] It is understood that in this embodiment, the memory may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid state drive; in addition, the memory may also include a combination of the above-mentioned types of memory. The present invention does not specifically limit this.

[0112] Similarly, the processor may be a processor that implements or executes various exemplary logic steps described in conjunction with the disclosure of the present invention. The processor may be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component, or any combination thereof. It may implement or execute various exemplary logic steps described in conjunction with the disclosure of the present invention. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.

[0113] According to the fifth aspect of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the steps of the method for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the first aspect of the present invention, and / or, when executed by a processor, can implement the steps of the method for testing a system for defending against cryptographic software side-channel attacks as described in any one of the technical solutions in the third aspect of the present invention.

[0114] In this embodiment, the computer readable storage medium, for example, can be but not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive list) of computer readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (Random Access Memory, RAM), a read-only memory (Read-Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory, EPROM), a register, a hard disk, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC). In embodiments of the present invention, computer-readable storage media may be any tangible media that contains or stores a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0115] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for defending against side channel attacks on cryptographic software, characterized in that: The steps include: Step S1: Get the start time of the encryption process of the cryptographic software and end time ; Step S2: From the end time The obfuscation algorithm is executed from the beginning; the running time of the obfuscation algorithm is the first obfuscation duration ; Wherein, the first confusion duration satisfy: In the formula, The total duration of the disguise encryption is set. is the set duration threshold constant, The encryption duration of the cryptographic software. ; So that the duration of encryption of different data by the cryptographic software is maintained close to the set total duration of disguise encryption, that is, to Therefore, attackers based on encryption time cannot obtain the difference in encryption time. The step S2 specifically includes: Step S2-1: Calculate the encryption time of the cryptographic software ; Step S2-2: From the end time Start by executing the obfuscation algorithm: In the formula, To confuse the algorithm formula, is the gamma function, is the hyperbolic sine function, is the hyperbolic cosine function, , , and are the set time thresholds, and .

2. The method for defending against side channel attacks on cryptographic software according to claim 1, characterized in that: The step S2 specifically includes: Step S2-1: Calculate the encryption time of the cryptographic software ; Step S2-2: From the end time Start by executing the obfuscation algorithm: In the formula, To confuse the algorithm formula, , are the set time thresholds, and , is the natural logarithm, is the floor function.

3. The method for defending against side channel attacks on cryptographic software according to claim 1, characterized in that: The defense method for the cryptographic software side channel attack also includes: Step S3: from the moment when the obfuscation algorithm is executed, immediately call the power consumption randomization algorithm, wherein the power consumption generated when the power consumption randomization algorithm is executed is random.

4. The method for defending against cryptographic software side channel attacks according to claim 3, characterized in that: The step S3 comprises: Step S3-1: In a predetermined range set In the example, the position parameters are randomly selected. and width parameters , Step S3-2: From the moment when the obfuscation algorithm is executed, the power consumption randomization algorithm is executed: In the formula, is the power consumption randomization algorithm formula, is a normal number set to adjust the power consumption. is a set positive constant used to control the decay speed of the exponential function. is a set integer, and , so that the exponential function part can produce nonlinear changes, is a positive constant set to adjust the amplitude of the sine function part. is a position parameter used to control the distance of the entire power consumption randomization algorithm in the x-axis direction. is the width parameter that controls the speed of the exponential decay and the period of the sine function.

5. A defense system for side channel attacks on cryptographic software, characterized in that: A method for defending against a cryptographic software side channel attack according to any one of claims 1 to 4, wherein the cryptographic software side channel attack defense system comprises: Data acquisition module, used to obtain the start time of the encryption process of the cryptographic software and end time ; Crypto-time obfuscation module, used to execute the obfuscation algorithm.

6. The cryptographic software side channel attack defense system according to claim 5, characterized in that: The method for defending against side channel attacks on cryptographic software further comprises step S3: from the moment when the obfuscation algorithm is executed, immediately calling a power consumption randomization algorithm, wherein the power consumption generated when the power consumption randomization algorithm is executed is random; The defense system for the cryptographic software side channel attack also includes: The encrypted power consumption randomization module is used to execute the power consumption randomization algorithm.

7. A method for testing a cryptographic software side channel attack defense system, characterized in that: The method is used to test the defense system against the side channel attack of cryptographic software as claimed in claim 5 or 6, comprising the following steps: Step S4: respectively obtaining the encryption duration and the corresponding encryption power consumption of multiple encryption processes of the cryptographic software; Step S5: respectively obtaining the obfuscation duration of the obfuscation algorithm executed corresponding to each encryption process and the random power consumption of the power consumption randomization algorithm executed correspondingly; Step S6: respectively calculating the sum of the encryption duration and the obfuscation duration of each encryption process, the average of the encryption duration and the obfuscation duration of multiple encryption processes, and the sum of the encryption power consumption and the random power consumption of each encryption process; Step S6: If the difference between the duration sum and the duration mean is less than or equal to the set difference threshold, the obfuscation algorithm is considered qualified; if the power consumption sum changes nonlinearly, the power consumption randomization algorithm is considered qualified.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, it can implement the steps of the method for defending against cryptographic software side-channel attacks described in any one of claims 1 to 4, and / or, when the processor executes the computer program, it can implement the steps of the method for testing the system for defending against cryptographic software side-channel attacks described in claim 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it can implement the steps of the method for defending against cryptographic software side-channel attacks described in any one of claims 1 to 4, and / or, when the computer program is executed by a processor, it can implement the steps of the method for testing the system for defending against cryptographic software side-channel attacks described in claim 7.

Citation Information

Patent Citations

  • Two-dimensional random scrambling AES power consumption attack resisting system and method

    CN111082918A