A method and device for communication between cores in a multi-core microprocessor

By introducing inter-core communication methods into multi-core microprocessors, the problem of inter-core communication security in multi-core microprocessors is solved, the encryption and integrity verification of communication content is realized, and the security of user information is ensured.

CN113742790BActive Publication Date: 2025-03-14GREE ELECTRIC APPLIANCE INC OF ZHUHAI +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110968500.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-23
Publication Date
2025-03-14
Estimated Expiration
2041-08-23

AI Technical Summary

Technical Problem

The communication security between the cores in multi-core microprocessors has not been effectively resolved, and there is a risk of hackers stealing confidential information and tampering with firmware.

Method used

By introducing inter-core communication methods in a multi-core microprocessor, the information to be sent is obtained and the data is encrypted and decrypted, the data is encrypted and decrypted using the target communication key to ensure the confidentiality and integrity of the communication content.

Benefits of technology

Effectively prevent hackers from obtaining communication content between cores through monitoring, ensuring the security of user confidential information, and establishing the information integrity of communication between cores.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113742790B_ABST
    Figure CN113742790B_ABST
Patent Text Reader

Abstract

The present application relates to a method and device for inter-core communication in a multi-core microprocessor, wherein the method includes: obtaining information to be sent from a first core and used to be sent to a second core; generating a target communication key according to a protocol header to be sent; encrypting the encrypted data by the target communication key to obtain encrypted data; transmitting the encrypted data and the protocol header to be sent to the second core; in the case where the target information is determined to be information to be sent according to the target protocol header in the target information obtained by the second core, generating a target communication key according to the target protocol header, and sending the target communication key to the second core, so that the second core decrypts the data to be decrypted in the target information by the target communication key to obtain the decrypted data. The present application can achieve the purpose of encrypting the information of communication between the two cores, and prevent hackers from obtaining the communication content between the cores by eavesdropping, thereby leaking the user's confidential information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of microprocessor technology, and in particular to a method and device for inter-core communication in a multi-core microprocessor. Background Art

[0002] With the widespread use of IoT devices, the risks they bring are becoming increasingly apparent. For example, hackers can easily obtain confidential information in the device, causing user data leakage, and modify or replace the program firmware inside, causing major threats to the entire IoT network.

[0003] In addition, as IoT applications become more and more complex, single-core microprocessors are no longer able to handle complex tasks, and multi-core microprocessors have appeared on the market.

[0004] In the process of implementing the present invention, the inventors found that the communication security between the cores in a multi-core microprocessor has become an important issue.

[0005] There is no effective solution to the technical problem of communication security between cores in a multi-core microprocessor in the related art. Summary of the invention

[0006] In order to solve the technical problem of communication security between the cores in the above-mentioned multi-core microprocessor, the present application provides a method and device for communication between cores in a multi-core microprocessor.

[0007] In a first aspect, an embodiment of the present application provides a method for inter-core communication in a multi-core microprocessor, comprising:

[0008] Acquire information to be sent from the first core and used to be sent to the second core, wherein the information to be sent includes a protocol header to be sent and data to be encrypted;

[0009] Generate a target communication key according to the protocol header to be sent;

[0010] Encrypting the data to be encrypted by using the target communication key to obtain encrypted data;

[0011] Transmitting the encrypted data and the protocol header to be sent to the second core;

[0012] When it is determined that the target information is the information to be sent according to the target protocol header in the target information obtained by the second core, a target communication key is generated according to the target protocol header, and the target communication key is sent to the second core, so that the second core decrypts the data to be decrypted in the target information by using the target communication key to obtain the decrypted data.

[0013] Optionally, as in the aforementioned method, generating a target communication key according to the protocol header to be sent includes:

[0014] Parsing the to-be-sent protocol header to obtain index information of the index field, identification information of the first core, and identification information of the second core;

[0015] Acquire a target root key from a target storage according to the index information;

[0016] The target root key is used to encrypt the identification information of the first core and the identification information of the second core to generate the target communication key.

[0017] Optionally, as in the aforementioned method, transmitting the encrypted data and the to-be-sent protocol header to the second core includes:

[0018] The encrypted data and the protocol header to be sent are sent to a target message queue, so that the second core obtains the encrypted data and the protocol header to be sent from the target message queue, wherein the target message queue is a message queue used for communication between the first core and the second core.

