# Research on Side-Channel Analysis Based on Deep Learning with Different Sample Data
## 4 CPA Side-Channel Analysis Based on Deep Learning
### CPA Experimental Analysis Process  
(1) Collection and pre-processing of side-channel data. This experiment uses the ChipWhisperer platform to perform SCA on the AES-128 cryptographic algorithm through the CW308T-STM32F3 demo board. When pre-processing the side channel data, it must first be aligned. Since the ChipWhisperer platform in the experiment has automatically aligned all collected data, this operation can be ignored. When the data are unstable, the variance or the degree of dispersion is large; it is necessary to normalize the data. The sample diagram of the power trace collected in the experiment is shown in Figure 6 below, and each trace contains 3000 data points. (2) Determine the location of the target attack point. The target attack point in the experiment is the output position of the first round S-box of the AES-128 cryptographic algorithm, and its output state can be expressed as \(state_{0}=Sbox(p_{0}\oplus k_{0})\), where subscript 0 represents the attack on the first byte of the key stream, S-box represents the byte substitution operation in the S-box, and \(p\) and \(k\) represent the input random plaintext and  
Figure 5: (**a**) Energy consumption data collection equipment; (**b**) target demo board. Figure 6: Single power trace waveform. random key information, respectively. Thus, the first byte K[0] of the key of the first round is recovered. (3) CPA attack on the power trace to find the data interest interval. The point of interest is the interval range of the encryption operation corresponding to the location of the attack point in a complete power trace, that is, the interesting interval. The detailed steps of CPA are as follows:  
Firstly, the power trace matrix T of the original side-channel data is established. A total of 50,000 energy consumption tracks were collected in this experiment, with 3000 sampling points on each track. Therefore, the energy consumption trajectory matrix T can be established, and its dimension is 50,000 \(\times\) 3000. Secondly, construct the output state matrix S. For an 8-bit key byte, the value of the key space ranges from 0 to 255, with a total of 256 possibilities. For all possible key values, obtain the output state matrix S of all target positions, and the matrix dimension is 50,000 \(\times\) 256. Finally, using the Pearson correlation coefficient [30] calculation method, the correlation between the power trace matrix T and the output state matrix S is calculated, and the final correlation coefficient matrix R is obtained with a dimension of 3000 \(\times\) 256, which represents the correlation coefficients of all possible key operations at all timing sampling points. Thus, the data point's position with the greatest correlation with the key in the power race is determined. The value range of the final interest interval is [850:930], with a total of 80 sampling points. Figure 7 shows the waveform of power trace information related to the first round of the encryption operation in the CPA of a single power trace. Figure 8 is the amplification result of the corresponding interest interval in the CPA, that is, it contains the energy consumption information of the first round of the S-box byte substitution operation. (4) According to the position of the determined interest interval, the original side-channel data are subjected to dimensionality reduction processing. In this experiment, the range of interest intervals is 850-930, that is, the original 3000-time series sampling points are reduced to 80, which greatly reduces the computational complexity of the deep learning  
Figure 8: Enlarged result of corresponding interest interval. Figure 7: CPA results correspond to the correct key. model and improves the computational efficiency. For the power consumption data of the CW308T-STM32F3 demo board, the correlation curve of all possible keys analyzed by CPA technology is shown in Figure 9 below. The range within the dotted line in the figure is the corresponding interval of the target byte in the experiment.