WO2018019233A1 - 一种运算方法和安全芯片 - Google Patents

一种运算方法和安全芯片 Download PDF

Info

Publication number
WO2018019233A1
WO2018019233A1 PCT/CN2017/094332 CN2017094332W WO2018019233A1 WO 2018019233 A1 WO2018019233 A1 WO 2018019233A1 CN 2017094332 W CN2017094332 W CN 2017094332W WO 2018019233 A1 WO2018019233 A1 WO 2018019233A1
Authority
WO
WIPO (PCT)
Prior art keywords
value
mask
modulus
modular
ciphertext
Prior art date
Application number
PCT/CN2017/094332
Other languages
English (en)
French (fr)
Inventor
胡翠
檀珠峰
孙少杰
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP17833536.0A priority Critical patent/EP3480998B1/en
Publication of WO2018019233A1 publication Critical patent/WO2018019233A1/zh
Priority to US16/258,114 priority patent/US10601577B2/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/002Countermeasures against attacks on cryptographic mechanisms
    • H04L9/003Countermeasures against attacks on cryptographic mechanisms for power analysis, e.g. differential power analysis [DPA] or simple power analysis [SPA]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/71Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
    • G06F21/72Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information in cryptographic circuits
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/60Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers
    • G06F7/72Methods or arrangements for performing computations using a digital non-denominational number representation, i.e. number representation without radix; Computing devices using combinations of denominational and non-denominational quantity representations, e.g. using difunction pulse trains, STEELE computers, phase computers using residue arithmetic
    • G06F7/723Modular exponentiation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/582Pseudo-random number generators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/58Random or pseudo-random number generators
    • G06F7/588Random number generators, i.e. based on natural stochastic processes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/04Masking or blinding
    • H04L2209/046Masking or blinding of operations, operands or results of the operations