[0019] Optionally, as in the aforementioned method, after sending the encrypted data and the protocol header to be sent to the target message queue, the method further includes:

[0020] After determining that the encrypted data and the protocol header to be sent are written to the target message queue, the read instruction generated by the first core is transmitted to the second core, so that the second core obtains the encrypted data and the protocol header to be sent from the target message queue according to the read instruction.

[0021] Optionally, as in the above method, after obtaining the information to be sent from the first core and used to be sent to the second core, the method further includes:

[0022] Determine a target field in the information to be sent for calculating a hash value, and a first information ID of the information to be sent, wherein the first information ID is information in the protocol header to be sent for indicating an identifier of the information to be sent;

[0023] A hash value calculation is performed on the first field data of the target field in the information to be sent to obtain a first hash value.

[0024] Optionally, as in the aforementioned method, determining the target information as the information to be sent according to the target protocol header in the target information acquired by the second core includes:

[0025] In the target protocol header, determining a second information ID for indicating an identifier of the target information;

[0026] When it is determined that the second information ID is consistent with the first information ID, the target information is determined to be the information to be sent.

[0027] Optionally, as in the aforementioned method, in the case where the target information is determined to be the information to be sent according to the target protocol header in the target information acquired by the second core, the target communication key is generated according to the target protocol header, so that the second core decrypts the data to be decrypted in the target information by using the target communication key, and after obtaining the decrypted data, the method further includes:

[0028] Determine the target protocol header and second field data corresponding to the target field in the decrypted data;

[0029] Performing hash value calculation on the second field data to obtain a second hash value;

[0030] When the second hash value is consistent with the first hash value, it is determined that the target protocol header and the decrypted data have not been tampered with.

[0031] In a second aspect, an embodiment of the present application provides an inter-core communication device in a multi-core microprocessor, comprising: a communication protection unit, a message queue, and an encryption accelerator; the communication protection unit is respectively connected to the first core and the second core in communication, the message queue is respectively connected to the first core and the second core in communication, and the communication protection unit is also respectively connected to the message queue and the encryption accelerator in communication;

[0032] The communication protection unit is used to obtain information to be sent from the first core and to send to the second core, wherein the information to be sent includes a protocol header to be sent and data to be encrypted;

[0033] The encryption accelerator is used to generate a target communication key according to the protocol header to be sent;

[0034] The communication protection unit is further used to encrypt the data to be encrypted by using the target communication key to obtain encrypted data;

[0035] A message queue, used for transmitting the encrypted data and the protocol header to be sent to the second core;

[0036] The communication protection unit is also used to generate a target communication key according to the target protocol header when it is determined that the target information is the information to be sent according to the target protocol header in the target information obtained by the second core, and send the target communication key to the second core, so that the second core decrypts the data to be decrypted in the target information by using the target communication key to obtain the decrypted data.

[0037] Optionally, the aforementioned device further comprises: a target memory; the communication protection unit is also in communication connection with the target memory;

[0038] The communication protection unit is further configured to parse the to-be-sent protocol header to obtain index information of the index field, identification information of the first core, and identification information of the second core; and obtain a target root key from a target memory according to the index information;

[0039] The encryption accelerator is used to encrypt the identification information of the first core and the identification information of the second core using the target root key to generate the target communication key.

[0040] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the storage medium includes a stored program, wherein the program executes the method as described in any of the preceding items when running.

[0041] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0042] The method provided in the embodiment of the present application can achieve the purpose of encrypting the information communicated between the first core and the second core, preventing hackers from obtaining the communication content between the cores through eavesdropping and thereby leaking user confidential information, thereby ensuring the security of the information communicated between the first core and the second core. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0045] Figure 1 A schematic diagram of a flow chart of a method for communication between cores in a multi-core microprocessor provided in an embodiment of the present application;

[0046] Figure 2 A flowchart of a method for communication between cores in a multi-core microprocessor provided by another embodiment of the present application;

[0047] Figure 3 A flowchart of a method for communication between cores in a multi-core microprocessor provided by another embodiment of the present application;

[0048] Figure 4 A schematic diagram of a protocol for messages communicated between cores in a multi-core microprocessor provided by another embodiment of the present application;

