Disclosure of Invention
The hardware system of the method mainly comprises a safe CPU core 1, a high-performance CPU core 2, a safe algorithm module and a data access control system, and is characterized in that:
the safety CPU core 1 has lower dominant frequency, low power consumption and higher safety level; the method is mainly used for application processing of the security data;
the high-performance CPU core 2 has higher main frequency and larger power consumption and is mainly used for application processing of the user end to the non-secure data;
the security algorithm module can quickly carry out the operation of symmetric and asymmetric algorithms and can effectively defend illegal attacks;
the data access control system can configure the resource range which can be accessed by the high-performance CPU core 2, and effectively control the diffusion range of the non-secure data of the high-performance core.
In the following description, the secure CPU core 1 is simply referred to as core 1, and the high-performance CPU core 2 is simply referred to as core 2.
In view of the differentiation of the current safety requirements, the invention mainly provides a flexible method which can meet the safety requirements of multiple industries; certain requirements are met in the aspects of low power consumption, safety level, performance requirements and the like, and the subsequent safety level expansion is facilitated, wherein the main process is as follows:
1) security mechanism of the boot process: before a CPU core (any core of a safe CPU core 1 or a high-performance CPU core 2) works, the integrity and identity authentication of a code of the working core are firstly carried out, and the code is ensured not to be tampered and the legality of the code identity; the access range of the high-performance core is strictly limited, and the safety information is prevented from being leaked; monitoring in the running of the code is increased.
After the chip is powered on, the core 1 is started firstly, the boot in the ROM of the core 1 finishes the verification and verification of the code of the core 1, after the verification is passed, the core 1 is started and the code of the core 2 is verified and confirmed, after the verification is successful, the accessible resource of the core 2 is configured, and the code of the core 2 is started; after the core 2 code is started, the core 1 may choose to authenticate the core 2.
2) Communication process security mechanism: the dual-core communication process is added with an identity authentication process, and data information is encrypted and data abstract processing is carried out, so that the authenticity, confidentiality and integrity of data are ensured.
The core 1 controls related resources of the security peripheral, and when the core 2 is required to perform high-speed operation or the core 2 is required to process, or when the core 2 processes non-security information and the authorization of the core 1 is required to process, instruction data can be transmitted to the other side in a shared memory (RAM) mode; in the transmission process, according to different safety and performance requirements, the command data can be signed, encrypted, subjected to data summarization, added with a transmission sequence number (random number factor) and the like, the data can be protected and subjected to identity anti-counterfeiting, and a symmetric algorithm and an asymmetric algorithm can be selected as related algorithms.
In the communication process, the related key can be a process session key or a fixed key, which depends on the application scene, and the root keys are stored in respective protection areas; the core 1 and the core 2 can choose to perform identity authentication irregularly and perform one-time updating on the session key of the used process; the core 1 monitors the running process of the core 2 and verifies the code integrity of the core 2.
When each core sends data, splicing transmitted instruction data, adding a transmission serial number (random number factor), performing data summarization on whole frame data, encrypting the data, and performing data summarization and data signature processing on a ciphertext; after data is acquired, firstly verifying signature data, then verifying the integrity of the data, decrypting the data, then verifying the integrity of the decrypted data, and checking a transmission sequence number (random number factor); by the mechanisms, the integrity and confidentiality of data can be ensured; and safety risks such as identity anti-counterfeiting, data playback and the like are avoided.
The return of the instruction data execution result is consistent with the safety mechanism of the instruction data processing process.
3) And (4) judging a safety result: and (3) combining a security mechanism, adding an auxiliary result verification value (mask value) to the data processing return result, and improving the anti-attack capability of the code.
Although the core 1 executes partial data processing through the core 2, the final judgment result and the key data operation are given by the core 1, and sensitive information leakage is avoided; when the core 2 needs authorization, the core 1 gives a result through the most authorization processing; the result of the key instruction processing generates a return mask value according to the transmitted data, and the execution result is jointly judged according to the return result and the mask value, so that the difficulty of being attacked is increased;
and (3) algorithm selection: the invention is not limited to which algorithm is used for completing the corresponding function, and can select a proper algorithm according to the application requirement.
4) And (3) low-power consumption processing: and a flexible low-power consumption processing mode is set by combining the dual-core time-sharing processing condition in some scenes.
The smart card and the Internet of things node have certain requirements on low power consumption in some application scenes, and the power consumption can be effectively configured in a time-sharing processing mode through the dual cores; when the core 1 is in the processing process, the core 2 is in a deep low power consumption mode; when core 2 is in process, core 1 is in low power mode; the whole power consumption can be balanced under certain conditions, and the performance can also be considered; the dual-core main frequency and the power consumption processing method such as the enabling of the peripheral interface can be adjusted according to different application scenes.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a chip system structure diagram of the present invention, which includes two CPU cores, a resource access controller, a security algorithm module, a shared memory area, and the like.
Fig. 2 is a security mechanism of the boot process proposed based on the chip system of fig. 1 in the present invention:
instep 201, when the chip is powered on, the boot code in the ROM of the core 1 is executed first.
Step 202, verifying the application code of the core 1 for the code in the boot, determining the integrity and correctness of the code, and avoiding illegal tampering; and if the code is checked correctly, after the application code of the core 1 is operated, thestep 203 is entered, otherwise, thestep 206 is entered for exception processing, and the subsequent flow is not continuously operated.
Step 203, verifying the application code of the core 2 for the application code of the core 1, determining the integrity and the correctness of the code, and avoiding illegal tampering; if the code is checked correctly, thestep 204 is entered, otherwise, thestep 206 is entered for exception handling, and the subsequent flow is not continued to be executed.
Step 204 describes that the core 1 checks that the code of the core 2 is correct, configures a resource range that the core 2 can access, and starts the application code of the core 2.
Step 205 is that the core 1 verifies the identity of the core 2, if the identity authentication is passed,step 207 is entered, otherwisestep 206 is entered for exception handling, and the subsequent flow is not continued to be run.
Step 206 is described as exception handling during boot up due to data tampering or attack.
Step 207 shows that the system boot is complete and starts normally.
Fig. 3 is a security mechanism description of the communication process in the present invention:
in step 301, the communication initiator organizes fields such as execution action, data content, transmission sequence number (random number factor) in the instruction data, and the random factor can be implemented by negotiation between the two parties and is used for preventing replay attack.
Step 302, performing summary calculation on the data organized in step 301 once, wherein a specific algorithm is flexibly selected according to an application scene; adding the abstract calculation result into a corresponding field of the instruction data; for ensuring the integrity of the plaintext.
Step 303 is to encrypt the data generated in step 302 and place the encrypted data into the data field of the instruction data.
Step 304 is to perform digest calculation on the ciphertext data, and put the digest calculation into a field corresponding to the instruction data to ensure the integrity of the ciphertext.
Step 305, signature processing is performed on the whole instruction data, and a specific algorithm is flexibly selected according to an application scene; the method is used for effectively preventing the instruction data from being forged.
Step 306 is to notify the other party that an instruction arrives through a chip signal or a shared RAM.
Step 307 begins processing the instruction data after the notification is obtained for the other party.
Step 308 shows that the signature validity of the instruction data is verified, after the identity is determined, step 309 is performed to process, otherwise, the data is discarded if the exception is processed.
Step 309 is to check the integrity of the ciphertext to ensure that the ciphertext has not been tampered or lost; after the integrity is passed, step 310 is entered, otherwise the exception is handled and the data is discarded.
In step 310, the ciphertext data is decrypted to obtain plaintext data.
Step 311 is to check the integrity of the plaintext data to ensure that the plaintext is not tampered or lost; after the integrity is passed, step 312 is entered, otherwise the exception is handled and the data is discarded.
Step 312 illustrates the action processing of the instruction after the instruction data is verified.
The example is a one-way transmission process, and after the instruction action is processed, the same processing mode is adopted to return the instruction execution result to the instruction sender; the algorithms in the process can be flexibly selected; this process describes a security mechanism process, not limited to the case described in this example, but also should include security mechanisms related to integrity, confidentiality, and identification.
FIG. 4 is an implementation and decision mechanism for returning results in the present invention:
step 401 illustrates that the instruction data is received and the result data is executed.
Step 402, judging whether the instruction data execution is correct, and if so, enteringstep 403; otherwise, go tostep 404, where the execution fails.
After the instruction result is correct instep 403, checking whether the mask value is matched with the correct result, if so, enteringstep 405, and determining that the final result is correct; otherwise, go tostep 406 for exception handling.
Step 404 illustrates the processing after an execution failure.
Step 405 illustrates the processing after the execution is successful.
Step 406 is described as a case where the data is abnormal, and a case where an attack may occur should be considered.
Fig. 5 is an example of a method for dual-core power consumption control according to the present invention, where the core 1 processes a data power consumption processing flow by means of the core 2, and the similar processing flow for processing data power consumption by means of the core 1 of the core 2 is the same, except that the communication roles of the following cores 1 and 2 are reversed:
step 501 shows that both core 1 and core 2 are in a low power consumption mode during the process of no event processing, and the low power consumption mode may enter different low power consumption modes according to specific scenes, and also includes a power-down mode.
Step 502, the core 1 receives the processing data due to the wakeup of the peripheral signal; if the data requires core 2 assistance, then step 503 is entered;
step 503, in order to transmit the execution data to the core 2, the core 1 configures a lowest power consumption mode that meets the functional requirements in order to reduce unnecessary power consumption loss;
step 504 is described as wake core 2;
step 505, after the core 1 transmits the data to the core 2, the low power consumption mode is entered, and the processing of the core 2 is waited to be completed;
step 506, after the core 2 is awakened, configuring a proper power consumption mode and processing instruction data;
step 507, processing the instruction data for the core 2, transmitting the instruction execution result to the core 1, and waking up the core 1;
step 508, the core 2 enters a low power consumption mode and waits for the next event;
instep 509, after the core 1 is awakened and the core 2 data notification is received, the data is finally processed;
step 510 completes the event data processing for core 1.