# Efficient Secure Mechanisms for In-Vehicle Ethernet in Autonomous Vehicles
## 3 Automotive Ethernet Security Protocol
### Design of Data Encryption and Authentication Algorithms for In-Vehicle Multimedia Signals
#### 3.2.1 Improved AES-128 Encryption Algorithm Design (IAES-128)
\[{S_{00}}^{\prime} =2{S_{00}}+1{S_{11}}+3{S_{22}}+1{S_{33}},{S_{01}}^{\prime}=2{S_{0 1}}+1{S_{12}}+3{S_{23}}+1{S_{30}}, \tag{3}\] \[{S_{02}}^{\prime} =2{S_{02}}+1{S_{13}}+3{S_{20}}+1{S_{31}},{S_{03}}^{\prime}=2{S_{0 3}}+1{S_{10}}+3{S_{21}}+1{S_{32}},\] \[{S_{10}}^{\prime} =1{S_{00}}+2{S_{11}}+1{S_{22}}+3{S_{33}},{S_{11}}^{\prime}=1{S_{0 1}}+2{S_{12}}+2{S_{23}}+1{S_{30}},\] \[{S_{12}}^{\prime} =1{S_{00}}+2{S_{13}}+1{S_{20}}+3{S_{31}},{S_{13}}^{\prime}=1{S_{0 3}}+2{S_{10}}+1{S_{21}}+3{S_{32}},\] \[{S_{20}}^{\prime} =3{S_{00}}+1{S_{11}}+2{S_{22}}+1{S_{33}},{S_{21}}^{\prime}=3{S_{0 1}}+1{S_{12}}+2{S_{23}}+1{S_{30}},\] \[{S_{22}}^{\prime} =3{S_{02}}+1{S_{13}}+2{S_{20}}+1{S_{31}},{S_{23}}^{\prime}=3{S_{0 3}}+1{S_{10}}+2{S_{21}}+1{S_{32}},\] \[{S_{30}}^{\prime} =1{S_{00}}+3{S_{11}}+1{S_{12}}+2{S_{33}},{S_{31}}^{\prime}=1{S_{0 1}}+3{S_{12}}+1{S_{23}}+2{S_{30}},\] \[{S_{32}}^{\prime} =1{S_{02}}+3{S_{13}}+1{S_{20}}+2{S_{31}},{S_{33}}^{\prime}=1{S_{0 3}}+3{S_{10}}+1{S_{21}}+2{S_{32}},\]  
The above operation expression is then expressed in the form of a vector matrix:  
\[\begin{pmatrix}{S_{00}}^{\prime}\\ {S_{01}}^{\prime}\\ {S_{02}}^{\prime}\\ {S_{03}}^{\prime}\\ {S_{10}}^{\prime}\\ {S_{11}}^{\prime}\\ {S_{11}}^{\prime}\\ {S_{12}}^{\prime}\\ {S_{13}}^{\prime}\\ {S_{20}}^{\prime}\\ {S_{21}}^{\prime}\\ {S_{21}}^{\prime}\\ {S_{22}}^{\prime}\\ {S_{23}}^{\prime}\\ {S_{30}}  
for adapting to the diverse performance requirements of automotive systems. Additionally, the IMD5 algorithm enhances the iterative word-generation formula, ensuring that the last 48 words are associated with the first 15 words, and improves two nonlinear functions to enhance algorithm security. These enhancements are aimed at providing a more efficient and secure data authentication mechanism that is better suited for the stringent demands of real-time communication in vehicle bus networks.  
During the padded grouping phase of the algorithm, arbitrary input message values are segmented into groups of 512 bits each. Following 64 rounds of iterations, users can select various lengths of output message digests according to their needs. This adaptability renders the MD5 algorithm suitable for diverse scenarios, particularly meeting the performance requirements of cyclicity, security, and real-time performance in the vehicle bus network context. The enhanced algorithm comprises the following four steps:  
Step 1: Filling Module: This step is identical to the corresponding step in the original MD5 algorithm. It involves padding the input message to a length that is a multiple of 512 bits.  
Step 2: Initialization of Variables: At the outset, this phase initializes the values of registers A, B, C, and D. These values are derived from the first 64 bits of the decimal part of the square root of the four smallest prime numbers (\(\sqrt{2}\), \(\sqrt{3}\), \(\sqrt{5}\), \(\sqrt{7}\)).  
Step 3: Message Digest Calculation: This phase generates a total of 64 words. Initially, the 512-bit message is decomposed into 16 32-bit words, represented as W[0],..., W[15]. The remaining 48 words are obtained by iterating through Equation (5), where \(\sigma_{0}\) and \(\sigma_{1}\) are nonlinear functions for confusion and diffusion.  
\[W_{i}=\sigma_{1}(W_{i-2})+W_{i-7}+\sigma_{0}(W_{i-15})+W_{i-16} \tag{5}\]  
Step 4: Data Group Processing: This stage entails executing four rounds of 16 operations each. In each operation, the four interconnected variables A, B, C, and D are initially assigned to the variables \(a\), \(b\), \(c\), and \(d\), respectively. Subsequently, the assigned variables \(a\), \(b\), \(c\), and \(d\), along with \(M_{j}\), the constants \(t_{i}\) (\(t_{i}=2^{64\times|\sin(i)|}\)), and \(s\), undergo a nonlinear function operation as per Equation (7). The resulting outcome of this operation replaces the variables \(a\), \(b\), \(c\), and \(d\) correspondingly. The four nonlinear function operations are illustrated in Equation (6) below:  
\[