[0049] Figure 5 A system architecture diagram of an inter-core communication device in a multi-core microprocessor provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0051] According to one aspect of an embodiment of the present application, there is provided a multi-core microprocessor inter-core communication. Optionally, in this embodiment, the multi-core microprocessor inter-core communication can be applied to a multi-core microprocessor environment composed of multiple cores.

[0052] Figure 1 A method for inter-core communication in a multi-core microprocessor provided in an embodiment of the present application includes the following steps:

[0053] Step S101, obtaining information to be sent from the first core and used to be sent to the second core, wherein the information to be sent includes a protocol header to be sent and data to be encrypted.

[0054] The method for communication between cores in a multi-core microprocessor in this embodiment can be applied to scenarios where communication between cores is required in a microprocessor including multiple cores, or scenarios where communication between cores of a microprocessor is required in other situations. In the embodiment of the present application, the communication between multiple cores of the same microprocessor is used as an example to illustrate the method for communication between cores in a multi-core microprocessor. For other types of scenarios, the method for communication between cores in a multi-core microprocessor is also applicable if there is no contradiction.

[0055] When the first core and the second core in the multi-core processor need to communicate, the first core can generate information to be sent so that the second core performs a corresponding task or receives corresponding data according to the information to be sent. Each core can be a single-core processor integrated into a multi-core processor.

[0056] The first core and the second core may be any two cores in a multi-core microprocessor that need to communicate, and the first core may complete the communication between the first core and the second core by generating information to be sent and transmitting the information to be sent to the second core.

[0057] In order to enable the second core to parse the data to be sent to determine the tasks to be performed or the data to be acquired, the information to be sent may include a protocol header to be sent and data to be encrypted.

[0058] The protocol header to be sent may be information about the task to be executed by the first core instructing the second core.

[0059] The data to be encrypted may include protocol data, which may include data required to execute the task specified by the protocol header to be sent or status information to be returned after the task is executed. Furthermore, the data to be encrypted may also include part of the data in the protocol header, and the protocol header to be sent may be the protocol header data in the information to be sent that does not need to be encrypted.

[0060] like Figure 4 As shown in FIG. 1 , the information to be sent includes a protocol header and protocol data (the data to be encrypted includes at least the protocol data). The protocol header may contain six sub-domains, wherein bits 0 to 15 are task domains, which specify the command to be executed by the core, i.e., the name of the command, such as query, statistics, etc.; bits 16 to 19 are ID domains, which are used to match the command sent by the core with the status information returned after the command is executed, i.e., the ID corresponding to the task; bits 20 to 22 are Index domains, which are used to specify the root key used for communication between two cores; bits 23 to 25 are Core ID domains, which are used to The 30th bit is the encryption enable bit. When it is 1, the protocol data is encrypted, otherwise it is not encrypted. The 31st bit is the read-write bit. When it is 1, one core (example parameter: core 1) specifies another core (example parameter: core 2) to execute the command specified in the task domain. At this time, the protocol data includes the parameters of the command. When it is 0, one core (example parameter: core 1) requests to read the data of another core (example parameter: core 2). At this time, the command has no protocol data part, and the read data is returned by core 2 through other commands.

[0061] Step S102, generating a target communication key according to the protocol header to be sent.

[0062] After obtaining the information to be sent, a target communication key for encrypting the information to be sent may be generated, so as to encrypt part or all of the information to be sent by using the target communication key.

[0063] The target communication key may be a key used to encrypt data to be encrypted.

[0064] The target communication key can facilitate the subsequent encryption of the encrypted data, thereby improving the overall security of the information to be sent.

[0065] Step S103, encrypt the data to be encrypted using the target communication key to obtain encrypted data.

[0066] After obtaining the target communication key, the target communication key can be used to encrypt the data to be encrypted to obtain the encrypted data. The reason why only the encrypted data is encrypted but not the protocol header to be sent is that the second core can obtain the key for decryption based on the protocol header to be sent.

[0067] Step S104, transmitting the encrypted data and the protocol header to be sent to the second core.

[0068] After obtaining the encrypted data and the protocol header to be sent, the encrypted data and the protocol header to be sent can be transmitted to the second core, so that the second core can obtain the data to be encrypted before encryption based on the encrypted data.

[0069] Step S105, when the target information is determined to be information to be sent based on the target protocol header in the target information obtained by the second core, a target communication key is generated based on the target protocol header, and the target communication key is sent to the second core, so that the second core decrypts the data to be decrypted in the target information through the target communication key to obtain the decrypted data.

