APPARATUS AND METHOD FOR CIPHERTEXT COMPARISON CAPABLE OF PREVENTING SIDE CHANNEL ATTACK

20240413970 ยท 2024-12-12

Assignee

Inventors

Cpc classification

International classification

Abstract

A ciphertext comparison method according to an embodiment is performed by a processor in a computing apparatus, and the method includes an operation of segmenting a first ciphertext and a second ciphertext into m part bitstreams (in this instance, m is a natural number satisfying 1<m), respectively; an operation of extracting a value corresponding to a j1.sup.th part bitstream (in this instance, j=i+1, i is a natural number satisfying 0im1) of the first ciphertext and a j1.sup.th part bitstream of the second ciphertext, as a j.sup.th intermediate value between a first value and a second value in a first lookup table including the first value and the second value of which Hamming weights are identical; an operation extracting a value corresponding to the j.sup.th intermediate value and a j1.sup.th result value, as a j.sup.th result value between a third value and a fourth value in a second lookup table including the third value and the fourth value of which Hamming weights are identical; and in a case of jm, an operation of repeatedly performing extraction as the j.sup.th intermediate value and extraction as the j.sup.th result value by increasing J; and in a case of j=m, an operation of outputting an m.sup.th result value as a result value of comparison between the first ciphertext and the second ciphertext.

Claims

1. A ciphertext comparison method performed by a processor in a computing apparatus, the method comprising: segmenting a first ciphertext and a second ciphertext into m part bitstreams (in this instance, m is a natural number satisfying 1<m), respectively; extracting a value corresponding to a j1.sup.th part bitstream (in this instance, j=i+1, i is a natural number satisfying 0im1) of the first ciphertext and a j1.sup.th part bitstream of the second ciphertext, as a j.sup.th intermediate value between a first value and a second value in a first lookup table including the first value and the second value of which Hamming weights are identical; extracting a value corresponding to the j.sup.th intermediate value and a j1.sup.th result value, as a j.sup.th result value between a third value and a fourth value in a second lookup table including the third value and the fourth value of which Hamming weights are identical; and in a case of jm, repeatedly performing extraction as the j.sup.th intermediate value and extraction as the j.sup.th result value by increasing J; and in a case of j=m, outputting an m.sup.th result value as a result value of comparison between the first ciphertext and the second ciphertext.

2. The method of claim 1, wherein the segmenting comprises segmenting, based on a predetermined segmentation unit, the first ciphertext and the second ciphertext into m part bitstreams, respectively.

3. The method of claim 1, wherein the extracting as the j.sup.th intermediate value comprises extracting a value of which an index is identical to a bitstream obtained by concatenating the j1.sup.th part bitstream of the first ciphertext and the j1.sup.th part bitstream of the second ciphertext, as the j.sup.th intermediate value between the first value and the second value in the first lookup table, and wherein the extracting as the j.sup.th result value comprises extracting a value of which an index is identical to a value obtained by concatenating the j.sup.th intermediate value and the j1.sup.th result value, as the j.sup.th result value between the third value and the fourth value in the second lookup table.

4. The method of claim 1, wherein the first value and the second value are predetermined values indicating whether the j1.sup.th part bitstream of the first ciphertext and the j1.sup.th part bitstream of the second ciphertext are identical, and wherein the third value and the fourth value are predetermined values indicating whether the first ciphertext and the second ciphertext are identical.

