Error detection in password replacement box operations
By introducing a multiplicative inverse circuit and an error detection circuit into the S-box circuit of the AES hardware unit, and using the multiplicative inverse characteristic to detect errors, the problem of difficulty in detecting S-box circuit errors in the existing technology is solved, and the defense capability against fault injection attacks is improved. , ensuring the security of the key.
Patent Information
- Application Number
- CN202311805241.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-03-31
- Filing Date
- 2023-12-26
- Publication Date
- 2024-10-01
AI Technical Summary
Existing AES hardware units have difficulty detecting errors that occur in the replacement box (S-box) circuitry, especially when faced with fault injection attacks, which may lead to key leakage.
An S-box circuit including a multiplicative inverse circuit and an error detection circuit is designed. By performing the multiplicative inverse operation in the Galois domain, and using the multiplicative inverse characteristics to detect whether the output is correct, if an error occurs, an error signal is sent to take protective measures. .
It effectively prevents fault injection attacks, ensures the security of the AES hardware unit and the protection of keys, and improves the integrity detection capability of S-box operations.
Smart Images

Figure CN118740368A_ABST
Abstract
Description
Technical Field
[0001] Embodiments described herein generally relate to cryptography. In particular, embodiments described herein generally relate to error detection in cryptography. Background Art
[0002] Cryptography is a technique used to protect data (e.g., data that is desired to remain secret or confidential) in computer systems and other electronic devices. Cryptography generally involves the use of cryptographic algorithms and cryptographic keys to protect data. For example, encryption (sometimes referred to as cryptography) uses an encryption key to perform a series of operations or transformations on input data or plaintext according to a cryptographic algorithm to generate output encrypted data or ciphertext that is generally unintelligible. Similarly, decryption (sometimes referred to as inverse cryptography) uses a decryption key to perform a series of operations or transformations on input encrypted data or ciphertext according to a cryptographic algorithm to generate output decrypted data or plaintext.
[0003] A known cryptographic algorithm is the Advanced Encryption Standard (AES), which is published by the National Institute of Standards and Technology (NIST) as the Federal Information Processing Standard (FIPS) 197. AES is sometimes referred to as the Rijndael algorithm. AES is a block encryption algorithm using a fixed block size of 128 bits, a key algorithm using a key that should be kept secret, and a symmetric key algorithm that uses the same key for encryption and decryption. The fixed block size of 128 bits of data is called a state and is arranged as a 4×4 array of sixteen bytes. The AES algorithm can be used to encrypt a 128-bit state or decrypt a 128-bit state in 10, 12, or 14 consecutive rounds, depending on whether the key size is 128 bits, 192 bits, or 256 bits for AES-128, AES-192, and AES-256, respectively.
[0004] In AES and other secret key cryptography, the key should be kept secret or confidential. If the attacker does not know the key, the characteristics of the cryptographic algorithm generally make it impossible, practically infeasible, or at least extremely difficult to regenerate the unencrypted data or plaintext from the encrypted data or ciphertext. However, if the attacker can know or determine the key, then the unencrypted data can be easily regenerated from the encrypted data. Summary of the invention
[0005] One aspect of the present disclosure provides an apparatus comprising: a substitution box (S-box) circuit, the S-box circuit comprising a multiplication inverse circuit, the multiplication inverse circuit being used to receive an 8-bit input of a Galois field and generate a corresponding 8-bit output of the Galois field, wherein, when there is no error in generating the 8-bit output, the 8-bit output is the multiplication inverse of the 8-bit input; and an error detection circuit, the error detection circuit being used to receive the 8-bit input, and the error detection circuit is coupled to the S-box circuit to receive the 8-bit output, the error detection circuit being used to detect whether an error has occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplication inverse of the 8-bit input.
[0006] An aspect of the present disclosure provides a method, comprising: performing a substitution box (S-box) operation on an 8-bit input of a Galois field to generate a corresponding 8-bit output of the Galois field, wherein, when there is no error in generating the 8-bit output, the 8-bit output is the multiplicative inverse of the 8-bit input; and detecting whether an error occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplicative inverse of the 8-bit input.
[0007] One aspect of the present disclosure provides a system, comprising: a processor; a memory; and a cryptographic unit, the cryptographic unit being coupled to the processor and to the memory, the cryptographic unit being used to encrypt data sent from the processor to the memory, the cryptographic unit comprising a substitution box (S-box) circuit, the S-box circuit comprising a multiplication inverse circuit, the multiplication inverse circuit being used to receive an 8-bit input of a Galois field and generate a corresponding 8-bit output of the Galois field, wherein, when there is no error in generating the 8-bit output, the 8-bit output is the multiplication inverse of the 8-bit input; and an error detection circuit, the error detection circuit being used to receive the 8-bit input, and the error detection circuit being coupled to the S-box circuit to receive the 8-bit output, the error detection circuit being used to detect whether an error has occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplication inverse of the 8-bit input.
[0008] One aspect of the present disclosure provides an apparatus comprising: a substitution box (S-box) component, the S-box component comprising a multiplication inverse component, the multiplication inverse component being used to receive an 8-bit input of a Galois field and generate a corresponding 8-bit output of the Galois field, wherein, when there is no error in generating the 8-bit output, the 8-bit output is the multiplication inverse of the 8-bit input; and an error detection component, the error detection component being used to receive the 8-bit input and the error detection component being coupled to the S-box component to receive the 8-bit output, the error detection component being used to detect whether an error has occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplication inverse of the 8-bit input.
[0009] One aspect of the present disclosure provides a processor including a component for executing the above method.
[0010] One aspect of the present disclosure provides a machine-readable medium, the machine-readable medium comprising machine-readable instructions, which, when executed, cause a machine to perform the above method.
[0011] One aspect of the present disclosure provides a computer program product, the computer program product comprising instructions, which when executed by a processor causes the processor to perform the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The present disclosure may be best understood by referring to the following description and accompanying drawings which illustrate embodiments. In the drawings:
[0013] Figure 1 is a block diagram of an example of an AES unit and corresponding error detection circuitry.
[0014] Figure 2 is a circuit diagram of a detailed example embodiment of an S-box circuit.
[0015] Figure 3 is a block diagram of a first embodiment of an S-box circuit and an error detection circuit.
[0016] Figure 4 is a block diagram of a second embodiment of an S-box circuit and an error detection circuit.
[0017] Figure 5 is a block diagram of a third embodiment of an S-box circuit and an error detection circuit.
[0018] Figure 6 is a block diagram illustrating sixteen S-box sections, each S-box section having a corresponding error detection circuit, and a combinational circuit for combining sixteen error signals output from the sixteen error detection circuits into a combined error signal.
[0019] Figure 7 is a block diagram of a multiplicative inverse AES circuit and a corresponding error detection circuit.
[0020] Figure 8 is a block diagram of an embodiment of an error detection circuit having more timing margin than the AES data path circuit.
[0021] Fig. 9 is a block diagram of a system that uses an AES cipher unit to provide memory encryption.
[0022] Fig.10 is a block diagram of a processor having an AES cryptographic unit for encrypting and decrypting data.
[0023] Fig.11 is a block diagram of a processor having an S-box unit for encrypting and decrypting data.
[0024] Fig.12 An example computing system is illustrated.
[0025] Fig.13 A block diagram of an example processor and / or system on a chip (SoC) that may have one or more cores and an integrated memory controller is illustrated.
[0026] FIG. 14(A) is a block diagram illustrating both an example in-order pipeline and an example register renaming, out-of-order issue / execution pipeline according to an example.
[0027] 14(B) is a block diagram illustrating both an example in-order architecture core and an example register renaming, out-of-order issue / execution architecture core to be included in a processor according to an example.
[0028] Fig.15 Examples of execution unit(s) circuitry are illustrated.
[0029] Fig.16 is a block diagram of a register architecture according to some examples.
[0030] Fig.17 An example of the instruction format is illustrated.
[0031] Fig.18 An example of the addressing information field is illustrated.
[0032] Fig.19 An example of the first prefix is illustrated.
[0033] Figures 20(A) to 20(D) illustrate how to use Fig.19 Example of the R, X, and B fields of the first prefix in .
[0034] 21(A) to 21(B) illustrate examples of the second prefix.
[0035] Fig. 22 An example of the third prefix is illustrated.
[0036] Fig.23 is a block diagram illustrating converting binary instructions in a source instruction set architecture to binary instructions in a target instruction set architecture using a software instruction converter according to an example. DETAILED DESCRIPTION
[0037] One challenge is that an attacker may target the AES hardware unit and certain other cryptographic hardware units in an attempt to obtain secret information (e.g., keys). One technique that an attacker may use is fault injection, such as voltage glitches, clock glitches, or laser / electromagnetic pulse injection. In this technique, errors may be caused or induced in the circuits of the AES or other cryptographic hardware units. For example, in a voltage glitch attack, the voltage is reduced until the circuit fails and causes an error. Such errors may result in corrupted or faulty ciphertext / encrypted data, which may be analyzed to discover the key. For example, faulty ciphertext / encrypted data may reduce the sample space of the key space, thereby reducing the security of the underlying cryptographic algorithm, and differential fault cryptanalysis may be used to extract the key. Conventionally, AES or other cryptographic hardware units may not be able to detect such errors, or may not be able to detect errors that occur in certain parts of the AES hardware unit (e.g., substitution box (S box) circuit).
[0038] Disclosed herein are methods, devices, and circuits for detecting errors in AES and other cryptographic units (e.g., S-box circuits). Advantageously, these methods, devices, and circuits can be used to detect and protect against fault injection attacks (e.g., voltage glitch attacks) during runtime. In the following description, many specific details (e.g., specific circuits, microarchitecture details, operation sequences, processor configurations, etc.) are described. However, embodiments can be practiced without these specific details. In other cases, well-known circuits, structures, and techniques are not shown in detail to avoid obscuring the understanding of this specification.
[0039] Figure 1 1 is a block diagram of an example of an AES unit 100 and a corresponding error detection circuit 101. The AES unit includes an add round key circuit 102, an S-box circuit 103, a shift row circuit 104, and a mix column circuit 105. Data 106 (e.g., unencrypted data for a first round or partially encrypted data for an intermediate round) can be provided or input to the add round key circuit. A round key 107 (a key derived from the encryption key of the round) can also be provided as an input to the add round key circuit. The add round key circuit can add or otherwise combine the input data with the input round key. For example, each byte of the input data can be combined with the bytes of the round key using a bitwise exclusive OR (XOR) operation to produce a 128-bit intermediate value.
[0040] The S-box circuit 103 may receive the 128-bit intermediate value from the addition round key circuit. As will be further explained below, the S-box circuit may have sixteen 8-bit slices or portions for processing the 128-bit intermediate value. The S-box circuit may perform a nonlinear byte replacement operation on the 128-bit intermediate value, wherein each byte of the 128-bit intermediate value is replaced by another byte value (e.g., corresponding at least conceptually to a lookup table). The S-box circuit may be based on a Galois field GF(2 8 ). To avoid attacks based on simple algebraic properties, the S-box can be constructed by combining the multiplicative inverse function with an invertible affine transformation.
[0041] The output of the S-box circuit may be received by the shift row circuit 104. The shift row circuit may perform a bit linear transposition operation, where the bytes of the last three rows from the output of the S-box circuit are circularly shifted to the left by a specific amount of offset.
[0042] Mix column circuit 105 may receive the output of the shift row circuit. Mix column circuit may perform a bit linear transformation or mixing operation on the columns of the output of the shift row circuit. This may mix or combine the four bytes in each column (e.g., independently of each other) to produce a new column. For example, each column of a 4×4 array or state may be treated as a GF(2 8 ), then we can use x 4 +1 is the modulus and the fixed polynomial c(x) = 3x 3 +x 2 The mix column circuit is shown as a dotted line to indicate that the mix column circuit is used for all AES rounds except the last round.
[0043] In some embodiments, the AES unit may output encrypted data 109 for the single round described (e.g., storing the encrypted data in a register of a processor). In other embodiments, as shown, the output of the mixing column circuit may optionally be returned as input to the adding round key circuit along the dashed arrow 108 to perform another round (e.g., until the encrypted data 109 is output after 10, 12, or 14 rounds).
[0044] In some embodiments, the error detection circuit 101 may detect errors in the AES unit or any part thereof. In some embodiments, the error detection circuit may only detect errors in the S-box circuit. The error detection circuit may output an error signal 112 indicating whether an error has been detected.
[0045] To illustrate certain concepts, the AES unit has been described in the context of AES encryption. However, it should be understood that the same or different AES unit can be used for decryption. The circuitry and operations used for decryption are roughly the reverse of the operations used for encryption.
[0046] Figure 2 is a circuit diagram of a detailed exemplary embodiment of the S-box circuit 203. The S-box circuit is used to process the S-box in [7:0], an 8-bit byte of input data in a finite field or Galois field. 8-bit byte S-box in [7:0] is assigned as the most significant or "high" 4-bit nibble of the input (b h ) and the least significant or “low” 4-bit nibble of the input (b l The S-box circuit includes a multiplication inverse circuit 210 for calculating GF(2 8 ). An efficient implementation of the multiplicative inverse circuit involves using GF(2 4 ) 2 The complex domain involves four multipliers as indicated by the circled "X", two adders as indicated by the circled "+" (e.g., logical exclusive OR (XOR) circuits), X 2 *β unit, and GF(2 4 )X -1 These circuit elements are coupled as shown. The multiplicative inverse circuit can generate a multiplicative inverse and output it to the affine transform circuit 211. This can be provided as the most significant or "high" 4-bit nibble (a h ) and the multiplicative inverse outputs the least significant or "low" 4-bit nibble (a l The two multiplication inverses output a 4-bit nibble (a h 、a l ) can be provided to the affine transformation circuit. The affine transformation can output a denoted S-box out [7:0], an 8-bit byte of output data in a finite field or Galois field. It should be understood that this is only an illustrative example of a suitable S-box circuit. Various other S-box circuits known in the art may also be used optionally. X*α, X 2 *β module calculation is necessary for calculating GF(2 4 ) 2 X in -1 The required intermediate terms, where α and β are of the form x 2 +αx+β is the coefficient of the extended field polynomial. Other composite field representations (such as GF((2 2 ) 2 ) 2 ) is also used to calculate GF(2 8 )-1 and can generate other circuits for implementing S-box modules.
[0047] The S-box circuit is one place where errors may be introduced (e.g., by voltage glitches or other fault injection attacks) or otherwise occur. Moreover, since the S-box operation tends to be a relatively high computationally intensive operation in AES, the S-box circuit may correspondingly represent the entire circuit for one round of AES and a significant portion of more circuits where errors may occur. Further, the S-box operation of AES is nonlinear, and the integrity of the S-box circuit is not easily protected using parity-based methods, which are useful for protecting the integrity of circuits used for linear operations in AES. Specifically, the nonlinear nature of the S-box operation tends to hinder the expression of the expected parity bit based on the input of the S-box operation. Therefore, new methods for detecting errors in S-box circuits would be useful and could provide certain advantages.
[0048] Figure 3 is a block diagram of a first embodiment of an S-box circuit 303 and an error detection circuit 301. The S-box circuit is used to process the in [7:0], an 8-bit byte of input data in a finite field or a Galois field. The S-box circuit includes a multiplication inverse circuit 310. In some embodiments, the multiplication inverse circuit can be optionally used with a Figure 2 The multiplication inverse circuit shown and described is the same or similar. Alternatively, other types of multiplication inverse circuits known in the art may be optionally used. The multiplication inverse circuit may output a multiplication inverse output 320. The S-box circuit also includes an affine transformation circuit 311. The affine transformation may receive the multiplication inverse output and generate and output a signal labeled as an S-box. out [7:0], an 8-bit byte of output data in a finite field or Galois field.
[0049] The error detection circuit 301 is coupled to the S-box circuit 303. The error detection circuit can detect errors in the multiplication inverse circuit 310 and / or the S-box operation used to calculate the multiplication inverse 320. These errors can be detected in real-time operation and / or during run time. The error detection circuit can be coupled to receive an 8-bit byte of input data S-box in [7:0]. S-box in [7:0] may represent an input (X) to an S-box operation. The error detection circuit may also be coupled to receive an 8-bit multiplication inverse output 320 (X) output from the multiplication inverse circuit. -1 ).
[0050] Now, the property of the S-box operation is called the multiplicative inverse property. Part of the S-box operation is mapping the input (X) of the S-box operation to its multiplicative inverse in a Galois field or finite field. The multiplicative inverse of X is X -1 , which is a number that produces the multiplication identity or one (i.e., 1) when multiplied by X. Thus, when there is no error in generating the multiplicative inverse, the S-box operation satisfies the multiplicative inverse property, where for any input (X) other than zero, the generated multiplicative inverse (X) -1 ) is the true multiplicative inverse of the input (X), and the input (X) of the S-box operation is the inverse output (X) of the multiplicative inverse portion of the S-box operation. -1 ) has the value one (e.g., the 8-bit binary value 00000001). That is, for any input (X) other than zero, (X*X -1 )=1. However, this multiplicative inverse characteristic is only used to calculate the multiplicative inverse output 320(X -1 ). If one or more errors are induced (e.g., by a voltage glitch or other fault injection attack) or otherwise occur in the S-box circuitry and / or S-box operation used to compute the inverse, then the multiplicative inverse property will most likely not remain true or be maintained.
[0051] In some embodiments, error detection circuit 301 may be operable to use the multiplicative inverse property as a basis for detecting errors in the multiplicative inverse circuit 310 and / or the S-box operation used to compute multiplicative inverse 320. In some embodiments, error detection circuit 301 may be operable to detect errors in the multiplicative inverse circuit 310 and / or the S-box operation used to compute multiplicative inverse 320 based at least in part on whether multiplicative inverse 320 is an input to S-box in [7:0] (e.g., having its properties or characteristics) to detect whether an error has occurred in the multiplication inverse circuit 310 and / or in the generation of the multiplication inverse 320. This can be done in various ways. First, the error detection circuit can use any of the various equations or relationships derived from or mathematically rearranged from the multiplication inverse characteristic to implement a check on the multiplication inverse characteristic. Second, the error detection circuit can use the properties, results, or characteristics generated by the multiplication inverse characteristic (e.g., the XOR of the most and least significant half bytes is 0001, as will be discussed further below) to implement a check on the multiplication inverse characteristic. Therefore, as will be apparent to those skilled in the art having the benefit of the present disclosure and several different example embodiments thereof, the check can be based on the multiplication inverse characteristic in various ways. The error detection can be operated to output an error signal indicating whether an error has been detected.
[0052] Figure 4 is a block diagram of a second embodiment of an S-box circuit 403 and an error detection circuit 401. The S-box circuit is used to process the error detection circuit 401. in[7:0], an 8-bit byte of input data in a finite field or a Galois field. The S-box circuit includes a multiplication inverse circuit 410. In some embodiments, the multiplication inverse circuit can be optionally used with a Figure 2 The multiplication inverse circuit shown and described is the same or similar. Alternatively, other types of multiplication inverse circuits known in the art may be optionally used. The multiplication inverse circuit may output a multiplication inverse output 420. The S-box circuit also includes an affine transform circuit 411. The affine transform may receive the multiplication inverse output and generate and output a signal labeled as an S-box. out [7:0], an 8-bit byte of output data in a finite field or Galois field.
[0053] The error detection circuit 401 is coupled to the S-box circuit 403. The error detection circuit can detect errors in the multiplicative inverse circuit 410 and / or the S-box operation for calculating the multiplicative inverse. These errors can be detected in real-time operation and / or during run time. The error detection circuit can be coupled to receive a signal labeled as an S-box. in The error detection circuit can also be coupled to receive the multiplication inverse output 420 (X) from the multiplication inverse circuit. -1 ).
[0054] AES operates on a finite field or Galois field GF(2 8 In some embodiments, the error detection circuit may include a finite field or Galois field multiplier 421 for calculating or generating an 8-bit input (X) of the S-box operation and an 8-bit multiplication inverse output 420 (X) from the multiplication inverse circuit 410. -1 In some embodiments, the Galois field multiplier 421 may be a one-term 8-bit Galois field multiplier.
[0055] In other embodiments, the composite domain implementation of AES may convert the 8-bit operation into a pair of 4-bit operations. In such an embodiment, the Galois field multiplier 420 may be a composite domain two-term 4-bit Galois field multiplier for computing the input X(b h ,b l ) and the multiplication inverse output X from the multiplication inverse circuit -1 (a h ,a l ). In this expression, b h and b l The most significant 4-bit nibble and the least significant 4-bit nibble of the input (X) of the S-box operation are represented by a h and a l They represent the multiplication inverse outputs (X -1)'s most significant 4 nibbles and least significant 4 nibbles.
[0056] In other embodiments, the composite domain implementation of AES can convert an 8-bit operation into four 2-bit operations. In such an embodiment, the Galois field multiplier 421 can be a composite domain four-term 2-bit Galois field multiplier for calculating the input X (b3, b2, b1, b0) of the S-box operation and the inverse output X from the multiplication inverse circuit. -1 In this expression, b3, b2, b1, and b0 represent the consecutive 2-bit values of the input (X) of the S-box operation, and a3, a2, a1, and a0 represent the multiplication inverse output (X) from the multiplication inverse circuit. -1 ) consecutive 2-digit values.
[0057] As described above, the multiplicative inverse property holds true only for any input (X) other than zero. If desired, a zero checker circuit (not shown) may optionally be included in the error detection circuit to check for corner case conditions when the input to the S-box is zero. For example, in a 4-bit embodiment, the zero checker circuit may be configured to detect corner case conditions when the input to the S-box is zero. h , b l When it is 0, check whether (8a h +a l = = 0 and a l ==0) to catch output errors.
[0058] Reference again Figure 4 , the error detection circuit 401 may further include a comparison circuit 422. The comparison circuit may convert the product (X*X -1) is compared with an expected value to determine whether the multiplicative inverse characteristic has been maintained and / or whether an error has occurred. For example, the comparison circuit can compare the product to a value of one (e.g., an 8-bit binary value of 00000001). If the product matches the value of one (e.g., 00000001), the comparison circuit can determine that no error has occurred, or determine that an error has occurred in generating the product when the product is not equal to one (e.g., the calculated product is 00000000, 00000010, 00100000, or any other value other than 00000001). The error detection circuit can output an error signal 412 indicating whether the multiplicative inverse characteristic is maintained (e.g., no error is detected) or not maintained (e.g., an error is detected). By way of example, an error signal may represent a signal on a single bit or wire having a first value (e.g., cleared to binary zero or set low) to indicate that the multiplicative inverse characteristic has been maintained (e.g., no error has been detected) or having a second value (e.g., set to binary one or set high) to indicate that the multiplicative inverse characteristic is not maintained (e.g., an error has been detected). The opposite convention is also possible.
[0059] Without limitation, in some embodiments, a protective action may be optionally taken based at least in part on an error signal indicating that an error has been detected. In some embodiments, this may be based on a single error indicated, or multiple errors or error threshold levels indicated within a particular period of time. The protective action may involve generating a machine check exception, writing a benign number (e.g., a random number, all zeros, or some other fixed number) to the output, or disabling an AES unit. This in turn may help avoid leaking secrets (e.g., keys) in the event of a fault injection attack.
[0060] Now, as described above, in different embodiments, the check using the multiplicative inverse characteristic can be implemented in different ways. For example, the error detection circuit can use the properties, results or characteristics produced by the multiplicative inverse characteristic to implement the check of the multiplicative inverse characteristic. To further illustrate, consider the following embodiment.
[0061] Figure 5 is a block diagram of a third embodiment of an S-box circuit 503 and an error detection circuit 501. The S-box circuit is used to process the error detection circuit 501. in [7:0], an 8-bit byte of input data in the Galois field. The S-box circuit includes a multiplication inverse circuit 510. In some embodiments, the multiplication inverse circuit can be optionally used with a Figure 2 The multiplication inverse circuit shown and described is the same or similar. Alternatively, other types of multiplication inverse circuits known in the art may be optionally used. The S-box circuit also includes an affine transformation circuit 511. The affine transformation may output a signal labeled S-box. out[7:0], an 8-bit byte of output data in the Galois field.
[0062] The error detection circuit 501 is coupled to the S-box circuit 503. The error detection circuit can detect errors in the multiplicative inverse circuit 510 and / or the S-box operation used to calculate the multiplicative inverse 520. These errors can be detected in real-time operation and / or during run time. The error detection circuit can be coupled to receive the most significant 4-bit nibble (b 2 ) of the input (X) of the S-box operation. h ) and the least significant 4 nibbles (b l The error detection circuit may also be coupled to receive the multiplication inverse output (X) from the multiplication inverse circuit 510. -1 )'s most significant 4 nibbles (a h ) and the least significant 4 nibbles (a l ).
[0063] Recall that the multiplicative inverse property is the inverse of the input (X) of the S-box operation and the output (X) from the multiplicative inverse of the S-box operation. -1 ) has the property that for any input (X) other than zero, the value is one (e.g., the 8-bit binary value 00000001). That is, for any input (X) other than zero, X*X -1 = 1. As a property, result, or characteristic, if the input (X) of an S-box operation is equal to the inverse output (X) from the S-box operation -1 ) is one (e.g., an 8-bit binary value 00000001), the most significant nibble of the product should be zero (e.g., a 4-bit binary value 0000) and the least significant nibble should be one (e.g., a 4-bit binary value 0001). In some embodiments, this property, result, or characteristic due to the multiplicative inverse property can be used as a basis for detecting errors. For example, in some embodiments, an error detection circuit can generate an inverse of the input (X) of an S-box operation and the output (X) from the multiplicative inverse portion of the S-box operation. -1 ) is an XOR, a sum, or a combination in a finite field of the most significant nibble and the least significant nibble of the product of ). The error detection circuit can then compare the result value with a 4-bit value of one (e.g., a 4-bit binary value of 0001) to determine whether an error has occurred in the S-box circuit and / or S-box operation used to generate the product.
[0064] Equation 1 below shows that the XOR of the most significant nibble (msb) of the product and the least significant nibble (lsb) of the product can be obtained using four 4-bit nibbles b h , b l 、a h and a l Specifically, the product X*X in the composite domain -1 We can use multiplication and simplified ah 、a l , b h , b l and x are expressed as polynomials as shown in the following equation:
[0065] X*X -1 =(a l b h +a h b l +a h b h )x+(a l b l +8a h b h )Equation 1
[0066] In Equation 1, the leftmost term multiplied by x represents the most significant nibble (msb), while the rightmost term represents the least significant nibble (lsb). The above equation can be mathematically rearranged to use a h 、a l , b h , b l The most significant nibble (msb) of the product and the least significant nibble (lsb) of the product are expressed as the exclusive OR of the product, as shown in Equation 2 below:
[0067] MSB XOR LSB = A h (b l +9b h )+a l (b l +b h )Equation 2
[0068] Equation 2 involves fewer multiplications, which generally means less circuitry, since multiplication circuits tend to be relatively large. In some embodiments, the above Equation 2 can be implemented in hardware as a test based on the multiplication inverse property. As shown, the error detection circuit includes a multiplication inverse checker circuit 523, which includes three multipliers shown as circled "X"s and three adders (e.g., XOR circuits) shown as circled "+". Advantageously, with Figure 4 The multiplication inverse checker circuit can generally reduce cost, size, and power consumption compared to the Galois field multiplier 421 of the embodiment. For example, the present embodiment eliminates the Galois field multiplier (eg, calculating the product a from the checker data path). l *b h The two GFs (2 4 ) 2 multiplier).
[0069] As described above, the multiplicative inverse property holds true only for any input (X) other than zero. If desired, a zero checker circuit may optionally be included in the error detection circuit to check for corner case conditions when the input to the S-box is zero. For example, in a 4-bit embodiment, the zero checker circuit may be included in the error detection circuit to check for corner case conditions when the input to the S-box is zero. h , b l When it is 0, check whether (8a h +a l = = 0 and a l ==0) to catch output errors.
[0070] Reference again Figure 5 , the error detection circuit may also include a comparison circuit 522. The comparison circuit may compare the XOR or other combination of the nibble with the expected value to determine whether the multiplication inverse characteristic has been maintained and / or whether an error has occurred in generating the multiplication inverse. For example, the comparison circuit may compare the XOR or other combination of the nibble with a value of one (e.g., a 4-bit binary value of 0001). If the XOR or other combination of the nibble is equal to value one, the comparison circuit may determine that no error has occurred, or if it is not equal to value one (e.g., it is 0000, 0010, 1000, or any other value except 0001), the comparison circuit may determine that an error has occurred. The error detection circuit may output an error signal 512 indicating whether an error has been detected. The error signal may optionally be identical or similar to the error signal previously described.
[0071] Without limitation, in some embodiments, protective action may optionally be taken based at least in part on an error signal indicating that an error has been detected. This may optionally be the same or similar to what has been previously described.
[0072] Figure 6 6 is a block diagram illustrating sixteen S-box slices or portions 630-1 to 630-16, each having a corresponding S-box circuit 603 and an error detection circuit 601, and an error signal combining circuit 631 that combines sixteen error signals output from the sixteen error detection circuits into a combined error signal 632. The S-box circuits may be the same or similar to the S-box circuits described elsewhere herein, or other types of S-box circuits known in the art may alternatively be used. In some embodiments, the error detection circuit may be coupled to Figure 3 , Figure 4 or Figure 5The error detection circuit of 631 is the same or similar to that of 632. Alternatively, other types of error detection circuits that detect errors based on the multiplicative inverse characteristic in some other way may be optionally used. The sixteen S-box parts may jointly process the sixteen bytes that constitute the 128-bit state of AES. The error signal combination circuit 631, which may optionally be a logical OR circuit (e.g., an OR tree circuit) or other combination circuit, may combine the sixteen corresponding error signals generated for the sixteen bytes into a combined error signal, which may indicate whether any one or more of the sixteen S-box parts have detected an error.
[0073] Advantageously, error detection circuitry for the S-box circuitry can be included without requiring a dual redundant design in space or time. Another possible approach is to include a pair of replicated AES cells and compare the two outputs of the pair of replicated AES cells to detect errors. However, such duplication of AES cells tends to increase manufacturing costs, die size, and power consumption. Yet another possible approach is to repeat the same calculation twice for the same AES cell and compare the two outputs to detect errors. However, this tends to reduce AES throughput and increase power consumption. Further, the described method does not rely on a parity-based approach to detect errors within the S-box circuitry and / or S-box operations used to generate the inverse product.
[0074] Figure 7 7 is a block diagram of a multiplicative inverse AES circuit 735 and a corresponding error detection circuit 736 for detecting errors introduced in the multiplicative inverse AES circuit. The multiplicative inverse AES circuit may be coupled to receive an inverse signal labeled Inv from a multiplicative inverse circuit (not shown) of an S-box circuit. out (b h ,b l ). The AES circuit after multiplication inverse includes an affine transformation circuit (AX) 711A, a scaling affine transformation circuit (2*AX) 711B, a mixing column circuit 705, and a key adding circuit 702. The affine transformation circuit 711A can calculate an affine transformation. The scaling affine transformation circuit 711B can calculate a scaling affine transformation of scaling 0×2. This is not required, but it can allow the 0×3 scaling in the mixing column circuit 705 to be achieved by a simple XOR or combination of the outputs from the affine transformation circuit and the scaling affine transformation circuit. The key adding circuit 702 can add a round key for the round. The AES round output 709 can be the output from the AES circuit after multiplication inverse.
[0075] In some embodiments, the error detection circuit 736 can use parity checking to detect errors in the AES operation after the multiplication inverse. The error detection circuit includes a prediction parity circuit 737A, a calculation parity circuit 738, and a comparison circuit 739. A more detailed example embodiment of the prediction parity circuit 737A is shown on the right side of the diagram as a prediction parity circuit 737B. In some embodiments, a byte-level parity scheme can be optionally used. This can help increase fault detection coverage, but is not required. The error detection circuit can be based on the multiplication inverse output (e.g., Inv out (b h ,b l )) to calculate the parity of the affine and scaled affine transformations. In some embodiments, by calculating the parity of the affine and scaled affine transformations according to the multiplication inverse output (e.g., Inv out (b h ,b l )) to express the expected parity of the round output, a single parity calculation can be used to check errors in mix-column and key-add operations. This approach can help detect errors in affine transform operations, but it is not required. This approach can also help reduce area overhead.
[0076] As illustrated for the predicted parity circuit 737B, a first group of parities marked as a first group of vertical lines 3, 2, 1, 0 can be calculated for the affine transform (AX) circuit 711A, and a second group of parities marked as a second group of vertical lines 3, 2, 1, 0 can be calculated for the scaled affine transform (2*AX) circuit 711B. As shown by the black dots crossing the line, the mixed column parity can be calculated by selecting or selecting a subset of these parities of the affine transform (AX) and the scaled affine transform (2*AX). These parities can be XORed or otherwise combined as shown by a group of four vertical circled "+" on the leftmost side of the XOR circuit. Although the upstream parity calculation in the round is contained in a single byte, the mixed column parity prediction can depend on the predicted affine and scaled affine parities of four adjacent bytes. The key expansion circuit can generate a round key and associated parity bits at each clock cycle. The round key parity bits may then be XORed or otherwise combined with the mixed column parity bits to reflect the round key addition, as indicated by the rightmost set of four vertical circled "+" representing the XOR circuit, to generate round predicted parity bits 740. The affine and scaled affine predicted parity may be combined with the round key parity to generate sixteen output byte granularity parity for the AES round. Comparison circuitry 739 may compare the round predicted parity bits 740 from the predicted parity circuitry 737A with the calculated parity bits calculated by the calculated parity circuitry 738 for the actual AES data path. The comparison circuitry may output an error signal 712 indicating that any errors were detected.
[0077] Now, it should be understood that this is merely an illustrative example embodiment of a suitable error detection circuit 736 for a multiplication inverse post-AES circuit. In other embodiments, parity checks may be calculated for only a subset of affine transforms, mix columns, and key addition operations. Typically, any such parity check can help detect errors and is useful. There is a tradeoff between error detection capability and error detection circuit complexity, and different levels may be used for different designs.
[0078] Voltage glitches or undervoltage attacks may attempt to cause timing errors or failures by degrading the power supply voltage to intentionally violate the maximum delay constraint or cause a timing violation. One challenge is that these attacks may cause errors in the actual AES circuit or the error detection circuit. If these errors are first caused in the error detection circuit, errors may be signaled even if there are no errors in the actual AES circuit, which may represent a "false alarm" and is generally undesirable. In some embodiments, the error detection circuit may be designed to have more timing margin (slack) and / or less stringent timing constraints than the actual AES circuit. This can help encourage or increase the likelihood that the actual AES circuit will experience errors or failures before the error detection circuit at low voltages (e.g., in the case of undervoltage glitches). This can also help improve the integrity of the error signal generation of the error detection circuit at such low voltages.
[0079] Figure 8 8 is a block diagram of an embodiment of an error detection circuit having more time margin than an AES round circuit. A first S-box portion 830-1 is shown in detail. The first S-box portion 830-1 includes an S-box circuit 803, which includes a multiplication inverse circuit 810 and an affine transformation circuit 811. The S-box circuit can be the same or similar to the S-box circuits described elsewhere herein, or other types of S-box circuits known in the art can alternatively be used. The first S-box portion also includes an error detection circuit 801 coupled to the S-box circuit 803. In some embodiments, the error detection circuit can be coupled to Figure 3 , Figure 4 or Figure 5. Alternatively, other types of error detection circuits based on the multiplication inverse characteristic to detect errors may be optionally used. Error detection circuit 801 may output error signal 812. There may be fifteen other S-box parts that are optionally similar to the first S-box part. Each of the other fifteen S-box parts may similarly output an error signal, which is not shown for simplicity of illustration. Fifteen additional error signals may be output simultaneously from fifteen additional error detection circuits similar to error detection circuit 801, but each error signal corresponds to a different one of the fifteen additional 8-bit inputs to be input to the corresponding S-box part. These error signals 847 may be stored in one or more registers or other storage devices 845.
[0080] Also shown are mixing column circuits 805 and key adding circuits 802 for adding round keys. The key adding circuits may output 128-bit round output data 809 for the round, which may be stored in (one or more) registers or other storage devices 845. Also shown are error detection circuits, which include predictive parity circuits 837, computed parity circuits 838, comparison circuits 839, and error signal combining circuits 831. The predictive parity circuits may optionally be used with Figure 7 The predicted parity circuit 737B of 840 may be the same or similar. The predicted parity circuit may calculate predicted parity bits 840 for one or more post-multiplication inverse AES operations (e.g., affine transformation, mixing columns, adding round keys, or any combination thereof). The predicted parity bits 840 may be stored in (one or more) registers or other storage devices 845.
[0081] The calculation parity circuit can receive 128-bit round output data 809 from (one or more) registers or other storage devices 845 and can calculate parity bits based on the data. The calculated parity can be calculated at a byte granularity so that there can be sixteen calculated parity bits. The comparison circuit 839 can receive the sixteen calculated parity bits from the calculation parity circuit, can receive the sixteen predicted parity bits 840 from (one or more) registers or other storage devices 845, can compare the sixteen calculated parity bits and the sixteen predicted parity bits, and can provide sixteen corresponding parity error signals 846 (e.g., sixteen 1-bit error signals) to the error signal combination circuit 831. The error signal combination circuit 831 can logically OR (e.g., using an OR tree) or otherwise combine the sixteen parity error signals 846 and the sixteen error signals 847 from the sixteen S-box portions to generate a combined round error signal 832 (e.g., a 1-bit error signal) for each AES operation round. Where error reporting is performed over multiple rounds, the combined round error signal 832 may subsequently be processed or otherwise combined with the combined round error signals of one or more or all subsequent rounds of AES.
[0082] Now, in some embodiments, the available timing margin for the error detection circuit may be greater than the available timing margin for the AES round circuit. In some embodiments, the error signal combination circuit 831 may combine the sixteen parity error signals 846 and the sixteen error signals 847 in a subsequent clock cycle when the 128-bit round data 809 is generated to generate a combined round error signal 832. As shown in the illustrated embodiment, in some embodiments, in addition to this, the comparison circuit 839 may compare the sixteen calculated parity bits from the calculation parity bit circuit 838 and the sixteen predicted parity bits 840 in a subsequent clock cycle when the 128-bit round data 809 is generated. As shown in the illustrated embodiment, in some embodiments, in addition to these two, the calculation parity circuit 838 may receive the 128-bit round output data 809 from (one or more) registers or other storage devices 845, and may calculate the parity bits based on the 128-bit round output data 809 in a subsequent clock cycle when the 128-bit round data 809 is generated. In some embodiments, during the same clock cycle, the AES round circuit (e.g., S-box circuit, mixing column circuit, key addition circuit, etc.) receives the S-box signal, compared to any delay of the error generation circuit. in The 128-bit input data of [7:0] to the output 128-bit output data 809 may have a greater delay.
[0083] AES and other cryptographic units can be used in different ways and in different contexts. Figures 9 to 11Several representative examples are illustrated, but the scope of the present disclosure is not limited thereto.
[0084] Fig. 9 985 is a block diagram of a system 985 that uses an AES cryptographic unit 900 to provide memory encryption. The system includes a processor 986, an AES cryptographic unit 900, and a memory 988. The AES cryptographic unit may optionally be included in or otherwise associated with a memory controller 987. The AES cryptographic unit may be used to encrypt unencrypted data 990 received from the processor and store corresponding encrypted data 991 in the memory. The AES cryptographic unit may also be used to decrypt encrypted data 991 received from the memory and provide corresponding decrypted data 990 to the processor. A similar system is envisioned in which an AES cryptographic unit is used to exchange encrypted data with an input / output device (not shown) instead of a memory. In some embodiments, the system may include an error detection circuit 901 (e.g., any error detection circuit disclosed herein) associated with the AES cryptographic unit for detecting an error (e.g., caused by a voltage glitch or other fault injection attack) and providing an error signal 912 indicating the error.
[0085] Fig.10 1086 is a block diagram of a processor 1086 having an AES cipher unit 1000 for encrypting and decrypting data. The processor may be a general purpose processor (e.g., a central processing unit (CPU) core) or a special purpose processor (e.g., a graphics processing unit (GPU), a cryptographic processor, a network processor, a communications processor, etc.). The processor includes a decoding unit 1088 for decoding an AES instruction 1087. The AES instruction may specify that one or more encryption or decryption rounds or only a portion of an encryption or decryption round (e.g., an S-box or inverse S-box operation) is to be performed. For example, the instruction may specify that any of the following items (to name a few examples) be performed: a single encryption round, a single decryption round, a single encryption last round, a single decryption last round, all operations of a single encryption round except for a mix column operation, only mix column operations, all operations of a single decryption round except for an inverse mix column operation, only inverse mix column operations, only substitution box (S-box) operations, only inverse S-box operations, 10, 12, or 14 encryption rounds, or 10, 12, or 14 decryption rounds. The AES instructions may represent macroinstructions, machine code instructions, or other instructions of the processor's instruction set.
[0086] The processor also includes an AES cryptographic unit 1000 for performing an encryption or decryption operation specified by the instruction. For encryption, the AES cryptographic unit may encrypt input unencrypted data 1090 to generate corresponding output encrypted data 1091. For decryption, the AES cryptographic unit may be used to decrypt the input encrypted data 1091 to generate corresponding output decrypted data 1090. As shown, the unencrypted data and the encrypted data may optionally be stored in a register 1089 of the processor. Alternatively, one or more of the unencrypted data and the encrypted data may optionally be stored in a memory (not shown). In some embodiments, the system may include an error detection circuit 1001 (e.g., any error detection circuit disclosed herein) associated with the AES cryptographic unit for detecting an error (e.g., caused by a voltage glitch or other fault injection attack) and providing an error signal 1012 indicating the error.
[0087] Fig.11 1 is a block diagram of a processor 1186 having an S-box unit 1103 for encrypting and decrypting data. The processor may be a general purpose processor or a special purpose processor as described above. The processor includes a decoding unit 1188 for decoding an S-box instruction 1187. The S-box instruction may specify that an S-box operation or an inverse S-box operation is to be performed. The S-box unit may perform an S-box or inverse S-box operation as specified by the instruction. For encryption, the S-box unit may be used to encrypt input unencrypted data 1190 to generate corresponding output encrypted data 1191 (e.g., encrypted by an S-box operation). For decryption, the S-box unit may be used to decrypt input encrypted data 1191 to generate corresponding output decrypted data 1190 (e.g., decrypted by an inverse S-box operation). The unencrypted data and the encrypted data may optionally be stored in registers 1189 of the processor, or one or more of them may optionally be stored in a memory (not shown). In some embodiments, the system may include an error detection circuit 1101 associated with the S-box unit (e.g., Figures 3 to 6 An error detection circuit of any one of the foregoing) is used to detect an error in an S-box unit (eg, caused by a voltage glitch or other fault injection attack) and provide an error signal 1112 indicating the error.
[0088] The scope of the present disclosure is not limited to providing error detection capabilities for all AES operations. In some embodiments, protection may be provided only for S-box operations. S-box operations typically represent a significant portion of the overall AES logic, and providing error detection for S-box operations is useful, regardless of whether error detection is provided for other AES operations. In addition, as described above, some instruction sets may include S-box instructions and associated S-box units as execution units, and in such cases, error detection may optionally be selectively applied to such S-box units, without being applied to other AES circuits.
[0089] Although embodiments have been described herein in the context of AES, the scope of the present disclosure is not limited to AES. Other existing or future cryptographic algorithms may have similar features that allow the methods described herein to be used or adapted for use with these other cryptographic algorithms. For example, SMS4 is a cryptographic algorithm for wireless networks promoted by the Chinese government that also has S-boxes with multiplicative inverse properties. Embodiments similar to the embodiments disclosed herein may be applied to SMS4 similarly to AES. Other embodiments of the embodiments disclosed herein may be applied to the Camellia block encryption algorithm.
[0090] Example computer architecture.
[0091] The following describes in detail an example computer architecture. Other system designs and configurations known in the art for laptop, desktop and handheld personal computers (PCs), personal digital assistants, engineering workstations, servers, decomposed servers, network devices, network hubs, switches, routers, embedded processors, digital signal processors (DSPs), graphics devices, video game devices, set-top boxes, microcontrollers, cellular phones, portable media players, handheld devices, and various other electronic devices are also suitable. Generally, various systems or electronic devices that can incorporate processors and / or other execution logic disclosed herein are generally suitable.
[0092] Fig.12 An example computing system is illustrated. Multiprocessor system 1200 is an interface system and includes multiple processors or cores, including a first processor 1270 and a second processor 1280 coupled via an interface 1250 such as a point-to-point (PP) interconnect, structure and / or bus. In some examples, first processor 1270 and second processor 1280 are isomorphic. In some examples, first processor 1270 and second processor 1280 are heterogeneous. Although example system 1200 is shown as having two processors, the system can have three or more processors, or can be a single processor system. In some examples, the computing system is a system on chip (SoC).
[0093] Processors 1270 and 1280 are shown to include integrated memory controller (IMC) circuits 1272 and 1282, respectively. Processor 1270 also includes interface circuits 1276 and 1278; similarly, second processor 1280 includes interface circuits 1286 and 1288. Processors 1270, 1280 may exchange information via interface 1250 using interface circuits 1278, 1288. IMCs 1272 and 1282 couple processors 1270, 1280 to respective memories, namely memory 1232 and memory 1234, which may be portions of main memory locally attached to the respective processors.
[0094] Processors 1270, 1280 may each exchange information with a network interface (NW I / F) 1290 via separate interfaces 1252, 1254 using interface circuits 1276, 1294, 1286, 1298. Network interface 1290 (e.g., one or more of an interconnect, bus, and / or fabric, and in some examples a chipset) may optionally exchange information with a coprocessor 1238 via interface circuit 1292. In some examples, coprocessor 1238 is a special-purpose processor such as, for example, a high-throughput processor, a network or communication processor, a compression engine, a graphics processor, a general-purpose graphics processing unit (GPGPU), a neural network processing unit (NPU), an embedded processor, and the like.
[0095] A shared cache (not shown) may be included in either processor 1270, 1280 or external to both processors but connected to the processors via an interface such as a PP interconnect so that if the processors are placed in a low power mode, local cache information of either or both of the two processors may be stored in the shared cache.
[0096] The network interface 1290 may be coupled to the first interface 1216 via the interface circuit 1296. In some examples, the first interface 1216 may be an interface such as a peripheral component interconnect (PCI), a PCI Express interconnect, or another I / O interconnect. In some examples, the first interface 1216 is coupled to a power control unit (PCU) 1217, which may include circuits, software, and / or firmware that perform power management operations with respect to the processors 1270, 1280, and / or the coprocessor 1238. The PCU 1217 provides control information to a voltage regulator (not shown) so that the voltage regulator generates an appropriate regulated voltage. The PCU 1217 also provides control information that controls the generated operating voltage. In various examples, the PCU 1217 may include various power management logic units (circuits) that perform hardware-based power management. Such power management may be fully processor-controlled (e.g., through various processor hardware, and it may be triggered by workload and / or power, thermal, or other processor constraints) and / or power management may be performed in response to an external source (such as a platform or power management source or system software).
[0097] PCU 1217 is illustrated as existing as logic separate from processor 1270 and / or processor 1280. In other cases, PCU 1217 may execute on a given one or more of the cores (not shown) of processors 1270 or 1280. In some cases, PCU 1217 may be implemented as a microcontroller (dedicated or general purpose) or other control logic that is configured to execute its own dedicated power management code, sometimes referred to as P-code. In other examples, the power management operations to be performed by PCU 1217 may be implemented external to the processor, such as by a separate power management integrated circuit (PMIC) or another component external to the processor. In other examples, the power management operations to be performed by PCU 1217 may be implemented in BIOS or other system software.
[0098] Various I / O devices 1214 may be coupled to the first interface 1216 along with a bus bridge 1218 that couples the first interface 1216 to the second interface 1220. In some examples, one or more additional processors 1215 such as a coprocessor, a high throughput integrated many core (MIC) processor, a GPGPU, an accelerator (such as a graphics accelerator or a digital signal processing (DSP) unit), a field programmable gate array (FPGA), or any other processor are coupled to the first interface 1216. In some examples, the second interface 1220 may be a low pin count (LPC) interface. Various devices may be coupled to the second interface 1220, including, for example, a keyboard and / or mouse 1222, a communication device 1227, and a storage circuit 1228. The storage circuit 1228 may be one or more non-transitory machine-readable storage media as described below, such as a disk drive or other mass storage device, which may include instructions / codes and data 1230 and may implement the storage device 845 in some examples. Further, an audio I / O 1224 may be coupled to the second interface 1220. It should be noted that other architectures besides the point-to-point architecture described above are also possible. For example, instead of a point-to-point architecture, a system such as multiprocessor system 1200 may implement a multi-point interface or other such architecture.
[0099] Example core architectures, processors, and computer architectures.
[0100] Processor cores may be implemented in different ways, for different purposes, and in different processors. For example, implementations of such cores may include: 1) a general-purpose in-order core intended for general-purpose computing; 2) a high-performance general-purpose out-of-order core intended for general-purpose computing; 3) a special-purpose core intended primarily for graphics and / or scientific (throughput) computing. Different processor implementations may include: 1) a CPU including one or more general-purpose in-order cores intended for general-purpose computing and / or one or more general-purpose out-of-order cores intended for general-purpose computing; and 2) a coprocessor including one or more special-purpose cores intended primarily for graphics and / or scientific (throughput) computing. Such different processors lead to different computer system architectures, which may include: 1) a coprocessor on a separate chip from the CPU; 2) a coprocessor on a separate die in the same package as the CPU; 3) a coprocessor on the same die as the CPU (in which case such coprocessors are sometimes referred to as dedicated logic, such as integrated graphics and / or scientific (throughput) logic, or as dedicated cores); and 4) a system on a chip (SoC), which may be included on the same die as the CPU (sometimes referred to as application core(s) or application processor(s), the coprocessors described above, and additional functionality. An example core architecture is described next, followed by a description of an example processor and computer architecture.
[0101] Fig.13 A block diagram of an example processor and / or SoC 1300 that may have one or more cores and an integrated memory controller is illustrated. The solid lined box illustrates a processor 1300 having a single core 1302(A), a system agent unit circuit 1310, and a set of one or more interface controller unit circuits 1316, while the optional addition of the dashed lined box illustrates an alternative processor 1300 having multiple cores 1302(A)-(N), a set of one or more integrated memory controller unit circuits 1314 and dedicated logic 1308 in the system agent unit circuit 1310, and a set of one or more interface controller unit circuits 1316. It should be noted that the processor 1300 may be one of the processors 1270 or 1280, or may be a processor 1270 or 1280. Fig.12 coprocessor 1238 or 1215.
[0102] Thus, different implementations of processor 1300 may include: 1) a CPU having: dedicated logic 1308, which is integrated graphics and / or scientific (throughput) logic (which may include one or more cores, not shown); and cores 1302(A)-(N), which are one or more general purpose cores (e.g., general purpose in-order cores, general purpose out-of-order cores, or a combination of both); 2) a coprocessor having cores 1302(A)-(N), which are a large number of dedicated cores primarily intended for graphics and / or scientific (throughput); and 3) a coprocessor having cores 1302(A)-(N), which are a large number of general purpose in-order cores. Thus, processor 1300 may be a general purpose processor, a coprocessor, or a dedicated processor, such as, for example, a network or communications processor, a compression engine, a graphics processor, a GPGPU (general purpose graphics processing unit), a high throughput many integrated core (MIC) coprocessor (including 30 or more cores), an embedded processor, etc. The processor may be implemented on one or more chips. Processor 1300 may be part of and / or may be implemented on one or more substrates using any of a variety of process technologies, such as, for example, complementary metal oxide semiconductor (CMOS), bipolar CMOS (BiCMOS), P-type metal oxide semiconductor (PMOS), or N-type metal oxide semiconductor (NMOS).
[0103] The memory hierarchy includes one or more levels of cache cell circuits 1304(A)-(N) within the cores 1302(A)-(N), a set of one or more shared cache cell circuits 1306, and external memory (not shown) coupled to the set of (one or more) integrated memory controller unit circuits 1314. The set of one or more shared cache cell circuits 1306 may include one or more mid-level caches, such as level 2 (L2), level 3 (L3), level 4 (L4), or other levels of cache (such as a last level cache (LLC)), and / or combinations thereof. While in some examples, an interface network circuit 1312 (e.g., a ring interconnect) interfaces with dedicated logic 1308 (e.g., integrated graphics logic), the set of (one or more) shared cache cell circuits 1306, and the system agent unit circuit 1310, alternative examples use any number of well-known techniques to interface with such units. In some examples, coherency is maintained between the (one or more) shared cache cell circuits 1306 and one or more of the cores 1302(A)-(N). In some examples, interface controller unit circuit 1316 couples core 1302 to one or more other devices 1318, such as one or more I / O devices, storage devices, one or more communication devices (e.g., wireless networking, wired networking, etc.), and the like.
[0104] In some examples, one or more of the cores 1302(A)-(N) are capable of multithreading. System agent unit circuitry 1310 includes those components that coordinate and operate the cores 1302(A)-(N). System agent unit circuitry 1310 may include, for example, power control unit (PCU) circuitry and / or display unit circuitry (not shown). The PCU may be or may include logic and components required to regulate the power state of the cores 1302(A)-(N) and / or the dedicated logic 1308 (e.g., integrated graphics logic). The display unit circuitry is used to drive one or more externally connected displays.
[0105] The cores 1302(A)-(N) may be homogeneous in terms of instruction set architecture (ISA). Alternatively, the cores 1302(A)-(N) may be heterogeneous in terms of ISA; that is, a subset of the cores 1302(A)-(N) may be capable of executing an ISA, while other cores may be capable of executing only a subset of that ISA or another ISA.
[0106] Example core architectures - in-order and out-of-order core block diagrams.
[0107] FIG. 14(A) is a block diagram illustrating both an example in-order pipeline and an example register renaming, out-of-order issue / execution pipeline according to an example. FIG. 14(B) is a block diagram illustrating both an example in-order architecture core and an example register renaming, out-of-order issue / execution architecture core to be included in a processor according to an example. The solid line boxes in FIG. 14(A) to FIG. 14(B) illustrate the in-order pipeline and the in-order core, while the optional addition of the dashed line boxes illustrates the register renaming, out-of-order issue / execution pipeline and the core. Considering that the in-order aspect is a subset of the out-of-order aspect, the out-of-order aspect will be described.
[0108] In FIG. 14(A), a processor pipeline 1400 includes an acquisition stage 1402, an optional length decoding stage 1404, a decoding stage 1406, an optional allocation (Alloc) stage 1408, an optional renaming stage 1410, a scheduling (also referred to as dispatch or issue) stage 1412, an optional register read / memory read stage 1414, an execution stage 1416, a write-back / memory write stage 1418, an optional exception handling stage 1422, and an optional submission stage 1424. One or more operations may be performed in each of these processor pipeline stages. For example, during the acquisition stage 1402, one or more instructions are acquired from the instruction memory, and during the decoding stage 1406, one or more acquired instructions may be decoded, an address using a forwarded register port (e.g., a load storage unit (LSU) address) may be generated, and branch forwarding (e.g., an immediate offset or a link register (LR)) may be performed. In one example, the decoding stage 1406 and the register read / memory read stage 1414 may be combined into one pipeline stage. In one example, during the execute stage 1416, decoded instructions may be executed, LSU address / data pipelining to an advanced microcontroller bus (AMB) interface may be performed, multiplication and addition operations may be performed, arithmetic operations with branch results may be performed, and the like.
[0109] By way of example, the example register renaming, out-of-order issue / execution architecture core of FIG. 14(B) may implement pipeline 1400 as follows: 1) instruction fetch circuit 1438 performs fetch and length decode stages 1402 and 1404; 2) decode circuit 1440 performs decode stage 1406; 3) rename / allocator unit circuit 1452 performs allocation stage 1408 and rename stage 1410; 4) (one or more) scheduler circuit 1456 performs scheduling stage 1412; 5) (one or more) physical registers 1414 and 1415; 6) instruction fetch circuit 1438 performs fetch and length decode stages 1402 and 1404; 7) decode circuit 1440 performs decoding stage 1406; 8) rename / allocator unit circuit 1452 performs allocation stage 1408 and rename stage 1410; 9) (one or more) scheduler circuit 1456 performs scheduling stage 1412; 10) (one or more) physical registers 1414 and 1415; The register stack circuit 1458 and the memory unit circuit 1470 perform a register read / memory read stage 1414; (one or more) execution clusters 1460 execute stage 1416; 6) the memory unit circuit 1470 and (one or more) physical register stack circuits 1458 perform a write back / memory write stage 1418; 7) various circuits may be involved in the exception handling stage 1422; and 8) the retirement unit circuit 1454 and (one or more) physical register stack circuits 1458 perform a commit stage 1424.
[0110] 14(B) shows a processor core 1490, which includes a front end unit circuit 1430 coupled to an execution engine unit circuit 1450, and both are coupled to a memory unit circuit 1470. The core 1490 can be a reduced instruction set architecture computing (RISC) core, a complex instruction set architecture computing (CISC) core, a very long instruction word (VLIW) core, or a hybrid or alternative core type. As another option, the core 1490 can be a dedicated core, such as, for example, a network or communication core, a compression engine, a coprocessor core, a general purpose computing graphics processing unit (GPGPU) core, a graphics core, etc.
[0111] The front end unit circuit 1430 may include a branch prediction circuit 1432 coupled to an instruction cache circuit 1434, which is coupled to an instruction translation lookaside buffer (TLB) 1436, which is coupled to an instruction fetch circuit 1438, which is coupled to a decoding circuit 1440. In one example, the instruction cache circuit 1434 is included in the memory unit circuit 1470 instead of the front end circuit 1430. The decoding circuit 1440 (or decoder) can decode the instruction and generate one or more micro-operations, microcode entry points, microinstructions, other instructions or other control signals as output, which are decoded from the original instruction or otherwise reflect the original instruction or are derived from the original instruction. The decoding circuit 1440 may also include an address generation unit (AGU, not shown) circuit. In one example, the AGU generates an LSU address using a forwarded register port, and may further perform branch forwarding (e.g., immediate offset branch forwarding, LR register branch forwarding, etc.). The decoding circuit 1440 can be implemented using a variety of different mechanisms. Examples of suitable mechanisms include, but are not limited to, lookup tables, hardware implementations, programmable logic arrays (PLAs), microcode read-only memories (ROMs), etc. In one example, core 1490 includes a microcode ROM (not shown) or other medium that stores microcode for certain macroinstructions (e.g., in decode circuitry 1440 or otherwise within front-end circuitry 1430). In one example, decode circuitry 1440 includes a micro-op or operation cache (not shown) to hold / cache decode operations, micro-tags, or micro-ops generated during decode or other stages of processor pipeline 1400. Decode circuitry 1440 may be coupled to rename / allocator unit circuitry 1452 in execution engine circuitry 1450.
[0112] The execution engine circuitry 1450 includes a rename / allocator unit circuitry 1452 coupled to a retirement unit circuitry 1454 and a set of one or more scheduler circuits 1456. The scheduler circuitry 1456 represents any number of different schedulers, including reservation stations, a central instruction window, and the like. In some examples, the scheduler circuitry 1456 may include an arithmetic logic unit (ALU) scheduler / scheduling circuit, an ALU queue, an address generation unit (AGU) scheduler / scheduling circuit, an AGU queue, and the like. The scheduler circuitry 1456 is coupled to a physical register file(s) circuitry 1458. Each of the physical register file(s) circuitry 1458 represents one or more physical register files, where different physical register files store one or more different data types, such as scalar integers, scalar floating points, packed integers, packed floating points, vector integers, vector floating points, status (e.g., an instruction pointer that is the address of the next instruction to be executed), and the like. In one example, the (one or more) physical register file circuits 1458 include vector register unit circuits, write mask register unit circuits, and scalar register unit circuits. These register units can provide architectural vector registers, vector mask registers, general registers, etc. The (one or more) physical register file circuits 1458 are coupled to the retirement unit circuit 1454 (also called a retirement queue) to illustrate various ways in which register renaming and out-of-order execution can be implemented (e.g., using (one or more) reorder buffers (ROBs) and (one or more) retirement register files; using (one or more) future stacks, (one or more) history buffers, and (one or more) retirement register files; using register maps and register pools, etc.). The retirement unit circuit 1454 and the (one or more) physical register file circuits 1458 are coupled to the (one or more) execution clusters 1460. The (one or more) execution clusters 1460 include a set of one or more execution unit circuits 1462 and a set of one or more memory access circuits 1464. Execution unit circuit(s) 1462 may perform various arithmetic, logical, floating point, or other types of operations (e.g., shifts, additions, subtractions, multiplications) on various types of data (e.g., scalar integer, scalar floating point, packed integer, packed floating point, vector integer, vector floating point). While some examples may include multiple execution units or execution unit circuits dedicated to a particular function or set of functions, other examples may include only one execution unit circuit or multiple execution units / execution unit circuits that all perform all functions.Scheduler circuit(s) 1456, physical register file(s) circuit(s) 1458, and execution cluster(s) 1460 are shown as possibly multiple because certain examples create separate pipelines for certain types of data / operations (e.g., a scalar integer pipeline, scalar floating point / packed integer / packed floating point / vector integer / vector floating point pipeline, and / or memory access pipeline, each with its own scheduler circuit(s), physical register file(s) circuit(s), and / or execution cluster—and in the case of a separate memory access pipeline, certain examples are implemented where only the execution cluster of that pipeline has memory access unit(s) circuit(s) 1464). It should also be understood that where separate pipelines are used, one or more of these pipelines may be out-of-order issue / execution, while the rest are in-order.
[0113] In some examples, execution engine unit circuit 1450 may perform load store unit (LSU) address / data pipelining, as well as address stage and writeback, data stage loads, stores, and branches to an advanced microcontroller bus (AMB) interface (not shown).
[0114] The set of memory access circuits 1464 is coupled to the memory cell circuit 1470, which includes a data TLB circuit 1472 coupled to a data cache circuit 1474, which is coupled to a level 2 (L2) cache circuit 1476. In one example, the memory access circuit 1464 may include a load unit circuit, a store address unit circuit, and a store data unit circuit, each of which is coupled to the data TLB circuit 1472 in the memory cell circuit 1470. The instruction cache circuit 1434 is also coupled to the level 2 (L2) cache circuit 1476 in the memory cell circuit 1470. In one example, the instruction cache 1434 and the data cache 1474 are combined into a single instruction and data cache (not shown) in the L2 cache circuit 1476, the level 3 (L3) cache circuit (not shown), and / or the main memory. The L2 cache circuit 1476 is coupled to one or more other levels of cache and ultimately to the main memory.
[0115] Core 1490 may support one or more instruction sets (e.g., x86 instruction set architecture (optionally with some extensions that have been added to newer versions); MIPS instruction set architecture; ARM instruction set architecture (optionally with optional additional extensions such as NEON)), including the instruction(s) described herein. In one example, core 1490 includes logic to support packed data instruction set architecture extensions (e.g., AVX1, AVX2), allowing operations used by many multimedia applications to be performed using packed data.
[0116] Example execution unit circuit(s).
[0117] Fig.15 An example of (one or more) execution unit circuits such as (one or more) execution unit circuits 1462 of FIG. 14 (B) is illustrated. As illustrated, (one or more) execution unit circuits 1462 may include one or more ALU circuits 1501, optional vector / single instruction multiple data (SIMD) circuits 1503, load / store circuits 1505, branch / jump circuits 1507, and / or floating point unit (FPU) circuits 1509. ALU circuits 1501 perform integer operations and / or Boolean operations. Vector / SIMD circuits 1503 perform vector / SIMD operations on packed data (such as SIMD / vector registers). Load / store circuits 1505 execute load and store instructions to load data from memory into registers or store data from registers to memory. Load / store circuits 1505 may also generate addresses. Branch / jump circuits 1507 cause branches or jumps to memory addresses according to instructions. FPU circuits 1509 perform floating point operations. The width of execution unit circuit(s) 1462 varies according to examples, and may range, for example, from 16 bits to 1024 bits. In some examples, two or more smaller execution units are logically combined to form a larger execution unit (e.g., two 128-bit execution units are logically combined to form a 256-bit execution unit).
[0118] Example register architecture.
[0119] Fig.16 1 is a block diagram of a register architecture 1600 according to some examples. As illustrated, the register architecture 1600 includes a vector / SIMD register 1610 that varies from a 128-bit width to a 1024-bit width. In some examples, the vector / SIMD register 1610 is physically 512 bits, and according to the mapping, only some of the lower bits are used. For example, in some examples, the vector / SIMD register 1610 is a 512-bit ZMM register: the lower 256 bits are used for the YMM register, and the lower 128 bits are used for the XMM register. It can be seen that there is an overlay of registers. In some examples, the vector length field selects between the maximum length and one or more other shorter lengths, wherein each such shorter length is half of the previous length. Scalar operations are operations performed on the lowest bit data element position in the ZMM / YMM / XMM register; according to the example, the higher bit data element positions are either the same as they were before the instruction, or are reset to zero.
[0120] In some examples, the register architecture 1600 includes a write mask / predicate register 1615. For example, in some examples, there are 8 write mask / predicate registers (sometimes referred to as k0 to k7), each of which is 16 bits, 32 bits, 64 bits, or 128 bits in size. The write mask / predicate register 1615 may allow merging (e.g., allowing any set of elements in the destination to be protected from updates during the execution of any operation) and / or zeroing (e.g., zeroing the vector mask allows any set of elements in the destination to be zeroed during the execution of any operation). In some examples, each data element position in a given write mask / predicate register 1615 corresponds to a data element position in the destination. In other examples, the write mask / predicate register 1615 is scalable and consists of a set number of enable bits for a given vector element (e.g., 8 enable bits per 64-bit vector element).
[0121] The register architecture 1600 includes a plurality of general registers 1625. These registers may be 16-bit, 32-bit, 64-bit, etc., and may be used for scalar operations. In some examples, these registers are referenced by the names RAX, RBX, RCX, RDX, RBP, RSI, RDI, RSP, and R8 to R15.
[0122] In some examples, register architecture 1600 includes a scalar floating point (FP) register file 1645, which is used to perform scalar floating point operations on 32 / 64 / 80-bit floating point data using x87 instruction set architecture extensions, or used as MMX registers to perform operations on 64-bit packed integer data, and to hold operands for some operations performed between MMX and XMM registers.
[0123] One or more flag registers 1640 (e.g., EFLAGS, RFLAGS, etc.) store status and control information for arithmetic, comparison, and system operations. For example, one or more flag registers 1640 can store condition code information such as carry, parity, auxiliary carry, zero, sign, and overflow. In some examples, one or more flag registers 1640 are referred to as program status and control registers.
[0124] Segment registers 1620 contain segment points for accessing memory. In some examples, these registers are referenced by the names CS, DS, SS, ES, FS, and GS.
[0125] Machine specific registers (MSRs) 1635 control and report processor performance. Most MSRs 1635 handle system-related functions and are not accessible to applications. Machine check registers 1660 include control, status, and error reporting MSRs used to detect and report hardware errors.
[0126] One or more instruction pointer registers 1630 store instruction pointer values. Control register(s) 1655 (e.g., CR0-CR4) determine the operating mode of a processor (e.g., processors 1270, 1280, 1238, 1215, and / or 1300) and the characteristics of the currently executing task. Debug registers 1650 control and allow monitoring of debug operations of a processor or core.
[0127] Memory (mem) management registers 1665 specify the location of data structures used in protected mode memory management. These registers may include the global descriptor table register (GDTR), the interrupt descriptor table register (IDTR), the task register, and the local descriptor table register (LDTR).
[0128] Alternative examples may use wider or narrower registers. In addition, alternative examples may use more, fewer, or different register files and registers. The register architecture 1600 may be used, for example, in a register file / memory or (one or more) physical register file circuits 1458.
[0129] Instruction set architecture.
[0130] Instruction set architecture (ISA) can include one or more instruction formats. A given instruction format can define various fields (e.g., the number of bits, the position of bits) to specify the operation to be performed (e.g., opcode) and the (one or more) operands and / or (one or more) other data fields (e.g., mask) etc. to be performed on it. Some instruction formats are further decomposed by the definition of instruction templates (or subformats). For example, the instruction templates of a given instruction format can be defined as having different subsets of the fields of the instruction format (the included fields are usually in the same order, but at least some fields have different bit positions because fewer fields are included) and / or defined as having given fields interpreted differently. Thus, each instruction of the ISA is expressed using a given instruction format (and if defined, in a given one of the instruction templates of the instruction format), and includes fields for specifying operations and operands. For example, the example ADD instruction has a specific opcode and instruction format, the instruction format includes an opcode field that specifies the opcode and an operand field that selects operands (source 1 / destination and source 2); and the occurrence of this ADD instruction in the instruction stream will have specific content in the operand field that selects the specific operand. In addition, although the following description is made in the context of the x86 ISA, it is within the knowledge of those skilled in the art to apply the teachings of the present disclosure in another ISA.
[0131] Example instruction format.
[0132] The examples of (one or more) instructions described herein may be implemented in different formats. In addition, example systems, architectures, and pipelines are described in detail below. The examples of (one or more) instructions may be executed on such systems, architectures, and pipelines, but are not limited to those described in detail.
[0133] Fig.17 An example of an instruction format is illustrated. As illustrated, an instruction may include multiple components, including, but not limited to, one or more fields for: one or more prefixes 1701, an opcode 1703, addressing information 1705 (e.g., a register identifier, memory addressing information, etc.), a displacement value 1707, and / or an immediate value 1709. It should be noted that some instructions utilize some or all of the fields of the format, while other instructions may only use the opcode 1703 field. In some examples, the illustrated order is the order in which the fields are to be encoded, however, it should be understood that in other examples, the fields may be encoded in a different order, combined, etc.
[0134] (One or more) prefix fields 1701 modify instructions when used. In some examples, one or more prefixes are used to repeat string instructions (e.g., 0xF0, 0xF2, 0xF3, etc.), to provide partial coverage (e.g., 0x2E, 0x36, 0x3E, 0x26, 0x64, 0x65, 0x2E, 0x3E, etc.), perform bus lock operations, and / or change operands (e.g., 0x66) and address sizes (e.g., 0x67). Certain instructions require mandatory prefixes (e.g., 0x66, 0xF2, 0xF3, etc.). Some of these prefixes can be considered "traditional" prefixes. Other prefixes (one or more examples of which are described in detail herein) indicate and / or provide further capabilities, such as specifying specific registers, etc. Other prefixes generally follow the "traditional" prefix.
[0135] The opcode field 1703 is used to at least partially define the operation to be performed when decoding the instruction. In some examples, the length of the primary opcode encoded in the opcode field 1703 is one, two, or three bytes. In other examples, the primary opcode can be a different length. Sometimes an additional 3-bit opcode field is encoded in another field.
[0136] The addressing information field 1705 is used to address one or more operands of the instruction, such as a location in memory or one or more registers. Fig.18An example of an addressing information field 1705 is illustrated. In this illustration, an optional MOD R / M byte 1802 and an optional scale, index, base (SIB) byte 1804 are shown. The MOD R / M byte 1802 and SIB byte 1804 are used to encode up to two operands of the instruction, each operand being a direct register or an effective memory address. It should be noted that both of these fields are optional, as not all instructions include one or more of these fields. The MOD R / M byte 1802 includes a MOD field 1842, a register (reg) field 1844, and an R / M field 1846.
[0137] The content of MOD field 1842 distinguishes between memory access and non-memory access modes. In some examples, when MOD field 1842 has a binary value of 11 (11b), register direct addressing mode is used, otherwise register indirect addressing mode is used.
[0138] Register field 1844 may encode a destination register operand or a source register operand, or may encode an opcode extension and is not used to encode any instruction operand. The contents of register field 1844 specify the location (in a register or in memory) of the source or destination operand directly or through address generation. In some examples, register field 1844 is supplemented with additional bits from a prefix (e.g., prefix 1701) to allow for greater addressing.
[0139] R / M field 1846 may be used to encode an instruction operand that references a memory address, or may be used to encode a destination register operand or a source register operand. Note that in some examples, R / M field 1846 may be combined with MOD field 1842 to indicate an addressing mode.
[0140] SIB byte 1804 includes a scaling field 1852, an index field 1854, and a base address field 1856 used in the generation of the address. Scaling field 1852 indicates a scaling factor. Index field 1854 specifies the index register to be used. In some examples, index field 1854 is supplemented with additional bits from a prefix (e.g., prefix 1701) to allow for larger addressing. Base address field 1856 specifies the base address register to be used. In some examples, base address field 1856 is supplemented with additional bits from a prefix (e.g., prefix 1701) to allow for larger addressing. In practice, the contents of scaling field 1852 allow the contents of index field 1854 to be scaled for memory address generation (e.g., for use with 2 缩放 * address generation of index + base address).
[0141] Some addressing forms use displacement values to generate memory addresses. For example,缩放 The memory address may be generated by using a *index+base+displacement, index*scale+displacement, r / m+displacement, instruction pointer (RIP / EIP)+displacement, register+displacement, etc. The displacement may be a value of 1 byte, 2 bytes, 4 bytes, etc. In some examples, the displacement field 1707 provides the value. Additionally, in some examples, the displacement factor is encoded in the MOD field of the addressing information field 1705, which indicates a compressed displacement scheme for which the displacement value is calculated and stored in the displacement field 1707.
[0142] In some examples, the immediate value field 1709 specifies the immediate value of the instruction. The immediate value may be encoded as a 1-byte value, a 2-byte value, a 4-byte value, etc.
[0143] Fig.19 An example of a first prefix 1701(A) is illustrated. In some examples, the first prefix 1701(A) is an example of a REX prefix. Instructions using this prefix can specify general registers, 64-bit packed data registers (e.g., single instruction multiple data (SIMD) registers or vector registers), and / or control registers and debug registers (e.g., CR8-CR15 and DR8-DR15).
[0144] Instructions using the first prefix 1701(A) can specify up to three registers using 3-bit fields depending on the format: 1) using the register field 1844 and the R / M field 1846 of the MOD R / M byte 1802; 2) using the MODR / M byte 1802 with the SIB byte 1804, including using the register field 1844 as well as the base field 1856 and the index field 1854; or 3) using the register field of the opcode.
[0145] In the first prefix 1701 (A), bit positions 7:4 are set to 0100. Bit position 3 (W) can be used to determine the operand size, but can determine more than just the operand width. It can be seen that when W=0, the operand size is determined by the code segment descriptor (CS.D), and when W=1, the operand size is 64 bits.
[0146] It should be noted that the addition of another bit allows 16 (24) registers to be addressed, whereas MOD R / M register field 1844 and MOD R / MR / M field 1846 alone can each address only 8 registers.
[0147] In the first prefix 1701(A), bit position 2 (R) may be an extension of the MOD R / M register field 1844 and may be used to modify the MOD R / M register field 1844 when the field encodes a general register, a 64-bit packed data register (e.g., an SSE register), or a control or debug register. When the MOD R / M byte 1802 specifies another register or defines an extended opcode, R is ignored.
[0148] Bit position 1 (X) may modify the SIB byte index field 1854 .
[0149] Bit position 0 (B) may modify the base address in MOD R / MR / M field 1846 or SIB byte base address field 1856; or it may modify the opcode register field used to access a general register (eg, general register 1625).
[0150] 20(A) to 20(D) illustrate examples of how the R, X, and B fields of the first prefix 1701(A) are used. FIG. 20(A) illustrates extending the register field 1844 and the R / M field 1846 of the MOD R / M byte 1802 using R and B from the first prefix 1701(A) when the SIB byte 1804 is not used for memory addressing. FIG. 20(B) illustrates extending the register field 1844 and the R / M field 1846 of the MOD R / M byte 1802 using R and B from the first prefix 1701(A) when the SIB byte 1804 is not used (register-register addressing). 20(C) illustrates that the register field 1844 of the MOD R / M byte 1802 is extended with R, X, and B from the first prefix 1701(A) when the SIB byte 1804 is used for memory addressing, as well as the index field 1854 and the base field 1856. FIG20(D) illustrates that the register field 1844 of the MOD R / M byte 1802 is extended with B from the first prefix 1701(A) when the register is encoded in the opcode 1703.
[0151] Figures 21(A) to 21(B) illustrate examples of second prefix 1701(B). In some examples, second prefix 1701(B) is an example of a VEX prefix. Second prefix 1701(B) encoding allows instructions to have more than two operands and allows SIMD vector registers (e.g., vector / SIMD registers 1610) to be longer than 64 bits (e.g., 128 bits and 256 bits). The use of second prefix 1701(B) provides a three-operand (or more) syntax. For example, the previous two-operand instruction performs an operation such as A=A+B, which overwrites the source operand. The use of second prefix 1701(B) enables operands to perform non-destructive operations such as A=B+C.
[0152] In some examples, the second prefix 1701(B) appears in two forms - a two-byte form and a three-byte form. The two-byte second prefix 1701(B) is primarily used for 128-bit, scalar, and some 256-bit instructions; while the three-byte second prefix 1701(B) provides a compact replacement for the first prefix 1701(A) with 3-byte opcode instructions.
[0153] Figure 21 (A) illustrates an example of a two-byte form of the second prefix 1701 (B). In one example, the format field 2101 (byte 0 2103) contains the value C5H. In one example, byte 1 2105 includes an "R" value in position [7]. This value is the complement of the "R" value of the first prefix 1701 (A). Position [2] is used to indicate the length (L) of the vector (wherein value 0 is a scalar or 128-bit vector and value 1 is a 256-bit vector). Position [1:0] provides an opcode extension equivalent to some traditional prefixes (e.g., 00=no prefix, 01=66H, 10=F3H, and 11=F2H). Bits [6:3], shown as vvvv, can be used to: 1) encode a first source register operand specified in reverse (1's complement) form and valid for instructions with 2 or more source operands; 2) encode a destination register operand specified in 1's complement form for certain vector shifts; or 3) encode no operand, the field is reserved and should contain some value, such as 1111b.
[0154] Instructions using this prefix may use MOD R / MR / M field 1846 to encode an instruction operand that references a memory address or to encode a destination register operand or a source register operand.
[0155] Instructions using this prefix may use MOD R / M register field 1844 to encode a destination register operand or a source register operand, or be treated as an opcode extension and not used to encode any instruction operand.
[0156] For instruction syntax supporting four operands, vvvv, MOD R / MR / M field 1846, and MOD R / M register field 1844 encode three of the four operands. Bits [7:4] of immediate value field 1709 are then used to encode the third source register operand.
[0157] Figure 21 (B) illustrates an example of a three-byte form of the second prefix 1701 (B). In one example, the format field 2111 (byte 0 2113) contains the value C4H. Byte 1 2115 includes "R", "X" and "B" in position [7:5], which are the complements of the same value of the first prefix 1701 (A). The position [4:0] of byte 1 2115 (shown as mmmm) includes the content of one or more implicit leading operation code bytes encoded as needed. For example, 00001 means 0FH leading operation code, 00010 means 0F38H leading operation code, 00011 means 0F3AH leading operation code, etc.
[0158] Bit [7] of byte 2 2117 is used similarly to W of the first prefix 1701 (A), including helping to determine the size of operands that can be promoted. Bit [2] is used to indicate the length (L) of the vector (where a value of 0 is a scalar or 128-bit vector and a value of 1 is a 256-bit vector). Bits [1:0] provide opcode extensions that are equivalent to some traditional prefixes (e.g., 00=no prefix, 01=66H, 10=F3H, and 11=F2H). Bits [6:3], shown as vvvv, can be used to: 1) encode a first source register operand that is specified in reverse (inverse) form and is valid for instructions with 2 or more source operands; 2) encode a destination register operand that is specified in inverse form for certain vector shifts; or 3) do not encode any operands, this field is reserved and should contain a value, such as 1111b.
[0159] Instructions using this prefix may use MOD R / MR / M field 1846 to encode an instruction operand that references a memory address or to encode a destination register operand or a source register operand.
[0160] Instructions using this prefix may use MOD R / M register field 1844 to encode a destination register operand or a source register operand, or be treated as an opcode extension and not used to encode any instruction operand.
[0161] For instruction syntax supporting four operands, vvvv, MOD R / MR / M field 1846, and MOD R / M register field 1844 encode three of the four operands. Bits [7:4] of immediate value field 1709 are then used to encode the third source register operand.
[0162] Fig. 22 An example of a third prefix 1701(C) is illustrated. In some examples, the third prefix 1701(C) is an example of an EVEX prefix. The third prefix 1701(C) is a four-byte prefix.
[0163] The third prefix 1701(C) may encode 32 vector registers (e.g., 128-bit, 256-bit, and 512-bit registers) in 64-bit mode. In some examples, write masks / operation masks are used (see, e.g., Fig.16 The prefix is used by instructions that are not discussed in the previous figure of the registers) or predicted by the operator. The operation mask register allows conditional processing or selection control. The second prefix 1701 (B) is used to encode an operation mask instruction whose source / destination operand is an operation mask register and the contents of the operation mask register are treated as a single value.
[0164] The third prefix 1701(C) may encode functionality specific to the instruction class (e.g., a packed instruction with "load+operation" semantics may support an embedded broadcast functionality, a floating-point instruction with rounding semantics may support a static rounding functionality, a floating-point instruction with non-rounding arithmetic semantics may support a "suppress all exceptions" functionality, etc.).
[0165] The first byte of the third prefix 1701 (C) is the format field 2211, which in one example has a value of 62 H. The subsequent bytes are referred to as payload bytes 2215-2219 and together form a 24-bit value P[23:0], which provides specific capabilities in the form of one or more fields (described in detail herein).
[0166] In some examples, P[1:0] of payload byte 2219 is the same as the lower two mm bits. In some examples, P[3:2] is reserved. Bit P[4] (R') allows access to the upper 16 vector registers when combined with P[7] and MOD R / M register field 1844. When SIB type addressing is not required, P[6] can also provide access to the upper 16 vector registers. P[7:5] includes R, X, and B, which are operand specifier modifier bits for vector registers, general registers, and memory addressing, and when combined with MOD R / M register field 1844 and MOD R / MR / M field 1846, allows access to the next group of 8 registers outside the lower 8 registers. P[9:8] provides an opcode extension equivalent to some traditional prefixes (e.g., 00=no prefix, 01=66H, 10=F3H, and 11=F2H). In some examples, P
[10] is a fixed value of 1. P[14:11], shown as vvvv, can be used to: 1) encode a first source register operand specified in reverse (inverse) form and valid for instructions with 2 or more source operands; 2) encode a destination register operand specified in inverse form for certain vector shifts; or 3) not encode any operand, the field is reserved and should contain some value, such as 1111b.
[0167] P
[15] is similar to W of the first prefix 1701 (A) and the second prefix 1711 (B), and can be used as an opcode extension bit or operand size promotion.
[0168] P[18:16] specifies the index of a register in an operation mask (write mask) register (e.g., write mask / predicate register 1615). In one example, a particular value aaa=000 has special behavior that implies that no operation mask is used for a particular instruction (this can be implemented in various ways, including using an operation mask that is hardwired to all operation masks or hardware that bypasses the masking hardware). When merged, the vector mask allows any set of elements in the destination to be protected from being updated during the execution of any operation (specified by the base operation and the augmentation operation); in another example, the old values of the respective elements of the destination are retained when the corresponding mask bits have a 0. Conversely, when the vector mask is zeroed, it allows any set of elements in the destination to be zeroed during the execution of any operation (specified by the base operation and the augmentation operation); in one example, when the corresponding mask bits have a 0 value, the elements of the destination are set to 0. A subset of this functionality is the ability to control the vector length of the operation being performed (i.e., the span from the first to the last element modified); however, the modified elements do not have to be consecutive. Thus, the operation mask field enables partial vector operations, including loads, stores, arithmetic, logical, etc. Although examples are described in which the contents of the operation mask field select one of a plurality of operation mask registers containing an operation mask to be used (and whereby the contents of the operation mask field indirectly identify the masking to be performed), alternative examples instead or additionally allow the contents of the mask write field to directly specify the masking to be performed.
[0169] P
[19] can be combined with P[14:11] to encode a second source vector register in a non-destructive source syntax that can use P
[19] to access the upper 16 vector registers. P
[20] encodes multiple features that are different across different instruction classes and can affect the meaning of the vector length / rounding control specifier field (P[22:21]). P
[23] indicates support for merge write masking (e.g., when set to 0) or support for zeroing and merge write masking (e.g., when set to 1).
[0170] An example of using the third prefix 1701 (C) to encode a register in an instruction is described in detail in the following table.
[0171]
[0172]
[0173] Table 1: 32-register support in 64-bit mode
[0174]
[0175] Table 2: Encoded register specifiers in 32-bit mode
[0176]
[0177]
[0178] Table 3: Operation Mask Register Specifier Encoding
[0179] Program code can be applied to input information to perform the functions described herein and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system with a processor, such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a microprocessor, or any combination thereof.
[0180] The program code can be implemented with a high-level program or object-oriented programming language to communicate with the processing system. If desired, the program code can also be implemented in assembly or machine language. In fact, the mechanism described herein is not limited to any specific programming language in scope. In any case, the language can be a compiled or interpreted language.
[0181] Examples of the mechanisms disclosed herein may be implemented in hardware, software, firmware, or a combination of these implementation methods. Examples may be implemented as a computer program or program code executed on a programmable system, the programmable system comprising at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0182] One or more aspects of at least one example may be implemented by representative instructions stored on a machine-readable medium, which represent various logic within a processor, and when read by a machine, the representative instructions cause the machine to fabricate logic to perform the techniques described herein. Such representations, referred to as "intelligent property (IP) cores," may be stored on a tangible machine-readable medium and provided to various customers or manufacturing facilities to be loaded into a manufacturing machine that fabricates the logic or processor.
[0183] Such machine-readable storage media may include, but are not limited to, a non-transitory tangible arrangement of an article manufactured or formed by a machine or device, including storage media such as a hard disk, any other type of disk, including floppy disks, optical disks, compact disk read-only memory (CD-ROM), compact disk rewritable (CD-RW), and magneto-optical disks; semiconductor devices such as read-only memory (ROM), random access memory (RAM), such as dynamic random access memory (DRAM), static random access memory (SRAM), erasable programmable read-only memory (EPROM), flash memory, electrically erasable programmable read-only memory (EEPROM), phase change memory (PCM), magnetic or optical cards, or any other type of medium suitable for storing electronic instructions.
[0184] Therefore, examples also include non-transitory tangible machine-readable media containing instructions or containing design data, such as hardware description language (HDL), which defines the structures, circuits, devices, processors and / or system features described herein. Such examples may also be referred to as program products.
[0185] Simulation (including binary translation, code deformation, etc.).
[0186] In some cases, the instruction converter can be used to convert instructions from a source instruction set architecture to a target instruction set architecture. For example, the instruction converter can translate (e.g., using static binary translation, dynamic binary translation including dynamic compilation), deform, simulate or otherwise convert instructions to one or more other instructions to be processed by the core. The instruction converter can be implemented in software, hardware, firmware or a combination thereof. The instruction converter can be on the processor, outside the processor, or partly on the processor and partly outside the processor.
[0187] Fig.23 1 is a block diagram illustrating the use of a software instruction converter to convert binary instructions in a source ISA into binary instructions in a target ISA according to an example. In the illustrated example, the instruction converter is a software instruction converter, but alternatively, the instruction converter can be implemented in software, firmware, hardware, or various combinations thereof. Fig.23 It is shown that a program in a high-level language 2302 can be compiled using a first ISA compiler 2304 to generate first ISA binary code 2306 that can be natively executed by a processor having at least one first ISA core 2316. A processor having at least one first ISA core 2316 represents any processor that can execute programs with an Intel processor having at least one first ISA core in the following manner: Processor substantially the same functionality: compatibly execute or otherwise process (1) a substantial portion of the first ISA or (2) an object code version of an application or other software targeted to run on an Intel processor having at least one first ISA core so as to achieve substantially the same results as a processor having at least one first ISA core. First ISA compiler 2304 represents a compiler operable to generate first ISA binary code 2306 (e.g., object code) that can be executed on a processor having at least one first ISA core 2316 with or without additional link processing. Similarly, Fig.23 It is shown that a program of a high-level language 2302 can be compiled using an alternative ISA compiler 2308 to generate an alternative ISA binary code 2310 that can be natively executed by a processor without a first ISA core 2314. An instruction converter 2312 is used to convert the first ISA binary code 2306 into a code that can be natively executed by a processor without a first ISA core 2314. The converted code need not be the same as the ISA binary code 2310 replaced; however, the converted code will complete general operations and consist of instructions from the replacement ISA. Thus, the instruction converter 2312 represents software, firmware, hardware, or a combination thereof that allows a processor or other electronic device without a first ISA processor or core to execute the first ISA binary code 2306 by emulation, simulation, or any other process.
[0188] The components, features, and details described for any device and circuit disclosed herein may optionally be applied to any method disclosed herein, which may optionally be performed by and / or using such device and circuit in an embodiment. Any device and circuit described herein in an embodiment may optionally be included in any system disclosed herein.
[0189] The components and circuits disclosed herein may be considered and / or claimed to operate, be operable, be capable of, be configured to be adapted to, or otherwise "perform" an operation. As used herein, these expressions relate to characteristics, properties, or attributes of a component when it is in a powered-off state, and do not imply that the component or the device or apparatus including them is currently powered on or operating. For the sake of clarity, it should be understood that the apparatus claimed herein is not required to be powered on or operating.
[0190] In the specification and claims, the terms "coupled" and / or "connected" and their derivatives may be used. These terms are not intended to be synonymous with each other. On the contrary, in an embodiment, "connected" may be used to indicate that two or more elements are in direct physical and / or electrical contact with each other. "Coupled" may mean that two or more elements are in direct physical and / or electrical contact with each other. However, "coupled" may also mean that two or more elements are not in direct contact with each other, but still cooperate or interact with each other. In the figures, arrows are used to illustrate connections and couplings.
[0191] Moreover, in the various embodiments described above, unless otherwise specifically noted, disjunctive language such as the phrase "at least one of A, B, or C" is intended to be understood to mean A, B, or C or any combination thereof (i.e., A, B, and / or C). It can be seen that disjunctive language is not intended to and should not be understood to imply that a given embodiment requires the presence of at least one A, at least one B, or at least one C, respectively.
[0192] In the above description, specific details are set forth to provide a thorough understanding of the embodiments. However, other embodiments may be practiced without some of these specific details. The scope of the present disclosure is not determined by the specific examples provided above, but only by the claims below. In other cases, well-known circuits, structures, devices, and operations are shown in block diagram form and / or without detail to avoid blurring the understanding of this specification. Where deemed appropriate, the end portion of a reference numeral or a reference numeral is repeated in the accompanying drawings to indicate corresponding or similar elements, which may optionally have similar or identical characteristics unless otherwise specified or clearly apparent.
[0193] Throughout the specification, references to, for example, "one embodiment," "an embodiment," "one or more embodiments," "some embodiments" indicate that particular features may be included in the practice of the disclosure, but are not necessarily required to be so. Similarly, in the specification, in order to make the disclosure flow smoothly and aid in the understanding of various inventive aspects, various features are sometimes grouped together in a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the disclosure requires more features than are expressly recited in each claim. On the contrary, as reflected in the following claims, inventive aspects lie in less than all the features of a single disclosed embodiment. Thus, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the disclosure.
[0194] Example Embodiments
[0195] The following examples relate to further embodiments. In one or more embodiments, the details in the examples may be used anywhere.
[0196] Example 1 is a device including a substitution box (S-box) circuit. The S-box circuit includes a multiplication inverse circuit that receives an 8-bit input of a Galois field and generates a corresponding 8-bit output of the Galois field. The 8-bit output is such that when there are no errors in generating the 8-bit output, the 8-bit output is the multiplication inverse of the 8-bit input. The device also includes an error detection circuit that receives the 8-bit input and is coupled to the S-box circuit to receive the 8-bit output. The error detection circuit detects whether an error has occurred when generating the 8-bit output based at least in part on whether the 8-bit output is the multiplication inverse of the 8-bit input.
[0197] Example 2 includes the apparatus of Example 1, wherein the error detection circuit comprises a Galois field multiplier that multiplies an 8-bit input and an 8-bit output to generate a product and optionally a comparison circuit that compares the product to an 8-bit value of one. The error detection circuit optionally determines that an error has occurred in generating the 8-bit output when the product is not equal to the 8-bit value of one.
[0198] Example 3 includes the apparatus of Example 2, wherein the Galois Field multiplier is one of an 8-bit Galois Field multiplier for one term, a 4-bit Galois Field multiplier for two terms, and a 2-bit Galois Field multiplier for four terms.
[0199] Example 4 includes the apparatus of Example 1, wherein the error detection circuit includes circuitry that generates a value equal to the sum of: (1) a most significant 4-bit nibble of a product of the 8-bit input and the 8-bit output; and (2) a least significant 4-bit nibble of the product. The error detection circuitry optionally further includes a comparison circuit that compares the value to a 4-bit value of one. The error detection circuitry optionally determines that an error has occurred in generating the 8-bit output when the value equal to the sum is not equal to the 4-bit value of one.
[0200] Example 5 includes the apparatus of any of Examples 1 to 4, wherein the error detection circuit outputs an error signal indicating whether an error has occurred when generating the 8-bit output.
[0201] Example 6 includes the apparatus of Example 5, further comprising a storage device that stores an error signal and fifteen additional error signals simultaneously output from fifteen additional error detection circuits, each additional error detection circuit corresponding to a different one of the fifteen additional 8-bit inputs, the input together with the 8-bit input representing 128 bits of input data for the cryptographic wheel. Optionally, further comprising an error signal combination circuit coupled to the storage device that combines the error signal and the fifteen additional error signals. Optionally, wherein the error signal combination circuit combines the error signal and the fifteen additional error signals in a subsequent clock cycle of a clock cycle that generates 128 bits of output data for the cryptographic wheel.
[0202] Example 7 includes the apparatus of any one of Examples 1 to 6, further comprising a cipher wheel circuit including an S-box circuit, the cipher wheel circuit receiving 128 bits of input data for the cipher wheel and outputting 128 bits of output data for the cipher wheel. Optionally, during the same clock cycle, the cipher wheel circuit can have a greater delay from receiving the 128 bits of input data to outputting the 128 bits of output data than any delay of the error detection circuit.
[0203] Example 8 includes the apparatus of any of Examples 1 to 7, further comprising circuitry to check whether the 8-bit input is zero.
[0204] Example 9 includes the apparatus of any of Examples 1 to 8, further comprising an Advanced Encryption Standard (AES) circuit comprising an S-box circuit.
[0205] Example 10 includes the apparatus of any of Examples 1 to 8, further comprising an SMS4 circuit comprising an S-box circuit.
[0206] Example 11 is a method comprising performing a substitution box (S-box) operation on an 8-bit input in a Galois field to generate a corresponding 8-bit output in a Galois field. When there is no error in generating the 8-bit output, the 8-bit output is the multiplicative inverse of the 8-bit input. The method also includes: detecting whether an error occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplicative inverse of the 8-bit input.
[0207] Example 12 includes the method of Example 11, wherein detecting whether an error occurs comprises generating a product by multiplying an 8-bit input with an 8-bit output, and comparing the product with an 8-bit value of one. Optionally, determining that an error occurs when generating the 8-bit output is also performed when the product is not equal to the 8-bit value of one.
[0208] Example 13 includes the method of Example 11, wherein detecting whether an error occurred comprises generating a value equal to the sum of: (1) a most significant 4-bit nibble of a product of the 8-bit input and the 8-bit output; and (2) a least significant 4-bit nibble of the product, and comparing the value to a 4-bit value of one. Optionally, determining that an error occurred in generating the 8-bit output is further determined when the value equal to the sum is not equal to the 4-bit value of one.
[0209] Example 14 includes the method of any of Examples 11 to 13, further comprising: outputting an error signal indicating whether an error occurs when generating the 8-bit output.
[0210] Example 15 includes the method of Example 14, further comprising: storing an error signal and fifteen additional error signals, the fifteen additional error signals corresponding to fifteen additional groups of S-box operations performed on different inputs of fifteen additional 8-bit inputs, the additional 8-bit inputs together with the 8-bit input representing 128 bits of input data for the cipher wheel. Optionally, further comprising: combining the error signal and the fifteen additional error signals in a subsequent clock cycle of a clock cycle for generating 128 bits of output data from the 128 bits of input data for the cipher wheel.
[0211] Example 16 is a system comprising a processor, a memory, and a cryptographic unit coupled to the processor and coupled to the memory. The cryptographic unit encrypts data sent from the processor to the memory. The cryptographic unit includes a substitution box (S-box) circuit, which includes a multiplication inverse circuit that receives an 8-bit input of a Galois field and generates a corresponding 8-bit output of the Galois field. When there is no error in generating the 8-bit output, the 8-bit output is the multiplication inverse of the 8-bit input. The cryptographic unit also includes an error detection circuit that receives the 8-bit input and is coupled to the S-box circuit to receive the 8-bit output. The error detection circuit detects whether an error has occurred when generating the 8-bit output based at least in part on whether the 8-bit output is the multiplication inverse of the 8-bit input.
[0212] Example 17 includes the system of Example 16, wherein the error detection circuit comprises a Galois field multiplier that multiplies the 8-bit input and the 8-bit output to generate a product and a comparison circuit that compares the product to the 8-bit value of one. Optionally, wherein the error detection circuit determines that an error has occurred in generating the 8-bit output when the product is not equal to the 8-bit value of one.
[0213] Example 18 includes the system of Example 16, wherein the error detection circuit includes circuitry that generates a value equal to the sum of: (1) a most significant 4-bit nibble of a product of the 8-bit input and the 8-bit output; and (2) a least significant 4-bit nibble of the product; and a comparison circuit that compares the value to a 4-bit value of one. Optionally, wherein the error detection circuit determines that an error has occurred in generating the 8-bit output when the value is not equal to the 4-bit value of one.
[0214] Example 19 includes the system of any of Examples 16 to 18, wherein the error detection circuit outputs an error signal indicating whether an error has occurred when generating the 8-bit output.
[0215] Example 20 includes the system of any of Examples 16 to 19, wherein the cryptographic unit further comprises a cryptographic wheel circuit comprising an S-box circuit. The cryptographic wheel circuit receives 128 bits of input data for the cryptographic wheel and outputs 128 bits of output data for the cryptographic wheel. Optionally, during the same clock cycle, the cryptographic wheel circuit has a greater delay from receiving the 128 bits of input data to outputting the 128 bits of output data than any delay of the error detection circuit.
[0216] Example 21 is a processor or other apparatus operable to perform the method of any of Examples 11-15.
[0217] Example 22 is a processor or other apparatus comprising means for performing the method of any of Examples 11-15.
[0218] Example 23 is a processor or other apparatus comprising circuitry for performing the method of any of Examples 11-15.
Claims
1. A device comprising: a substitution box (S-box) circuit, the S-box circuit comprising a multiplicative inverse circuit to receive an 8-bit input of a Galois field and generate a corresponding 8-bit output of the Galois field, wherein when there are no errors in generating the 8-bit output, the 8-bit output is the multiplicative inverse of the 8-bit input; and an error detection circuit for receiving the 8-bit input and coupled to the S-box circuit to receive the 8-bit output, the error detection circuit for detecting whether an error has occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplicative inverse of the 8-bit input.
2. The device according to claim 1, wherein: The error detection circuit comprises: a Galois field multiplier for multiplying the 8-bit input and the 8-bit output to generate a product; and A comparison circuit is configured to compare the product to an 8-bit value of one, wherein the error detection circuit is configured to determine that an error has occurred in generating the 8-bit output when the product is not equal to the 8-bit value of one.
3. The device according to claim 2, wherein: The Galois Field multiplier is one of: one 8-bit Galois Field multiplier, two 4-bit Galois Field multipliers, and four 2-bit Galois Field multipliers.
4. The device according to claim 1, wherein: The error detection circuit comprises: circuitry for generating a value equal to the sum of: (1) the most significant 4-bit nibble of the product of the 8-bit input and the 8-bit output; and (2) the least significant 4-bit nibble of the product; and A comparison circuit is configured to compare the value to a 4-bit value of one, wherein the error detection circuit is configured to determine that an error has occurred in generating the 8-bit output when the value equal to the sum is not equal to the 4-bit value of one.
5. The device according to any one of claims 1 to 4, wherein: The error detection circuit is used to output an error signal indicating whether an error has occurred in generating the 8-bit output.
6. The apparatus according to claim 5, further comprising: a storage device for storing the error signal and fifteen additional error signals simultaneously output from fifteen additional error detection circuits, each additional error detection circuit corresponding to a different one of fifteen additional 8-bit inputs, the fifteen additional 8-bit inputs together with the 8-bit input representing 128 bits of input data for the cipher wheel; as well as An error signal combining circuit coupled to the storage device is configured to combine the error signal and the fifteen additional error signals, wherein the error signal combining circuit is configured to combine the error signal and the fifteen additional error signals in a subsequent clock cycle of a clock cycle for generating 128 bits of output data for the cryptographic wheel.
7. The device according to any one of claims 1 to 4, further comprising: A cipher wheel circuit, the cipher wheel circuit including the S-box circuit, the cipher wheel circuit being configured to receive 128 bits of input data for a cipher wheel and output 128 bits of output data for the cipher wheel, wherein during a same clock cycle, the cipher wheel circuit has a greater delay from receiving the 128 bits of input data to outputting the 128 bits of output data than any delay of the error detection circuit.
8. The device according to any one of claims 1 to 4, further comprising: A circuit for checking whether the 8-bit input is zero.
9. The device according to any one of claims 1 to 4, further comprising: An Advanced Encryption Standard (AES) circuit includes the S-box circuit.
10. The device according to any one of claims 1 to 4, further comprising: An SMS4 circuit, the SMS4 circuit comprising the S-box circuit.
11. A method comprising: performing a substitution box (S-box) operation on an 8-bit input of a Galois field to generate a corresponding 8-bit output of a Galois field, wherein the 8-bit output is the multiplicative inverse of the 8-bit input when there are no errors in generating the 8-bit output; and Whether an error occurred in generating the 8-bit output is detected based at least in part on whether the 8-bit output is the multiplicative inverse of the 8-bit input.
12. The method according to claim 11, wherein: Detecting whether an error has occurred includes: generating a product by multiplying the 8-bit input and the 8-bit output; and comparing the product to an 8-bit value of one; and It is determined that an error occurred in generating the 8-bit output when the product is not equal to the 8-bit value of one.
13. The method according to claim 11, wherein: Detecting whether an error has occurred includes: generating a value equal to the sum of: (1) the most significant 4-bit nibble of the product of the 8-bit input and the 8-bit output; and (2) the least significant 4-bit nibble of the product; and comparing the value to a 4-bit value of one; and When the value equal to the sum is not equal to the 4-bit value of one, it is determined that an error occurred in generating the 8-bit output.
14. The method according to claim 11, further comprising: An error signal is output indicating whether an error occurred in generating the 8-bit output.
15. The method according to claim 14, further comprising: storing the error signal and fifteen additional error signals, the fifteen additional error signals corresponding to fifteen additional sets of S-box operations, the fifteen additional sets of S-box operations being performed on different 8-bit inputs of fifteen additional 8-bit inputs, respectively, the fifteen additional 8-bit inputs together with the 8-bit input representing 128-bit input data for a cipher round; as well as The error signal and the fifteen additional error signals are combined in a subsequent clock cycle of a clock cycle for the cipher wheel to generate 128 bits of output data from the 128 bits of input data.
16. A system comprising: processor; Memory; as well as a cryptographic unit coupled to the processor and to the memory, the cryptographic unit configured to encrypt data sent from the processor to the memory, the cryptographic unit comprising a substitution box (S-box) circuit, the S-box circuit comprising a multiplication inverse circuit configured to receive an 8-bit input of a Galois field and generate a corresponding 8-bit output of a Galois field, wherein when there is no error in generating the 8-bit output, the 8-bit output is the multiplication inverse of the 8-bit input; as well as an error detection circuit for receiving the 8-bit input and coupled to the S-box circuit to receive the 8-bit output, the error detection circuit for detecting whether an error has occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplicative inverse of the 8-bit input.
17. The system of claim 16, wherein: The error detection circuit comprises: a Galois field multiplier for multiplying the 8-bit input and the 8-bit output to generate a product; and A comparison circuit is configured to compare the product to an 8-bit value of one, wherein the error detection circuit is configured to determine that an error has occurred in generating the 8-bit output when the product is not equal to the 8-bit value of one.
18. The system of claim 16, wherein: The error detection circuit comprises: circuitry for generating a value equal to the sum of: (1) the most significant 4-bit nibble of the product of the 8-bit input and the 8-bit output; and (2) the least significant 4-bit nibble of the product; and A comparison circuit is configured to compare the value to a 4-bit value of one, wherein the error detection circuit is configured to determine that an error has occurred in generating the 8-bit output when the value is not equal to the 4-bit value of one.
19. A system according to any one of claims 16 to 18, wherein: The error detection circuit is used to output an error signal indicating whether an error has occurred in generating the 8-bit output.
20. The system according to any one of claims 16 to 18, wherein: The cryptographic unit also includes a cryptographic wheel circuit, which includes the S-box circuit, and the cryptographic wheel circuit is used to receive 128-bit input data for the cryptographic wheel and output 128-bit output data for the cryptographic wheel, wherein during the same clock cycle, the cryptographic wheel circuit has a greater delay from receiving the 128-bit input data to outputting the 128-bit output data than any delay of the error detection circuit.
21. An apparatus comprising: a substitution box (S-box) component, the S-box component comprising a multiplicative inverse component for receiving an 8-bit input of a Galois field and generating a corresponding 8-bit output of the Galois field, wherein when there are no errors in generating the 8-bit output, the 8-bit output is the multiplicative inverse of the 8-bit input; and an error detection component for receiving the 8-bit input and coupled to the S-box component to receive the 8-bit output, the error detection component for detecting whether an error has occurred in generating the 8-bit output based at least in part on whether the 8-bit output is the multiplicative inverse of the 8-bit input.
22. A processor comprising components for performing the method of any one of claims 11 to 15.
23. A machine-readable medium comprising machine-readable instructions which, when executed, cause a machine to perform the method of any one of claims 11 to 15.
24. A computer program product comprising instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 11 to 15.