[0070] After the second core obtains the target information, it can decrypt the data to be decrypted in the target information.

[0071] After the second core obtains the target information, it can obtain the target protocol header in the target information. The target protocol header may be an unencrypted protocol header in the target information.

[0072] The method for generating the target communication key according to the target protocol header can be the same as the method for generating the target communication key according to the protocol header to be sent in step S102 in the aforementioned steps, thereby ensuring that the same communication key can be generated using the same unencrypted protocol header.

[0073] After obtaining the target communication key, the second core can decrypt the data to be decrypted in the target information by using the target communication key to obtain the decrypted data.

[0074] Through the method in this embodiment, the purpose of encrypting the information communicated between the first core and the second core can be achieved, preventing hackers from obtaining the communication content between the cores through eavesdropping and thus leaking user confidential information, thereby ensuring the security of the information communicated between the first core and the second core.

[0075] like Figure 2 As shown, as an optional implementation, as in the aforementioned method, the step S102 of generating a target communication key according to the protocol header to be sent includes the following steps:

[0076] Step S201: parse the protocol header to be sent to obtain index information of the index field, identification information of the first core, and identification information of the second core.

[0077] The secure communication protection circuit implementing the method of this embodiment can obtain the to-be-sent information that the first core uses to send to the second core.

[0078] After obtaining the information to be sent, the index information of the index can be parsed from the protocol header to be sent, that is, the Index field in the aforementioned embodiment. The root key used for communication encryption between the first core and the second core can be determined through the Index field; and the core ID field can be used to specify the core ID of the sending information and the core ID of the receiving information to determine the core ID of the first core and the core ID of the second core. For a multi-core microprocessor, which includes multiple cores, each core can be identified in advance to determine the core ID of each core.

[0079] Step S202: Obtain a target root key from a target storage device according to the index information.

[0080] The target storage may include multiple root keys, and the index information may indicate the target storage location and / or root key identification information of the target root key, and the target root key may be obtained from the target storage according to the index information.

[0081] Step S203: Use the target root key to encrypt the identification information of the first core and the identification information of the second core to generate a target communication key.

[0082] After obtaining the target root key, the target communication key can be generated based on the target root key.

[0083] The target root key may be obtained by encrypting identification information of the first core (ie, the core ID of the first core) and identification information of the second core (ie, the core ID of the second core).

[0084] Since the target root key is only known to the first core and the second core, and therefore, the target communication key obtained by encrypting the identification information of the first core and the identification information of the second core with the target root key can only be obtained by the first core and the second core. Therefore, the method in this embodiment can also protect the communication content of any two cores from being correctly parsed by other cores.

[0085] As an optional implementation, as in the above method, the step S104 of transmitting the encrypted data and the protocol header to be sent to the second core includes the following steps:

[0086] Step S301, sending the encrypted data and the protocol header to be sent to the target message queue, so that the second core obtains the encrypted data and the protocol header to be sent from the target message queue, wherein the target message queue is a message queue used for communication between the first core and the second core.

[0087] After obtaining the encrypted data, the encrypted data and the protocol header to be sent can be transmitted so that the second core can obtain the encrypted data and the protocol header to be sent. In this embodiment, the encrypted data and the protocol header to be sent are sent to the target message queue, so that the second core consumes the encrypted data and the protocol header to be sent in the target message queue to achieve the purpose of obtaining the encrypted data and the protocol header to be sent.

[0088] Optionally, the encrypted data and the protocol header to be sent can be written into the target message queue accordingly, so that the second core can simultaneously obtain the encrypted data and the protocol header to be sent when acquiring information. In addition, the second core can query the target message queue at a fixed frequency to determine whether new information is written and consume it in time.

[0089] As an optional implementation, as in the aforementioned method, after the encrypted data and the protocol header to be sent are sent to the target message queue, the method further includes the following steps:

[0090] Step S401, after determining that the encrypted data and the protocol header to be sent are written into the target message queue, the read instruction generated by the first core is transmitted to the second core, so that the second core obtains the encrypted data and the protocol header to be sent from the target message queue according to the read instruction.