5. The method of claim 1, wherein the j.sup.th intermediate value satisfies Equation 2 below, t m p j = T 1 [ C j - 1 .Math. C j - 1 ] = { A 1 , if C j - 1 = C j - 1 A 2 , if C j - 1 C j - 1 [ Equation 2 ] (in this instance, C.sub.j1 denotes the j1.sup.th part bitstream of the first ciphertext that satisfies C.sub.j1[0,2.sup.n), C.sub.j1 denotes the j1.sup.th part bitstream of the second ciphertext that satisfies C.sub.j1[0,2.sup.n), n denotes a predetermined segmentation unit, A.sub.1 denotes the first value, A.sub.2 denotes the second value, and T.sub.1[C.sub.j1C.sub.j1] denotes a value of which an index is C.sub.j1C.sub.j1 in the first lookup table).

6. The method of claim 5, wherein the j.sup.th result value satisfies Equation 3 or Equation 4 below, r j = T 1 [ r j - 1 .Math. tmp j ] = { A 3 = A 1 , if r j - 1 = tmp j = A 1 A 4 = A 2 , if r j - 1 = A 2 or tmp j = A 2 [ Equation 3 ] r j = T 2 [ r j - 1 .Math. tmp j ] = { A 3 , if r j - 1 = A 3 and tmp j = A 1 A 4 , if r j - 1 = A 4 or tmp j = A 2 [ Equation 4 ] (in this instance, r.sub.j denotes the j.sup.th result value, r.sub.0=A.sub.3, tmp.sub.j denotes the j.sup.th intermediate value, A.sub.3 denotes the third value, A.sub.4 denotes the fourth value, and T.sub.2[r.sub.j1tmp.sub.j] denotes a value of which an index is r.sub.j1tmp.sub.j in the second lookup table).

7. A ciphertext comparison apparatus, the apparatus comprising: a memory storing one or more instructions; and one or more processors executing the one or more instructions, wherein the one or more processors are configured to: segment a first ciphertext and a second ciphertext into m part bitstreams (in this instance, m is a natural number satisfying 1<m), respectively; extract a value corresponding to a j1.sup.th part bitstream (in this instance, j=i+1, i is a natural number satisfying 0im1) of the first ciphertext and a j1.sup.th part bitstream of the second ciphertext, as a j.sup.th intermediate value between a first value and a second value in a first lookup table including the first value and the second value of which Hamming weights are identical; extract a value corresponding to the j.sup.th intermediate value and a j1.sup.th result value, as a j.sup.th result value between a third value and a fourth value in a second lookup table including the third value and the fourth value of which Hamming weights are identical; in a case of jm, repeatedly perform extraction as the j.sup.th intermediate value and extraction as the j.sup.th result value by increasing J; and in a case of j=m, output an m.sup.th result value as a result value of comparison between the first ciphertext and the second ciphertext.

8. The apparatus of claim 7, wherein the one or more processors are configured to segment, based on a predetermined segmentation unit, the first ciphertext and the second ciphertext into m part bitstreams, respectively.

9. The apparatus of claim 7, wherein the one or more processors are configured to: extract a value of which an index is identical to a bitstream obtained by concatenating the j1.sup.th part bitstream of the first ciphertext and the j1.sup.th part bitstream of the second ciphertext, as the j.sup.th intermediate value between the first value and the second value in the first lookup table, and extract a value of which an index is identical to a value obtained by concatenating the j.sup.th intermediate value and the j1.sup.th result value, as the j.sup.th result value between the third value and the fourth value in the second lookup table.

10. The apparatus of claim 7, wherein the first value and the second value are predetermined values indicating whether the j1.sup.th part bitstream of the first ciphertext and the j1.sup.th part bitstream of the second ciphertext are identical, and wherein the third value and the fourth value are predetermined values indicating whether the first ciphertext and the second ciphertext are identical.

11. The apparatus of claim 7, wherein the j.sup.th intermediate value satisfies Equation 2 below, t m p j = T 1 [ C j - 1 .Math. C j - 1 ] = { A 1 , if C j - 1 = C j - 1 A 2 , if C j - 1 C j - 1 [ Equation 2 ] (in this instance, C.sub.j1 denotes the j1.sup.th part bitstream of the first ciphertext that satisfies C.sub.j1[0,2.sup.n), Cj denotes the j1.sup.th part bitstream of the second ciphertext that satisfies C.sub.j1[0,2.sup.n), n denotes a predetermined segmentation unit, A.sub.1 denotes the first value, A.sub.2 denotes the second value, and T.sub.1[C.sub.j1C.sub.j+1] denotes a value of which an index is C.sub.j1C.sub.j1 in the first lookup table).

12. The apparatus of claim 11, wherein the j.sup.th result value satisfies Equation 3 or Equation 4 below, r j = T 1 [ r j - 1 .Math. tmp j ] = { A 3 = A 1 , if r j - 1 = tmp j = A 1 A 4 = A 2 , if r j - 1 = A 2 or tmp j = A 2 [ Equation 3 ] r j = T 2 [ r j - 1 .Math. tmp j ] = { A 3 , if r j - 1 = A 3 and tmp j = A 1 A 4 , if r j - 1 = A 4 or tmp j = A 2 [ Equation 4 ] (in this instance, r.sub.j denotes the j.sup.th result value, r.sub.0=A.sub.3, tmp.sub.j denotes the j.sup.th intermediate value, A.sub.3 denotes the third value, A.sub.4 denotes the fourth value, and T.sub.2[r.sub.j1tmp.sub.j] denotes a value of which an index is r.sub.j1tmp.sub.j in the second lookup table).

13. A computer-readable storage medium storing instructions which, when executed by a processor, cause a computing apparatus comprising the processor to perform operations for text-based document classification, the operations comprising: segmenting a first ciphertext and a second ciphertext into m part bitstreams (in this instance, m is a natural number satisfying 1<m), respectively; extracting a value corresponding to a j1.sup.th part bitstream (in this instance, j=i+1, i is a natural number satisfying 0im1) of the first ciphertext and a j1.sup.th part bitstream of the second ciphertext, as a j.sup.th intermediate value between a first value and a second value in a first lookup table including the first value and the second value of which Hamming weights are identical; extracting a value corresponding to the j.sup.th intermediate value and a j1.sup.th result value, as a j.sup.th result value between a third value and a fourth value in a second lookup table including the third value and the fourth value of which Hamming weights are identical; and in a case of jm, repeatedly performing extraction as the j.sup.th intermediate value and extraction as the j.sup.th result value by increasing J; and in a case of j=m, outputting an m.sup.th result value as a result value of comparison between the first ciphertext and the second ciphertext.

Description

BRIEF DESCRIPTION OF DRAWINGS

[0022] FIG. 1 is a block diagram illustrating an example of a computing environment including a computing apparatus according to an embodiment.

[0023] FIG. 2 is a diagram illustrating an example of pseudo code associated with an encapsulation (key encapsulation) algorithm and a decapsulation (key decapsulation) algorithm of a key encapsulation mechanism (KEM) to which a ciphertext comparison method according to an embodiment is applicable.

[0024] FIG. 3 is a diagram illustrating an example of pseudo code associated with an algorithm used for a ciphertext comparison operation.

[0025] FIG. 4 is a flowchart illustrating a ciphertext comparison method according to an embodiment.

[0026] FIG. 5 is a diagram illustrating an example of pseudo code associated with a ciphertext comparison method according to an embodiment.

BEST MODE FOR CARRYING OUT THE INVENTION

[0027] Hereinafter, detailed embodiments of the disclosure will be described with reference to drawings. Detailed descriptions below will be provided to help comprehensive understanding of the method, apparatus, and/or system described in the present specification. However, this is merely an example, and the present disclosure is not limited thereto.

[0028] When describing embodiments of the disclosure, if detailed descriptions associated with a well-known art related to the disclosure are determined as unnecessarily making the subject matter of the disclosure ambiguous, the detailed descriptions thereof will be omitted herein. The terms to be described below are terms defined in consideration of functions in the present disclosure, and may be changed by a user, intention of an operator, practice, or the like. Therefore, the definitions of the terms should be understood based on the contents throughout the specification. The terms used in the detailed description are merely for the purpose of describing embodiments of the disclosure and should not be intended to be restrictive. The singular forms are intended to include the plural forms as well, unless otherwise mentioned. In the descriptions, the expression comprises, includes, or the like specifies features, numbers, steps, operations, elements, and/or part or a combination thereof, but do not preclude the presence or possibility of one or more other features, numbers, steps, operations, elements, and/or part or combination thereof.

[0029] FIG. 1 is a block diagram illustrating an example of a computing environment including a computing apparatus according to an embodiment.

[0030] In the illustrated embodiments, the respective components may have different functions and capabilities, in addition to the description below, and an additional component that is not described below may be included.

[0031] The illustrated computing environment 10 includes a computing apparatus 12. The computing apparatus 12 may be one or more components included in an apparatus for implementing a ciphertext comparison method according to an embodiment.

[0032] The computing apparatus 12 may include at least one processor 14, a computer-readable storage medium 16, and a communication bus 18. The processor 14 may enable the computing apparatus 12 to operate according to the above-described embodiments. For example, the processor 14 may implement one or more programs stored in the computer-readable storage medium 16. The one or more programs may include one or more computer-executable instructions, and the computer-executable instructions may be configured to cause the computing apparatus 12 to perform operations according to embodiments when the computer-executable instructions are executed by the processor 14.

[0033] The computer-readable storage medium 16 may be configured to store a computer-executable instruction or program code, program data, and/or other appropriate types of information. The program 20 stored in the computer-readable storage medium 16 may include a set of instructions executable by the processor 14. According to an embodiment, the computer-readable storage medium 16 may be memory (volatile memory such as random access memory, non-volatile memory, or an appropriate combination thereof), one or more magnetic disc storage devices, optical disc storage devices, flash memory devices, and other types of storage media capable of storing information desired or accessed by the computing apparatus 12, or an appropriate combination thereof.

[0034] The communication bus 18 may include the processor 14, the computer-readable storage medium 16, and may mutually connect various other components of the computing apparatus 12.

[0035] The computing apparatus 12 may include one or more input/output interfaces 22 that provides an interface for one or more input/output devices 24, and one or more network communication interfaces 26. The input/output interface 22 and the network communication interface 26 may be connected to the communication bus 18. The input/output device 24 may be connected to other components of the computing apparatus 12 via the input/output interface 22. The illustrated input/output device 24 may include a pointing device (a mouse, a trackpad, or the like), a keyboard, a touch input device (a touch pad, a touch screen, or the like), a voice or sound input device, various types of sensor devices, and/or an input device such as a shooting device, and/or an output device such as a display device, a printer, a speaker, and/or a network card. The illustrated input/output device 24 may be included in the computing apparatus 12 as one of the components that constitute the computing apparatus 12, or may be connected to the computing apparatus 12 as a separate device from the computing apparatus 12. Here, the algorithms of FIGS. 2 and 3 described below may be performed by the computing apparatus 12 illustrated in FIG. 1.

[0036] FIG. 2 is a diagram illustrating an example of pseudo code associated with an encapsulation (key encapsulation) algorithm and decapsulation (key decapsulation) algorithm of a key encapsulation mechanism (KEM) to which a ciphertext comparison method according to an embodiment is applicable.

[0037] In the example illustrated in FIG. 2, KEM.CCA.Encaps(pk) and KEM.CCA.Decaps(sk, pk, c) respectively denote an encapsulation algorithm and a decapsulation algorithm. PKE.CPA.Enc(pk, m; r) and PKE.CPA.Dec(sk, pk, c) respectively denote an encryption algorithm and a decryption algorithm that are based on a public key which is safe from chosen plaintext attack (CPA). In addition, pk denotes a public key, sk denotes a private key, m denotes a message to be encrypted, and each of H.sub.1 and H.sub.2 denote a hash function.

[0038] The decapsulation algorithm as illustrated in FIG. 2 may decode, using the private key sk, ciphertext C produced via the encapsulation algorithm, and may encrypt m, which is produced via the decryption, again using the public key pk, so as to produce ciphertext C. Subsequently, in the case that the decapsulation algorithm compares C and C and they are identical, the decapsulation algorithm outputs a normal secret value (i.e., s=s). In the case that they are different from each other, the decapsulation algorithm outputs a random value (i.e., ss).

[0039] FIG. 3 is a diagram illustrating an example of pseudo code associated with an algorithm used for a ciphertext comparison operation.

[0040] Specifically, the algorithm illustrated in FIG. 3 is to perform a comparison operation between two ciphertext such as a comparison operation between ciphertext C and C performed in the 4.sup.th line of the decapsulation algorithm illustrated in FIG. 2. For example, the algorithm may be used for a lattice-based key encapsulation mechanism such as FrodoKEM, KYBER, SABER, and the like.

[0041] In the example illustrated in FIG. 3, denotes an XOR operation, and | denotes an OR operation. In addition, >> denotes a signed right shift. Specifically, in the example illustrated in FIG. 3, (r)>>n written in the 5.sup.th line is an operation that converts r into a negative number and fills a left-digit bit with 1 by moving each bit of r by n from the left to the right. Through the above, the algorithm illustrated in FIG. 3 returns r=0 in the case of C=C, and returns r=1 in the case of CC.

[0042] A side channel analysis is a scheme of analyzing a secret value via information associated with power, electromagnetic waves, and the like that is generated when encryption or decryption is performed. In this instance, it is well known that power consumption in a light device environment in which an algorithm is embodied based on software is proportional to Hamming weight (HW) of an intermediate operation value. Therefore, the amount of power consumed when an intermediate operation value is x is as shown in Equation 1 below.

[00005] P = .Math. HW ( x ) + p noise [ Equation 1 ]

[0043] In Equation 1, denotes a constant, and P.sub.noise denotes noise.

[0044] That is, HW of intermediate value x and consumed power P have linearity.

[0045] The operation written in the 3.sup.rd line of the algorithm illustrated in FIG. 3 may segment two ciphertext C and C, which are to be compared, based on a predetermined segmentation unit n, and may perform an XOR operation (i.e., C.sub.iC.sub.i) m times, thereby being processed within a constant time. Through the above, a timing attack type of side channel attack may be prevented. In this instance, although the pre-determined segmentation unit n may be, for example, a word unit (i.e., n=32 in the case of 32-bit computing environment, n=64 in the case of 64-bit computing environment), the disclosure is not necessarily limited thereto and may be variously changeable.

[0046] In the case that C and C are identical, r generated via the operation written in the 3.sup.rd line of the algorithm illustrated in FIG. 3 may be 0. Otherwise, r is changed to a value different from 0. In addition, in the case the two ciphertext are identical, the algorithm may output r=0, and otherwise, the algorithm may output r=1, via an operation written in the 5.sup.th line. In this instance, 1 may be expressed as 0xffff in a 16-bit computing environment, and HW is 16. That is, in the case of 1, power is consumed in proportion to HW=16. In the case of 0, power is consumed in proportion to HW=0. As described above, in the case that the difference in HW is high, secret information may be restored by analyzing a power consumption pattern.

[0047] FIG. 4 is a flowchart illustrating a ciphertext comparison method according to an embodiment, and FIG. 5 is a diagram illustrating an example of pseudo code associated with a ciphertext comparison method according to an embodiment.

[0048] The method illustrated in FIGS. 4 and 5 may be performed by, for example, the computing apparatus 12 illustrated in FIG. 1.

[0049] Referring to FIGS. 4 and 5, the computing apparatus 12 may segment two ciphertext C and C, which are to be compared, into m part bitstreams, respectively, in operation 410.

[0050] In this instance, according to an embodiment, based on a predetermined segmentation unit n, the computing apparatus 12 may segment C and C into m part bitstreams, respectively.

[0051] Specifically, the computing apparatus 12 may sequentially segment ciphertext C from a most significant bit (or a least significant bit) based on the predetermined segmentation unit n, and thus C may be segmented into m part bitstreams C.sub.m-1, C.sub.m-2 . . . , C.sub.0 (in this instance, C.sub.i[0,2.sup.n)) each of which has a length of n. In addition, the computing apparatus 12 may sequentially segment ciphertext C from a most significant bit (or a least significant bit) based on the predetermined segmentation unit n, and thus C may be segmented into m part bitstreams C.sub.m-1, C.sub.m-2 . . . , C.sub.0 (in this instance, C.sub.i[0,2.sup.n)) each of which has a length of n. In this instance, the computing apparatus 12 may segment C and C based on a word unit (i.e., n=32 in the case of a 32-bit computing environment and n=64 in the case of a 64-bit computing environment), but n may be variously changeable according to an embodiment.

[0052] Subsequently, the computing apparatus 12 sets j=1, and extracts a value corresponding to C.sub.j1 and C.sub.j1 between a first value and a second value included in a first lookup table, as a j.sup.th intermediate value in operation 420.

[0053] In this instance, the first value and the second value included in the first lookup table are predetermined values indicating whether C.sub.j1 and C.sub.j1 are identical, and i.sup.th intermediate value may satisfy Equation 2 below.

[00006] t m p j = T 1 [ C j - 1 .Math. C j - 1 ] = { A 1 , if C j - 1 = C j - 1 A 2 , if C j - 1 C j - 1 [ Equation 2 ]

[0054] In Equation 2, tmp.sub.j denotes a j.sup.th intermediate value, and T.sub.1[C.sub.j1C.sub.j1] denotes a value of which the index has a value (i.e., C.sub.j1C.sub.j1) that concatenates C.sub.j1 and C.sub.j1 in the first lookup table. In addition, A.sub.1 and A.sub.2 denote a first value and a second value, respectively, and have the same Hamming weight (i.e., HW(A.sub.1)=HW(A.sub.2)).

[0055] Subsequently, the computing apparatus 12 extracts a value corresponding to the j.sup.th intermediate value and the j1.sup.th result value between a third value and a fourth value included in a second lookup table, as a j.sup.th result value in operation 430.

[0056] In this instance, the third value and the fourth value included in the second lookup table are predetermined values indicating whether ciphertext C and C are identical, and the j.sup.th result value may satisfy Equation 3 or 4 below.

[00007] r j = T 1 [ r j - 1 .Math. tmp j ] = { A 3 = A 1 , if r j - 1 = tmp j = A 1 A 4 = A 2 , if r j - 1 = A 2 or tmp j = A 2 [ Equation 3 ] r j = T 2 [ r j - 1 .Math. tmp j ] = { A 3 , if r j - 1 = A 3 and tmp j = A 1 A 4 , if r j - 1 = A 4 or tmp j = A 2 [ Equation 4 ]

[0057] In Equations 3 and 4, r.sub.j denotes a j.sup.th result value, T.sub.2[r.sub.j1tmp.sub.j] denotes a value of which the index is a value obtained by concatenating r.sub.j1 and tmp.sub.j (i.e., r.sub.j1tmp.sub.j) in the second lookup table. In addition, A.sub.3 and A.sub.4 denote the third value and the fourth value, respectively, and have the same Hamming weight (i.e., HW(A.sub.3)=HW(A.sub.4)).

[0058] In Equations 3 and 4, r.sub.0 may be set to A.sub.3 in advance (i.e., r.sub.0=A.sub.3).

[0059] Subsequently, the computing apparatus 12 may determine whether j=m is satisfied in operation 450.

[0060] In this instance, in the case of jm, the computing apparatus 12 may increase j by 1 in operation 460, and may return to operation 420.

[0061] Conversely, in the case of j=m, the computing apparatus 12 may output an m.sup.th result value as a result value of comparison between the ciphertext C and C in operation 470.

[0062] At least some operations in the flowchart of FIG. 4 may be performed in a different order, may be performed with other operations in combination, may be omitted, may be performed in detailed steps, or may be performed with one or more additional steps which are not illustrated.

[0063] Although the present disclosure has been described in detail with reference to a representative embodiment, it would be apparent to those skilled in the art which the disclosure belongs to that various modifications can be made to the above-described embodiments without departing from the scope of the present disclosure. Therefore, the scope of the disclosure should not be determined merely based on the described embodiments. Rather, the scope of the disclosure should be determined based on the accompanying claims and their equivalents.