scieee AI-readable full text Open interactive document viewer

Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers for Quantum Key Recovery Attack

Saravanan, P.,Jenitha, J.,Sanjana, S.,Haghparast, Majid

Full text

This is a self-archived version of an original article. This version may differ from the original in pagination and typographic details. Author(s): Title: Year: Version: Copyright: Rights: Rights url: Please cite the original version: CC BY-NC-ND 4.0 https://creativecommons.org/licenses/by-nc-nd/4.0/ Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers for Quantum Key Recovery Attack © Authors 2023 Published version Saravanan, P.; Jenitha, J.; Sanjana, S.; Haghparast, Majid Saravanan, P., Jenitha, J., Sanjana, S., & Haghparast, M. (2023). Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers for Quantum Key Recovery Attack. IEEE Access, 11, 66767-66776. https://doi.org/10.1109/access.2023.3289764 2023 Received 26 May 2023, accepted 22 June 2023, date of publication 26 June 2023, date of current version 7 July 2023. Digital Object Identifier 10.1109/ACCESS.2023.3289764 Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers for Quantum Key Recovery Attack SARAVANAN PARAMASIVAM 1, (Senior Member, IEEE), J. JENITHA 1, S. SANJANA1, AND MAJID HAGHPARAST 2, (Senior Member, IEEE) 1Department of Electronics and Communication Engineering, PSG College of Technology, Coimbatore, Tamil Nadu 641004, India 2Faculty of Information Technology, University of Jyv¨askyl¨a, 40014 Jyv¨askyl¨a, Finland Corresponding author: Majid Haghparast ([email protected]) This work was supported by the Academy of Finland under Project DEQSE 349945. ABSTRACT Quantum computing plays a vital role in the next generation computing platforms as researchers have achieved quantum supremacy by proving that quantum computers can outperform classical computers. These high performance computers will pose a serious threat to the security of the conventional cryptographic algorithms. The secret key of the conventional cryptographic algorithms when implemented by quantum circuits can be recovered easily with the help of Grover key search algorithm. The Grover’s algorithm requires low cost quantum implementation of cryptographic algorithms in order to mount the quantum key recovery attack successfully. Hence the low cost quantum implementation of conventional cryptographic algorithms to mount quantum key recovery attack using Grover search algorithm is an active area of research. For the first time in literature, this work proposes a novel quantum circuit implementation of two lightweight block ciphers namely PUFFIN and PRINT. Inplace method is used to optimize the quantum resources in these two ciphers which helps to build compact quantum circuits without extra ancilla inputs. The performance metrics considered in this work to quantify the quantum resources of the proposed circuits are number of quantum gates, quantum cost, latency and number of qubits. In addition, the quantum resources are also estimated to mount the quantum key recovery attacks on the proposed quantum circuit implementations of PUFFIN and PRINT using Grover-based key search algorithm. INDEX TERMS Cryptography, Grover’s search algorithm, lightweight cipher, PUFFIN, PRINT, quantum computing, quantum circuit, quantum cost, quantum key recovery attack. I. INTRODUCTION Quantum computing makes use of the phenomena of quantum mechanics to solve certain intractable problems which cannot be solved by using classical computers [1]. One such intractable problem is the brute force attack in cryptographic algorithms wherein the adversary guesses the secret key by trying all possible combinations of the secret keys. The cryptographers community claimed that it would take years of time to mount brute force attack due to the limitations in the performance of the conventional computing platforms. But The associate editor coordinating the review of this manuscript and approving it for publication was Jiafeng Xie. due to the advent of Grover’s quantum key search algorithm, the time complexity involved in guessing the secret key is reduced from O(n) to O(√n) due to the quantum parallelism in the quantum computers [2]. For a successful quantum key recovery attack, optimal design of quantum circuits for cryptographic algorithms is an active area of research. Quantum supremacy was significantly demonstrated in the quantum algorithms of Shor, for solving the discrete logarithm problem of factorization and of Grover, for a bruteforce key search of size n-bits with O(√n) steps. Recently, classical search algorithm was used as a preprocessor to Grover’s search algorithm in order to lower the quantum circuit complexity [3]. Quantum circuits are widely used VOLUME 11, 2023 This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 License. For more information, see https://creativecommons.org/licenses/by-nc-nd/4.0/ 66767 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers in cryptographic applications due to the improvement in performance when compared to their traditional counterparts. The time-space complexity of quantum search algorithms targeting cryptographic functions were investigated in [4]. Novel quantum circuits were presented for all the three standardized key lengths of AES with reduction in quantum gates in [5]. As a follow up, the work in [6] proposed quantum circuits for the block ciphers AES and LowMC and studied the cost of quantum key search attacks under depth restrictions. Lightweight cryptography (LWC) aims at expanding the applications of cryptography to resource constrained environments by keeping a small footprint and low computational complexity in the target implementation platform. The preferred lightweight properties are the reduction in chip size and energy consumption for hardware implementations and reduction in code size and RAM size for software implementations. The compact quantum circuit design of several lightweight ciphers were presented in literature for quantum key recovery attack using Grover’s algorithm. The work in [7] proposed quantum circuit for RECTANGLE lightweight cipher and estimated the quantum resources for both 80-bit and 128-bit key lengths. The Sbox designs were optimized by LIGHTER-R tool [8] and in-place implementation was carried out to remove the ancilla inputs and garbage outputs. The quantum circuits for PRESENT and GIFT block ciphers were presented in [9] with optimal number of quantum resources by minimizing qubits, quantum gates and circuit depth. The quantum circuit design of all variants of SIMON lightweight cipher was presented in [10] and the quantum resources were enumerated to mount attack based on Grover’s key search algorithm. The quantum circuit designs of the various Korean made lightweight block ciphers such as HIGHT, CHAM, LEA and the NSA made lightweight block cipher, namely SPECK were demonstrated in [11]. The in-place implementation of GIMLI lightweight cipher was presented in [12]. Quantum reversible circuit of a Korean standardized block cipher namely ARIA was presented in [13]. The upper bounds for the number of qubits and the number of Clifford+T gates required to mount Grover’s key search attack were presented. A compact block cipher with low hardware complexity known as PUFFIN was proposed in [14]. The PRINT block cipher was mainly proposed to exploit the properties of IC- printing technology [15]. The main objective of [16]search work is to attack the two cryptographic algorithms PUFFIN and PRINT with Grover’s key search algorithm and to extract the secret keys. In order to mount the attack, novel quantum circuits are developed for the two lightweight block ciphers PUFFIN and PRINT. The PUFFIN block cipher follows Substitution and Permutation Network (SPN) and it absorbs 64-bit plaintext and 128-bit key to produce 64-bit ciphertext after 32 identical rounds of operations. The PRINT is based on the SPN structure which has the following two variants 48 and 96. In both the ciphers, in-place implementation using TABLE 1. Sbox used in PUFFIN cipher. LIGHTER-R tool is employed to achieve optimal qubits without ancilla inputs and garbage outputs. The quantum resources required to mount the quantum key recovery attacks on the proposed quantum circuit implementations of PUFFIN and PRINT ciphers are also estimated. The paper is organized as follows. A brief introduction to the two lightweight ciphers PUFFIN, PRINT and Grover’s search algorithm are given in Section II and Section III respectively. Section IV describes the proposed quantum circuit for PUFFIN cipher, followed by its performance analysis in Section V. Section VI describes the proposed quantum circuit for PRINT cipher, followed by its performance analysis in Section VII. Section VIII presents a comparative analysis of the proposed quantum circuits with the existing ones. Section IX details the quantum resources estimation for applying Grover’s search algorithm. Section Xdraws the conclusion of the paper along with noted references. II. ABOUT THE ALGORITHM A. PUFFIN LIGHTWEIGHT CIPHER PUFFIN is a block cipher which takes 64-bit plaintext, 128-bit key and produces 64-bit ciphertext. It follows the substitution and permutation network (SPN) structure and performs an initial round followed by 32 identical rounds of operation as shown in Fig. 1. In this cipher, the round operations are involutional which means identical round operations are performed on both the encryption as well as decryption processes. Each round operation is carried out by using three layers of sub-operations. The first layer also termed as Substitution layer (Sbox) performs nonlinear substitution operation on 64-bit input data using sixteen involutional 4 ×4 Sboxes and produces 64- bit output data. The Sbox used in PUFFIN cipher is given in Table 1. The second layer also termed as AddRoundKey layer performs data whitening operation on 64-bit input data using 64-bit unique roundkey and produces 64-bit output data. The data whitening operation can be performed with logical XOR operation. The third layer also termed as Permutation layer (P64) performs transposition of the 64-bit input data and produces 64-bit output data. The three layers of operations are repeated among 32 identical rounds using 32 unique sets of 64-bit roundkey to produce the 64-bit ciphertext. In the initial round, the Substitution layer operation alone is skipped from the round operation and the remaining operations such as AddRoundKey and Permutation are performed. The key generation algorithm produces 33 64-bit round keys from 66768 VOLUME 11, 2023 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers TABLE 2. Permutation used in PUFFIN cipher. FIGURE 1. Algorithmic steps in PUFFIN encryption process. the 128-bit secret key given by the user. In order to reduce the complexity, nonlinear operations are not used in the process and only permutation and selected bit inversions are involved. The permutation table for the transposition of 64-bit is given in Table 2. The selected key bit inversions are not performed in second, fifth, sixth and eighth rounds. In the remaining 28 rounds, the key bits 1, 2, 3 and 5 alone will be complemented. The compression operation selects 64 from the 128-bit key. B. PRINT LIGHTWEIGHT CIPHER PRINT is also a block cipher which takes b-bit blocks, b{48,96} as plaintext and produces b-bit blocks of ciphertext with the help of (5/3) x b bits of key. It follows the SPN structure and performs b identical rounds of operation. Each round operation is carried out by using five layers of sub-operations. The PRINT cipher-48 variant takes 48-bit plaintext and produces 48-bit ciphertext with 80-bit key using 48 rounds whereas the PRINT cipher-96 variant takes 96-bit TABLE 3. Sbox used in PRINT cipher. plaintext and produces 96-bit ciphertext with 160-bit key using 96 rounds of operation. The first layer also termed as AddRoundKey layer performs bitwise XOR operation between the current state of the cipher and b-bit subkey. The second layer also termed as Linear Diffusion Layer performs permutation of 48-bit input data and produces 48-bit output data on the current state of the cipher as per the equation (1). P(i)=(3 x i mod b −1for 0≤i≤b−2 b−1for i =b−1(1) The third layer also termed as AddRoundCounter (RCi) layer performs addition of round counter value on the least 6-bit of the current state using bitwise XOR operation for PRINT cipher-48 variant and on the least 7-bit of the current state using bitwise XOR operation for PRINT cipher-96 variant. The round counter value is generated by using a shift register and the contents of the shift register (xn−1...x0) are updated as per the equation (2). t=1+xn−1+xn−2 xi=xi−1for n −1≥i≥1 x0=t(2) The fourth layer also termed as Keyed Permutation Layer performs b/3 permutations on the current state based on the key values. The b bit of the current state is grouped as b/3 sets with each set consisting of 3-bit. There are four possible key dependent permutations and each b/3 permutation can be chosen from these four possibilities and the chosen permutation is used in the same set in every round. The fifth layer also termed as Substitution layer (Sbox) performs nonlinear substitution operation on b-bit input data using b/3 3 ×3 Sboxes as given in Table 3and produces b-bit output data. The five layers of operations are repeated among b identical rounds using b sets of b-bit round key from (5/3) x b bits of user key and produce b-bit cipher text. The sequence of operations in the PRINT cipher is shown in Fig. 2. Out of the (5/3) x b-bit user supplied key, the first b bits of key are used in the AddRoundKey operation in each round. The remaining (2/3) x b bit user supplied key are decomposed into b/3 sets of two bits and these two bits are used to pick one from the four possible permutations as given in Table 4. III. GROVER’S SEARCH ALGORITHM Grover’s Algorithm is a searching algorithm which enables us to find the element with high probability in lower time complexity. The classic method requires O(n) where Grover’s VOLUME 11, 2023 66769 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers TABLE 4. Permutation used in PRINT cipher. FIGURE 2. Algorithmic steps in PRINT encryption process. FIGURE 3. Grover’s algorithm. algorithm uses O(√n). The quantum description of Grover’s algorithm for the three qubits is given in Fig. 3[16], [17]. If the required element is found then the oracle function f(x)=1, otherwise f(x)=0. Then the oracle function flips the required element. In Fig. 4, if the required element is |01⟩ then the qubit |01⟩is flipped and the required element’s sign is also changed. The amplification part of Grover’s Algorithm deals with increasing the amplitude of the required element as shown in Fig. 5. Thus the amplitude of the required element is increased by performing Oracle and amplification repeatedly. IV. PROPOSED QUANTUM CIRCUIT FOR PUFFIN CIPHER In this work, the key steps of PUFFIN lightweight cryptographic algorithm such as AddRoundkey, Substitution Box, Permutation Layer, Key Scheduler are synthesized using FIGURE 4. Oracle of grover’s algorithm. FIGURE 5. Amplification of grover’s algorithm. ordinary gates and are then mapped to the quantum gates. The quantum gates are reused wherever possible as some of the outputs retains its original value which evenly reduces the quantum cost. A. QUANTUM CIRCUIT FOR AddRoundKey In the encryption module, the AddRoundKey of PUFFIN- 64/128 lightweight cipher includes the XOR operation between the 64-bit data and the left most 64-bit of 128-bit key in the first round. In the remaining rounds, the output from substitution layer and Key scheduler are XORed and given to the permutation layer. The XOR operations in AddRoundKey are performed by using CNOT quantum gates. To complete one AddRoundKey operation, 64 CNOT gates are required. B. QUANTUM CIRCUIT FOR SUBSTITUTION BOX The PUFFIN algorithm uses 4-bit Sbox and a single substitution layer contains 16 Sboxes. Three variants of Sboxes are designed using quantum gates. The optimal Sbox with less quantum cost is used for designing the complete quantum circuit. 1) SBOX USING ANF The first variant is designed using Algebraic Normal Form (ANF) method which uses only AND and XOR operation to build the circuit. The boolean expression of the PUFFIN Sbox-1 is derived and are mapped to the quantum gates. In this variant, AND and XOR operations are mapped to CCNOT and CNOT gates and hence consumes more quantum cost. The Quantum circuit design is given in Fig. 6and the 66770 VOLUME 11, 2023 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers FIGURE 6. Quantum circuit design of Sbox-1 using ANF. FIGURE 7. Quantum circuit design of Sbox-2 using non search based synthesis. FIGURE 8. Quantum circuit design of Sbox-3 using inplace implementation. ANF equation is as follows, y0=x0∗x2∗x3+x3∗x2+x3∗x1+x3 +x1∗x2∗x0+x1∗x2+x2+x1∗x0+1 y1=x3∗x1∗x2+x0∗x1∗x3+x1∗x2∗x0 +x2∗x0+x2+x1∗x0+x1+1 y2=x0∗x2∗x3+x3∗x2+x3+x1∗x2+x2+x0 y3=x3∗x1∗x2+x0∗x2∗x3+x3∗x2+x3∗x1 +x0∗x3+x1∗x2+x1∗x0+1 2) SBOX USING NON SEARCH BASED SYNTHESIS ALGORITHM In the second variant, Non Search Based Synthesis algorithm is employed which makes use of the reversible approach to design the circuit. This results in optimized quantum circuit with reduced quantum cost and qubits than the ANF approach as shown in Fig. 7. 3) SBOX USING INPLACE IMPLEMENTATION The final variant is designed using inplace method where the one-to-one mapping of this algorithm to the quantum gates results in the quantum circuit with zero ancilla qubits and reduced quantum cost as shown in Fig. 8. The Algorithm is as follows. C. QUANTUM CIRCUIT FOR P-LAYER The transposition of bits happens at permutation layer which requires only SWAP gates. The output from permutation layer Algorithm 1 Quantum circuit for Substitution Layer of PUFFIN using Inplace Method Input: 4-qubit input x(x3, x2, x1, x0) (before entering Sbox). Output: 4-qubit output y(y0, y1, y2, y3) (after performing Sbox). 1 : x1 ←Toffoli (x0, x3, x1) 2 : x0 ←CNOT (x3, x0) 3 : x3 ←Toffoli (x1, x2, x3) 4 : x2 ←Toffoli (x0, x3, x2) 5 : x1 ←Toffoli (x0, x2, x1) 6 : x3 ←X (x3) 7 : x0 ←Toffoli (x2, x3, x0) 8 : x3 ←Toffoli (x0, x1, x3) 9 : x2 ←CNOT (x3, x2) 10: x1 ←Toffoli (x2, x3, x1) 11: return x(x2, x1, x0, x3) is passed to the next round. In this operation no quantum cost calculation is involved as Swap gate operation can be obtained by rearranging the qubit labels [9]. D. QUANTUM CIRCUIT FOR KEY SCHEDULER The key scheduler of PUFFIN does not require any nonlinear operation. It performs only permutation and selected bit inversion. The permutation operation can be done by using SWAP gates. For selected bit inversion, only four bits in the position 1, 2, 3 and 5 are inverted. Therefore for one round only four Pauli X gates are required. And this selected bit inversion will not happen at second, fifth, sixth and eighth key rounds. V. PERFORMANCE ANALYSIS A. QUANTUM COST ESTIMATION OF DESIGNED SBOXES The quantum resources and cost estimation of the three variants of designed Sboxes are given in the Table 5. It is clear that Sbox-3 which is designed using inplace method consumes less quantum resources than the other two. In addition, the latency of Sbox-3 is also minimal which results in faster operation. Therefore Sbox-3 is considered for building the PUFFIN quantum circuit. B. QUANTUM COST ESTIMATION OF PUFFIN CIPHER BUILDING BLOCKS Quantum resources required for the designed AddRoundkey, Substitution Layer, Permutation Layer and Key-Scheduler are given in Table 6. As mentioned Earlier, the Sbox-3 which is designed using inplace method is considered for quantum cost calculation. Since the permutation operation uses only swap gates to just rearrange the wires, it is not included in the cost calculation. C. QUANTUM COST ESTIMATION OF ROUND OPERATION The quantum resources for the first round of operation in PUFFIN-64/128 is estimated and tabulated. Table 7shows the VOLUME 11, 2023 66771 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers TABLE 5. Quantum cost estimation of designed Sboxes. TABLE 6. Quantum cost estimation Of PUFFIN cipher building block. TABLE 7. Quantum cost estimation for one round of PUFFIN cipher. quantum cost estimation of Round 1 operation implemented with Sbox designed using inplace technique (Sbox-3). The proposed quantum circuit for one round of PUFFIN cipher takes 228 quantum gates with a quantum cost of 676. The substitution layer has a latency of 10 and XORing each roundkey has a latency of 1. Hence the total delay estimation for 32 rounds would sum up to 353 along with a delay of 1 for XORing roundkey 0. VI. PROPOSED QUANTUM CIRCUIT FOR PRINT CIPHER A. QUANTUM CIRCUIT FOR KEY-XOR The key length of (5/3) ×b is XORed with plaintext. The XOR operation can be performed using Quantum CNOT gates for 48-bit plaintext 16 CNOT gates are required and for 96-bit plaintext 32 CNOT gates are required. B. QUANTUM CIRCUIT FOR LINEAR DIFFUSION The linear diffusion is a rewiring operation and can be done with only swap gates whose operation can be obtained by rearranging the qubit labels. C. QUANTUM CIRCUIT FOR ROUND COUNTER The RoundCounter RCiis XORed with the least significant bits of the current values. Since the RoundCounter values are already known, Pauli-X gates which have unit quantum cost can be directly used based on the number of bit changes instead of using CNOT gates and additional qubits. D. QUANTUM CIRCUIT FOR KEYED PERMUTATION The permutation is based on the key values provided and this layer requires only the swapping of values which can be obtained by rearranging the qubit labels. The output of this layer is given to the substitution layer. E. QUANTUM CIRCUIT FOR S-LAYER The PRINT cipher uses 3 qubit Sbox circuits which can be derived using various classical techniques and can be mapped to the quantum circuit. 1) SBOX USING ANF The first approach used to design the Sbox is Algebraic Normal Form (ANF) which employs only AND and XOR gates. The Boolean expressions of the PRINT Sbox are derived first and are then mapped to the quantum circuit. This method uses ancillas and consumes more quantum cost as given by Fig. 9. The ANF expressions are as follows, y0=x0+x1∗x2 y1=x0+x1+x0∗x2 y2=x0+x1+x2+x0∗x1 2) SBOX USING NON-SEARCH BASED SYNTHESIS ALGORITHM The non-search based synthesis algorithm uses the reversible approach to obtain the circuit. This method consumes less 66772 VOLUME 11, 2023 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers TABLE 8. Quantum cost estimation of designed Sboxes. TABLE 9. Quantum cost estimation of PRINT-48 cipher building block. FIGURE 9. Quantum circuit design of Sbox-1 using ANF. FIGURE 10. Quantum circuit design of Sbox-2 using non-search based synthesis algorithm. FIGURE 11. Quantum circuit design of Sbox-3 using inplace implementation. quantum cost than the ANF method. The circuit is given in Fig. 10. 3) SBOX USING INPLACE IMPLEMENTATION The final variant of Sbox is designed using inplace method. The steps involved in the quantum circuit of PRINT Sbox are deduced in Algorithm 2. The one-to-one mapping of this algorithm to a quantum circuit consumes less quantum cost when compared to the previous variants as shown in Fig. 11. Algorithm 2 Quantum circuit for Substitution layer of PRINT using Inplace Method Input: 4-qubit input x(x0, x1, x2) (before entering Sbox). Output: 4-qubit output y(y0, y1, y2) (after performing Sbox). 1: x0 ←Toffoli (x1, x2, x0) 2: x1 ←Toffoli (x0, x2, x1) 3: x2 ←CNOT (x1, x2) 4: x1 ←CNOT (x0, x1) 5: x2 ←Toffoli (x0, x1, x2) 6: return x(x0, x1, x2) VII. PERFORMANCE ANALYSIS A. QUANTUM COST ESTIMATION OF DESIGNED SBOXES The quantum resource estimation of designed Sboxes using various approaches are given in Table 8. The ANF method consumes more quantum resources than the other approaches. Non-search based Synthesis algorithm uses zero Ancillas but has increased quantum cost than the inplace approach. B. QUANTUM COST ESTIMATION OF PRINT CIPHER BUILDING BLOCKS The AddRoundKey operation uses only CNOT gates based on the size of plain text. PRINT-48 consumes 48 CNOT gates VOLUME 11, 2023 66773 S. Paramasivam et al.: Compact Quantum Circuit Design of PUFFIN and PRINT Lightweight Ciphers TABLE 10. Quantum cost estimation of PRINT-96 cipher building block. TABLE 11. Quantum cost estimation for first round of PRINT cipher. TABLE 12. Comparison of quantum resources with other block ciphers. TABLE 13. Resource Estimation for a Grover-based key search. and PRINT-96 consumes 96 CNOT gates. The linear diffusion layer and permutation layer do not consume quantum cost as they use only SWAP Gates. The addition of Round- Counter values can be performed with Pauli-X gates and the quantum cost varies based on the rounds. For substitution layer, the Sbox designed using inplace method is considered 66774 VOLUME 11, 2023