[0091] After determining that the encrypted data and the protocol header to be sent are written to the target message queue, the second core can obtain the encrypted data and the protocol header to be sent from the target message queue. Therefore, it is necessary to enable the second core to know that the encrypted data and the protocol header to be sent are written in the target message queue.

[0092] In order to enable the second core to trigger the acquisition of information from the target message queue, in this embodiment, a read instruction is generated by the first core, and a correspondence between the read instruction and the new information newly written into the target message queue and the ability to read the target message queue is established in advance in the second core. Therefore, after the second core obtains the read instruction, it can be determined that new information has been newly written into the target message queue, so the second core can read information from the target message queue to obtain the encrypted data and the protocol header to be sent.

[0093] For example, after determining that the encrypted data and the protocol header to be sent are written to the target message queue, the first core can use an interrupt as a generated read instruction. Therefore, after the second core finds that the first core triggers an interrupt, it performs a message reading operation on the target message queue. If the encrypted data and the protocol header to be sent have not been tampered with, the second core can obtain the encrypted data and the protocol header to be sent.

[0094] As an optional implementation, as in the above method, after the step S101 acquires the information to be sent from the first core and used to send to the second core, the method further includes the following steps:

[0095] Step S501, determining a target field in the information to be sent for calculating a hash value and a first information ID of the information to be sent, wherein the first information ID is information in the protocol header to be sent for indicating an identifier of the information to be sent.

[0096] After obtaining the information to be sent, information of all fields in the information to be sent can be obtained. Then, a target field for calculating a hash value can be determined from all fields. Moreover, the target field includes a field corresponding to the data to be encrypted, that is, the data corresponding to the target field includes the data to be encrypted.

[0097] Furthermore, after determining the information to be sent, the information of the field used to indicate the identification of the information to be sent can be determined in the protocol header of the information to be sent, that is, the information recorded in the ID field from the 16th to the 19th bit, that is, the first information ID in this embodiment; the first information ID can be an ID that uniquely corresponds to the information to be sent. Furthermore, when the second core feeds back a feedback information to the first core based on the information to be sent, the first core can determine that the information corresponding to the feedback information is the information to be sent based on the ID recorded in the ID field in the protocol header of the feedback information.

[0098] Step S502: performing hash value calculation on the first field data of the target field in the information to be sent to obtain a first hash value.

[0099] After the first field data of the target field is determined, a hash value calculation may be performed on the first field data to obtain a first hash value.

[0100] Optionally, a hash value calculation (i.e., a summary calculation) can be performed on the first field data using methods such as MD, SHA, and MAC. Since the first field data has the characteristic of uniquely corresponding to the first hash value, it is convenient to later verify the target information obtained by the second core based on the first field data.

[0101] As an optional implementation, as in the aforementioned method, the step S105 of determining the target information as information to be sent according to the target protocol header in the target information acquired by the second core includes the following steps:

[0102] Step S601: Determine, in a target protocol header, a second information ID for indicating an identifier of target information.

[0103] After determining the target information, the information of the field used to indicate the identification of the target information can be determined in the target protocol header of the target information, that is, the information recorded in the ID field from the 16th to the 19th bit, that is, the second information ID in this embodiment; the second information ID can be an ID that uniquely corresponds to the target information.

[0104] Step S602: When it is determined that the second information ID is consistent with the first information ID, the target information is determined to be the information to be sent.

[0105] When the second information ID of the target information is consistent with the first information ID of the information to be sent, it can be determined that the target information and the information to be sent are both sent by the first core for the same task, so the target information and the information to be sent can be preliminarily determined.

[0106] If it is determined that the second information ID is inconsistent with the first information ID, it means that the target information may not be the information sent by the first core, and if executed, it may affect the security of the microprocessor. Therefore, in this case, the target information is not specified.

[0107] Furthermore, after the second core executes according to the target information, the second information ID is also used for identification in the ID field of the feedback information generated for feeding back to the first core, so that the first core can determine that the feedback information is information corresponding to the information to be sent.

[0108] Through the method in this embodiment, by using information ID to identify information, it is convenient to correspond different information later, so that different cores can synchronize information on the same task.

[0109] like Figure 3As shown, as an optional implementation, as in the aforementioned method, in the step S105, when the target information is determined to be information to be sent according to the target protocol header in the target information obtained by the second core, a target communication key is generated according to the target protocol header, and the target communication key is sent to the second core, so that the second core decrypts the data to be decrypted in the target information by the target communication key, and after obtaining the decrypted data, the method further includes the following steps:

