MIPI message encryption and decryption method and device

By using the hardware-based MIPIsec method for encryption and decryption processing in MIPI message transmission, the MIPI message security problem is solved, and the image data is highly secure transmission is achieved, ensuring the privacy of car owners and driving safety.

CN117675328BActive Publication Date: 2024-12-17KUNGAO XINXIN MICROELECTRONICS (JIANGSU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311633902.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-01
Publication Date
2024-12-17
Estimated Expiration
2043-12-01

AI Technical Summary

Technical Problem

The prior art has failed to effectively solve the security problems of MIPI packets during transmission, and image data is easily stolen or tampered, resulting in threats to car owner's privacy and driving safety.

Method used

The hardware-based MIPIsec method is used to encrypt and decrypt MIPI messages, determine the encryption channel by parsing the messages, and use symmetric encryption to encrypt and integrity verification to ensure the security of the data during transmission.

Benefits of technology

It realizes line-speed forwarding and high-security transmission of MIPI messages, prevents data tampering and leakage, and significantly improves the transmission security of image data in the vehicle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117675328B_ABST
    Figure CN117675328B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for MIPI message encryption and decryption, which comprises the following steps in the encryption direction: S1: generating a MIPI message; S2: judging whether the MIPIsec function is enabled at the export, if so, proceeding to step S3, otherwise directly sending the message out; S3: the message enters a message parsing module, determines the SC through parsing, obtains the encryption information bound to the SC, and proceeds to step S4; S4: sending the message and the encryption information to the encryption module for encryption, and sending out after encryption; in the decryption direction, the method comprises the following steps: S5: after the MIPI message receiving module receives the message, sending it to the MIPI message parsing module for parsing; S6: judging whether the message has a sectag header and the entry enables MIPIsec, if so, obtaining the decryption information bound to the SC by determining the SC, and proceeding to step S7, otherwise directly sending it to an upper application layer processing module for subsequent processing; S7: sending the message and the decryption information to the decryption module for decryption, and sending it to the upper application layer processing module for subsequent processing after decryption.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of encryption and decryption of image data packets, and in particular to a method and device for encryption and decryption of MIPI messages. Background Art

[0002] MIPI (Mobile Industry Processor Interface) is an open standard initiated by the MIPI Alliance for mobile application processors. Its purpose is to standardize the internal interfaces of mobile phones, such as cameras, display interfaces, and RF / baseband interfaces, thereby reducing the complexity of mobile phone design and increasing design flexibility. In recent years, with the application of autonomous driving, many cars are equipped with high-resolution cameras to assist in autonomous driving, and the MIPI open standard has also been applied in the automotive field.

[0003] The industry currently offers a variety of symmetric encryption methods, such as SM4 (a block cipher standard adopted by China), AES (Advanced Encryption Standard), etc., that is, encryption and decryption use the same key, which can encrypt plain text into cipher text and decrypt cipher text into plain text. In addition, a fixed-length data, namely a MAC value (Message Authentication Code), can be generated to confirm the integrity of the message and perform authentication.

[0004] The camera transmits the captured image to the processor through the link for processing. However, because the image is transmitted in plain text, there is no security guarantee. Hackers can easily steal the image information and violate the privacy of the car owner. What's worse, they can destroy the data, causing great safety hazards to the car owner during driving. At present, there is no good method for encrypting MIPI messages in the industry. Summary of the invention

[0005] The present invention utilizes the scalability of symmetric encryption in cryptography and combines encryption characteristics with MIPI messages, referred to as MIPIsec (MIPI security). MIPIsec performs hardware-based encryption and decryption on MIPI messages, thereby improving the security of MIPI messages. This implementation method is closer to the bottom layer and can achieve line-speed forwarding of messages.

[0006] To achieve the above-mentioned purpose, the technical solution of the present invention provides a method for encrypting and decrypting MIPI messages, wherein, in the encryption direction, the method comprises the following steps: S1: the original image data is processed by the upper application layer processing module, the packet layer module and the bottom protocol layer module to generate a MIPI message; S2: judging whether the MIPIsec function is enabled at the export, if so, proceeding to step S3, otherwise the MIPI message is directly sent out from the MIPI message sending module; S3: the MIPI message enters the MIPI message parsing module, and the encryption channel SC is determined by parsing the MIPI message, thereby obtaining the encryption information bound to the SC, and then proceeding to step S4; S4: the MIPI message and the obtained encryption information are sent to the MIPI message parsing module; The message is sent to the encryption module for encryption processing, and after the message encryption is completed, it is sent to the MIPI message sending module for sending; in the decryption direction, the method includes the following steps: S5: after the MIPI message receiving module receives the MIPI message, the MIPI message is sent to the MIPI message parsing module for parsing; S6: determine whether the message has a sectag header and the entry enables MIPIsec. If so, obtain the decryption information bound to the SC by determining the SC, and then proceed to step S7, otherwise it is directly sent to the upper application layer processing module for subsequent processing; S7: send the MIPI message and the obtained decryption information to the decryption module for decryption processing, and after the decryption processing is completed, send it to the upper application layer processing module for subsequent processing.

[0007] Further, in step S3 and step S6, the process of determining SC includes: F1: obtaining the virtual data channel VC and data type DT in the DI information by parsing the MIPI message; F2: determining whether the parsed DT value is between 0x00 and 0x0f, if so, the message is considered to be a short packet and proceeds to step F3, otherwise the message is considered to be a long packet and proceeds to step F4; F3: determining whether the short packet needs to bypass MIPIsec processing, if so, the short packet is not encrypted or decrypted and is directly sent out, otherwise the short packet needs to be encrypted or decrypted and proceeds to step F4; F4: performing SC search processing.

[0008] Furthermore, in step F4, the SC search processing modes include the following three: using VC+DT as the key to do SC lookup; using VC as the key to do SC lookup; and global mode, using one SC to do SC lookup by default.

[0009] Furthermore, in step F4, if the SC lookup hit is successful, SC info is used to encrypt and decrypt the message; if the hit is unsuccessful, the message is discarded.

[0010] Further, in step S4, if a long packet is encrypted, sectag is located after DI and ICV is located before CRC, the WC+ECC+data part is encrypted and integrity checked, and the DI field is integrity checked; if a short packet is encrypted, sectag is located after DI and ICV is located after the data part, the data part is encrypted and integrity checked, and the DI field is integrity checked.

[0011] Furthermore, at the sending end, the CRC content of the message is removed and the 16-byte ICV is calculated using the key and inserted after the data payload. At the receiving end, the encrypted data is still inversely calculated using the key to obtain the ICV. By judging whether the ICV carried by the message is equal to the calculated ICV, it is determined whether the message has been tampered with.

[0012] Furthermore, when it is determined that the message has been tampered with, the message is directly discarded; when it is determined that the message has not been tampered with, the decryption information bound to the corresponding encryption channel SC is found through a lookup to perform decryption. If the decryption is successful, the sectag and ICV are stripped off and restored to plain text for subsequent processing. If the decryption fails, the message is discarded.

[0013] The technical solution of the present invention also provides a device for MIPI message encryption and decryption, which is used to execute the method as described above, and the device includes the following modules: an upper application layer processing module, a packet layer module, a bottom protocol layer module, a MIPI message parsing module, an encryption module, a MIPI message sending module, a MIPI message receiving module and a decryption module. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a schematic diagram of long packet encryption and decryption message encapsulation of the present invention;

[0015] Figure 2 It is a schematic diagram of short packet encryption and decryption message encapsulation of the present invention;

[0016] Figure 3 It is a schematic diagram of the encryption and decryption architecture design of the present invention;

[0017] Figure 4 It is a schematic diagram of the process of searching for SC in the present invention. DETAILED DESCRIPTION

[0018] The technical solution of the present invention is further described below in conjunction with specific embodiments, but the present invention is not limited to these embodiments.

[0019] At the transmitting end, the camera performs corresponding image processing on the raw data at the application layer, including white balance / noise removal and color restoration, etc., and then enters the processed data into the packet layer for data segmentation and reorganization, and then transmits it to the underlying protocol layer. The underlying protocol layer will generate a packet header according to the data type, and generate a check sequence that constitutes the packet tail according to the data content, and then send the packet header, the data itself and the packet tail together to the channel management layer. The channel management layer module reasonably allocates data to each channel according to the channel selection situation, and then the data enters the physical layer through digital-to-analog conversion and is transmitted to the processor. After receiving the physical layer data, the receiving end unpacks the original image data in the reverse order of the previous one.

[0020] Taking the D-PHY transceiver data stream as an example to analyze the specific message format, there are two types of data packets for communication between the processor and the camera module: long packets (or long frames) and short packets (or short frames). The long packet is mainly composed of a 4-byte header, valid data padding, and a 2-byte tail. The header is composed of a 1-byte data identity (Data Identity, DI) and a 2-byte data count (Word Count, WC) indicating the length of the padding data, in bytes and a 1-byte error detection (ECC). Valid data padding can be filled with 0 to 65535 bytes of data. The tail is used as a check value, with the low bit first. The check value can only detect errors, but cannot correct them.

[0021] DI is composed of virtual data channel VC (Vitual Channel) [7:6] and data type DT (Data Type) [5:0]. The purpose of VC is to provide separate channels for different data streams interleaved in the data stream. The virtual channel identifier is located in the first two bits of the DI byte. The receiving end will identify the received VC identifier and direct it to the corresponding channel. It supports up to 4 data streams, and the valid VC identifiers are 0 to 3. The DT value can specify the format and content of the effective load data.

[0022] A short packet has a total of four bytes, which only contains a packet header and no packet tail. The 16-bit WC in the packet header is replaced by the data field of the short packet (the data field has different filling contents due to different DTs).

[0023] When using MIPIsec to encrypt a long packet, the sectag (Security Tag) should be located after the DI, and the ICV (Integrity Check Value) should be located before the CRC (Cyclic Redundancy Check). The WC+ECC+data part can be encrypted and integrity checked, and the DI field can be integrity checked. The encryption channel selection can be based on VC, that is, one VC corresponds to one encryption channel, and different keys are used to encrypt the message. It can be globally unique, that is, the same key is used to encrypt the message, or VC+DT can be used to encrypt the message with a finer granularity, providing optional granularity for selection. The decrypted long packet is decrypted based on the VC and DT carried by the message to find the decryption information bound to the corresponding encryption channel for decryption. If the decryption is successful, the sectag and ICV are stripped off and restored to plain text for subsequent processing. If the decryption fails, the message is discarded.

[0024] For short packets, because their length is very short, if the short packets are encrypted, the message will become longer and the burden of the transmission link will be increased. In addition, the data field of the short packets carries some control information. For example, if the short packet is Data Type Frame Synchronization, the data field indicates the number of frames; if the Data Type of the short packet is Line Synchronization, the data field indicates the number of lines; it also includes some timing information such as shutter opening / closing and flash triggering. This information is less protectable, and even if this information is stolen, it will not lead to the leakage of user information, so it can be selectively encrypted. If the short packet does not need to be encrypted, it will be forwarded directly. If encryption is required, the encryption method is the same as the long packet encryption, which will not be repeated. Here we need to explain how to distinguish short packets. According to DT, if the DT value is 0x00-0x0f, it is a short packet.

[0025] If you choose not to encrypt short packets, the decryption end should also choose not to decrypt short packets and directly transmit them.

[0026] Figure 1 The schematic diagram of long packet encryption and decryption message encapsulation is shown. Figure 1The message encapsulation format on the left is a plaintext MIPI package. The specific format content has been described in detail above. The message encapsulation format on the right is an encrypted MIPI message. The sectag is located after the 1-byte Data ID and the ICV is located before the CRC. The contents between the sectag and the ICV will be encrypted. These contents are transmitted in ciphertext during the entire transmission process of the message. The original data can only be obtained after the other end receives the message and decrypts it. In addition, the message will be authenticated after removing the CRC. At the sending end, the 16-byte ICV calculated by using the key after removing the CRC of the message is inserted after the data payload. At the other end, the key is still used to inversely calculate the encrypted data to obtain the ICV. If the ICV carried by the message is equal to the calculated ICV, it means that the message content has not been tampered with. If they are not equal, it means that the message content has been tampered with. This mechanism greatly protects the security of the data. At the receiving end, if the message has not been tampered with, the ciphertext will be replaced with plaintext, and the sectag and ICV will be stripped for subsequent processing.

[0027] Figure 2 The schematic diagram of short packet encryption and decryption message encapsulation is shown. Its technical solution is the same as the long packet encryption and decryption process, so I will not repeat it here.

[0028] Figure 3 The encryption and decryption architecture design is shown. In the encryption direction, the original image data passes through the upper application layer processing module, the packet layer module, and the bottom protocol layer to generate MIPI data packets, and determine whether the exporter has enabled the MIPIsec function. If not, the message is directly sent out from the MIPI message sending module. If enabled, it will enter the MIPI message parsing module to parse the MIPI message key information, and use this key information to determine the SC (specifically in Figure 4 ), the encrypted information is bound to the SC (Secure Channel), and the encrypted information and the message are sent to the encryption module for encryption. After the message is encrypted, it is sent to the MIPI message sending module. In the decryption direction, the MIPI message receiving module receives the MIPI ciphertext, and then sends the MIPI ciphertext to the MIPI message parsing module to parse the key information of the MIPI message and determine whether the sectag exists. Here, the first two bytes of the sectag can be used to determine. If the first two bytes of the sectag are equal to the sectag type (type is configurable), it is considered to be a sectag header, otherwise it is an unencrypted message. If the sectag header exists and MIPIsec is enabled on the entry, these key information are used to determine the SC (specific details will be in the attached). Figure 4The decryption information is bound to the SC, and the decryption information and the message are sent to the decryption module for decryption processing. After the decryption processing is completed, it is finally sent to the upper application layer processing module for subsequent processing.

[0029] Figure 4 The process of searching for SC is shown. When MIPIsec is enabled, the MIPI message is first parsed to obtain DIInfo including the virtual data channel VC (Vitual Channel) [7:6] and the data type DT (Data Type) [5:0]. If the parsed DT value is between 0x00 and 0x0f, it is considered to be a short packet. For the short packet, see whether it needs to bypass MIPIsecprocess. If bypassed, it is considered that the short packet does not need to be encrypted and decrypted and is directly sent out. If not bypassed, it is considered that the short packet needs to be encrypted and decrypted, and then the SC search is performed. If the DT value is not between 0x0 and 0xf, it is considered to be a long packet, and then the SC search is performed. There are three modes for SC lookup processing. One is to use VC+DT as the key to do SC lookup, the other is to use VC as the key to do SC lookup, and the last is the global mode. By default, one SC is used to do SC lookup, that is, all received messages use one SC. You can choose the appropriate SC output method according to different needs. If the SC lookup hit is successful, SC info is used to encrypt and decrypt the message. If the hit is unsuccessful, the message is discarded.

[0030] It should be noted that the process of issuing MIPIsec keys is not within the scope of the present invention, and those skilled in the art can flexibly select appropriate methods to adapt the present invention. In addition, it can be understood that although the above embodiment is described with D-PHY transceiver data stream as an example, the present invention is also applicable to the application scenarios of C-PHY, A-PHY, M-PHY and other transceivers.

[0031] In an embodiment of the present invention, a method for encrypting and decrypting MIPI messages is provided, wherein, in the encryption direction, the method comprises the following steps: S1: the original image data is processed by an upper application layer processing module, a packet layer module and a bottom protocol layer module to generate a MIPI message; S2: judging whether the MIPIsec function is enabled at the export, if so, proceeding to step S3, otherwise the MIPI message is directly sent out from the MIPI message sending module; S3: the MIPI message enters the MIPI message parsing module, and the encryption channel SC is determined by parsing the MIPI message, thereby obtaining the encryption information bound to the SC, and then proceeding to step S4; S4: the MIPI message and the obtained encryption information are sent to The encryption module performs encryption processing, and after the message encryption is completed, it is sent to the MIPI message sending module for sending; in the decryption direction, the method includes the following steps: S5: after the MIPI message receiving module receives the MIPI message, the MIPI message is sent to the MIPI message parsing module for parsing; S6: determine whether the message has a sectag header and the entry enables MIPIsec. If so, obtain the decryption information bound to the SC by determining the SC, and then proceed to step S7, otherwise it is directly sent to the upper application layer processing module for subsequent processing; S7: send the MIPI message and the obtained decryption information to the decryption module for decryption processing, and after the decryption processing is completed, send it to the upper application layer processing module for subsequent processing.

[0032] Further, in step S3 and step S6, the process of determining SC includes: F1: obtaining the virtual data channel VC and data type DT in the DI information by parsing the MIPI message; F2: determining whether the parsed DT value is between 0x00 and 0x0f, if so, the message is considered to be a short packet and proceeds to step F3, otherwise the message is considered to be a long packet and proceeds to step F4; F3: determining whether the short packet needs to bypass MIPIsec processing, if so, the short packet is not encrypted or decrypted and is directly sent out, otherwise the short packet needs to be encrypted or decrypted and proceeds to step F4; F4: performing SC search processing.

[0033] Furthermore, in step F4, the SC search processing modes include the following three: using VC+DT as the key to do SC lookup; using VC as the key to do SC lookup; and global mode, using one SC to do SC lookup by default.

[0034] Furthermore, in step F4, if the SC lookup hit is successful, SC info is used to encrypt and decrypt the message; if the hit is unsuccessful, the message is discarded.

[0035] Further, in step S4, if a long packet is encrypted, sectag is located after DI and ICV is located before CRC, the WC+ECC+data part is encrypted and integrity checked, and the DI field is integrity checked; if a short packet is encrypted, sectag is located after DI and ICV is located after the data part, the data part is encrypted and integrity checked, and the DI field is integrity checked.

[0036] Furthermore, at the sending end, the CRC content of the message is removed and the 16-byte ICV is calculated using the key and inserted after the data payload. At the receiving end, the encrypted data is still inversely calculated using the key to obtain the ICV. By judging whether the ICV carried by the message is equal to the calculated ICV, it is determined whether the message has been tampered with.

[0037] Furthermore, when it is determined that the message has been tampered with, the message is directly discarded; when it is determined that the message has not been tampered with, the decryption information bound to the corresponding encryption channel SC is found through a lookup to perform decryption. If the decryption is successful, the sectag and ICV are stripped off and restored to plain text for subsequent processing. If the decryption fails, the message is discarded.

[0038] In other embodiments of the present invention, a device for MIPI message encryption and decryption is also provided, which is used to execute the method as described above, and the device includes the following modules: an upper application layer processing module, a packet layer module, a bottom protocol layer module, a MIPI message parsing module, an encryption module, a MIPI message sending module, a MIPI message receiving module and a decryption module.

[0039] The present invention utilizes the scalability of symmetric encryption in cryptography, combines encryption characteristics with MIPI messages, performs hardware-based encryption and decryption on MIPI messages, and improves the security of MIPI messages. This implementation method is closer to the bottom layer and can achieve line-speed forwarding of messages. In addition, per VC, per DT encryption channels can be selected, and encryption granularity can be flexibly selected to further improve data security.

[0040] The above is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several modifications and improvements without departing from the inventive concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A method for encrypting and decrypting MIPI messages. It is characterized in that In the encryption direction, the method comprises the following steps: S1: The original image data is processed by the upper application layer processing module, the packet layer module and the underlying protocol layer module to generate a MIPI message; S2: Determine whether the MIPIsec function is enabled at the egress. If yes, proceed to step S3. Otherwise, send the MIPI message directly from the MIPI message sending module. S3: The MIPI message enters the MIPI message parsing module, and the encryption channel SC is determined by parsing the MIPI message, thereby obtaining the encryption information bound to the SC, and then proceeding to step S4; S4: Send the MIPI message and the obtained encryption information to the encryption module for encryption processing. After the message encryption is completed, it is sent to the MIPI message sending module for transmission; In the decryption direction, the method comprises the following steps: S5: After the MIPI message receiving module receives the MIPI message, the MIPI message is sent to the MIPI message parsing module for parsing; S6: Determine whether the message has a sectag header and whether the ingress has MIPIsec enabled. If so, obtain the decryption information bound to the SC by determining the SC, and then proceed to step S7, otherwise, directly send it to the upper application layer processing module for subsequent processing; S7: Send the MIPI message and the obtained decryption information to the decryption module for decryption processing. After the decryption processing is completed, it is sent to the upper application layer processing module for subsequent processing; wherein, In step S3 and step S6, the process of determining SC includes: F1: By parsing the MIPI message, determine whether the message is a short packet, if yes, proceed to step F2, otherwise proceed to step F3; F2: Determine whether the short packet needs to bypass MIPIsec processing. If so, the short packet is not encrypted or decrypted and is sent directly. Otherwise, the short packet needs to be encrypted or decrypted and the process goes to step F3. F3: Perform SC search processing.

2. The method according to claim 1, It is characterized in that In step F1, determining whether the message is a short packet includes: F11: Obtain the virtual data channel VC and data type DT in the DI information by parsing the MIPI message; F12: Determine whether the parsed DT value is between 0x00 and 0x0f. If so, the message is considered to be a short packet, otherwise it is considered to be a long packet.

3. The method according to claim 2, It is characterized in that In step F4, the SC search processing modes include the following three: Use VC+DT as the key to do SC lookup; Use VC as the key to do a lookup of SC; In global mode, one SC is used by default to do SC lookup.

4. The method according to claim 3, It is characterized in that In step F4, if the SC lookup hit is successful, SC info is used to encrypt and decrypt the message. If the hit is unsuccessful, the message is discarded.

5. The method according to claim 4, It is characterized in that In step S4, If a long packet is encrypted, the sectag is located after the DI, and the ICV is located before the CRC. The WC+ECC+data part is encrypted and integrity checked, and the DI field is integrity checked. If a short packet is encrypted, the sectag is located after the DI and the ICV is located after the data part. The data part is encrypted and integrity checked, and the DI field is integrity checked.

6. The method according to claim 5, It is characterized in that At the sending end, the CRC content of the message is removed and the 16-byte ICV is calculated using the key and inserted after the data payload. At the receiving end, the encrypted data is still inversely calculated using the key to obtain the ICV. By judging whether the ICV carried by the message is equal to the calculated ICV, it is determined whether the message has been tampered with.

7. The method according to claim 6, It is characterized in that When it is determined that the message has been tampered with, the message is directly discarded; When it is determined that the message has not been tampered with, a lookup is performed to find the decryption information bound to the corresponding encryption channel SC for decryption. If the decryption is successful, the sectag and ICV are stripped off and restored to plain text for subsequent processing. If the decryption fails, the message is discarded.

8. A device for encrypting and decrypting MIPI messages, It is characterized in that For executing the method according to any one of claims 1 to 7, the device comprises the following modules: an upper application layer processing module, a packet layer module, a bottom protocol layer module, a MIPI message parsing module, an encryption module, a MIPI message sending module, a MIPI message receiving module and a decryption module; wherein, The upper application layer processing module is used to perform image processing and transmit the processed data to the packet layer module; The packet layer module is used to perform data segmentation and reorganization, and transmit the segmented and reorganized data to the bottom layer protocol layer module; The bottom protocol layer module is used to generate a packet header according to the data type, generate a check sequence constituting a packet tail according to the data content, and then combine the packet header, the data itself and the packet tail to form a MIPI message.