A communication method and system for a microcontroller unit
By analyzing the address correlation and short-term instruction continuity of the instruction communication data of the micro control unit, the number of substitutions in the encryption process is adjusted, which solves the problem of low encryption efficiency of the ASCON encryption algorithm when processing continuous instruction data and improves encryption security. and efficiency.
Patent Information
- Application Number
- CN202410935635.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-07-12
AI Technical Summary
When processing a large amount of continuous and highly correlated command data, the existing lightweight data encryption algorithm ASCON has low encryption efficiency. An attacker can increase the possibility of cracking other command data based on cracking one continuous command communication data. .
By analyzing the address correlation and instruction short-term continuity of the instruction communication data of the micro control unit, the address correlation weight is determined, and the number of target substitutions in the encryption process is adjusted based on the weight to improve encryption complexity and security.
It improves the encryption security of a large number of continuous and highly correlated instruction data of the micro control unit in a short period of time, reduces the possibility of being breached by malicious attackers, and improves encryption efficiency.
Smart Images

Figure CN118468325B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a communication method and system of a micro control unit in the technical field of data processing. Background Art
[0002] Microcontroller Unit (MCU), also known as a single-chip microcomputer or single-chip microcomputer, is a chip-level computer formed by appropriately reducing the frequency and specifications of the central processor through memory, counters, Universal Serial Bus (USB), analog-to-digital (A / D) conversion, Universal Asynchronous Receiver / Transmitter (UART), Programmable Logic Controller (PLC), Direct Memory Access (DMA) and other peripheral interfaces and driver circuits to provide different combination controls for different applications. The security of MCU communication and transmission data has always been a concern, and choosing a suitable lightweight data encryption algorithm to encrypt MCU communication data has become the key.
[0003] The communication data of the microcontroller unit is encrypted using a lightweight data encryption algorithm (ASCON), which has low resource consumption, can provide high data throughput while preventing attackers from maliciously tampering with data, and can be more easily integrated into the existing MCU firmware. However, when the communication data of the microcontroller unit is instruction data, the associated data in the ASCON encryption algorithm does not consider the time information of continuous instruction communication data, and lacks analysis of the correlation between continuous instruction communication plaintext data; when an attacker cracks a continuous instruction communication data, he needs to increase the possibility of cracking the remaining instruction communication data in a short time. Therefore, when processing a large amount of continuous and highly correlated instruction data, the encryption efficiency of the ASCON algorithm is low. Summary of the invention
[0004] In order to solve the technical problem of low encryption efficiency when processing a large amount of continuous and highly correlated instruction data, the purpose of the present invention is to provide a communication method for a micro control unit, and the technical solution adopted is as follows:
[0005] In a first aspect, an embodiment of the present invention provides a communication method of a micro control unit, the method comprising:
[0006] Obtaining instruction communication data of the microcontroller unit;
[0007] Determining the address relevance of the instruction communication data and the short-term continuity of the instruction;
[0008] Determining the address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction;
[0009] Determining a target number of permutations of the intermediate stage of the corresponding associated data during the encryption process of the instruction communication data based on the address association weight;
[0010] The command communication data is encrypted based on the target number of replacement times and the associated data.
[0011] In combination with the first aspect above, in some possible implementations, the obtaining of instruction communication data of the micro control unit includes:
[0012] Determine an encryption interval that meets a preset time length;
[0013] Determining the last session in the encryption interval based on the real-time instruction communication data in the current session;
[0014] The command communication data corresponding to the last session is used as the command communication data of the micro control unit.
[0015] In the above scheme, by setting the encryption interval, the real-time instruction communication data in the current session is taken as the last session in an encryption interval, so that the instruction communication data of the micro control unit can be quickly obtained through the instruction communication data corresponding to the last session.
[0016] In combination with the first aspect above, in some possible implementations, determining the address relevance of the instruction communication data and the short-term continuity of the instruction includes:
[0017] Determining multiple sessions of the micro control unit in the same encryption interval;
[0018] determining similarities between address data in the instruction communication data of the plurality of sessions;
[0019] Determining the address relevance based on the similarity between the address data;
[0020] The instruction short-term continuity is determined based on time stamps of instruction communication data in the plurality of sessions.
[0021] In the above scheme, by analyzing the similarity between the address data in the instruction communication data of each session, the address correlation corresponding to the instruction communication data of different sessions can be accurately analyzed; and through the time difference between the instruction communication data in each session, the short-term continuity of the instructions of the instruction communication data can be accurately analyzed.
[0022] In combination with the first aspect, in some possible implementations, determining the short-term continuity of the instruction based on timestamps of instruction communication data in the multiple sessions includes:
[0023] Determine the time difference between the current session and each of the other sessions based on the timestamp of the instruction communication data in the current session and the timestamp of the instruction communication data in each of the other sessions to obtain multiple time differences;
[0024] Based on the maximum value and the minimum value of the multiple time differences, the instruction short-term continuity of the instruction communication data in the current session is determined.
[0025] In the above solution, the short-term continuity of instructions of instruction communication data in the current session can be accurately determined by the maximum and minimum values of the time difference between the current session and each other session.
[0026] In combination with the first aspect above, in some possible implementations, determining the address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction includes:
[0027] Determining address repetition factor and communication delay information based on address relevance of the instruction communication data and short-term continuity of the instruction;
[0028] Based on the address repetition factor and the communication delay information, an address association weight of the instruction communication data is determined.
[0029] In the above scheme, the association between instruction communication data can be analyzed through the address repetition factor and communication delay information, so that the size of the address association weight can be controlled through the address repetition factor and the communication delay information, thereby increasing the encryption complexity and ensuring the security of instruction communication data.
[0030] In combination with the first aspect above, in some possible implementations, determining the address repetition factor and the communication delay information based on the address relevance of the instruction communication data and the short-term continuity of the instruction includes:
[0031] determining the address repetition factor based on the address relevance of the instruction communication data;
[0032] Determine the communication delay factor based on the short-term continuity of the instruction and the accumulated result of the time difference; wherein the accumulated result of the time difference includes: the time difference between the instruction communication data and the instruction communication data corresponding to other sessions in the encryption interval;
[0033] Determining a delay rule weight based on the communication delay factor;
[0034] The communication delay information is determined based on the communication delay factor and the delay regularity weight.
[0035] In the above scheme, the communication delay information is obtained through the communication delay factor and the delay rule weight, so that the communication delay situation in the session can be accurately analyzed.
[0036] In combination with the first aspect, in some possible implementations, determining the address repetition factor based on the address association of the instruction communication data includes:
[0037] Determining the similarity between the instruction communication data in each session based on the address association of the instruction communication data in each session;
[0038] The address repetition factor is determined based on the similarity between the instruction communication data in each session.
[0039] In the above scheme, by analyzing the similarity between the instruction communication data in each session, the obtained address repetition factor can be made more accurate, thereby improving the security of the encryption process.
[0040] In combination with the first aspect, in some possible implementations, determining, based on the address association weight, a target number of replacements of the intermediate stage of the corresponding associated data in the encryption process of the instruction communication data includes:
[0041] Using the data header of the instruction communication data of the micro control unit as the associated data;
[0042] Based on the address association weight, determining minimum associated instruction data in the encryption interval where the instruction communication data is located;
[0043] Obtaining the minimum number of replacements of the minimum associated instruction data in the intermediate stage;
[0044] The target number of permutations is determined based on the address association weight corresponding to the minimum number of permutations and the instruction communication data.
[0045] In the above scheme, the target number of replacements is determined by comprehensively considering the address correlation of the instruction communication data of the microcontroller unit in a short period of time and the short-term continuity of the instructions, so as to change the number of replacements of the associated data in the intermediate stage according to the target number of replacements, thereby improving the encryption security of the instruction communication data.
[0046] In combination with the first aspect above, in some possible implementations, encrypting the instruction communication data based on the target number of replacements and the associated data includes:
[0047] Dividing the associated data based on a preset bit length to obtain multiple groups of data blocks;
[0048] determining internal states of the plurality of groups of data blocks;
[0049] According to the target number of permutations, a preset permutation function is used to perform multiple rounds of permutations on the internal states of the multiple groups of data blocks, so as to encrypt the instruction communication data.
[0050] In the above scheme, by setting the encryption interval, the real-time instruction communication data in the current session is taken as the last session in an encryption interval, so that the instruction communication data of the micro control unit can be quickly obtained through the instruction communication data corresponding to the last session.
[0051] In a second aspect, a communication system of a micro control unit is provided, the system comprising:
[0052] An acquisition module, used for acquiring instruction communication data of a microcontroller unit;
[0053] A first determination module, used to determine the address relevance of the instruction communication data and the short-term continuity of the instruction;
[0054] A second determination module, configured to determine an address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction;
[0055] A third determination module is used to determine a target number of replacements of the intermediate stage of the corresponding associated data in the encryption process of the instruction communication data based on the address association weight;
[0056] The encryption module is used to encrypt the instruction communication data based on the target number of replacements and the associated data.
[0057] According to a third aspect, a computer program product is provided, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method according to the first aspect or any possible implementation of the first aspect.
[0058] In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program code. When the computer program code runs on a computer, the computer executes the method in the above-mentioned first aspect or any possible implementation manner of the first aspect.
[0059] The present invention has the following beneficial effects: after acquiring the instruction communication data of the microcontroller unit, the address association weight of the instruction communication data is obtained through the address association of the instruction communication data of the microcontroller unit and the short-term continuity of the instruction. Afterwards, the target number of replacements of the intermediate stage of the corresponding associated data in the encryption process of the instruction communication data is analyzed through the address association weight, and the number of replacements of the intermediate stage of the associated data in the encryption process is improved through the target number of replacements; in this way, the address association and the short-term continuity of the instruction communication data of the microcontroller unit in a short period of time are comprehensively considered, so that in the process of encrypting a large number of continuous and highly associated instruction data of the microcontroller unit in a short period of time, by changing the number of replacements of the associated data in the intermediate stage, the encryption security can be improved, the possibility of being broken by malicious attackers can be reduced, and the encryption efficiency can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0061] Figure 1 It is a schematic diagram of an implementation flow of a communication method of a micro control unit provided by an embodiment of the present invention;
[0062] Figure 2 It is another implementation flow diagram of a communication method of a micro control unit provided by an embodiment of the present invention;
[0063] Figure 3 It is another implementation flow diagram of a communication method of a micro control unit provided by an embodiment of the present invention;
[0064] Figure 4 It is a schematic diagram of another implementation flow of a communication method of a micro control unit provided by an embodiment of the present invention;
[0065] Figure 5 It is another implementation flow diagram of a communication method of a micro control unit provided by an embodiment of the present invention;
[0066] Figure 6 It is a schematic diagram of the structure of a communication system of a micro control unit provided by an embodiment of the present invention;
[0067] Figure 7 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a communication method of a micro control unit proposed by the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0069] Among them, in the description of the embodiments of the present invention, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a way to describe the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present invention, "multiple" refers to two or more than two.
[0070] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0071] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0072] A specific scheme of a communication method of a micro control unit provided by the present invention is described in detail below with reference to the accompanying drawings.
[0073] See also Figure 1 , which shows a flow chart of a communication method of a micro control unit provided by an embodiment of the present invention, the method comprising:
[0074] 101, obtaining instruction communication data of the micro control unit.
[0075] Here, by setting an encryption interval for the microcontroller, preprocessing the data in each session in each encryption interval is performed to obtain the instruction communication data in each session. In some possible implementations, first, an encryption interval that meets the preset duration is determined; wherein the preset duration can be a custom duration, for example, the preset duration is 10 minutes, so that an encryption interval with a duration of 10 minutes can be obtained. Secondly, based on the real-time instruction communication data in the current session, the last session in the encryption interval is determined; finally, the instruction communication data corresponding to the last session is used as the instruction communication data of the microcontroller. For example, the instruction communication data of each session of the microcontroller is obtained through the input port or communication interface of the MCU, and the timestamp information of the instruction communication data of each session is obtained at the same time, and the instruction communication data in the real-time session is used as the last session in the encryption interval; that is, the instruction communication data of the nth session obtained in real time is used as the last session in the nth encryption interval, and the instruction communication data in the nth encryption interval is stored in the temporary cache module of the MCU. In this way, by setting the encryption interval, the real-time instruction communication data in the current session is taken as the last session in an encryption interval, so that the instruction communication data of the micro control unit can be quickly obtained through the instruction communication data corresponding to the last session.
[0076] 102, determine the address relevance of the instruction communication data and the short-term continuity of the instruction.
[0077] Here, the address relevance of the instruction communication data is used to indicate the relevance between the addresses of the instruction communication data in different sessions within the same encryption interval. The instruction short-term continuity is used to indicate the time difference between the instruction communication data in any session and the instruction communication data in other sessions within the same encryption interval.
[0078] In some possible implementations, the instruction data of a conversation in a microcontroller unit includes two parts: an address block and a data block. In the same encryption interval, if the address blocks in the instruction data contained in each communication session of the microcontroller unit are highly similar, then in the encryption interval, the greater the repetitiveness of the instruction communication address of the microcontroller unit, the higher the correlation between the instruction data of different sessions; at this time, when generating a data header based on the instruction communication data of the microcontroller unit, the correlation between the instruction data of different sessions in the encryption interval should be considered, and the data header should be obtained together with the correlation analysis. And the number of replacements of the associated data in the ASCON algorithm is changed according to the data header, so as to improve the encryption efficiency of the subsequent encryption algorithm while ensuring the security of the instruction communication data of the microcontroller unit. In the embodiment of the present invention, the subsequent analysis is performed using the address block length of 32-bit binary number as an example. The above step 102 can be performed by Figure 2 The steps shown achieve:
[0079] 201. Determine multiple sessions of the micro control unit in the same encryption interval.
[0080] Here, after the encryption intervals are divided according to the preset time lengths, each encryption interval includes multiple sessions.
[0081] 202, determine the similarity between the address data in the instruction communication data of the multiple sessions.
[0082] Here, by analyzing the cosine similarity between the address data, the similarity between the address data in the instruction communication data of multiple sessions is obtained.
[0083] 203: Determine the address relevance based on the similarity between the address data.
[0084] Here, the higher the similarity between address data, the stronger the address correlation is; the lower the similarity between address data, the weaker the address correlation is.
[0085] 204 , determining the short-term continuity of the instructions based on the timestamps of the instruction communication data in the multiple sessions.
[0086] Here, according to the timestamp of the instruction communication data in each session, the time difference between each instruction communication data is calculated, so as to analyze the short-term continuity of the instruction through the time difference. In this way, by analyzing the similarity between the address data in the instruction communication data of each session, the address correlation corresponding to the instruction communication data of different sessions can be accurately analyzed; and through the time difference between the instruction communication data in each session, the instruction short-term continuity of the instruction communication data can be accurately analyzed.
[0087] In some possible implementations, first, the time difference between the current session and each other session is determined by using the timestamp of the instruction communication data in the current session and the timestamp of the instruction communication data in each other session to obtain multiple time differences. Then, based on the maximum and minimum values of the multiple time differences, the instruction short-term continuity of the instruction communication data in the current session is determined.
[0088] Here, the short-time continuity of instructions can be determined by the reciprocal of the difference between the maximum time difference and the minimum time difference between the instruction communication data and the instruction communication data in all sessions in the encryption interval to which it belongs. That is, the reciprocal of the difference between the maximum value and the minimum value among multiple time differences is determined as the instruction short-time continuity of the instruction communication data in the current session. Among them, the short-time continuity of instructions is negatively correlated with the difference. When the similarity possibility of the instruction communication data of the microcontroller unit in a short time is smaller, the communication delay factor of the instruction communication data is larger, the accumulated result of the time difference is larger, and the instruction short-time continuity is smaller. Further, the difference between the maximum time difference and the minimum time difference between the instruction communication data and the instruction communication data of all sessions in the encryption interval to which it belongs is larger. In this way, the instruction short-time continuity of the instruction communication data in the current session can be accurately determined by the maximum and minimum values of the time difference between the current session and each other session.
[0089] 103. Determine the address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction.
[0090] Here, by simultaneously considering the address correlation of instruction communication data and the short-term continuity of instructions, the address correlation weight of the instruction communication data is obtained. Therefore, in the process of encrypting a large amount of continuous and highly correlated instruction data of the microcontroller unit in a short period of time, the encryption security of the continuous and highly correlated instruction data can be improved by changing the number of replacements of the associated data in the intermediate stage.
[0091] In some possible implementations, the above step 103 can be performed by Figure 3 The steps shown achieve:
[0092] 301 , determining an address repetition factor and communication delay information based on the address relevance of the instruction communication data and the short-term continuity of the instruction.
[0093] Here, the address repetition factor is analyzed through the address relevance, so that the ambiguity of the communication delay condition can be represented by the address repetition factor; for example, the larger the address repetition factor, the more ambiguous the communication delay condition; the smaller the address repetition factor, the clearer the communication delay condition. In some possible implementations, the relevance between instruction communication data can be determined based on the information entropy of the sequence composed of the time difference between the instruction communication data in the corresponding encryption interval and the instruction communication data in all other sessions; the more significant the short-term continuity of the instruction, the smaller the information entropy. When the possibility of association between the instruction communication data sent by the microcontroller unit in a short period of time is higher, the larger the address repetition factor of the instruction communication data obtained in real time, the more ambiguous the communication delay condition.
[0094] In some possible implementations, the above step 301 can be performed by Figure 4 The steps shown achieve:
[0095] 401. Determine the address repetition factor based on the address relevance of the instruction communication data.
[0096] Here, the similarity between the instruction communication data in each session is determined by the address correlation of the instruction communication data in each session; and the address repetition factor is determined based on the similarity between the instruction communication data in each session. For example, the address repetition factor is obtained by calculating the cosine similarity between the instruction communication data in each session. For the instruction communication data of any session within the encryption interval of the microcontroller unit, the sequence composed of the first 32 binary digits of the instruction communication data is used as the instruction address sequence of the instruction communication data.
[0097] For the instruction communication data of any session in the encryption interval of the microcontroller, the address repetition factor can be determined by the Jaccard similarity coefficient and cosine similarity of the instruction address sequence between the instruction communication data corresponding to the session and the instruction communication data corresponding to the other sessions in the encryption interval, or can be determined according to the cumulative result of the absolute value of the position difference between the address block sequences; the larger the cumulative result, the smaller the address repetition factor. When the communication address repetition of the instruction communication data of the microcontroller in the encryption interval is higher than that of the other instruction communication data, it means that the possibility of association between the instruction communication data and the other instruction communication data in the encryption interval is stronger, the address repetition factor is larger, and the encryption complexity should be increased in the subsequent encryption process to ensure the security of the instruction communication data. In this way, by analyzing the similarity between the instruction communication data in each session, the address repetition factor obtained can be made more accurate, thereby improving the security of the encryption process.
[0098] 402. Determine a communication delay factor based on the short-term continuity of the instruction and the accumulated time difference.
[0099] The time difference accumulation result includes: the time difference between the instruction communication data and the instruction communication data corresponding to other sessions in the encryption interval. The communication delay factor can be determined based on the time difference accumulation result between the instruction communication data and the instruction communication data corresponding to all other sessions in the encryption interval and the instruction short-term continuity; wherein the communication delay factor is positively correlated with the time difference accumulation result and negatively correlated with the instruction short-term continuity.
[0100] 403. Determine a delay rule weight based on the communication delay factor.
[0101] Here, the communication delay condition is obtained through the communication delay factor, and the delay law weight is obtained according to the communication delay condition. The communication delay condition is positively correlated with the communication delay factor and negatively correlated with the delay law weight.
[0102] 404. Determine the communication delay information based on the communication delay factor and the delay regularity weight.
[0103] Here, the communication delay information of the instruction communication data can be determined by the communication delay factor of the instruction communication data in its corresponding encryption interval and the delay law weight; wherein the communication delay condition is positively correlated with the communication delay factor and negatively correlated with the delay law weight. In this way, the communication delay information is obtained through the communication delay factor and the delay law weight, so that the communication delay situation in the session can be accurately analyzed.
[0104] 302. Determine an address association weight of the instruction communication data based on the address repetition factor and the communication delay information.
[0105] Here, the address association weight of the instruction communication data can be obtained through the integerization result of the address repetition factor and the communication delay information; wherein the address association weight is positively correlated with the address repetition factor and negatively correlated with the communication delay information. In this way, the association between the instruction communication data can be analyzed through the address repetition factor and the communication delay information, and the size of the address association weight can be controlled through the address repetition factor and the communication delay information, thereby improving the encryption complexity and ensuring the security of the instruction communication data.
[0106] 104. Determine, based on the address association weight, a target number of replacements of the corresponding intermediate stage of the association data during the encryption process of the instruction communication data.
[0107] Here, after the address association weight of the microcontroller unit's instruction communication data is obtained in real time, the address association weight of the microcontroller unit's real-time instruction communication data and the address association weight of all instruction communication data in the encryption interval corresponding to the instruction communication data are combined into an address association sequence of the instruction communication data in a time sequence. The target number of permutations is determined by the address association sequence. In some possible implementations, the above step 104 can be performed by Figure 5 The steps shown achieve:
[0108] 501. Use the data header of the instruction communication data of the micro control unit as the associated data.
[0109] Here, the address association sequence of the micro-control unit instruction communication data acquired in real time is used as a part of the data header. In the embodiment of the present invention, the data header structure of the micro-control unit instruction communication data is set as: (source address, session sequence number, timestamp, checksum, target address, address association sequence). The source address and target address in the data header structure can be determined according to the communication protocol and network configuration, the session sequence number can be obtained through the session counter in the micro-control unit, and the timestamp can be obtained through the counter.
[0110] 502 : Based on the address association weight, determine minimum associated instruction data in the encryption interval where the instruction communication data is located.
[0111] Here, in the encryption interval where the instruction communication data is located, the instruction communication data corresponding to the smallest address association weight is determined, that is, the minimum associated instruction data is obtained.
[0112] In some possible implementations, the data header of the microcontroller unit's command communication data is used as associated data, and the microcontroller unit's command communication data is encrypted using the ASCON encryption algorithm. The specific encryption process is as follows:
[0113] When the ASCON algorithm is used to encrypt the instruction communication data of the microcontroller unit, the initial 320-bit state contains the key K, the random value N and the initial vector IV, where the initial vector
[0114] , including: key bit size k, rate state bit size, number of permutations used for initialization and label generation, and number of permutations used in the intermediate stage. The number of permutations used for initialization and label generation is set to a by default, and the number of permutations used in the intermediate stage is set to b by default. Each data is 8 bits; r is the length of the rate segment; the last data bit of the rate segment is padded with 0, and the number of data is (288-2k).
[0115] For the instruction communication data of any microcontroller unit, the target number of permutations used by the instruction communication data of the microcontroller unit in the intermediate stage of the initialization phase can be determined by the minimum number of permutations and the permutation adjustment number; the target number of permutations is positively correlated with the default number of permutations b and is positively correlated with the permutation adjustment number.
[0116] For the instruction communication data of any micro-control unit, the instruction communication data corresponding to the minimum address association weight in the address association sequence in the data header corresponding to the instruction communication data of the micro-control unit is determined as the minimum associated instruction data in the encryption interval where the instruction communication data of the micro-control unit is located. When there are multiple minimum address association weights, the instruction communication data with the largest time interval with the instruction communication data of the micro-control unit is determined as the minimum associated instruction data.
[0117] 503, obtaining the minimum number of replacements of the minimum associated instruction data in the intermediate stage.
[0118] Here, the candidate permutation times of the minimum associated instruction data in the middle stage of the ASCON encryption algorithm process are obtained through the temporary cache module of the micro control unit and used as the minimum permutation times.
[0119] 504 , determining the target number of permutations based on the address association weight corresponding to the minimum number of permutations and the instruction communication data.
[0120] Here, for any microcontroller unit instruction communication data, the target number of permutations d of the microcontroller unit instruction communication data is determined by the minimum number of permutations and the permutation adjustment number, and the target number of permutations is positively correlated with the permutation adjustment number. The permutation adjustment number of the microcontroller unit instruction communication data is determined by the difference between the instruction communication data and the address association weight corresponding to the minimum associated instruction data, and the rounded result of the time difference between the instruction communication data; wherein the permutation adjustment number is positively correlated with the address association weight difference and the time difference.
[0121] When the correlation between the instruction communication data acquired by the microcontroller in real time and the rest of the instruction communication data in the encryption interval is greater, the inverse of the difference between the instruction communication data and the address correlation weight corresponding to the minimum correlation instruction data is greater, and at the same time, the time difference between the instruction communication data and the minimum correlation instruction data is greater; at this time, the number of substitutions in the intermediate stage should be increased to achieve a more complex encryption level. Furthermore, the greater the target number of substitutions is compared with the minimum number of substitutions, the greater the substitution adjustment number. Based on this, the target number of substitutions of the real-time instruction communication data of the microcontroller can be obtained according to the above method, and the target number of substitutions can be replaced by b in the original initialization vector IV of the ASCON encryption algorithm (that is, the original initialization vector in the embodiment of the present invention). ,in As such, the target number of replacements is determined by comprehensively considering the address relevance of the instruction communication data of the microcontroller unit in a short period of time and the short-term continuity of the instruction, thereby changing the number of replacements of the associated data in the intermediate stage according to the target number of replacements, thereby improving the encryption security of the instruction communication data.
[0122] 105. Encrypt the instruction communication data based on the target number of replacements and the associated data.
[0123] Here, the ASCON encryption process is completed according to the obtained target number of permutations and the associated data, thereby achieving an improvement in the number of permutations at the intermediate stage of the associated data.
[0124] In some possible implementations, the above step 105 may be implemented by the following process:
[0125] First, the associated data is divided based on a preset bit length to obtain multiple groups of data blocks; second, the internal states of the multiple groups of data blocks are determined; finally, according to the target number of permutations, a preset permutation function is used to perform multiple rounds of permutations on the internal states of the multiple groups of data blocks to encrypt the instruction communication data. In this way, during the encryption process, the number of permutations of the associated data in the intermediate stage is changed by the target number of permutations, which can improve the encryption security of the instruction data with strong continuous correlation, reduce the possibility of being broken by malicious attackers, and avoid the disadvantage of independently encrypting each instruction communication data of the microcontroller unit, which reduces the efficiency of the algorithm encryption.
[0126] In some possible implementations, the data header obtained above is used as the associated data and divided into multiple groups of data blocks (for example, S groups of data blocks), each of which contains data of r bits (i.e., a preset bit length). If the number of associated data bits in the data block is less than r bits or is not a multiple of r bits, 0 is filled in. Then, the operation is performed S times, and each group of the associated data is respectively associated with the internal state The r bits in the middle and high positions are XORed, and then the internal state The permutation is sent to the associated permutation round (i.e., round b). The internal state S can be obtained by formula (1): (1);
[0127] Among them, S represents the internal state, is the permutation function in the ASCON algorithm, represents the r bits of the internal state S, is the data block of the ith group in the associated data; In the internal state S, The remaining c bits are c=320-r; Is the XOR symbol.
[0128] In each loop processing, the input is a plaintext packet (i=1,…,t), group the plaintext and the high-order r bits in the internal state XOR is performed, then the plaintext is absorbed, and then the ciphertext is squeezed out. Before all plaintext packets are processed, the internal state Refresh the permutation by associating the number of permutations. Encrypt the plaintext to get the ciphertext , as shown in formula (2): (2);
[0129] in, For plain text, For ciphertext.
[0130] In the final stage of the ASCON algorithm, the key is first XORed with the internal state S and then fed into the permutation function P (i.e., function ) to update the internal state S, as shown in formula (3):
[0131] (3);
[0132] in, is to add t bits of 0 in front of the key; k is the key length; K is the key; To add 0 to the ck bit after the key; XOR the lower k bits of the internal state S with the key to obtain a 128-bit label T, as shown in formula (4):
[0133] (4);
[0134] in, are the lower k bits of the internal state S.
[0135] Permutation layer in ASCON algorithm , Both are 320 bits and cyclically use the same Substitution-Permutation Network (SPN) structure round function.
[0136] Based on this, the above method can be used to combine the encryption of microcontroller unit instruction communication data with the instruction data relevance and time characteristics, and improve the number of intermediate stage permutations of associated data during ASCON encryption processing.
[0137] According to the secure storage module of the microcontroller unit, the encryption key and random number of the instruction data to be transmitted are obtained, and the encryption processing of the instruction data to be transmitted is completed; the transmission protocol header information is added to the instruction ciphertext to be transmitted through the data encapsulation module of the microcontroller unit, and the transmission protocol header information includes but is not limited to the message length, version number, and protocol type. At the same time, the label generated by the ASCON encryption algorithm is attached to the ciphertext, and all information sequences are converted into a continuous data stream. The serial bus communication protocol is selected to configure the communication interface of the microcontroller unit, and the communication address of the communication object is obtained, and the communication object is not limited to the communication device and the communication module; the serialized data is written into the sending buffer of the communication interface of the microcontroller unit, and the data is sent when the communication interface is triggered. After the data is sent, the microcontroller unit waits for the confirmation signal or response information of the receiving end, that is, the communication object. When the sending end of the microcontroller unit times out and does not receive the response of the receiving end, the microcontroller unit resends the data, wherein the CRC check is used to detect the error that may occur during the transmission process.
[0138] When the receiving end of the microcontroller unit obtains the ciphertext data and the tag, it uses the same key and random number as the sending end to decrypt the instruction ciphertext data and restore the original instruction data.
[0139] In the embodiment of the present invention, after obtaining the instruction communication data of the microcontroller unit, the address association weight of the instruction communication data is obtained through the address association of the instruction communication data of the microcontroller unit and the short-term continuity of the instruction. Afterwards, the target number of replacements of the intermediate stage of the corresponding associated data in the encryption process of the instruction communication data is analyzed through the address association weight, and the number of replacements of the intermediate stage of the associated data of the ASCON algorithm is improved through the target number of replacements; in this way, the address association and the short-term continuity of the instruction communication data of the microcontroller unit in a short period of time are comprehensively considered; so that the improved ASCON algorithm can improve the encryption security by changing the number of replacements of the associated data in the intermediate stage in the process of encrypting a large number of continuous and highly associated instruction data of the microcontroller unit in a short period of time, reduce the possibility of being broken by malicious attackers, and avoid the disadvantage of reducing the encryption efficiency of the algorithm by independently encrypting each instruction communication data of the microcontroller unit.
[0140] An embodiment of the present invention provides a communication system of a micro control unit, such as Figure 6 As shown, the system 600 includes:
[0141] The acquisition module 601 is used to acquire the instruction communication data of the micro control unit;
[0142] A first determination module 602, used to determine the address relevance of the instruction communication data and the short-term continuity of the instruction;
[0143] A second determination module 603, configured to determine an address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction;
[0144] A third determination module 604 is used to determine a target number of replacements in an intermediate stage of the corresponding associated data during the encryption process of the instruction communication data based on the address association weight;
[0145] The encryption module 605 is used to encrypt the instruction communication data based on the target number of replacements and the associated data.
[0146] In some possible implementations, the acquisition module 601 is also used to determine an encryption interval that meets a preset time length; determine the last session in the encryption interval based on the real-time instruction communication data in the current session; and use the instruction communication data corresponding to the last session as the instruction communication data of the micro control unit.
[0147] In some possible implementations, the first determination module 602 is also used to determine multiple sessions of the microcontroller unit in the same encryption interval; determine the similarity between the address data in the instruction communication data of the multiple sessions; determine the address association based on the similarity between the address data; and determine the short-term continuity of the instructions based on the timestamps of the instruction communication data in the multiple sessions.
[0148] In some possible implementations, the first determination module 602 is further used to determine the time difference between the current session and each other session based on the timestamp of the instruction communication data in the current session and the timestamp of the instruction communication data in each other session, so as to obtain multiple time differences; and determine the short-term continuity of instructions of the instruction communication data in the current session based on the maximum value and the minimum value of the multiple time differences.
[0149] In some possible implementations, the second determination module 603 is further used to determine the address repetition factor and communication delay information based on the address relevance of the instruction communication data and the short-term continuity of the instruction; and determine the address association weight of the instruction communication data based on the address repetition factor and the communication delay information.
[0150] In some possible implementations, the second determination module 603 is also used to determine the address repetition factor based on the address relevance of the instruction communication data; determine the communication delay factor based on the short-term continuity of the instruction and the accumulated time difference; wherein the accumulated time difference result includes: the time difference between the instruction communication data and the instruction communication data corresponding to other sessions in the encryption interval; determine the delay law weight based on the communication delay factor; determine the communication delay information based on the communication delay factor and the delay law weight.
[0151] In some possible implementations, the second determination module 603 is further used to determine the similarity between the instruction communication data in each session based on the address correlation of the instruction communication data in each session; and determine the address repetition factor based on the similarity between the instruction communication data in each session.
[0152] In some possible implementations, the third determination module 604 is also used to use the data header of the instruction communication data of the microcontroller unit as the associated data; based on the address association weight, determine the minimum associated instruction data in the encryption interval where the instruction communication data is located; obtain the minimum number of permutations of the minimum associated instruction data in the intermediate stage; and determine the target number of permutations based on the address association weight corresponding to the minimum number of permutations and the instruction communication data.
[0153] In some possible implementations, the encryption module 605 is further used to divide the associated data based on a preset bit length to obtain multiple groups of data blocks; determine the internal states of the multiple groups of data blocks; and perform multiple rounds of permutations on the internal states of the multiple groups of data blocks using a preset permutation function according to the target number of permutations to encrypt the instruction communication data.
[0154] Optionally, the transmission medium can be a wired link (such as but not limited to coaxial cable, optical fiber and digital subscriber line (DSL)) or a wireless link (such as but not limited to wireless Fidelity (WIFI), Bluetooth and mobile device network).
[0155] It should be noted that: the device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device is divided into different functional modules to complete all or part of the functions described above. In addition, the shopping guide device provided in the above embodiment and the image extension method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0156] Figure 7 is a schematic diagram of the structure of a computer device provided by an embodiment of the present invention. Figure 7 As shown, the computer device 700 includes: a memory 701, a processor 702, and a computer program 703 stored in the memory 701 and running on the processor 702, wherein when the processor 702 executes the computer program 703, the computer device can execute any one of the communication methods of the micro control unit introduced above.
[0157] In addition, an embodiment of the present invention also protects a device, which may include a memory and a processor, wherein the memory stores executable program code, and the processor is used to call and execute the executable program code to perform a communication method of a micro control unit provided by an embodiment of the present invention.
[0158] This embodiment can divide the functional modules of the device according to the above method example. For example, it can correspond to each functional module, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic and is only a logical function division. There may be other division methods in actual implementation. In the case of dividing each module corresponding to each function, the device may also include a signal uploading module, a determination module, an adjustment module, etc. It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0159] It should be understood that the device provided in this embodiment is used to execute the communication method of the above-mentioned micro control unit, so the same effect as the above-mentioned implementation method can be achieved. In the case of an integrated unit, the device may include a processing module and a storage module. Among them, when the device is applied to a device, the processing module can be used to control and manage the actions of the device. The storage module can be used to support the device to execute mutual program codes, etc. Among them, the processing module can be a processor or a controller, which can implement or execute various exemplary logical boxes, modules and circuits described in conjunction with the disclosure of the present invention. The processor can also be a combination that implements a computing function, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc., and the storage module can be a memory.
[0160] In addition, the device provided in the embodiment of the present invention may be a chip, a component or a module, and the chip may include a connected processor and a memory; wherein the memory is used to store instructions, and when the processor calls and executes the instructions, the chip may execute a communication method of a micro control unit provided in the above embodiment. This embodiment also provides a computer-readable storage medium, in which a computer program code is stored, and when the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a communication method of a micro control unit provided in the above embodiment.
[0161] The present embodiment also provides a computer program product, when the computer program product is run on a computer, the computer executes the above-mentioned related steps to implement a communication method of a micro control unit provided in the above embodiment. Among them, the device, computer-readable storage medium, computer program product or chip provided in the present embodiment are all used to execute the corresponding method provided above, so the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, and will not be repeated here. Through the description of the above implementation mode, the technicians in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In the embodiments provided by the present invention, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiment described above is only schematic, for example, the division of modules or units is only a logical function division, and there can be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, which may be electrical, mechanical or other forms.
[0162] It should be noted that the sequence of the above-mentioned embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The process depicted in the accompanying drawings does not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multi-tasking and parallel processing are also possible or may be advantageous. The various embodiments in this specification are described in a progressive manner, and the same and similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. The above content is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or replacements within the technical scope disclosed by the present invention, which should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A communication method of a micro control unit, characterized in that: The method comprises: Obtaining instruction communication data of the microcontroller unit; Determining the address relevance of the instruction communication data and the short-term continuity of the instruction; Determining the address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction; Determining a target number of permutations of the intermediate stage of the corresponding associated data during the encryption process of the instruction communication data based on the address association weight; Based on the target number of replacements and the associated data, encrypting the instruction communication data; The method for acquiring the target number of permutations is as follows: using the data header of the instruction communication data of the microcontroller unit as the associated data; based on the address associated weight, determining the instruction communication data corresponding to the minimum address associated weight in the encryption interval where the instruction communication data is located as the minimum associated instruction data; acquiring the minimum number of permutations of the minimum associated instruction data in the intermediate stage; determining the target number of permutations based on the address associated weight corresponding to the minimum number of permutations and the instruction communication data; The short-term continuity of the instruction is the reciprocal of the difference between the maximum time difference and the minimum time difference between the instruction communication data and the instruction communication data in all sessions within the encryption interval to which it belongs.
2. The method according to claim 1, characterized in that The step of obtaining the instruction communication data of the micro control unit includes: Determine an encryption interval that meets a preset time length; Determining the last session in the encryption interval based on the real-time instruction communication data in the current session; The command communication data corresponding to the last session is used as the command communication data of the micro control unit.
3. The method according to claim 1, characterized in that The determining of the address relevance of the instruction communication data and the short-term continuity of the instruction comprises: Determining multiple sessions of the micro control unit in the same encryption interval; determining similarities between address data in the instruction communication data of the plurality of sessions; Determining the address relevance based on the similarity between the address data; The instruction short-term continuity is determined based on time stamps of instruction communication data in the plurality of sessions.
4. The method according to claim 3, characterized in that The determining the short-term continuity of the instructions based on the timestamps of the instruction communication data in the multiple sessions includes: Determine the time difference between the current session and each of the other sessions based on the timestamp of the instruction communication data in the current session and the timestamp of the instruction communication data in each of the other sessions to obtain multiple time differences; Based on the maximum value and the minimum value of the multiple time differences, the instruction short-term continuity of the instruction communication data in the current session is determined.
5. The method according to claim 1, characterized in that The determining the address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction includes: Determining address repetition factor and communication delay information based on address relevance of the instruction communication data and short-term continuity of the instruction; Based on the address repetition factor and the communication delay information, an address association weight of the instruction communication data is determined.
6. The method according to claim 5, characterized in that The determining of the address repetition factor and the communication delay information based on the address relevance of the instruction communication data and the short-term continuity of the instruction includes: determining the address repetition factor based on the address relevance of the instruction communication data; Determine the communication delay factor based on the short-term continuity of the instruction and the accumulated result of the time difference; wherein the accumulated result of the time difference includes: the time difference between the instruction communication data and the instruction communication data corresponding to other sessions in the encryption interval; Determining a delay rule weight based on the communication delay factor; The communication delay information is determined based on the communication delay factor and the delay regularity weight.
7. The method according to claim 6, characterized in that The determining the address repetition factor based on the address association of the instruction communication data comprises: Determining the similarity between the instruction communication data in each session based on the address association of the instruction communication data in each session; The address repetition factor is determined based on the similarity between the instruction communication data in each session.
8. The method according to claim 1, characterized in that The step of encrypting the instruction communication data based on the target number of replacements and the associated data includes: Dividing the associated data based on a preset bit length to obtain multiple groups of data blocks; determining internal states of the plurality of groups of data blocks; According to the target number of permutations, a preset permutation function is used to perform multiple rounds of permutations on the internal states of the multiple groups of data blocks, so as to encrypt the instruction communication data.
9. A communication system of a micro control unit, characterized in that: The system comprises: An acquisition module, used for acquiring instruction communication data of a microcontroller unit; A first determination module is used to determine the address relevance and instruction short-term continuity of the instruction communication data; wherein the instruction short-term continuity is the reciprocal of the difference between the maximum time difference and the minimum time difference between the instruction communication data and the instruction communication data in all sessions within the encryption interval to which it belongs; A second determination module, configured to determine an address association weight of the instruction communication data based on the address association of the instruction communication data and the short-term continuity of the instruction; A third determination module is used to determine a target number of replacements of the intermediate stage of the corresponding associated data in the encryption process of the instruction communication data based on the address association weight; The third determination module is further configured to use the data header of the instruction communication data of the micro control unit as the associated data; based on the address associated weight, determine the instruction communication data corresponding to the minimum address associated weight in the encryption interval where the instruction communication data is located as the minimum associated instruction data; obtain the minimum number of permutations of the minimum associated instruction data in the intermediate stage; determine the target number of permutations based on the address associated weight corresponding to the minimum number of permutations and the instruction communication data; The encryption module is used to encrypt the instruction communication data based on the target number of replacements and the associated data.