[0110] Step S701, determining the target protocol header and the second field data corresponding to the target field in the decrypted data.

[0111] After obtaining the target information, the information of all fields in the target information can be obtained. Then, the target field used to calculate the hash value can be determined in all fields. In addition, since the first field data is calculated based on the data of the target field in the information before encryption, the second field data used to calculate the second hash value must also be the target protocol header and the data corresponding to the target field in the decrypted data. Generally, the target field includes all fields corresponding to the decrypted data, that is, the data corresponding to the second field data includes the decrypted data. In addition, the target field can also include some fields in the target protocol header.

[0112] Step S702: Calculate a hash value for the second field data to obtain a second hash value.

[0113] After determining the target protocol header and the second field data corresponding to the target field in the decrypted data, a hash value calculation may be performed on the second field data to obtain a second hash value.

[0114] Optionally, the second field data may be hashed (i.e., a summary is calculated) using methods such as MD, SHA, and MAC. Since the second field data has a characteristic that uniquely corresponds to the second hash value, it is convenient to later verify the target information obtained by the second core based on the second field data.

[0115] Furthermore, the method for calculating the hash value of the second field data must be consistent with the method for calculating the hash value of the first field data to ensure that the same hash value can be calculated for the same data.

[0116] Step S703: when the second hash value is consistent with the first hash value, determine that the target protocol header and the decrypted data have not been tampered with.

[0117] After the second hash value is calculated, it can be determined whether the target protocol header and the decrypted data have been tampered with by judging the consistency between the second hash value and the first hash value.

[0118] For example, when the second hash value is consistent with the first hash value, since the second hash value is calculated based on the data of the target field of the target information, and the first hash value is calculated based on the data of the target field of the information to be sent, the fields on which the two are based are completely consistent. If the second hash value is consistent with the first hash value, it can be determined that the target protocol header and the decrypted data have not been tampered with. Conversely, if the second hash value is inconsistent with the first hash value, it can be determined that the target protocol header and the decrypted data have been tampered with.

[0119] Through the method in this embodiment, in addition to encrypting data to prevent leakage, the integrity check of the decrypted target information can be added by calculating the summary (ie, hash value), thereby ensuring that the data interacting between the first core and the second core has not been tampered with.

[0120] In the following example, an application example of the above embodiment is provided:

[0121] (1) Obtain the Index field from the protocol header, obtain the specified key as the root key (represented by root key) from all the keys in the OTP (represented by the index information) in the Index field, and then use the root key to encrypt the IDs of the cores that communicate with each other (when core 1 communicates with core 2, the IDs are the ID of core 1 (example parameter) and the ID of core 2 (example parameter)) through the AES accelerator (represented by the encryption accelerator) to generate the target communication key (represented by commkey).

[0122] (2) The protocol data (clear data) sent by core 1 to core 2 is encrypted using the comm key, and the encrypted data (encrypted data) and the protocol header are sent to the target message queue; when there is data in the target message queue, the core 2 (example parameter) will be notified through an interrupt to read the data, and core 2 will take out the encrypted data (encrypted data) and the protocol header from the message queue, calculate the target communication key based on the protocol header, and then use the target communication key to decrypt the encrypted data to obtain the protocol data (clear data), and then execute the command, and return the execution result to core 1 (example parameter). Similarly, the result data returned by core 2 to core 1 must also be encrypted and put into the target message queue, and core 1 will take out the data from the message queue and decrypt it for use.

[0123] (3) The accelerator AES supports modes such as CTR and GCM. In addition to encrypting protocol data to prevent leakage, it can also calculate digests to increase integrity checks and ensure that the data of dual-core interactions has not been tampered with.

[0124] like Figure 5As shown, according to an embodiment of another aspect of the present application, there is also provided a core-to-core communication device in a multi-core microprocessor, comprising: a communication protection unit 1, a message queue unit 2, and an encryption accelerator 3; the communication protection unit 1 is respectively connected to the first core 51 and the second core 52 for communication, the message queue unit 2 is respectively connected to the first core 51 and the second core 52 for communication, and the communication protection unit 1 is also respectively connected to the message queue unit 2 and the encryption accelerator 3 for communication;