Definitions

  • the present invention relates to the field of information security technologies, and in particular, to an operation method and a security chip.
  • RSA Raster Shamir Adleman
  • the security chip includes a financial IC (Integrated Circuit) card chip and a mobile payment chip. And USB (Universal Serial Bus) key and so on.
  • IC Integrated Circuit
  • USB Universal Serial Bus
  • Common password attack techniques can be classified into non-intrusive attacks, semi-intrusive attacks, and intrusive attacks. Among them, semi-intrusive attacks and non-intrusive attacks do not cause permanent damage to the security chip, thus becoming a password attack.
  • the mainstream development direction of technology The mainstream development direction of technology.
  • the core process of the RSA algorithm is modular exponentiation.
  • the common method for implementing the modular exponentiation of the security chip is to split the modular exponentiation into several modular operations and several modular multiplication operations.
  • the modular operation and the modular multiplication operation are respectively implemented by two different hardware circuits, so that it is difficult to resist the SPA (Single Power Analysis) attack in the non-intrusive attack.
  • the SPA attack means that the attacker obtains the power consumption graph by collecting the power consumption generated by the RSA algorithm during the decryption process (as shown in FIG. 5).
  • the operation corresponding to the higher power consumption peak is determined as The modular multiplication operation
  • the operation corresponding to the lower power consumption peak is a modular operation, thereby deciphering the bits of the private key. It can be seen that the existing security chip is difficult to resist the SPA attack, resulting in the private key being deciphered and the security is not high.
  • the embodiment of the invention provides an operation method and a security chip, which can achieve anti-SPA attacks and improve security.
  • the first aspect of the embodiments of the present invention provides an operation method, which is applied to a security chip, where the security chip includes an input/output interface, a decryption circuit, a microprocessor, and an arithmetic unit, and the method includes: input/output interface acquires input The ciphertext; the decryption circuit performs a modular exponentiation operation according to the ciphertext and the preset operation parameters; the microprocessor obtains the operation result obtained by the modular exponentiation operation as the plaintext obtained by the decryption.
  • the specific operation of the decryption circuit for performing the modular exponentiation operation according to the ciphertext and the preset operation parameter is: the decryption circuit decomposes the modular exponentiation operation into a first operation of multiple iterations, and the first operation is a modular operation or a modular multiplication operation; The decryption circuit sends the ciphertext and the operation parameter to the operator, and the operator performs the first operation according to the ciphertext and the operation parameter to obtain a modulus value or a modulus multiplication value, and the operation parameter includes the parameter m and a modulus N preset to a fixed value, If the current first operation is the first, m is a preset initial value.
  • the decryption circuit will The modulus value or modulus multiplication value obtained by the operator for the first operation is used as the operation result of the modular exponentiation operation. It can be seen that the modular operation and the modular multiplication operation can be realized by the same hardware (ie, the arithmetic unit), so that the power consumption generated by the two operations is the same, and can not be distinguished according to the power consumption, thereby resisting the SPA attack and improving the security.
  • the operator includes a mask circuit, a hardware acceleration circuit, and a de-masking circuit, and the operator performs a first operation according to the ciphertext and the operation parameter to obtain a modulus value or a mode
  • the multiplication value is specifically as follows: the mask circuit performs a mask operation on the ciphertext and/or the operation parameter by using a random number to obtain a mask parameter, and the mask parameter includes the ciphertext and the operation parameter after the mask, or includes the ciphertext and the mask.
  • the advantage is that masking the ciphertext and the operation parameters can improve the randomness of the ciphertext and the operation parameters.
  • the power consumption generated by each round of operations is not related. Sex, which can resist DPA (Differential Power Analysis) attacks and improve security.
  • the computing device further includes a verification circuit, and the de-masking circuit unmasks the modulus of the mask or the modulus of the mask
  • the code operation before obtaining the modulus value or the modulus multiplication value, is further performed: the verification circuit performs a second operation on the modulus square value of the mask or the modular multiplication value of the mask to obtain the verification value; the verification circuit determines the verification The value is equal to the preset value. If the current calculation is performed on the modulus of the mask, the default value is m. If the current operation is the second operation on the modulus multiplication value of the mask, the preset value is m or C.
  • the computing unit further includes a reset The circuit, the verification circuit performs a second operation on the modulus value of the mask or the modulus multiplication value of the mask, and after obtaining the verification value, performing: if the verification value is not equal to the preset value, the reset circuit clears the ciphertext and Operate the parameters and stop the operation.
  • the random number is generated by a true random number generator, or after the number of seeds is generated by the true random number generator, by using a pseudo random number
  • the generator is generated based on the number of seeds.
  • a second aspect of the embodiments of the present invention provides a security chip, where the security chip has a behavior function that implements the method provided by the foregoing first aspect, and the function may be implemented by using hardware or by executing corresponding software by hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • a third aspect of the embodiments of the present invention provides a security chip, including: a microprocessor, a memory, and an input/output interface. Wherein, a program is stored in the memory, and the microprocessor is used to call a program stored in the memory to implement the method provided by the first aspect.
  • the security chip provided by the embodiment of the present invention includes an input/output interface, a decryption circuit, a microprocessor, and an arithmetic unit.
  • the input/output interface first acquires the input.
  • the ciphertext, the decryption circuit performs a modular exponentiation operation according to the ciphertext and the preset operation parameters, and the microprocessor then uses the operation result obtained by the modular exponentiation operation as the plaintext obtained by decryption.
  • the decryption circuit first decomposes the modular exponentiation into the first operation of the multiple iterations when performing the modular exponentiation operation according to the ciphertext and the preset operation parameters, and the first operation is a modular operation or a modular multiplication operation. Then, the ciphertext and the operation parameter are sent to the operator, and the operator performs the first operation according to the ciphertext and the operation parameter to obtain the modulus value or the modulus multiplication value, which is visible, whether to obtain the modulus value or to obtain the modulus multiplication value. Both can be implemented by the same hardware (operator), so that the power consumption of the two operations is the same, and can not be distinguished according to the power consumption, thereby resisting SPA attacks and improving security.
  • FIG. 1 is a schematic flow chart of an operation method according to an embodiment of the present invention.
  • FIG. 2 is a schematic flowchart of another operation method according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a security chip according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of another security chip according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of power consumption analysis according to an embodiment of the present invention.
  • N is the product of two large prime p and q
  • e and (p-1)*(q-1) are prime numbers.
  • e*dmod((p-1)*(q-1)) 1.
  • the core process is the modular exponentiation.
  • the common method for implementing the modular power operation of the existing security chip is the binary modular power method (Montgomery modular power method).
  • the modular operation and the modular multiplication operation are respectively implemented by two different hardwares, and the attacker collects the power consumption of the security chip and analyzes the power consumption graph, as shown in FIG. It can be determined that the operation corresponding to the higher power consumption peak is a modular multiplication operation, and the operation corresponding to the lower power consumption peak is a modular operation, thereby deciphering the bits of the private key.
  • FIG. 1 is a schematic flow chart of an operation method according to an embodiment of the present invention.
  • the method is applied to a security chip, and the security chip includes an input/output interface, a decryption circuit, a microprocessor, and an arithmetic unit.
  • the flow of the operation method in this embodiment as shown in the figure may include:
  • the input/output interface acquires the input ciphertext.
  • the input/output interface in the security chip acquires the input ciphertext.
  • the decryption circuit performs a modular exponentiation operation according to the ciphertext and a preset operation parameter.
  • the core of the decryption process is the modular exponentiation.
  • the decryption circuit in the security chip first decomposes the modular exponentiation into the first operation of multiple iterations, the first operation is a modular operation or a modular multiplication operation, and the decryption circuit sends the ciphertext and the operation parameters to the operator.
  • the operator performs the first operation according to the ciphertext and the operation parameters to obtain the modulus value or the modulus multiplication value, and the decryption circuit then performs the first square operation or the modulus multiplication value obtained by the operator for the first operation, as the operation result of the modular power operation. .
  • the above operation parameters include the parameter m and the modulus N preset to a fixed value. If the current first operation is the first initial value, m is a preset initial value (for example, the preset initial value is 1). If it is not the first first operation, m is the modulus value or modular multiplication value obtained by the previous first operation. That is to say, m in the operation parameters sent to the arithmetic unit by the decryption circuit is different each time, and m will be assigned multiple times and iteratively operated multiple times.
  • the arithmetic unit in the embodiment of the present invention is not hardware integrated with a modular operation circuit and a modular multiplication operation circuit, that is, the operation unit is a hardware including only a unique operation circuit, and the operation circuit can be The modular operation is realized, and the modular multiplication operation can be realized, and the power consumption is the same when performing the modular operation and the modular multiplication operation.
  • the microprocessor uses the operation result obtained by the modular exponentiation operation as the plaintext obtained by decryption.
  • the last first operation may obtain a modulus value, and may also obtain a modular multiplication value.
  • the microprocessor in the security chip uses the modulus value or the modulus multiplication value obtained by the last operation of the operator in the decryption process as plaintext.
  • the security chip provided by the embodiment of the present invention includes an input/output interface, a decryption circuit, a microprocessor, and an arithmetic unit.
  • the input/output interface first acquires the input.
  • the ciphertext, the decryption circuit performs a modular exponentiation operation according to the ciphertext and the preset operation parameters, and the microprocessor then uses the operation result obtained by the modular exponentiation operation as the plaintext obtained by decryption.
  • the decryption circuit first decomposes the modular exponentiation into the first operation of the multiple iterations when performing the modular exponentiation operation according to the ciphertext and the preset operation parameters, and the first operation is a modular operation or a modular multiplication operation. Then, the ciphertext and the operation parameter are sent to the operator, and the operator performs the first operation according to the ciphertext and the operation parameter to obtain the modulus value or the modulus multiplication value, which is visible, whether to obtain the modulus value or to obtain the modulus multiplication value. Both can be implemented by the same hardware (operator), so that the power consumption of the two operations is the same, and can not be distinguished according to the power consumption, thereby resisting SPA attacks and improving security.
  • FIG. 2 is a schematic flow chart of another operation method in the embodiment of the present invention, which is a further refinement of step S102 in the embodiment described in FIG. 1.
  • the flow of the operation method in this embodiment as shown in the figure may include:
  • the decryption circuit decomposes the modular exponentiation into a first operation of multiple iterations, and the first operation is a modular operation or a modular multiplication operation.
  • the core of the decryption process is the modular exponentiation.
  • the decryption circuit decomposes the modular exponentiation into a first operation of multiple iterations, and the first operation is a modular operation or a modular multiplication operation.
  • the decryption circuit sends the ciphertext and the operation parameter to the operator, where the operator includes a mask circuit, a hardware acceleration circuit, a de-masking circuit, a verification circuit, and a reset circuit.
  • the operation parameter includes a parameter m and a modulus N preset to a fixed value. If the current first operation is the first initial value, m is a preset initial value (for example, the preset initial value is 1), if the current is not For the first first operation, m is the modulus value or modulus multiplication value obtained by the previous first operation. That is, each time the decryption circuit sends the arithmetic parameters to the operator The m in is different, and m will be assigned multiple times and iterated multiple times.
  • the mask circuit performs a mask operation on the ciphertext and/or the operation parameter by using a random number to obtain a mask parameter.
  • the obtained mask parameters include the masked ciphertext and operation parameters, or the operation parameters including the ciphertext and the mask, or the masked ciphertext and the masked operation parameters.
  • the mask operation may be an addition or subtraction mask, a multiplication or division mask, a mask of a hybrid operation or other operations, and the like, and is not exhaustive.
  • the parameter m, and the modulus C is not masked, that is, the obtained mask parameter includes the masked parameter m and the unmodulated modulus C
  • the first operation in step S203 is to obtain the modular multiplication value
  • the random number r is randomly generated, and thus the r used for each round of mask operation is different. Since the r used in each round of mask operation is different, the power consumption generated by each round of operations is not correlated, so that it can resist DPA attacks.
  • the DPA attack refers to the correlation of power consumption generated by analyzing each round of operations. Sexuality to decipher the bits of the private key.
  • the random number can be generated by a true random number generator.
  • the random number may also be generated by the pseudo random number generator according to the seed number after generating the seed number by the real random number generator. Compared with the former, the actual speed of generating the random number in this manner is faster.
  • the hardware acceleration circuit performs the first operation on the mask parameter to obtain a modulus square value of the mask or a modulus multiplication value of the mask.
  • the hardware circuits used in the operation of the same expression are the same, the hardware circuits used are the same whether the first operation is performed on X1 or Y1, and the generated power consumption is the same.
  • the present embodiment can resist SPA attacks.
  • the verification circuit performs a second operation on a modulus value of the mask or a modulus multiplication value of the mask to obtain a verification value.
  • the preset value is the parameter m. If the current module is performing the second operation on the modulus multiplication value of the mask, the preset value may be the parameter m. Or parameter C.
  • the hardware circuits used in the operation of the same expression are the same, the hardware circuits used are the same whether the second operation is performed on X2 or Y2, and the generated power consumption is the same.
  • the present embodiment can resist SPA attacks.
  • the purpose of the second operation is to obtain the parameter before the mask according to the output value of the mask, that is, the obtained check value is the parameter before being masked.
  • the verification circuit determines whether the check value is equal to a preset value.
  • step S207 if it is determined that the check value is equal to the preset value, step S207 is performed, and if it is determined that the check value is not equal to the preset value, step S208 is performed.
  • the preset value is equal to the ciphertext or the operation parameter before being masked. Under normal circumstances, since the obtained check value is the ciphertext or operation parameter before being masked, and the preset value is also the ciphertext or operation parameter before being masked, the check value is equal to the preset value. Step S207 is performed. However, in the case of an error injection attack, since the ciphertext and/or operation parameters are tampered with during the operation, the obtained check value is the falsified ciphertext or operation parameter, and is no longer the original ciphertext or operation. The parameter is invalid, so the check value is not equal to the preset value. At this time, step S208 is performed. It can be seen that the embodiment of the present invention can achieve resistance to error injection attacks and improve security.
  • the prior art has also proposed a verification method, which is to verify the result of the entire modular exponentiation operation, because the result of the modular exponentiation operation is wrong when subjected to an error injection attack, The result cannot be verified, so that it can resist the error injection attack.
  • the verification method in the embodiment of the present invention can complete the verification before each modular operation or each modular multiplication operation, and can resist the error in time without waiting for the end of the entire modular exponentiation operation. Inject attacks to improve verification efficiency.
  • the preset value may also be equal to the parameter that is not masked.
  • the preset value is only required to be set as a parameter that is not masked, and the second operation is used according to the mask.
  • the output value gets the parameters that are not masked, and the other ideas are unchanged.
  • the de-masking circuit performs a de-masking operation on the modulus value of the mask or the modular multiplication value of the mask, and correspondingly obtains a modulus value or a modulus multiplication value.
  • the hardware circuits used in the operation of the same expression are the same, the hardware circuits used are the same whether X2 or Y2 is demasked, and the power consumption is the same.
  • the present embodiment can resist SPA attacks.
  • the embodiment of the present invention can implement the modular operation and the modular multiplication operation.
  • the decryption circuit uses the modulus value or the modulus multiplication value obtained by the operator for the first operation as the operation result of the modular exponentiation operation.
  • the reset circuit clears the ciphertext and the operation parameter, and stops the operation.
  • the reset circuit clears the input parameters m, C, and N, optionally, the private key d, and stops all operations to prevent data from being stolen and to avoid illegally analyzing the data.
  • an alarm is issued at the same time, before or after the above operation is performed.
  • the security chip provided by the embodiment of the present invention includes an input/output interface, a decryption circuit, a microprocessor, and an arithmetic unit.
  • the input/output interface first acquires the input.
  • the ciphertext, the decryption circuit performs a modular exponentiation operation according to the ciphertext and the preset operation parameters, and the microprocessor then uses the operation result obtained by the modular exponentiation operation as the plaintext obtained by decryption.
  • the decryption circuit first decomposes the modular exponentiation into the first operation of the multiple iterations when performing the modular exponentiation operation according to the ciphertext and the preset operation parameters, and the first operation is a modular operation or a modular multiplication operation. Then, the ciphertext and the operation parameter are sent to the operator, and the operator performs the first operation according to the ciphertext and the operation parameter to obtain the modulus value or the modulus multiplication value, which is visible, whether to obtain the modulus value or to obtain the modulus multiplication value. Both can be implemented by the same hardware (operator), so that the power consumption of the two operations is the same, and can not be distinguished according to the power consumption, thereby resisting SPA attacks and improving security. In addition, since the embodiment of the present invention also performs parameter comparison check, it can also resist the error injection attack and further improve the security.
  • FIG. 3 is a schematic structural diagram of a security chip according to an embodiment of the present invention, and the security chip can implement the operation method described in FIG. 1 to FIG. 2 above.
  • the security chip in the embodiment of the present invention may at least include an input/output interface 310, a decryption circuit 320, a microprocessor 330, and an operator 340, wherein:
  • the input/output interface 310 is configured to acquire the input ciphertext.
  • the input/output interface 310 acquires the input ciphertext.
  • the decryption circuit 320 is configured to perform a modular exponentiation operation according to the ciphertext and the preset operation parameters.
  • the core of the decryption process is the modular exponentiation.
  • the decryption circuit 320 first decomposes the modular exponentiation into a first operation of multiple iterations, the first operation is a modular operation or a modular multiplication operation, and the decryption circuit 320 sends the ciphertext and the operation parameters to the operator 340, and the operation is performed.
  • the 340 performs a first operation according to the ciphertext and the operation parameter to obtain a modulus value or a modulus multiplication value, and the decryption circuit 320 then performs a module value or a modulus multiplication value obtained by the operator for the first operation as a modular exponentiation operation. result.
  • the above operation parameters include the parameter m and the modulus N preset to a fixed value. If the current first operation is the first initial value, m is a preset initial value (for example, the preset initial value is 1). If it is not the first first operation, m is the modulus value or modular multiplication value obtained by the previous first operation. That is to say, m of the operation parameters sent to the arithmetic unit 340 by the decryption circuit 320 is different each time, and m will be assigned multiple times and iteratively operated multiple times.
  • the operator 340 performs a first operation according to the ciphertext and the operation parameters to obtain a modulus value or a modulus multiplication value.
  • the arithmetic unit 340 in the embodiment of the present invention is not integrated with the hardware of the modular operation circuit and the modular multiplication operation circuit, that is, the operation unit 340 is a hardware including only a unique operation circuit, and the operation circuit Both the modular operation and the modular multiplication operation can be realized, and the power consumption is the same when performing the modular operation and the modular multiplication operation.
  • the microprocessor 330 is configured to use the operation result obtained by the modular exponentiation operation as the plaintext obtained by decryption.
  • the last first operation may obtain a modulus value, and may also obtain a modular multiplication value.
  • the microprocessor 330 uses the modulus value or the modulus multiplication value obtained by the last first operation as the plaintext.
  • the operator 340 as shown in the figure may include:
  • a mask circuit 341 configured to perform a mask operation on the ciphertext and/or the operation parameter by using a random number, to obtain a mask parameter, where the mask parameter includes a masked ciphertext and the operation parameter, Or include the ciphertext and the masked operation parameters, or the masked ciphertext and the masked operation parameters.
  • the obtained mask parameters include the masked ciphertext and operation parameters, or the operation parameters including the ciphertext and the mask, or the masked ciphertext and the masked operation parameters.
  • the mask operation may be an addition or subtraction mask, a multiplication or division mask, a mask of a hybrid operation or other operations, and the like, and is not exhaustive.
  • the hardware acceleration circuit 342 is configured to perform the first operation on the mask parameter to obtain a modulus value of the mask or a modulus multiplication value of the mask.
  • the de-masking circuit 343 is configured to perform a de-masking operation on the modulus value of the mask or the modular multiplication value of the mask, and obtain a modulus value or a modulus multiplication value correspondingly.
  • the operator 340 as shown in the figure may further include a verification circuit 344 for:
  • the check value is equal to a preset value, wherein if the second operation is performed on the modulus value of the mask, the preset value is the m, if the current mask is The modulus multiplication performs a second operation, and the preset value is the m or the C.
  • the hardware acceleration circuit 342 is specifically configured to:
  • the verification circuit 344 is specifically configured to:
  • the de-masking circuit 343 is specifically configured to:
  • the operator 340 may further include a reset circuit 345, configured to clear the ciphertext and the operation parameter if the check value is not equal to the preset value. And triggering the operator to stop the operation.
  • the random number is generated by a true random number generator, or is generated by a pseudo random number generator according to the seed number after the seed number is generated by the true random number generator.
  • the security chip may include: at least one microprocessor 401, such as a CPU, at least one transmission bus 402, a memory 403, and an input. / Output interface 404.
  • the transmission bus 402 is used to implement connection communication between these components;
  • the memory 403 may be a high speed RAM memory or a non-volatile memory such as at least one disk memory.
  • the memory 403 may also be at least one storage device located away from the foregoing processor 401; the input/output interface 404 is configured to perform data transmission with an external device, such as receiving data.
  • a set of programs is stored in the memory 403
  • a code, such as HDL (Hardware Description Language), and the microprocessor 401 is used to call a program stored in the memory, and performs the following steps:
  • the operation result obtained by the modular exponentiation operation is used as the plaintext obtained by decryption;
  • the performing a modular exponentiation operation according to the ciphertext and a preset operation parameter includes:
  • the modulus value or the modulus multiplication value obtained by the operator performing the first operation for the last time is used as the operation result of the modular exponentiation operation.
  • the microprocessor 401 performs a first operation according to the ciphertext and the operation parameter to obtain a modulus value or a modulus multiplication value, where the specific operation is:
  • the microprocessor 401 performs a first operation according to the ciphertext and the operation parameter to obtain a modulus value or a modulus multiplication value, where the specific operation is:
  • the microprocessor 401 performs a de-masking operation on the modulus value of the mask or the modulus multiplication value of the mask, and before performing the modulus value or the modulus multiplication value, performing:
  • the check value is equal to a preset value, wherein if the second operation is performed on the modulus value of the mask, the preset value is the m, if the current mask is The modulus multiplication performs a second operation, and the preset value is the m or the C.
  • microprocessor 401 performs a mask operation on the ciphertext and the operation parameter by using a random number, and the specific operation is:
  • microprocessor 401 performs the first operation on the mask parameter to obtain a modulus square value of the mask or a modulus multiplication value of the mask, and the specific operation is:
  • microprocessor 401 performs a second operation on the modulus value of the mask or the modulus multiplication value of the mask to obtain a check value, and the specific operation is:
  • the microprocessor 401 performs a demasking operation on the modulus value of the mask or the modulus multiplication value of the mask, and correspondingly obtains a modulus value or a modulus multiplication value, and the specific operation is:
  • the microprocessor 401 performs a second operation on the modulus value of the mask or the modulus multiplication value of the mask, and after obtaining the check value, further performing:
  • the check value is not equal to the preset value, the ciphertext and the operation parameter are cleared, and the operation is stopped.
  • the random number is generated by a true random number generator or generated by a pseudo random number generator according to the number of seeds after generating a seed number by a true random number generator.
  • the security chip provided by the embodiment of the present invention includes an input/output interface, a decryption circuit, a microprocessor, and an arithmetic unit.
  • the input/output interface first acquires the input.
  • the ciphertext, the decryption circuit performs a modular exponentiation operation according to the ciphertext and the preset operation parameters, and the microprocessor then uses the operation result obtained by the modular exponentiation operation as the plaintext obtained by decryption.
  • the decryption circuit first decomposes the modular exponentiation into the first operation of the multiple iterations when performing the modular exponentiation operation according to the ciphertext and the preset operation parameters, and the first operation is a modular operation or a modular multiplication operation. Then, the ciphertext and the operation parameter are sent to the operator, and the operator performs the first operation according to the ciphertext and the operation parameter to obtain the modulus value or the modulus multiplication value, which is visible, whether to obtain the modulus value or to obtain the modulus multiplication value. Both can be implemented by the same hardware (operator), so that the power consumption of the two operations is the same, and can not be distinguished according to the power consumption, thereby resisting SPA attacks and improving security.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Optimization (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Physics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Storage Device Security (AREA)

Abstract

本发明实施例公开了一种运算方法,所述方法应用于安全芯片,所述安全芯片包括输入/输出接口、解密电路、微处理器和运算器,包括:输入/输出接口获取输入的密文;解密电路根据密文和预设的运算参数执行模幂运算;微处理器将模幂运算获得的运算结果,作为解密得到的明文;其中,解密电路根据密文和预设的运算参数执行模幂运算具体为,解密电路将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算;解密电路将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值。相应的,本发明实施例还公开了一种安全芯片。采用本发明,可以实现抵抗SPA攻击,提高安全性。

Description

一种运算方法和安全芯片
本申请要求于2016年7月26日提交中国专利局、申请号为CN201610594595.7、申请名称为“一种运算方法和安全芯片”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及信息安全技术领域,尤其涉及一种运算方法和安全芯片。
背景技术
RSA(Rivest Shamir Adleman)算法是一种高安全性的公钥加密算法,可应用于安全芯片的加、解密过程,所述安全芯片包括金融IC(Integrated Circuit,集成电路)卡芯片、移动支付芯片和USB(Universal Serial Bus,通用串行总线)key等。然而,随着密码攻击技术的不断发展,安全芯片中RSA算法的安全性逐渐受到威胁。常见的密码攻击技术可分为非侵入式攻击、半侵入式攻击和侵入式攻击,其中,由于半侵入式攻击和非侵入式攻击不会对安全芯片造成永久性的破坏,因而成为了密码攻击技术的主流发展方向。
应理解的,RSA算法的核心过程是模幂运算,目前安全芯片实现模幂运算的常用方法是将模幂运算拆分为若干个模方运算和若干个模乘运算。在现有的安全芯片中,模方运算和模乘运算分别是通过两个不同的硬件电路实现的,因而难以抵抗非侵入式攻击中的SPA(Single Power Analysis,单功耗分析)攻击。SPA攻击是指,攻击者通过采集RSA算法在解密过程所产生的功耗得到功耗曲线图(如图5所示),在功耗曲线图中,确定较高的功耗峰对应的运算为模乘运算,较低的功耗峰对应的运算为模方运算,从而破译出私钥的各比特位。可见,现有的安全芯片难以抵抗SPA攻击,导致私钥被破译,安全性不高。
发明内容
本发明实施例提供了一种运算方法和安全芯片,可以实现抵抗SPA攻击,提高安全性。
本发明实施例第一方面提供了一种运算方法,该方法应用于安全芯片,安全芯片包括输入/输出接口、解密电路、微处理器和运算器,该方法包括:输入/输出接口获取输入的密文;解密电路根据密文和预设的运算参数执行模幂运算;微处理器将模幂运算获得的运算结果,作为解密得到的明文。其中,解密电路根据密文和预设的运算参数执行模幂运算的具体操作为:解密电路将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算;解密电路将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则m为预设的初始值,若当前不为初次的第一运算,则m为上一次的第一运算获得的模方值或者模乘值;解密电路将运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。可见,模方运算和模乘运算可以通过同一硬件(即运算器)实现,使得两种运算所产生的功耗相同,不能根据功耗区分,从而可以抵抗SPA攻击,提高安全性。
在第一方面的第一种可能实现方式中,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值的具体操作为:运算器根据公式X=m2mod N对m和N进行模乘运算获得模方值,或者,根据公式Y=m*C mod N对密文C、m和N进行模方运算获得模乘值。
在第一方面的第一种可能实现方式中,运算器包括掩码电路、硬件加速电路和解掩码电路,运算器根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,具体为:掩码电路使用随机数对密文和/或运算参数进行掩码运算,获得掩码参数,掩码参数包括掩码后的密文和运算参数,或者包括密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数;掩码电路对掩码参数进行第一运算,获得掩码的模方值或者掩码的模乘值;掩码电路对掩码的模方值或者掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值。优点在于,对密文和运算参数进行掩码,可以提高密文和运算参数的随机性,另外,由于每一轮掩码运算所用的r不同,使得每一轮运算所产生的功耗没有关联性,从而可以抵抗DPA(Differential Power Analysis,差分功率分析)攻击,提高安全性。
结合第一方面的第二种可能实现方式,在第三种可能实现方式中,运算器还包括校验电路,解掩码电路对掩码的模方值或者掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值之前,还执行:校验电路对掩码的模方值或者掩码的模乘值进行第二运算,获得校验值;校验电路确定校验值等于预设值,其中,若当前是对掩码的模方值进行第二运算,则预设值为m,若当前是对掩码的模乘值进行第二运算,则预设值为m或C。优点在于,在受到错误注入攻击时将不能通过校验,进而无法获得模方值或者模乘值,从而可以抵抗错误注入攻击,提高安全性。
结合第一方面的第三种可能实现方式,在第四种可能实现方式中,掩码电路使用随机数对密文和运算参数进行掩码运算的操作,具体为:掩码电路根据公式X1=(m+r)mod N获得掩码后的m,其中,X1表示该掩码后的m,r表示随机数;和/或安全芯片根据公式Y1=(C+r)mod N获得掩码后的C,其中,Y1表示该掩码后的C,r表示随机数。
结合第一方面的第四种可能实现方式,在第五种可能实现方式中,硬件加速电路对掩码参数进行第一运算,获得掩码的模方值或者掩码的模乘值,具体为:硬件加速电路根据公式X2=m*X1mod N获得掩码的模方值,其中,X2表示该掩码的模方值;或者硬件加速电路根据公式Y2=m*Y1mod N获得掩码的模乘值,其中,Y2表示该掩码的模乘值。
结合第一方面的第五种可能实现方式,在第六种可能实现方式中,校验电路对掩码的模方值或者掩码的模乘值进行第二运算,获得校验值的操作,具体为:若当前是对掩码的模方值进行第二运算,则校验电路根据公式X3=(X2-m*r)*m-1mod N获得校验值,其中,X3表示该校验值;或者若当前是对所述掩码的模乘值进行第二运算,则校验电路根据公式Y3=(Y2-m*r)*m-1mod N获得校验值,其中,Y3表示该校验值。
结合第一方面的第六种可能实现方式,在第七种可能实现方式中,解掩码电路对掩码的模方值或者掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值的操作,具体为:若当前是对掩码的模方值进行解掩码运算,则解掩码电路根据公式X=X2-m*r mod N获得模方值X;或者若当前是对掩码的模乘值进行解掩码运算,则解掩码电路根据公式Y=Y2-m*r mod N获得模乘值Y。
结合第一方面的第三种可能实现方式,在第八种可能实现方式中,运算器还包括复位 电路,校验电路对掩码的模方值或者掩码的模乘值进行第二运算,获得校验值之后,还执行:若校验值不等于预设值,则复位电路清空密文和运算参数,并停止运算。优点在于,在发现受到错误注入攻击时,清空输入参数并停止运算,提高安全性。
结合第一方面的第二种可能实现方式,在第九种可能实现方式中,随机数是通过真随机数发生器生成的,或者是通过真随机数发生器生成种子数之后,通过伪随机数发生器根据该种子数生成的。
本发明实施例第二方面提供了一种安全芯片,所述安全芯片具有实现上述第一方面提供的方法的行为功能,所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。
本发明实施例第三方面提供了一种安全芯片,包括:微处理器、存储器和输入/输出接口。其中,存储器中存储一组程序,且微处理器用于调用存储器中存储的程序,实现上述第一方面提供的方法。
由上可见,本发明实施例提供的安全芯片包括输入/输出接口、解密电路、微处理器和运算器,在安全芯片将密文转换为明文的解密过程中,输入/输出接口先获取输入的密文,解密电路再根据密文和预设的运算参数执行模幂运算,微处理器然后将模幂运算获得的运算结果作为解密得到的明文。其中,解密电路在根据密文和预设的运算参数执行模幂运算执行模幂运算时,先将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算,再将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,可见,无论是为了获得模方值,还是为了获得模乘值,均可以通过同一硬件(运算器)实现,使得两种运算所产生的功耗相同,不能根据功耗区分,从而可以抵抗SPA攻击,提高安全性。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1是本发明实施例提供的一种运算方法的流程示意图;
图2是本发明实施例提供的另一种运算方法的流程示意图;
图3是本发明实施例提供的一种安全芯片的结构示意图;
图4是本发明实施例提供的另一种安全芯片的结构示意图;
图5是本发明实施例提供的一种功耗分析的示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本 发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
为了便于理解本发明实施例,首先简单介绍下RSA算法的实现过程。RSA算法涉及三个参数,模数N、公钥e和私钥d,其中,N是两个大质数的p、q乘积,e与(p-1)*(q-1)互为质数,以及e*dmod((p-1)*(q-1))=1。假设m为明文、C为密文,则安全芯片的加密过程可以表示为C=memod N,相应的,解密过程可以表示为m=Cdmod N,可见在解密过程中,RSA算法的核心过程是模幂运算。
现有安全芯片实现模幂运算的常用方法是二进制模幂法(蒙哥马利模幂法),具体实现中,解密过程的运算流程如下:①输入C、N和d=(di,......,d2,d1)2,其中,(......)2表示二进制数组,i为正整数。②令m的初始值等于1。③从k计数到1,k为正整数,每计数一次时,计算m=m2mod N,并且当ek=1时,额外计算m=m*C mod N。历经上述①、②和③,最终可以使输出的m=Cdmod N,实现了模幂运算。可见,实现模幂运算的本质是将模幂运算拆分为若干个模方运算m2mod N和若干个模乘运算m*C mod N。需要指出的是,现有安全芯片在实现模幂运算时存在以下问题:
第一,难以抵抗非侵入式攻击中的SPA攻击。原因在于:在现有安全芯片中,模方运算和模乘运算分别是通过两个不同的硬件实现的,攻击者通过采集安全芯片的功耗,以及分析功耗曲线图,如图5所示,可以确定较高的功耗峰对应的运算为模乘运算,较低的功耗峰对应的运算为模方运算,从而破译出私钥的各比特位。
第二,难以抵抗半侵入式攻击中的错误注入攻击。具体实现中,攻击者在模幂运算过程中对私钥d注入1比特的错误,设错误注入后的私钥为d^,则没有错误注入时的m=Cdmod N,错误注入时的m^=Cd^mod N,然后通过分析m和m^的比值关系,可以推断出错误注入的那1比特的数据。以错误注入位置为d^的最后一个比特为例,当最后一个比特的数据由0变为1时,(m^/m)mod N=C,当由1变为0时,(m/m^)mod N=C,根据这个区别,便可以推断出最后一个比特的数据是0还是1。
图1是本发明实施例中一种运算方法的流程示意图,该方法应用于安全芯片,安全芯片包括输入/输出接口、解密电路、微处理器和运算器。如图所示本实施例中的运算方法的流程可以包括:
S101,输入/输出接口获取输入的密文。
具体的,当外部向安全芯片输入密文以请求解密时,安全芯片中的输入/输出接口获取输入的密文。
S102,解密电路根据所述密文和预设的运算参数执行模幂运算。
由上文介绍的内容可知,解密过程的核心是模幂运算,模幂运算可以拆分为多次的模方运算m=m2mod N和多次的模乘运算m=m*C mod N。具体的,安全芯片中的解密电路先将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算,解密电路再将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,解密电路然后将运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。
需要指出的是,上述运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则m为预设的初始值(例如:预设初始值为1),若当前不为初次的第一运算,则m为上一次的第一运算获得的模方值或者模乘值。也就是说,解密电路每次发送给运算器的运算参数中的m是不同的,且m将会被多次赋值并多次迭代运算。
可选的,第一运算的表达式可以表示为F(S)=m*Smod N,S表示运算的对象。相应的,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,具体为:当解密电路仅发送了m和N给运算器时,运算器根据公式X=m2mod N对m和N进行模乘运算获得模方值,当解密电路发送了密文C、m和N给运算器时,运算器根据公式Y=m*C mod N对密文C、m和N进行模方运算获得模乘值。
还需要指出的是,本发明实施例中的运算器不是集成了模方运算电路和模乘运算电路的硬件,也就是说,运算器是一个只包含唯一运算电路的硬件,该运算电路既可以实现模方运算,又可以实现模乘运算,且执行模方运算和模乘运算时功耗相同。
S103,微处理器将模幂运算获得的运算结果,作为解密得到的明文。
由上文介绍的内容可知,根据模幂运算的幂指数不同,最后一次的第一运算可能获得模方值,也可能获得模乘值。具体的,安全芯片中的微处理器将解密过程中运算器最后一次的第一运算获得的模方值或者模乘值作为明文。
由上可见,本发明实施例提供的安全芯片包括输入/输出接口、解密电路、微处理器和运算器,在安全芯片将密文转换为明文的解密过程中,输入/输出接口先获取输入的密文,解密电路再根据密文和预设的运算参数执行模幂运算,微处理器然后将模幂运算获得的运算结果作为解密得到的明文。其中,解密电路在根据密文和预设的运算参数执行模幂运算执行模幂运算时,先将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算,再将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,可见,无论是为了获得模方值,还是为了获得模乘值,均可以通过同一硬件(运算器)实现,使得两种运算所产生的功耗相同,不能根据功耗区分,从而可以抵抗SPA攻击,提高安全性。
图2是本发明实施例中另一种运算方法的流程示意图,该方法是对图1所描述的实施例中步骤S102的进一步细化。如图所示本实施例中的运算方法的流程可以包括:
S201,解密电路将模幂运算分解为多次迭代的第一运算,所述第一运算为模方运算或者模乘运算。
由上文介绍的内容可知,解密过程的核心是模幂运算,模幂运算可以拆分为多次的模方运算m=m2mod N和多次的模乘运算m=m*C mod N。具体的,解密电路将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算。
S202,解密电路将密文和运算参数发送至运算器,其中,运算器包括掩码电路、硬件加速电路、解掩码电路、校验电路和复位电路。
其中,运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则m为预设的初始值(例如:预设初始值为1),若当前不为初次的第一运算,则m为上一次的第一运算获得的模方值或者模乘值。也就是说,解密电路每次发送给运算器的运算参数 中的m是不同的,且m将会被多次赋值并多次迭代运算。
S203,掩码电路使用随机数对所述密文和/或所述运算参数进行掩码运算,获得掩码参数。
也就是说,获得的掩码参数包括掩码后的密文和运算参数,或者包括密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数。
可选的,掩码运算的方式可以是加法或减法掩码,也可以是乘法或除法掩码,还可以是混合运算或其它运算的掩码,等等,这里不作穷举。以加法掩码为例,掩码运算的表达式可以表示为F(S)=(S+r)mod N,其中,S表示被掩码的对象,r表示随机数。
作为一种可选的实施方式,具体实现中,若下文步骤S203中第一运算是为了获得模方值,则掩码电路根据公式X1=(m+r)mod N,求得掩码后的参数m,且不对模数C作掩码,即获得的掩码参数包括掩码后的参数m和没有掩码的模数C;若下文步骤S203中第一运算是为了获得模乘值,则掩码电路根据公式Y1=(C+r)mod N,求得掩码后的模数C,且不对参数m作掩码,即获得的掩码参数包括没有掩码的参数m和掩码后的模数C。应理解的,由于同一表达式的运算所使用的硬件电路是相同的,因此无论是对参数m还是对模数C进行掩码运算,所使用的硬件电路是相同的,进而所产生的功耗是相同的,从而本实施方式可以抵抗SPA攻击。
需要说明的是,上述随机数r是随机生成的,因而每一轮掩码运算所用的r不同。由于每一轮掩码运算所用的r不同,使得每一轮运算所产生的功耗没有相关性,从而可以抵抗DPA攻击,其中,DPA攻击是指通过分析各轮运算所产生的功耗的相关性来破译出私钥的各比特位。可选的,随机数可以通过真随机数发生器生成。另可选的,随机数也可以通过真随机数发生器生成种子数之后,通过伪随机数发生器根据该种子数生成,相较于前者,该方式生成随机数的实际速度更快。
S204,硬件加速电路对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值。
可选的,第一运算的表达式可以表示为F(S)=m*Smod N,S表示运算的对象。
作为一种可选的实施方式,具体实现中,若当前的第一运算是为了获得模方值,则根据公式X2=m*X1mod N获得掩码的模方X2;若当前的第一运算是为了获得模乘值,则根据公式Y2=m*Y1mod N获得掩码的模乘值Y2。同理的,由于同一表达式的运算所使用的硬件电路是相同的,因此无论是对X1还是对Y1进行第一运算,所使用的硬件电路是相同的,进而所产生的功耗是相同的,从而本实施方式可以抵抗SPA攻击。
S205,校验电路对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值。
可选的,若当前是对掩码的模方值进行第二运算,则预设值为参数m,若当前是对掩码的模乘值进行第二运算,则预设值可以为参数m或参数C。
相应的,若掩码运算为上述的加法掩码方式,且预设值为参数m,则第二运算的表达式可以表示为F(S)=(S-m*r)*m-1mod N,其中,S表示运算的对象。
作为一种可选的实施方式,具体实现中,若当前是对掩码的模方值进行第二运算,则根据公式X3=(X2-m*r)*m-1mod N获得校验值X3;若当前是对掩码的模乘值进行第二 运算,则根据公式Y3=(Y2-m*r)*m-1mod N获得校验值Y3。同理的,由于同一表达式的运算所使用的硬件电路是相同的,因此无论是对X2还是对Y2进行第二运算,所使用的硬件电路是相同的,进而所产生的功耗是相同的,从而本实施方式可以抵抗SPA攻击。
其中,根据X3=(X2-m*r)*m-1mod N可以得到X3=m,具体推导过程如下:
①已知X2=m*X1mod N,
故X3=(m*X1mod N-m*r)*m-1mod N=(X1-r)mod N,
②已知X1=(m+r)mod N,
故X3=[(m+r)mod N-r]mod N=m
另外,根据Y3=(Y2-m*r)*m-1mod N可以得到Y3=C,具体推导过程如下:
①已知Y2=m*Y1mod N,
故Y3=(m*Y1mod N-m*r)*m-1mod N=(Y1-r)mod N,
②已知Y1=(C+r)mod N,
故Y3=[(C+r)mod N-r]mod N=C
由上可见,本实施方式中,第二运算的目的是根据掩码的输出值得到被掩码前的参数,即求得的校验值为被掩码前的参数。
S206,校验电路判断所述校验值是否等于预设值。
具体的,若判定校验值等于预设值,则执行步骤S207,若判定校验值不等于预设值,则执行步骤S208。
其中,所述预设值等于被掩码前的密文或运算参数。正常情况下,由于求得的校验值为被掩码前的密文或运算参数,而预设值也为被掩码前的密文或运算参数,故校验值等于预设值,此时执行步骤S207。但在受到错误注入攻击时,由于密文和/或运算参数会在运算过程中被篡改,使得求得的校验值为篡改后的密文或运算参数,不再为原始的密文或运算参数,故校验值不等于预设值,此时执行步骤S208。可见,本发明实施例可以实现抵抗错误注入攻击,提高了安全性。
需要指出的是,现有技术也曾提出过一种校验方式,该校验方式是对整个模幂运算的结果进行校验,由于在受到错误注入攻击时模幂运算的结果会出错,使得该结果不能通过校验,从而可以实现抵抗错误注入攻击。相较于现有技术,本发明实施例中的校验方式可以在每一次模方运算或者每一次模乘运算得到结果之前便完成校验,无需等到整个模幂运算结束,可以及时地抵抗错误注入攻击,提高校验效率。
可选的,预设值也可以等于未被掩码的参数,这种情况下,只需将预设值相应地设定为未被掩码的参数,以及第二运算用于根据掩码的输出值得到未被掩码的参数即可,其它思路不变。
S207,解掩码电路对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值。
相应的,若掩码运算为上述的加法掩码方式,则解掩码运算的表达式可以表示为F(S)=(S-m*r)mod N,其中,S表示被解掩码的对象。
作为一种可选的实施方式,具体实现中,若上文步骤S203中第一运算是为了获得模方值,则根据公式X=X2-m*r mod N获得模方值X;若上文步骤S203中第一运算是为了 获得模乘值,则根据公式Y=Y2-m*r mod N获得模乘值Y。同理的,由于同一表达式的运算所使用的硬件电路是相同的,因此无论是对X2还是对Y2进行解掩码运算,所使用的硬件电路是相同的,进而所产生的功耗是相同的,从而本实施方式可以抵抗SPA攻击。
其中,根据X=X2-m*r mod N可以得到X=m2mod N,具体推导过程如下:
①已知X2=m*X1mod N,
故X=X2-m*r mod N=m*X1mod N-m*r mod N,
②已知X1=(m+r)mod N,
故X=m*X1mod N-m*r mod N={m*[(m+r)mod N]}mod N-m*r mod N
③根据模的四则运算法则a*(bmodp)=a*bmodp,
可得X=m*(m+r)mod N-m*r mod N,
④根据模的四则运算法则amodp-bmodp=(a-b)modp,
可得X=m*mmod N=m2mod N。
另外,根据Y=Y2-m*r mod N可以得到Y=m*C mod N,具体推导过程如下:
①已知X2=m*X1mod N,
故X=X2-m*r mod N=m*X1mod N-m*r mod N,
②已知Y1=(C+r)mod N,
故Y=m*X1mod N-m*r mod N={m*[(C+r)mod N]}mod N-m*r mod N
③根据模的四则运算法则a*(bmodp)=a*bmodp,
可得Y=m*(C+r)mod N-m*r mod N,
④根据模的四则运算法则amodp-bmodp=(a-b)modp,
可得X=m*C mod N。
也就是说,本发明实施例可以实现模方运算和模乘运算。
S208,解密电路将运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。
S209,复位电路清空所述密文和所述运算参数,并停止运算。
具体的,复位电路清空输入参数m、C和N,可选的,私钥d,并停止所有的运算,以防止数据被盗取,以及避免继续输出数据而被非法分析。
可选的,在执行上述操作的同时、之前或之后,还发出警报。
由上可见,本发明实施例提供的安全芯片包括输入/输出接口、解密电路、微处理器和运算器,在安全芯片将密文转换为明文的解密过程中,输入/输出接口先获取输入的密文,解密电路再根据密文和预设的运算参数执行模幂运算,微处理器然后将模幂运算获得的运算结果作为解密得到的明文。其中,解密电路在根据密文和预设的运算参数执行模幂运算执行模幂运算时,先将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算,再将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,可见,无论是为了获得模方值,还是为了获得模乘值,均可以通过同一硬件(运算器)实现,使得两种运算所产生的功耗相同,不能根据功耗区分,从而可以抵抗SPA攻击,提高安全性。另外,由于本发明实施例还要进行参数对比检验,因而还可以抵抗错误注入攻击,进一步提高安全性。
图3是本发明实施例中一种安全芯片的结构示意图,该安全芯片可以实现上述图1-图2所描述的运算方法。如图所示本发明实施例中的安全芯片至少可以包括输入/输出接口310、解密电路320、微处理器330以及运算器340,其中:
输入/输出接口310,用于获取输入的所述密文。
具体的,当外部向安全芯片输入密文以请求解密时,输入/输出接口310获取输入的密文。
解密电路320,用于根据所述密文和预设的运算参数执行模幂运算。
由上文介绍的内容可知,解密过程的核心是模幂运算,模幂运算可以拆分为多次的模方运算m=m2mod N和多次的模乘运算m=m*C mod N。具体的,解密电路320先将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算,解密电路320再将密文和运算参数发送至运算器340,运算器340根据密文和运算参数进行第一运算获得模方值或者模乘值,解密电路320然后将运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。
需要指出的是,上述运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则m为预设的初始值(例如:预设初始值为1),若当前不为初次的第一运算,则m为上一次的第一运算获得的模方值或者模乘值。也就是说,解密电路320每次发送给运算器340的运算参数中的m是不同的,且m将会被多次赋值并多次迭代运算。
可选的,第一运算的表达式可以表示为F(S)=m*Smod N,S表示运算的对象。相应的,运算器340根据密文和运算参数进行第一运算获得模方值或者模乘值,具体为:当解密电路320仅发送了m和N给运算器时,运算器340根据公式X=m2mod N对m和N进行模乘运算获得模方值,当解密电路320发送了密文C、m和N给运算器时,运算器340根据公式Y=m*C mod N对密文C、m和N进行模方运算获得模乘值。
还需要指出的是,本发明实施例中的运算器340不是集成了模方运算电路和模乘运算电路的硬件,也就是说,运算器340是一个只包含唯一运算电路的硬件,该运算电路既可以实现模方运算,又可以实现模乘运算,且执行模方运算和模乘运算时功耗相同。
微处理器330,用于将模幂运算获得的运算结果,作为解密得到的明文。
由上文介绍的内容可知,根据模幂运算的幂指数不同,最后一次的第一运算可能获得模方值,也可能获得模乘值。具体的,微处理器330将最后一次的第一运算获得的模方值或者模乘值作为明文。
进一步的,请参阅图3,如图所示运算器340可以包括:
掩码电路341,用于使用随机数对所述密文和/或所述运算参数进行掩码运算,获得掩码参数,所述掩码参数包括掩码后的密文和所述运算参数,或者包括所述密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数。
也就是说,获得的掩码参数包括掩码后的密文和运算参数,或者包括密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数。
可选的,掩码运算的方式可以是加法或减法掩码,也可以是乘法或除法掩码,还可以是混合运算或其它运算的掩码,等等,这里不作穷举。以加法掩码为例,掩码运算的表达 式可以表示为F(S)=(S+r)mod N,其中,S表示被掩码的对象,r表示随机数。
硬件加速电路342,用于对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值。
可选的,第一运算的表达式可以表示为F(S)=m*Smod N,S表示运算的对象。
解掩码电路343,用于对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值。
更进一步的,请参阅图3,如图所示运算器340还可以包括校验电路344,用于:
对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值;
确定所述校验值等于预设值,其中,若当前是对所述掩码的模方值进行第二运算,则所述预设值为所述m,若当前是对所述掩码的模乘值进行第二运算,则所述预设值为所述m或所述C。
可选的,硬件加速电路342,具体用于:
根据公式X2=m*X1mod N获得掩码的模方值,其中,所述X2表示所述掩码的模方值;或者
根据公式Y2=m*Y1mod N获得掩码的模乘值,其中,所述Y2表示所述掩码的模乘值。
又可选的,校验电路344,具体用于:
若当前是对所述掩码的模方值进行第二运算,则根据公式X3=(X2-m*r)*m-1mod N获得校验值,其中,所述X3表示所述校验值;或者
若当前是对所述掩码的模乘值进行第二运算,则根据公式Y3=(Y2-m*r)*m-1mod N获得校验值,其中,所述Y3表示所述校验值。
又可选的,解掩码电路343,具体用于:
若当前是对所述掩码的模方值进行解掩码运算,则根据公式X=X2-m*r mod N获得所述模方值X;或者
若当前是对所述掩码的模乘值进行解掩码运算,则根据公式Y=Y2-m*r mod N获得所述模乘值Y。
可选的,请参阅图3,如图所示运算器340还可以包括复位电路345,用于若所述校验值不等于所述预设值,则清空所述密文和所述运算参数,并触发所述运算器停止运算。进一步可选的,随机数是通过真随机数发生器生成的,或者是通过真随机数发生器生成种子数之后,通过伪随机数发生器根据所述种子数生成的。
需要指出的是,本实施例中未展开描述的示例和/或实施方式,具体可以参阅图1-图2所描述的内容,这里不再赘述。
图4是本发明实施例中的另一种安全芯片的结构示意图,如图4所示,该安全芯片可以包括:至少一个微处理器401,例如CPU,至少一个传输总线402,存储器403,输入/输出接口404。其中,传输总线402用于实现这些组件之间的连接通信;存储器403可以是高速RAM存储器,也可以是非易失的存储器(non-volatile memory),例如至少一个磁盘存储器。可选的,存储器403还可以是至少一个位于远离前述处理器401的存储装置;输入/输出接口404用于与外部设备进行数据传输,如接收数据。存储器403中存储一组程序 代码,如HDL(Hardware Description Language,硬件描述语言),且微处理器401用于调用存储器中存储的程序,执行以下步骤:
获取输入的密文;
根据所述密文和预设的运算参数执行模幂运算;
将模幂运算获得的运算结果,作为解密得到的明文;
其中,所述根据所述密文和预设的运算参数执行模幂运算,包括:
将模幂运算分解为多次迭代的第一运算,所述第一运算为模方运算或者模乘运算;
根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,所述运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则所述m为预设的初始值,若当前不为初次的第一运算,则所述m为上一次的第一运算获得的模方值或者模乘值;
将所述运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。
可选的,微处理器401根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,具体操作为:
根据公式X=m2mod N对所述m和所述N进行模乘运算获得模方值,或者,根据公式Y=m*C mod N对所述密文C、所述m和所述N进行模方运算获得模乘值。
可选的,微处理器401根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,具体操作为:
使用随机数对所述密文和/或所述运算参数进行掩码运算,获得掩码参数,所述掩码参数包括掩码后的密文和所述运算参数,或者包括所述密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数;
对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值;
对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值。
可选的,微处理器401对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值之前,还执行:
对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值;
确定所述校验值等于预设值,其中,若当前是对所述掩码的模方值进行第二运算,则所述预设值为所述m,若当前是对所述掩码的模乘值进行第二运算,则所述预设值为所述m或所述C。
进一步的,微处理器401使用随机数对所述密文和所述运算参数进行掩码运算,具体操作为:
根据公式X1=(m+r)mod N获得掩码后的m,其中,所述X1表示所述掩码后的m,所述r表示所述随机数;和/或
根据公式Y1=(C+r)mod N获得掩码后的C,其中,所述Y1表示所述掩码后的C,所述r表示所述随机数。
更进一步的,微处理器401对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值,具体操作为:
根据公式X2=m*X1mod N获得掩码的模方值,其中,所述X2表示所述掩码的模方值;或者
根据公式Y2=m*Y1mod N获得掩码的模乘值,其中,所述Y2表示所述掩码的模乘值。
更进一步的,微处理器401对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值,具体操作为:
若当前是对所述掩码的模方值进行第二运算,则根据公式X3=(X2-m*r)*m-1mod N获得校验值,其中,所述X3表示所述校验值;或者
若当前是对所述掩码的模乘值进行第二运算,则根据公式Y3=(Y2-m*r)*m-1mod N获得校验值,其中,所述Y3表示所述校验值。
更进一步的,微处理器401对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值,具体操作为:
若当前是对所述掩码的模方值进行解掩码运算,则根据公式X=X2-m*r mod N获得所述模方值X;或者
若当前是对所述掩码的模乘值进行解掩码运算,则根据公式Y=Y2-m*r mod N获得所述模乘值Y。
可选的,微处理器401对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值之后,还执行:
若所述校验值不等于所述预设值,则清空所述密文和所述运算参数,并停止运算。
又可选的,所述随机数是通过真随机数发生器生成的,或者是通过真随机数发生器生成种子数之后,通过伪随机数发生器根据所述种子数生成的。
由上可见,本发明实施例提供的安全芯片包括输入/输出接口、解密电路、微处理器和运算器,在安全芯片将密文转换为明文的解密过程中,输入/输出接口先获取输入的密文,解密电路再根据密文和预设的运算参数执行模幂运算,微处理器然后将模幂运算获得的运算结果作为解密得到的明文。其中,解密电路在根据密文和预设的运算参数执行模幂运算执行模幂运算时,先将模幂运算分解为多次迭代的第一运算,第一运算为模方运算或者模乘运算,再将密文和运算参数发送至运算器,运算器根据密文和运算参数进行第一运算获得模方值或者模乘值,可见,无论是为了获得模方值,还是为了获得模乘值,均可以通过同一硬件(运算器)实现,使得两种运算所产生的功耗相同,不能根据功耗区分,从而可以抵抗SPA攻击,提高安全性。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。

Claims (20)

  1. 一种运算方法,其特征在于,所述方法应用于安全芯片,所述安全芯片包括输入/输出接口、解密电路、微处理器和运算器,所述方法包括:
    所述输入/输出接口获取输入的密文;
    所述解密电路根据所述密文和预设的运算参数执行模幂运算;
    所述微处理器将模幂运算获得的运算结果,作为解密得到的明文;
    其中,所述解密电路根据所述密文和预设的运算参数执行模幂运算,包括:
    所述解密电路将模幂运算分解为多次迭代的第一运算,所述第一运算为模方运算或者模乘运算;
    所述解密电路将所述密文和所述运算参数发送至所述运算器,所述运算器根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,所述运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则所述m为预设的初始值,若当前不为初次的第一运算,则所述m为上一次的第一运算获得的模方值或者模乘值;
    所述解密电路将所述运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。
  2. 如权利要求1所述的方法,其特征在于,所述运算器根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,包括:
    所述运算器根据公式X=m2mod N对所述m和所述N进行模乘运算获得模方值,或者,根据公式Y=m*C mod N对所述密文C、所述m和所述N进行模方运算获得模乘值。
  3. 如权利要求1所述的方法,其特征在于,所述运算器包括掩码电路、硬件加速电路和解掩码电路;
    所述运算器根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,包括:
    所述掩码电路使用随机数对所述密文和/或所述运算参数进行掩码运算,获得掩码参数,所述掩码参数包括掩码后的密文和所述运算参数,或者包括所述密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数;
    所述硬件加速电路对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值;
    所述解掩码电路对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值。
  4. 如权利要求3所述的方法,其特征在于,所述运算器还包括校验电路;
    所述解掩码电路对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值之前,还包括:
    所述校验电路对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值;
    所述校验电路确定所述校验值等于预设值,其中,若当前是对所述掩码的模方值进行第二运算,则所述预设值为所述m,若当前是对所述掩码的模乘值进行第二运算,则所述 预设值为所述m或所述C。
  5. 如权利要求4所述的方法,其特征在于,所述掩码电路使用随机数对所述密文和所述运算参数进行掩码运算,包括:
    所述掩码电路根据公式X1=(m+r)mod N获得掩码后的m,其中,所述X1表示所述掩码后的m,所述r表示所述随机数;和/或
    所述掩码电路根据公式Y1=(C+r)mod N获得掩码后的C,其中,所述Y1表示所述掩码后的C,所述r表示所述随机数。
  6. 如权利要求5所述的方法,其特征在于,所述硬件加速电路对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值,包括:
    所述硬件加速电路根据公式X2=m*X1 mod N获得掩码的模方值,其中,所述X2表示所述掩码的模方值;或者
    所述硬件加速电路根据公式Y2=m*Y1 mod N获得掩码的模乘值,其中,所述Y2表示所述掩码的模乘值。
  7. 如权利要求6所述的方法,其特征在于,所述校验电路对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值,包括:
    若当前是对所述掩码的模方值进行第二运算,则所述校验电路根据公式X3=(X2-m*r)*m-1mod N获得校验值,其中,所述X3表示所述校验值;或者
    若当前是对所述掩码的模乘值进行第二运算,则所述校验电路根据公式Y3=(Y2-m*r)*m-1mod N获得校验值,其中,所述Y3表示所述校验值。
  8. 如权利要求7所述的方法,其特征在于,所述解掩码电路对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值,包括:
    若当前是对所述掩码的模方值进行解掩码运算,则所述解掩码单元根据公式X=X2-m*rmod N获得所述模方值X;或者
    若当前是对所述掩码的模乘值进行解掩码运算,则所述解掩码电路根据公式Y=Y2-m*rmod N获得所述模乘值Y。
  9. 如权利要求4所述的方法,其特征在于,所述运算器还包括复位电路;
    所述校验电路对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值之后,还包括:
    若所述校验值不等于所述预设值,则所述复位电路清空所述密文和所述运算参数,并停止运算。
  10. 如权利要求3所述的方法,其特征在于,所述随机数是通过真随机数发生器生成的,或者是通过真随机数发生器生成种子数之后,通过伪随机数发生器根据所述种子数生 成的。
  11. 一种安全芯片,其特征在于,所述安全芯片包括:
    输入/输出接口,用于获取输入的密文;
    解密电路,用于根据所述密文和预设的运算参数执行模幂运算;
    微处理器,用于将模幂运算获得的运算结果,作为解密得到的明文;
    其中,所述安全芯片还包括运算器,所述解密电路具体用于:
    将模幂运算分解为多次迭代的第一运算,所述第一运算为模方运算或者模乘运算;
    将所述密文和所述运算参数发送至所述运算器,所述运算器用于根据所述密文和所述运算参数进行第一运算获得模方值或者模乘值,所述运算参数包括参数m和预设为固定值的模数N,若当前为初次的第一运算,则所述m为预设的初始值,若当前不为初次的第一运算,则所述m为上一次的第一运算获得的模方值或者模乘值;
    将所述运算器最后一次进行第一运算获得的模方值或者模乘值,作为模幂运算的运算结果。
  12. 如权利要求11所述的安全芯片,其特征在于,所述运算器具体用于,根据公式X=m2mod N对所述m和所述N进行模乘运算获得模方值,或者,根据公式Y=m* CmodN对所述密文C、所述m和所述N进行模方运算获得模乘值。
  13. 如权利要求11所述的安全芯片,其特征在于,所述运算器包括:
    掩码电路,用于使用随机数对所述密文和/或所述运算参数进行掩码运算,获得掩码参数,所述掩码参数包括掩码后的密文和所述运算参数,或者包括所述密文和掩码后的运算参数,或者包括掩码后的密文和掩码后的运算参数;
    硬件加速电路,用于对所述掩码参数进行所述第一运算,获得掩码的模方值或者掩码的模乘值;
    解掩码电路,用于对所述掩码的模方值或者所述掩码的模乘值进行解掩码运算,对应获得模方值或者模乘值。
  14. 如权利要求13所述的安全芯片,其特征在于,所述运算器还包括校验电路,用于:
    对所述掩码的模方值或者所述掩码的模乘值进行第二运算,获得校验值;
    确定所述校验值等于预设值,其中,若当前是对所述掩码的模方值进行第二运算,则所述预设值为所述m,若当前是对所述掩码的模乘值进行第二运算,则所述预设值为所述m或所述C。
  15. 如权利要求14所述的安全芯片,其特征在于,所述掩码电路,具体用于:
    根据公式X1=(m+r)mod N获得掩码后的m,其中,所述X1表示所述掩码后的m,所述r表示所述随机数;和/或
    根据公式Y1=(C+r)mod N获得掩码后的C,其中,所述Y1表示所述掩码后的C,所 述r表示所述随机数。
  16. 如权利要求15所述的安全芯片,其特征在于,所述硬件加速电路,具体用于:
    根据公式X2=m*X1 mod N获得掩码的模方值,其中,所述X2表示所述掩码的模方值;或者
    根据公式Y2=m*Y1 mod N获得掩码的模乘值,其中,所述Y2表示所述掩码的模乘值。
  17. 如权利要求16所述的安全芯片,其特征在于,所述校验电路,具体用于:
    若当前是对所述掩码的模方值进行第二运算,则根据公式X3=(X2-m*r)*m-1mod N获得校验值,其中,所述X3表示所述校验值;或者
    若当前是对所述掩码的模乘值进行第二运算,则根据公式Y3=(Y2-m*r)*m-1mod N获得校验值,其中,所述Y3表示所述校验值。
  18. 如权利要求17所述的安全芯片,其特征在于,所述解掩码电路,具体用于:
    若当前是对所述掩码的模方值进行解掩码运算,则根据公式X=X2-m*r mod N获得所述模方值X;或者
    若当前是对所述掩码的模乘值进行解掩码运算,则根据公式Y=Y2-m*r mod N获得所述模乘值Y。
  19. 如权利要求14所述的安全芯片,其特征在于,所述运算器还包括复位电路,用于若所述校验值不等于所述预设值,则清空所述密文和所述运算参数,并触发所述运算器停止运算。
  20. 如权利要求13所述的安全芯片,其特征在于,所述随机数是通过真随机数发生器生成的,或者是通过真随机数发生器生成种子数之后,通过伪随机数发生器根据所述种子数生成的。
PCT/CN2017/094332 2016-07-26 2017-07-25 一种运算方法和安全芯片 WO2018019233A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP17833536.0A EP3480998B1 (en) 2016-07-26 2017-07-25 Operation method and security chip
US16/258,114 US10601577B2 (en) 2016-07-26 2019-01-25 Operation method and security chip

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610594595.7A CN106254059B (zh) 2016-07-26 2016-07-26 一种运算方法和安全芯片
CN201610594595.7 2016-07-26

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US16/258,114 Continuation US10601577B2 (en) 2016-07-26 2019-01-25 Operation method and security chip

Publications (1)

Publication Number Publication Date
WO2018019233A1 true WO2018019233A1 (zh) 2018-02-01

Family

ID=57603239

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/094332 WO2018019233A1 (zh) 2016-07-26 2017-07-25 一种运算方法和安全芯片

Country Status (4)

Country Link
US (1) US10601577B2 (zh)
EP (1) EP3480998B1 (zh)
CN (1) CN106254059B (zh)
WO (1) WO2018019233A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106254059B (zh) * 2016-07-26 2020-03-20 华为技术有限公司 一种运算方法和安全芯片
CN110048840B (zh) * 2019-04-28 2021-10-15 苏州国芯科技股份有限公司 一种基于rsa算法的信息处理方法、系统及相关组件
CN111351992B (zh) * 2020-02-20 2022-08-02 南方电网科学研究院有限责任公司 一种基于电磁侧信道分析的芯片安全评估方法和相关装置
CN113515075A (zh) * 2021-09-13 2021-10-19 梅州国威电子有限公司 一种通过低功耗远距离射频无线网络智能控制系统及方法
CN114880686A (zh) * 2022-05-30 2022-08-09 杭州医康慧联科技股份有限公司 基于联邦学习的硬件加速数据传输方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113252A1 (en) * 2007-10-30 2009-04-30 Lambert Robert J Fault detection in exponentiation and point multiplication operations using a montgomery ladder
CN101436932A (zh) * 2008-12-18 2009-05-20 天津大学 一种抵抗简单电耗攻击的模幂计算方法
CN105099684A (zh) * 2014-05-08 2015-11-25 国民技术股份有限公司 一种模幂运算的处理方法、装置及密码设备
CN106254059A (zh) * 2016-07-26 2016-12-21 华为技术有限公司 一种运算方法和安全芯片

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6064740A (en) * 1997-11-12 2000-05-16 Curiger; Andreas Method and apparatus for masking modulo exponentiation calculations in an integrated circuit
GB0013349D0 (en) * 2000-06-01 2000-07-26 Tao Group Ltd Pseudo-random number generator
GB0013398D0 (en) * 2000-06-01 2000-07-26 Tao Group Ltd A method of protecting a cryptosystem from a multiple transmission attack
GB0013399D0 (en) * 2000-06-01 2000-07-26 Tao Group Ltd Decryption of cipher polynomials
US6898284B2 (en) * 2000-08-18 2005-05-24 The United States Of America As Represented By The National Security Agency Cryptographic identification and digital signature method using efficient elliptic curve
US6836869B1 (en) * 2001-02-02 2004-12-28 Cradle Technologies, Inc. Combined cyclic redundancy check (CRC) and Reed-Solomon (RS) error checking unit
US7219184B2 (en) * 2002-12-10 2007-05-15 Isic Corporation Method and apparatus for longest prefix matching in processing a forwarding information database
US7043515B2 (en) * 2002-12-10 2006-05-09 Isic Corporation Methods and apparatus for modular reduction circuits
FR2885711B1 (fr) * 2005-05-12 2007-07-06 Atmel Corp Procede et materiel modulaire et aleatoire pour la reduction polynomiale
US7864951B2 (en) * 2006-07-10 2011-01-04 King Fahd University Of Petroleum And Minerals Scalar multiplication method with inherent countermeasures
WO2008028529A1 (de) * 2006-09-07 2008-03-13 Micronas Gmbh Schaltungen für die modulare arithmetik basierend auf der ergänzung von kettenbrüchen
CA2680047C (en) * 2007-03-06 2015-08-11 Research In Motion Limited Integer division in a manner that counters a power analysis attack
US20110116539A1 (en) * 2009-11-13 2011-05-19 Freescale Semiconductor, Inc. Method and apparatus for video decoding with reduced complexity inverse transform
KR101610917B1 (ko) * 2010-03-08 2016-04-11 삼성전자주식회사 암호 알고리즘의 복호 방법 및 그것을 포함하는 암호 시스템
CN103164187B (zh) * 2011-12-09 2017-03-01 深圳市证通电子股份有限公司 Rsa模幂电路及rsa安全加密芯片
CN103944714A (zh) * 2014-04-26 2014-07-23 胡建国 基于ecc实现抗dpa攻击的标量乘算法的方法及装置
CN104899527A (zh) * 2015-05-12 2015-09-09 广州中大微电子有限公司 一种片上安全协处理器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090113252A1 (en) * 2007-10-30 2009-04-30 Lambert Robert J Fault detection in exponentiation and point multiplication operations using a montgomery ladder
CN101436932A (zh) * 2008-12-18 2009-05-20 天津大学 一种抵抗简单电耗攻击的模幂计算方法
CN105099684A (zh) * 2014-05-08 2015-11-25 国民技术股份有限公司 一种模幂运算的处理方法、装置及密码设备
CN106254059A (zh) * 2016-07-26 2016-12-21 华为技术有限公司 一种运算方法和安全芯片

Also Published As

Publication number Publication date
EP3480998A4 (en) 2019-07-10
US10601577B2 (en) 2020-03-24
CN106254059B (zh) 2020-03-20
CN106254059A (zh) 2016-12-21
EP3480998B1 (en) 2022-02-09
EP3480998A1 (en) 2019-05-08
US20190173665A1 (en) 2019-06-06

Similar Documents

Publication Publication Date Title
WO2018019233A1 (zh) 一种运算方法和安全芯片
EP2332040B1 (en) Countermeasure securing exponentiation based cryptography
US11824986B2 (en) Device and method for protecting execution of a cryptographic operation
JP2012129993A (ja) 暗号装置の保護方法及び保護システム
EP3191936B1 (en) System and method for one-time chinese-remainder-theorem exponentiation for cryptographic algorythms
CN109495270A (zh) 数字签名生成中的临时乱数到消息的结合
KR100652377B1 (ko) 모듈라 지수승 알고리즘, 기록매체 및 시스템
JP2004304800A (ja) データ処理装置におけるサイドチャネル攻撃防止
CN107896142B (zh) 一种执行模幂运算的方法及装置、计算机可读存储介质
CN1985458B (zh) 增强的自然蒙哥马利指数掩蔽和恢复的方法和装置
EP3166013B1 (en) Modular exponentiation using randomized addition chains
JP3952304B2 (ja) 電子コンポネントにおいて公開指数を求める暗号アルゴリズムを実行する方法
Arjunan et al. Securing RSA algorithm against timing attack.
KR100953716B1 (ko) Crt-rsa 기반의 비트 연산을 이용한 디지털 서명방법, 그 장치 및 이를 기록한 기록 매체
KR101112570B1 (ko) 전력 분석 및 오류 주입 공격에 안전한 디지털 서명 장치, 방법 및 그 기록 매체
Hanley et al. Exploiting collisions in addition chain-based exponentiation algorithms using a single trace
Kaminaga et al. Crashing modulus attack on modular squaring for rabin cryptosystem
Fournaris et al. Efficient crt rsa with sca countermeasures
Feix et al. Recovering CRT-RSA secret keys from message reduced values with side-channel analysis
Howgrave-Graham et al. Pseudo-random number generation on the IBM 4758 Secure Crypto Coprocessor
Fournaris Hardware module design for ensuring trust
Shukla et al. A Comparative analysis of the attacks on public key RSA cryptosystem
Voyiatzis An introduction to side channel cryptanalysis of RSA
Ling Smart card fault attacks on public key and elliptic curve cryptography
CN106533672A (zh) 验证加密文件安全性的方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17833536

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2017833536

Country of ref document: EP

Effective date: 20190131