CN-116414347-B - Carry-save adder, safety adder and method for executing safety carry-save addition
Abstract
The invention provides a carry-save adder, a safety adder and a method for executing the safety carry-save adder. The carry-saving adder includes a first mask unit for performing a first mask operation on a first input data corresponding to a first mask value according to the first mask value and an input variable to obtain a first variable. And a second mask unit performs a second mask operation on second input data corresponding to the second mask value according to the first mask value and the second mask value to obtain first masked data. And a third mask unit performs a third mask operation on third data corresponding to the third mask value according to the first mask value and the third mask value to obtain second masked data. An exclusive or gate receives the first masked data and the second masked data and the first variable to provide a summed output of the first input data, the second input data, and the third input data.
Inventors
- WU KUNYI
- LI YUSHAN
Assignees
- 新唐科技股份有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20220926
- Priority Date
- 20211230
Claims (10)
- 1. A carry-save adder, comprising: The first mask unit is used for executing a first mask operation on first input data corresponding to a first mask value according to the first mask value and an input variable to obtain a first variable; A second mask unit, configured to perform a second mask operation on a second input data corresponding to the second mask value according to the first mask value and a second mask value, so as to obtain first masked data; A third mask unit for performing a third mask operation on a third input data corresponding to the third mask value according to the first mask value and a third mask value to obtain a second masked data, and And a first exclusive-or gate for receiving the first masked data, the second masked data, and the first variable to provide a sum output of the first input data, the second input data, and the third input data.
- 2. The carry-save adder according to claim 1, further comprising: A logic circuit for receiving the first masked data, the second masked data and the first input data to provide a carry out of the first input data, the second input data and the third input data.
- 3. The carry-save adder according to claim 2, wherein said logic circuit comprises: a first AND gate for receiving the first masked data and the second masked data to provide a first intermediate data; a second AND gate for receiving the first masked data and the first input data to provide a second intermediate data; a third AND gate for receiving the second masked data and the first input data to provide a third intermediate data, and An OR gate for receiving the first intermediate data, the second intermediate data and the third intermediate data to provide the carry out.
- 4. The carry-save adder according to claim 1, wherein said first mask unit comprises: a second exclusive-OR gate for receiving the first mask value and the input variable to provide a second variable, and A third exclusive-or gate for receiving the second variable and the first input data to provide the first variable; The first input data is obtained by performing a masking operation on first data by using the first mask value.
- 5. A safety adder, comprising: A mask generator, comprising: A random number generator for randomly generating a first mask value, a second mask value, a third mask value and an input variable, and A carry-save adder, comprising: the first mask unit is used for executing a first mask operation on first input data corresponding to the first mask value according to the first mask value and the input variable so as to obtain a first variable; A second mask unit, configured to perform a second mask operation on a second input data corresponding to the second mask value according to the first mask value and the second mask value, so as to obtain first masked data; a third mask unit for performing a third mask operation on a third input data corresponding to the third mask value according to the first mask value and the third mask value to obtain a second masked data, and And a first exclusive-or gate for receiving the first masked data, the second masked data, and the first variable to provide a sum output of the first input data, the second input data, and the third input data.
- 6. The secure adder of claim 5, further comprising: a look-ahead carry adder for providing a sum of the first input data, the second input data, and the third input data according to the sum output, a carry output, the input variable, and the first mask value; Wherein the carry-save adder further comprises: A logic circuit for receiving the first masked data, the second masked data, and the first input data to provide the carry outputs of the first input data, the second input data, and the third input data; Wherein the input variable is a mask value of the sum output and the first mask value is a mask value of the carry output.
- 7. The safety adder according to claim 6, wherein said look-ahead carry adder further performs a fourth masking operation on said summed result according to a fourth masking value.
- 8. The safety adder according to claim 5, wherein said first mask unit comprises: a second exclusive-OR gate for receiving the first mask value and the input variable to provide a second variable, and A third exclusive-or gate for receiving the second variable and the first input data to provide the first variable; The first input data is obtained by performing a masking operation on first data by using the first mask value.
- 9. A method of performing a safe carry-save addition, comprising: according to a first mask value and an input variable, performing a first mask operation on first input data corresponding to the first mask value to obtain a first variable; Performing a second mask operation on second input data corresponding to the second mask value according to the first mask value and the second mask value to obtain first masked data; Performing a third mask operation on a third input data corresponding to a third mask value according to the first mask value and the third mask value to obtain a second masked data, and An exclusive or operation is performed on the first masked data, the second masked data, and the first variable using an exclusive or gate to provide a sum output of the first input data, the second input data, and the third input data.
- 10. The method of performing a safe carry-save addition of claim 9, further comprising: Using a look-ahead carry adder to provide a sum of the first input data, the second input data, and the third input data according to the sum output, a carry output, the input variable, and the first mask value; Wherein the input variable is a mask value of the sum output and the first mask value is a mask value of the carry output.
Description
Carry-save adder, safety adder and method for executing safety carry-save addition Technical Field The present invention relates to a safety adder, and more particularly, to a carry-save adder, a safety adder, and a method for performing a safety carry-save addition. Background Addition is an important function of many operations, so adders are widely used in applications such as signal processing, data protection, and the like. In recent years, encryption and decryption applications have very important consideration on how to protect confidential information, so as to avoid the operation data from being analyzed and stolen. In general, a common and effective protection mechanism is an exclusive-or mask technique, which performs an exclusive-or operation using a random number and important data (or variables) in an encryption and decryption algorithm to complete the mask protection mechanism. Therefore, the encryption and decryption application needs a secure adder capable of performing secure addition. The safe addition operation means that the safe adder can complete the addition operation without removing a mask of the input data, and the original value of the input data is not revealed in the calculation process, and the output protected by the mask value can be provided. In various integrated circuits or electronic products used in encryption and decryption operations, a secure adder capable of performing secure addition is used in a large number. Thus, there is a need for a low manufacturing cost safety adder. Disclosure of Invention The invention provides a carry-saving adder. The carry-saving adder includes a first mask (mask) unit, a second mask unit, a third mask unit, and a first exclusive-OR gate. The first mask unit performs a first mask operation on first input data corresponding to a first mask value according to the first mask value and an input variable to obtain a first variable. The second mask unit executes a second mask operation on a second input data corresponding to the second mask value according to the first mask value and a second mask value to obtain first masked data. And the third mask unit executes a third mask operation on third input data corresponding to the third mask value according to the first mask value and a third mask value so as to obtain second masked data. The first exclusive-or gate receives the first masked data, the second masked data, and the first variable to provide a sum output of the first input data, the second input data, and the third input data. Furthermore, the invention provides a safety adder. The safety adder includes a mask generator and a save carry adder. The mask generator includes a random number generator for randomly generating a first mask value, a second mask value, a third mask value, and an input variable. The carry-saving adder includes a first mask unit, a second mask unit, a third mask unit, and a first exclusive-OR gate. The first mask unit performs a first mask operation on a first input data corresponding to the first mask value according to the first mask value and the input variable to obtain a first variable. The second mask unit executes a second mask operation on a second input data corresponding to the second mask value according to the first mask value and the second mask value to obtain first masked data. And the third mask unit executes a third mask operation on third input data corresponding to the third mask value according to the first mask value and the third mask value so as to obtain second masked data. The first exclusive-or gate receives the first masked data, the second masked data, and the first variable to provide a sum output of the first input data, the second input data, and the third input data. Furthermore, the invention provides a method for performing a safe carry-save addition. And executing a first mask operation on first input data corresponding to the first mask value according to the first mask value and an input variable to obtain a first variable. And executing a second mask operation on second input data corresponding to the second mask value according to the first mask value and a second mask value to obtain first masked data. And executing a third mask operation on third input data corresponding to the third mask value according to the first mask value and a third mask value to obtain second masked data. An exclusive or operation is performed on the first masked data, the second masked data, and the first variable using an exclusive or gate to provide a sum output of the first input data, the second input data, and the third input data. Drawings Fig. 1 illustrates a secure adder according to some embodiments of the invention. FIG. 2 illustrates a method of performing a safe carry-save adder according to some embodiments of the invention, suitable for use in the carry-save adder of FIG. 1. Fig. 3 shows a truth table for variable Exy according to some embodiments of the invention. Fig. 4 shows a t