[0125] The communication protection unit 1 is used to obtain information to be sent from the first core and to send to the second core, wherein the information to be sent includes a protocol header to be sent and data to be encrypted;

[0126] The encryption accelerator 3 is used to generate a target communication key according to the protocol header to be sent;

[0127] The communication protection unit 1 is further used to encrypt the data to be encrypted by using the target communication key to obtain the encrypted data;

[0128] Message queue unit 2, used for transmitting the encrypted data and the protocol header to be sent to the second core;

[0129] The communication protection unit 1 is also used to generate a target communication key according to the target protocol header when the target information is determined to be information to be sent according to the target protocol header in the target information obtained by the second core, and send the target communication key to the second core, so that the second core decrypts the data to be decrypted in the target information through the target communication key to obtain the decrypted data.

[0130] Specifically, the specific process of each module in the device of the embodiment of the present invention realizing its function can be referred to the relevant description in the method embodiment, which will not be repeated here.

[0131] As an optional implementation, the aforementioned device further includes: a target memory 4; the communication protection unit 1 is also communicatively connected with the target memory 4;

[0132] The communication protection unit 1 is further used to parse the to-be-sent protocol header to obtain index information of the index field, identification information of the first core, and identification information of the second core; and obtain a target root key from the target memory 4 according to the index information;

[0133] The encryption accelerator 3 is used to encrypt the identification information of the first core and the identification information of the second core using the target root key to generate a target communication key.

[0134] When multiple cores are involved (e.g. Figure 5The communication contents between each two cores (the first core 51, the second core 52, the third core 53 and the fourth core 54) are protected by the communication device, wherein there is a message queue between each two cores, that is, there is also a message queue between the second core 52 and the third core 53, there is also a message queue between the third core 53 and the fourth core 54, there is also a message queue between the fourth core 54 and the first core 51, and the AES accelerator (that is, the encryption accelerator 3), OTP (that is, the target memory 4) and the communication protection unit 1 are shared by all the cores. Core 1 (example parameter) sends data to core 2 (example parameter) through the message queue.

[0135] Specifically, the specific process of each module in the device of the embodiment of the present invention realizing its function can be referred to the relevant description in the method embodiment, which will not be repeated here.

[0136] An embodiment of the present application further provides a computer-readable storage medium, the storage medium including a stored program, wherein the method steps of the above method embodiment are executed when the program is run.

[0137] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0138] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for inter-core communication in a multi-core microprocessor, characterized in that: include: Acquire information to be sent from the first core and used to be sent to the second core, wherein the information to be sent includes a protocol header to be sent and data to be encrypted; Generate a target communication key according to the protocol header to be sent, wherein the protocol header to be sent includes information of the task to be executed by the second core indicated by the first core, specifically including a task field, an ID field, an Index field, a core ID field, an encryption enable bit and a read-write bit, wherein the task field is used to specify the command to be executed by the second core, the ID field is used to store the ID corresponding to the task, the ID is used to match the command sent by the first core with the status information returned after the second core executes the command, the Index field is used to specify the root key used for communication between the first core and the second core, the core ID field is used to specify the core ID of the first core that sends information and the core ID of the second core that receives information, the encryption enable bit is used to indicate that the data to be encrypted is encrypted when it is 1, otherwise it is not encrypted, the read-write bit is used to indicate that the first core specifies the second core to execute the command specified in the task field when it is 1, and the read-write bit is used to indicate that the first core requests to read the data of the second core when it is 0; Encrypting the data to be encrypted by using the target communication key to obtain encrypted data; Transmitting the encrypted data and the protocol header to be sent to the second core; When it is determined that the target information is the information to be sent according to the target protocol header in the target information obtained by the second core, the target communication key is generated according to the target protocol header, and the target communication key is sent to the second core, so that the second core decrypts the data to be decrypted in the target information by using the target communication key to obtain the decrypted data.

2. The method according to claim 1, characterized in that Generating a target communication key according to the protocol header to be sent includes: Parsing the to-be-sent protocol header to obtain index information of the index field, identification information of the first core, and identification information of the second core; Acquire a target root key from a target storage according to the index information; The target root key is used to encrypt the identification information of the first core and the identification information of the second core to generate the target communication key.

