# Barrel Shifter Physical Unclonable Function Based Encryption
## 3 Block Encryption Protocol
### Asymmetric Encryption
#### 3.2.2 Symmetric Encryption  
BS-PUF must preserve plaintext message bit positions in the ciphertext to meet the commutativity requirement of encryption protocol with no shared key. Otherwise, the bit delay vector cannot be recovered correctly. The shift permutation is deployed for generating quantized physical delays. If the ciphertext message bits are permuted, they present a stronger challenge for man-in-the-middle attacks. In order to deploy permuted public messages, [PERSON] and [PERSON] must share the same key. The corresponding protocol is shown in Figure 6.  
A key sharing protocol such as Diffie-Hellman key exchange scheme can be used to share a secret as needed in the following symmetric encryption protocol. In the symmetric encryption protocol, [PERSON] permutes the input message with \(\pi\) entangling it with his delay. [PERSON] reverses the permutation using \(\pi^{-1}\) entangling it with her delay. Thus, the bits are in their original positions in the message sent to [PERSON] for decryption. Note that entanglement with both PUFs' delays protects this message. The delay will be un-entangled from the correct bits in the subsequent decryption steps. Details of the shared key scheme presented in Figure 6 are as follows:  
* **Step 1:** [PERSON] permutes \(x_{0},x_{1},x_{2},x_{3}\) with \(\pi=(1,2,3,0)\) and gets \((x_{3}\oplus D(3,0)_{m},x_{0}\oplus D(0,1)_{m},\)\(x_{1}\oplus D(1,2)_{m},x_{2}\oplus D(2,3)_{m})\). It is sent to [PERSON] without any further bit-level routing; this achieves bit-level confusion of the public message. * **Step 3:**\(f_{[PERSON]}\) performs the reverse permutation \(\pi^{-1}\) of \(f_{[PERSON]}\) and simultaneously applies [PERSON]'s delay (\(\pi^{-1}=(3,0,1,2)\)). After \(f_{[PERSON]}\) is applied, all bits are rotated back to their original position, but each bit is encrypted with two physical delay values. In this example, after applying \(f_{[PERSON]}\), we get \((x_{0}\oplus D(0,1)_{m}\oplus d(1,0)_{m},x_{1}\oplus D(1,2)_{m}\oplus d(2,1)_{ m},x_{2}\oplus D(2,3)_{m}\oplus d(3,2)_{m},x_{3}\oplus D(3,0)_{m}\oplus d(0,3)_{m})\). Figure 6: Sharing a key allows both parties to perform the same permutation. This ensures that the delay is subtracted from the correct bit when performing the inverse \(f_{PUF_{x}}^{-1}\). Shifting the public message adds entropy. * **Step 5:**\(f_{[PERSON]}^{-1}\) is applied. Permutation \(\pi\) is applied again and the delay added in Step 1 is negated by XOR. Then, the message sent to [PERSON] is converted to \((x_{3}\oplus D(3,0)_{m}\oplus d(0,3)_{m}\oplus D(3,0)_{m}\), \(x_{0}\oplus D(0,1)_{m}\oplus d(1,0)_{m}\oplus D(0,1)_{m},x_{1}\oplus D(1,2)_{m }\oplus d(2,1)_{m}\oplus D(1,2)_{m},x_{2}\oplus D(2,3)_{m}\oplus d(3,2)_{m}\)\(\oplus D(2,3)_{m})\), which is \((x_{3}\oplus d(0,3)_{m},x_{0}\oplus d(1,0)_{m},x_{1}\oplus d(2,1)_{m},x_{2} \oplus d(3,2)_{m})\)
* **Step 7:**\(f_{Alice}^{-1}\) is applied, bit positions are rotated back again, and the delay added in Step 3 is negated by XOR. The message from the previous step is converted to \((x_{0}\oplus d(1,0)_{m}\oplus d(1,0)_{m},x_{1}\oplus d(2,1)_{m}\oplus d(2,1)_{ m},x_{2}\oplus d(3,2)_{m}\oplus d(3,2)_{m},x_{3}\oplus d(0,3)_{m}\oplus d(0,3)_{m})\), which equals the original message \(x_{0},x_{1},x_{2},x_{3}\). Evaluating all messages crossing the insecure channel, \(M^{\prime}=(x_{3}\oplus D(3,0)_{m},x_{0}\oplus D(0,1)_{m},x_{1}\oplus D(1,2)_{ m},x_{2}\oplus D(2,3)_{m})\), \(M^{\prime\prime}=(x_{0}\oplus D(0,1)_{m}\oplus d(1,0)_{m},x_{1}\oplus D(1,2)_{ m}\oplus d(2,1)_{m},x_{2}\oplus D(2,3)_{m}\oplus d(3,2)_{m},x_{3}\oplus D(3,0)_{m} \oplus d(0,3)_{m})\), \(M^{\prime\prime\prime}=(x_{3}\oplus d(0,3)_{m},x_{0}\oplus d(1,0)_{m},x_{1} \oplus d(2,1)_{m},x_{2}\oplus d(3,2)_{m})\). Linear equations such as \(M^{\prime}\oplus M^{\prime\prime}\) do not reveal any useful information due to the additional shifting performed using the shared key. There is no way to retrieve the original message from the in flight messages without the shared key and access to [PERSON] and [PERSON]'s PUFs.