3. The method according to claim 1, characterized in that The transmitting the encrypted data and the to-be-sent protocol header to the second core comprises: The encrypted data and the protocol header to be sent are sent to a target message queue, so that the second core obtains the encrypted data and the protocol header to be sent from the target message queue, wherein the target message queue is a message queue used for communication between the first core and the second core.

4. The method according to claim 3, characterized in that After sending the encrypted data and the to-be-sent protocol header to the target message queue, the method further includes: After determining that the encrypted data and the protocol header to be sent are written to the target message queue, the read instruction generated by the first core is transmitted to the second core, so that the second core obtains the encrypted data and the protocol header to be sent from the target message queue according to the read instruction.

5. The method according to claim 1, characterized in that: After acquiring the information to be sent from the first core and used to be sent to the second core, the method further includes: Determine a target field in the information to be sent for calculating a hash value, and a first information ID of the information to be sent, wherein the first information ID is information in the protocol header to be sent for indicating an identifier of the information to be sent; A hash value calculation is performed on the first field data of the target field in the information to be sent to obtain a first hash value.

6. The method according to claim 5, characterized in that The determining, according to the target protocol header in the target information acquired by the second core, that the target information is the information to be sent includes: In the target protocol header, determining a second information ID for indicating an identifier of the target information; When it is determined that the second information ID is consistent with the first information ID, the target information is determined to be the information to be sent.

7. The method according to claim 6, characterized in that In the case where the target information is determined to be the information to be sent according to the target protocol header in the target information obtained by the second core, the target communication key is generated according to the target protocol header, and the target communication key is sent to the second core, so that the second core decrypts the data to be decrypted in the target information by using the target communication key. After obtaining the decrypted data, the method further includes: Determine the target protocol header and second field data corresponding to the target field in the decrypted data; Performing hash value calculation on the second field data to obtain a second hash value; When the second hash value is consistent with the first hash value, it is determined that the target protocol header and the decrypted data have not been tampered with.

8. An inter-core communication device in a multi-core microprocessor, characterized in that: include: A communication protection unit, a message queue unit and an encryption accelerator; the communication protection unit is respectively connected to the first core and the second core in communication, the message queue is respectively connected to the first core and the second core in communication, and the communication protection unit is also respectively connected to the message queue unit and the encryption accelerator in communication; The communication protection unit is used to obtain information to be sent from the first core and to send to the second core, wherein the information to be sent includes a protocol header to be sent and data to be encrypted; The encryption accelerator is used to generate a target communication key according to the protocol header to be sent, wherein the protocol header to be sent includes information of the task to be executed by the second core indicated by the first core, specifically including a task field, an ID field, an Index field, a core ID field, an encryption enable bit and a read-write bit, the task field is used to specify the command to be executed by the second core, the ID field is used to store the ID corresponding to the task, the ID is used to match the command sent by the first core with the status information returned after the second core executes the command, the Index field is used to specify the root key used for communication between the first core and the second core, the core ID field is used to specify the core ID of the first core that sends information and the core ID of the second core that receives information, the encryption enable bit is used to indicate that the data to be encrypted is encrypted when it is 1, otherwise it is not encrypted, the read-write bit is used to indicate that the first core specifies the second core to execute the command specified in the task field when it is 1, and the read-write bit is used to indicate that the first core requests to read the data of the second core when it is 0; The communication protection unit is further used to encrypt the data to be encrypted by using the target communication key to obtain encrypted data; A message queue, used for transmitting the encrypted data and the protocol header to be sent to the second core; The communication protection unit is also used to generate a target communication key according to the target protocol header when it is determined that the target information is the information to be sent according to the target protocol header in the target information obtained by the second core, and send the target communication key to the second core, so that the second core decrypts the data to be decrypted in the target information by using the target communication key to obtain the decrypted data.

9. The device according to claim 8, characterized in that Also includes: target storage; The communication protection unit is also in communication connection with the target storage; The communication protection unit is further configured to parse the to-be-sent protocol header to obtain index information of the index field, identification information of the first core, and identification information of the second core; and obtain a target root key from a target memory according to the index information; The encryption accelerator is used to encrypt the identification information of the first core and the identification information of the second core using the target root key to generate the target communication key.

10. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Inter-process communication system and method, readable medium and memory controller

    CN107526644A

  • Integrity checking method during kernel running anda computer readable storage medium

    CN109753788A