Microcontroller with safe starting function, safe starting method and vehicle terminal

By building a hardware security module into the microcontroller to safely verify the information to be verified, the problem of high complexity of the safe startup verification mechanism of the vehicle microcontroller is solved, maintenance costs are reduced and security is improved.

CN118862091APending Publication Date: 2024-10-29CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410983556.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-10-29

AI Technical Summary

Technical Problem

The secure startup verification mechanism of existing vehicle microcontrollers is highly complex, resulting in high maintenance costs. The pure software approach increases system complexity and resource consumption, and the external security chip solution increases the risk of data transmission leakage and system complexity.

Method used

Design a microcontroller with a hardware security module. The built-in hardware security module performs security verification on the information to be verified. The public key and private key are used to sign and digest the bootloader and application files to verify the microcontroller. The startup state of the controller avoids dependence on the operating system and external bus.

Benefits of technology

It reduces the complexity of the security architecture, avoids communication delays and protocol compatibility issues, reduces the maintenance cost of secure boot verification, and increases the difficulty of implementing the secure boot function.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118862091A_ABST
    Figure CN118862091A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of MCU control, and discloses a microcontroller with a safe starting function, a safe starting method and a vehicle terminal. According to the application, the hardware security module is arranged in the microcontroller, and the security verification is carried out on the to-be-verified information in the storage module through the security key in the hardware security module, so that the starting state of the microcontroller is controlled, and compared with a mode of realizing secure starting depending on an external security module or a software module, the security verification is carried out on the to-be-verified information. The hardware security module arranged in the microcontroller is used for carrying out security verification on a boot loader and an application program file corresponding to the microcontroller, so that an operating system, an external bus and the like are not needed, the complexity of a security framework is reduced, potential problems caused by communication delay, protocol compatibility and the like are avoided, and the security of the microcontroller is improved. Therefore, the realization difficulty of the safety starting function is greatly reduced, and the maintenance cost of safety starting verification of the microcontroller is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of MCU control technology, and in particular to a microcontroller with a safe startup function, a safe startup method and a vehicle terminal. Background Art

[0002] With the rapid development of the automotive industry, especially the widespread application of intelligent network technology, vehicle systems are increasingly becoming highly complex and integrated. As the core of automotive electronic control systems, the on-board microcontroller (MCU) plays multiple roles such as vehicle function control, data management and security protection. Its security is directly related to the overall operational stability of the vehicle, passenger safety and data protection. Traditionally, automobile manufacturers and parts suppliers rely on software-level security strategies (such as access control, data encryption, etc.) to ensure the security of MCUs. However, in the face of increasingly complex and changeable network attack methods and the ever-increasing level of intelligence, this method of relying solely on software protection has become inadequate. Therefore, seeking more efficient and reliable security measures has become an urgent need in the industry.

[0003] The secure boot verification mechanism came into being in this context and is regarded as the first solid barrier to protect the security of in-vehicle MCUs. The core of this mechanism is to perform a series of strict security checks at the beginning of MCU startup to ensure the integrity and authenticity of its firmware, applications and key data, thereby effectively resisting the risks of malicious code injection and data tampering.

[0004] However, the current technical solutions for implementing secure boot verification still face many challenges. On the one hand, although the pure software method can achieve security verification by building a trusted execution environment (TEE), the additional operating system not only increases the complexity and resource consumption of the system, but may also become a potential security vulnerability point. On the other hand, although the external security chip solution can provide strong hardware-level protection, because it needs to communicate with the main controller through an external bus, it not only increases the risk of data transmission leakage, but also increases the overall complexity and maintenance cost of the system.

[0005] In summary, existing secure boot verification mechanisms for vehicle-mounted microcontrollers all have the problem of high overall complexity, resulting in high maintenance costs. Summary of the invention

[0006] In order to provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. The summary is not an extensive review, nor is it intended to identify key / critical components or delineate the scope of protection of these embodiments, but rather serves as a prelude to the detailed description that follows.

[0007] In view of the above-mentioned shortcomings of the prior art, the present application discloses a microcontroller with a safe boot function, a safe boot method and a vehicle terminal to reduce the maintenance cost of performing safe boot verification on the microcontroller.

[0008] The present application discloses a microcontroller with a secure boot function, comprising: a storage module, used to store information to be verified, wherein the information to be verified includes a loader signature value and / or an application summary value, the loader signature value is obtained by signing a boot loader corresponding to the microcontroller according to a first private key, and the application summary value is obtained by calculating an application file corresponding to the microcontroller according to a second key; a hardware security module, used to obtain a security key, and read the information to be verified from the storage unit, perform a security check on the read information to be verified according to the security key, so as to control the startup state of the microcontroller according to the security check result, wherein the security key includes a first public key and / or a second key, and there is a corresponding relationship between the first public key and the first private key.

[0009] In one embodiment of the present application, the storage module is further used to store any one or more of the boot loader, the application file, and the first public key.

[0010] In one embodiment of the present application, the hardware security module obtains the first public key in the following manner: pre-setting a verification value corresponding to the first public key in the hardware security module, wherein the verification value corresponding to the first public key is obtained by calculating the first public key; reading the first public key from the storage module, and using the read first public key as the key to be verified; calculating the key to be verified to obtain a verification value corresponding to the key to be verified; verifying the verification value corresponding to the key to be verified according to the verification value set in the hardware security module to obtain a public key verification result; if the public key verification result is verification passed, using the key to be verified as the first public key in the hardware security module.

[0011] In one embodiment of the present application, the check value corresponding to the first public key is calculated in the following manner: obtaining a hash initial value and a hash constant; padding the end of the first public key to obtain a first character string, and padding the length information of the first public key into the first character string to obtain a second character string; dividing the second character string into multiple data groups according to a preset grouping granularity, and performing logical bit operations on the data groups according to the hash initial value and the hash constant to obtain a hash value corresponding to the first public key; and using the hash value corresponding to the first public key as the check value corresponding to the first public key.

[0012] In one embodiment of the present application, the hardware security module performs security verification on the information to be verified read according to the security key in at least one of the following ways: performs security verification on the loader signature value read according to the first public key in the hardware security module to obtain a loader verification result; reads an application file from the storage module, and calculates the read application file according to the second key in the hardware security module, so as to verify the read application summary value according to the calculated application summary value to obtain an application verification result.

[0013] In one embodiment of the present application, the hardware security module controls the startup state of the microcontroller according to the security verification result in the following manner: taking at least one of the public key verification result, the loader verification result, and the application verification result as the security verification result: if the security verification results are all passed, the startup state of the microcontroller is set to allow startup; if the security verification results include a verification failure, the startup state of the microcontroller is set to startup failure.

[0014] The present application discloses a secure boot method, which is applied to a hardware security module, wherein the hardware security module is arranged in the microcontroller, and the method comprises: obtaining a security key, wherein the security key comprises a first public key and / or a second key; reading information to be verified from a storage unit arranged in the microcontroller, wherein the storage module is used to store the information to be verified, and the information to be verified comprises a loader signature value and / or an application summary value, wherein the loader signature value is obtained by signing a boot loader corresponding to the microcontroller according to a first private key, and the application summary value is obtained by calculating an application file corresponding to the microcontroller according to the second key; performing a security check on the read information to be verified according to the security key, so as to control the startup state of the microcontroller according to the security check result, wherein there is a corresponding relationship between the first public key and the first private key.

[0015] In one embodiment of the present application, a first public key and a first private key are generated in the following manner: obtaining a key length; determining a first random number and a second random number based on the key length, and generating an Euler function corresponding to the key length based on the first random number and the second random number; determining a public key exponent and a private key exponent based on the Euler function, wherein the private key exponent is a modular inverse element of the public key exponent with respect to the Euler function; generating a first public key based on the key length and the public key exponent, and generating a first private key based on the key length and the private key exponent.

[0016] In one embodiment of the present application, the application summary value is obtained in the following manner: a subkey is generated based on the second key; the application file is divided into multiple data blocks according to a preset encryption block length; each of the data blocks is encrypting by a preset encryption algorithm to obtain an encrypted ciphertext, so as to determine the application summary value from the encrypted ciphertext.

[0017] The present application discloses a vehicle terminal, comprising: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the vehicle terminal executes the above method.

[0018] Beneficial effects of this application:

[0019] By building a hardware security module into the microcontroller, the security key in the hardware security module is used to perform security verification on the information to be verified in the storage module, thereby controlling the startup state of the microcontroller. In this way, compared with the method of relying on an external security module or software module to achieve secure startup, the hardware security module built into the microcontroller performs security verification on the boot loader and application files corresponding to the microcontroller. It not only does not need to rely on the operating system, external bus, etc., reducing the complexity of the security architecture, but also avoids potential problems caused by communication delays, protocol compatibility and other issues, making the difficulty of implementing the secure startup function greatly reduced, thereby reducing the maintenance cost of secure startup verification of the microcontroller. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a schematic diagram of the structure of a microcontroller with a secure boot function in an embodiment of the present invention;

[0021] Figure 2 is a schematic diagram of a data block encryption method in an embodiment of the present invention;

[0022] Figure 3 is a schematic flow chart of a secure startup method in an embodiment of the present invention;

[0023] Figure 4 is a flowchart of another secure startup method in an embodiment of the present invention;

[0024] Figure 5 is a flowchart of another secure startup method in an embodiment of the present invention;

[0025] Figure 6 It is a schematic diagram of the structure of a vehicle terminal in an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The following describes the embodiments of the present invention through specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and sub-samples in the embodiments can be combined with each other without conflict.

[0027] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0028] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.

[0029] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so as to describe the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.

[0030] Unless otherwise stated, the term "plurality" means two or more.

[0031] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.

[0032] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.

[0033] Combination Figure 1 As shown, an embodiment of the present disclosure provides a microcontroller with a secure boot function, including a storage module 101 and a hardware security module (HSM, Hardware Security Module) 102.

[0034] The storage module 101 is used to store information to be verified, wherein the information to be verified includes a loader signature value and / or an application summary value, the loader signature value is obtained by signing a boot loader (BootLoader) corresponding to the microcontroller according to a first private key, and the application summary value is obtained by calculating an application file (HEX file, a standard file format for transmitting application data) corresponding to the microcontroller according to a second key.

[0035] The hardware security module 102 is used to obtain a security key and read information to be verified from a storage unit, and perform a security check on the read information to be verified according to the security key to control the startup state of the microcontroller according to the security check result, wherein the security key includes a first public key and / or a second key, and there is a corresponding relationship between the first public key and the first private key.

[0036] The microcontroller with a secure boot function provided by the embodiment of the present disclosure is adopted, and a hardware security module is built into the microcontroller, and the information to be verified in the storage module is securely verified by the security key in the hardware security module, thereby controlling the startup state of the microcontroller. In this way, compared with the method of relying on an external security module or software module to achieve secure boot, the boot loader and application files corresponding to the microcontroller are securely verified by the hardware security module built into the microcontroller, which not only does not need to rely on the operating system, external bus, etc., reducing the complexity of the security architecture, but also avoids potential problems caused by communication delays, protocol compatibility and other issues, making the difficulty of implementing the secure boot function greatly reduced, thereby reducing the maintenance cost of secure boot verification of the microcontroller.

[0037] In some embodiments, the microcontroller uses a RH850U2A series microcontroller.

[0038] Optionally, the storage module is also used to store any one or more of a boot loader, an application file, and a first public key.

[0039] In some embodiments, an RSA2048 asymmetric key (Rivest-Shamir-Adleman) is obtained as a public-private key pair, and an AES-128 key (Advanced Encryption Standard) is obtained as a second key, wherein the public-private key pair includes a first public key and a first private key; the first public key is stored in a storage module, and the second key is stored in an OTP area of ​​a hardware security module; the first public key is calculated by a SHA256 algorithm, and the obtained hash value is used as a verification value corresponding to the first public key, wherein the verification value corresponding to the first public key is stored in the OTP area of ​​the hardware security module; the boot loader corresponding to the microcontroller is signed according to the first private key to obtain a loader signature value, wherein the boot loader and the loader signature value are stored in the storage module; the HEX file corresponding to the application (APP) is calculated according to the second key, and the calculated CMAC (Cipher-Based Message Authentication Code) value is used as an application summary value, wherein the HEX file and the application summary value are stored in the storage module.

[0040] In some embodiments, the flash area of ​​the microcontroller is used as a storage module, and data is written to the OTP (One-Time Programmable) area of ​​the hardware security module through a flash burning tool, wherein the data stored in the storage module and the hardware security module are shown in Table 1.

[0041] Table 1

[0042]

[0043] Optionally, the first public key and the first private key are generated in the following manner: obtaining a key length; determining a first random number and a second random number based on the key length, and generating an Euler function corresponding to the key length based on the first random number and the second random number; determining a public key exponent and a private key exponent based on the Euler function, wherein the private key exponent is a modular inverse element of the public key exponent with respect to the Euler function; generating a first public key based on the key length and the public key exponent, and generating a first private key based on the key length and the private key exponent.

[0044] In some embodiments, the first public key and the first private key are generated by: generating two random and unequal large exponents as the first random number p and the second random number q, and satisfying the key length Len = p × q; determining the Euler function according to the first random number p and the second random number q According to the Euler function Determine the public key exponent e such that and Where GCD is the greatest common divisor; calculate the modular inverse element of the public key exponent e with respect to the Euler function to obtain the private key exponent d, so that and Wherein, mod is a modulus operator; the key length Len and the public key exponent e are encapsulated into a first public key, and the key length Len and the private key exponent d are encapsulated into a first private key.

[0045] In some embodiments, in response to the microcontroller entering a power-on state, the code solidified in the ROM area of ​​the hardware security module is started to initialize the startup security function; by reading the value of the corresponding register, it is determined whether the startup security function of the microcontroller is turned on; if the value of the register is 0, the startup security function is in an off state; if the value of the register is 1, the startup security function is in an on state; if the startup security function is in an on state, the boot loader and application of the microcontroller need to be verified separately before the microcontroller can be turned on.

[0046] Optionally, the hardware security module obtains the first public key in the following manner: pre-setting a verification value corresponding to the first public key in the hardware security module, wherein the verification value corresponding to the first public key is obtained by calculating the first public key; reading the first public key from the storage module, and using the read first public key as the key to be verified; calculating the key to be verified to obtain a verification value corresponding to the key to be verified; verifying the verification value corresponding to the key to be verified according to the verification value set in the hardware security module to obtain a public key verification result; if the public key verification result is that the verification is passed, the key to be verified is used as the first public key in the hardware security module.

[0047] In some embodiments, the hardware security module reads a first public key from the flash area of ​​the microcontroller; the read first public key is calculated according to a hash value algorithm to obtain a check value corresponding to the key to be verified; if the check value corresponding to the key to be verified is numerically consistent with the public key check value set in the hardware security module (check passed), the boot loader and the application program continue to be checked; if the check value corresponding to the key to be verified is numerically inconsistent with the public key check value set in the hardware security module (check failed), the startup state of the microcontroller is set to startup failure.

[0048] In some embodiments, the verification value corresponding to the first public key is calculated by any of the following methods: performing hash value calculation on the first public key according to a preset hash value algorithm, and using the obtained hash value as the verification value corresponding to the first public key; performing cumulative sum calculation based on the first public key, and using the obtained cumulative sum as the verification value corresponding to the first public key.

[0049] In some embodiments, the preset hash value algorithm is the SHA256 algorithm.

[0050] Optionally, the check value corresponding to the first public key is calculated in the following manner: the check value corresponding to the first public key is calculated in the following manner: obtaining a hash initial value and a hash constant; padding the end of the first public key to obtain a first string, and padding the length information of the first public key into the first string to obtain a second string; dividing the second string into multiple data groups according to a preset grouping granularity, and performing logical bit operations on the data groups according to the hash initial value and the hash constant to obtain a hash value corresponding to the first public key; using the hash value corresponding to the first public key as the check value corresponding to the first public key.

[0051] In some embodiments, 8 hash initial values ​​and 64 hash constants are obtained, wherein the 8 hash initial values ​​are obtained by taking the first 32 bits of the decimal part of the square roots of the first 8 prime numbers in natural numbers, and the 64 hash constants are obtained by taking the first 32 bits of the decimal part of the cube roots of the first 64 prime numbers in natural numbers; the end of the first public key is padded to obtain a first string, wherein the remainder of the total length of the first string after modulo 512 is 448; the length information of the first public key is padded to the first string to obtain a second string; the second string is divided into multiple data groups according to a preset grouping granularity, and logical bit operations are performed on the data groups according to the hash initial values ​​and the hash constants to obtain a hash value corresponding to the first public key; the hash value corresponding to the first public key is used as the check value corresponding to the first public key.

[0052] In some embodiments, the eight initial hash values ​​are H0:=0x6a09e667, H1:=0xbb67ae85, H2:=0x3c6ef372, H3:=0xa54ff53a, H4:=0x510e527f, H5:=0x9b05688c, H6:=0x1f83d9ab, and H7:=0x5be0cd19.

[0053] In some embodiments, the 64 hash constants are 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06 a7、0xc19bf174、0xe49b69c1、0xefbe4786、0x0fc19dc6、0x240ca1cc、0x2de92c6f、0x4a7484aa、0x5cb0a9dc , 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x 14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92 722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106a a070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6f f3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2.

[0054] Optionally, the hardware security module performs security verification on the information to be verified that is read according to the security key in at least one of the following ways: performing security verification on the loader signature value that is read according to the first public key in the hardware security module to obtain a loader verification result; reading the application file from the storage module, and calculating the read application file according to the second key in the hardware security module, so as to verify the read application summary value according to the calculated application summary value to obtain an application verification result.

[0055] In some embodiments, the hardware security module reads the loader signature value stored in the flash area, and uses the first public key in the hardware security module to perform a security check on the read loader signature value to obtain a loader check result to verify whether the loaded boot program has been modified; if the loader check result is a pass, the application program continues to be checked; if the loader check result is a fail, the startup state of the microcontroller is set to startup failure.

[0056] In some embodiments, a CMAC value corresponding to the application file is calculated based on the second key, and the CMAC value corresponding to the application file is used as the application summary value.

[0057] Optionally, the application summary value is obtained in the following manner: a subkey is generated based on the second key; the application file is divided into multiple data blocks according to a preset encryption block length; each data block is encrypting by a preset encryption algorithm to obtain an encrypted ciphertext, so as to determine the application summary value from the encrypted ciphertext.

[0058] In some embodiments, generating a subkey according to the second key includes: encrypting a preset string of 128 bits in length according to the second key through the AES algorithm to obtain an encrypted string L of 128 bits in length; if the highest bit of the encrypted string L is 0, shifting the encrypted string L left by one bit to obtain a first subkey K1; if the highest bit of the encrypted string L is 1, shifting the encrypted string L left by one bit, and merging the encrypted string after the left shift with the constant string R b Perform an XOR operation to obtain the first subkey K1; if the highest bit of the first subkey K1 is 0, shift the first subkey K1 left by one bit to obtain the second subkey K2; if the highest bit of the first subkey K1 is 1, shift the first subkey K1 left by one bit and AND the left-shifted subkey with the constant string R b Perform an XOR operation to obtain the second subkey K2; use the first subkey K1 and the second subkey K2 as the subkeys corresponding to the second key.

[0059] In some embodiments, the application file is divided into multiple data blocks according to a preset encryption block length, including: if the application file M is empty, the number of data blocks n is 1, otherwise, n is a minimum integer value not less than (MLen / b), where MLen is the data length of the application file M, and b is the bit length of the data block; the application file M is divided into n data blocks, where the first (n-1) data blocks are complete blocks.

[0060] Combination Figure 2 As shown, before encrypting each data block by a preset encryption algorithm to obtain the encrypted ciphertext, the last data block is processed in the following manner: if the last data block If the last data block is a complete block, the last data block is XORed with the first subkey K1 to obtain a new last data block. If it is an incomplete block, the last data block is padded, and the padded last data block is XORed with the second subkey K2 to obtain a new last data block.

[0061] In some embodiments, each data block is encrypted by a preset encryption algorithm to obtain an encrypted ciphertext to determine the application summary value from the encrypted ciphertext, including: encrypting each data block by an AES encryption algorithm, and taking the value of the last set of encrypted ciphertext in the high order as the application summary value T.

[0062] In some embodiments, the hardware security module reads the application summary value and the HEX file from the flash area; calculates the CMAC value corresponding to the HEX file based on the second key, and verifies the read application summary value based on the calculated CMAC value to obtain the application verification result; if the application verification result is that the value is consistent (verification passed), the startup state of the microcontroller is set to allow startup; if the application verification result is that the value is inconsistent (verification failed), the startup state of the microcontroller is set to startup failure.

[0063] Optionally, the hardware security module controls the startup state of the microcontroller according to the security verification results in the following manner: taking at least one of the public key verification result, the loader verification result, and the application verification result as the security verification result: if the security verification results are all passed, the startup state of the microcontroller is set to allow startup; if the security verification results include verification failure, the startup state of the microcontroller is set to startup failure.

[0064] Combination Figure 3 As shown, an embodiment of the present disclosure provides a secure boot method, which is applied to a hardware security module, and the hardware security module is set in a microcontroller. The method includes:

[0065] Step S301, obtaining a security key;

[0066] Wherein, the security key includes a first public key and / or a second key;

[0067] Step S302, reading the information to be verified from the storage unit set in the microcontroller;

[0068] Wherein, the storage module is used to store the information to be verified, and the information to be verified includes the loader signature value and / or the application program summary value;

[0069] The loader signature value is obtained by signing the boot loader corresponding to the microcontroller according to the first private key;

[0070] The application summary value is obtained by calculating the application file corresponding to the microcontroller according to the second key;

[0071] Step S303, performing security verification on the read information to be verified according to the security key, so as to control the startup state of the microcontroller according to the security verification result;

[0072] There is a corresponding relationship between the first public key and the first private key.

[0073] The secure boot method provided by the embodiment of the present disclosure is adopted, by building a hardware security module into a microcontroller, and performing security verification on the information to be verified in the storage module through the security key in the hardware security module, thereby controlling the startup state of the microcontroller. In this way, compared with the method of relying on an external security module or software module to achieve secure boot, the boot loader and application files corresponding to the microcontroller are securely verified by the hardware security module built into the microcontroller, which not only does not need to rely on the operating system, external bus, etc., reducing the complexity of the security architecture, but also avoids potential problems caused by communication delays, protocol compatibility and other issues, making the difficulty of implementing the secure boot function greatly reduced, thereby reducing the maintenance cost of performing secure boot verification on the microcontroller.

[0074] Combination Figure 4 As shown, an embodiment of the present disclosure provides a secure boot method, which is applied to a hardware security module, and the hardware security module is set in a microcontroller. The method includes:

[0075] Step S401, obtaining a check value corresponding to the first public key, and obtaining a second key;

[0076] Step S402, in response to the device being powered on, reading the enabling state of the secure boot function from the ROM area;

[0077] Step S403, judging whether to perform a secure boot check on the boot loader according to the startup state, if yes, jump to step S403, if no, jump to step S409;

[0078] Step S404, reading the first public key and the loader signature value from the storage module;

[0079] Step S405, calculating a check value for the read first public key, and verifying the calculated check value according to the check value set in the hardware security module to obtain a public key verification result;

[0080] Step S406, determine whether the public key verification result is verified, if so, jump to step S407, if not, jump to step S415;

[0081] Step S407, verifying the loader signature value according to the read first public key to obtain a loader verification result;

[0082] Step S408, determine whether the verification result of the loader is verified, if so, jump to step S409, if not, jump to step S415;

[0083] Step S409, setting the boot loader startup state to allow startup;

[0084] Step S410, judging whether to perform a security startup check on the application according to the startup state, if yes, jump to step S411, if no, jump to step S414;

[0085] Step S411, reading the application summary value and the application file from the storage module;

[0086] Step S412, calculating the read application file according to the second key, and verifying the read application summary value according to the calculated application summary value to obtain an application verification result;

[0087] Step S413, determine whether the application verification result is verified, if so, jump to step S414, if not, jump to step S415;

[0088] Step S414, setting the startup state of the microcontroller to allow startup.

[0089] Step S415, setting the startup state of the microcontroller to startup failure.

[0090] The secure boot method provided by the embodiment of the present disclosure is adopted, by building a hardware security module into a microcontroller, and performing security verification on the information to be verified in the storage module through the security key in the hardware security module, thereby controlling the startup state of the microcontroller. In this way, compared with the method of relying on an external security module or software module to achieve secure boot, the boot loader and application files corresponding to the microcontroller are securely verified by the hardware security module built into the microcontroller, which not only does not need to rely on the operating system, external bus, etc., reducing the complexity of the security architecture, but also avoids potential problems caused by communication delays, protocol compatibility and other issues, making the difficulty of implementing the secure boot function greatly reduced, thereby reducing the maintenance cost of performing secure boot verification on the microcontroller.

[0091] Combination Figure 5 As shown, the embodiment of the present disclosure provides a secure boot method, including:

[0092] Step S501, the storage module stores the loader signature value, the application summary value, the boot loader, the application file, and the first public key;

[0093] Step S502, the hardware security module obtains a check value corresponding to the first public key, and obtains a second key;

[0094] Step S503, the hardware security module reads the first public key and the loader signature value from the storage module;

[0095] Step S504, the hardware security module calculates a check value for the read first public key, and verifies the calculated check value according to the check value set in the hardware security module to obtain a public key verification result;

[0096] Step S505, if the public key verification result is verification passed, the hardware security module verifies the loader signature value according to the read first public key to obtain the loader verification result;

[0097] Step S506, if the loader verification result is verification passed, the hardware security module sets the boot status of the boot loader to allow startup;

[0098] Step S507, the hardware security module reads the application summary value and the application file from the storage module;

[0099] Step S508, the hardware security module calculates the read application file according to the second key, and verifies the read application summary value according to the calculated application summary value to obtain an application verification result;

[0100] Step S509: If the application verification result is that the verification is passed, the hardware security module sets the startup state of the microcontroller to allow startup.

[0101] The secure boot method provided by the embodiment of the present disclosure is adopted, by building a hardware security module into a microcontroller, and performing security verification on the information to be verified in the storage module through the security key in the hardware security module, thereby controlling the startup state of the microcontroller. In this way, compared with the method of relying on an external security module or software module to achieve secure boot, the boot loader and application files corresponding to the microcontroller are securely verified by the hardware security module built into the microcontroller, which not only does not need to rely on the operating system, external bus, etc., reducing the complexity of the security architecture, but also avoids potential problems caused by communication delays, protocol compatibility and other issues, making the difficulty of implementing the secure boot function greatly reduced, thereby reducing the maintenance cost of performing secure boot verification on the microcontroller.

[0102] The embodiment of the present disclosure also provides a vehicle terminal, including: a processor and a memory; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the vehicle terminal executes the above method.

[0103] Figure 6 The structure diagram of the computer system of the vehicle terminal suitable for implementing the embodiment of the present application is shown. It should be noted that: Figure 6 The computer system 600 of the vehicle terminal shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0104] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603, such as executing the method in the above embodiment. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, ROM 602 and RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0105] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.

[0106] The vehicle terminal disclosed in this embodiment includes a processor, a memory, a transceiver and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication with each other. The memory is used to store computer programs, the communication interface is used to communicate, and the processor and the transceiver are used to run computer programs so that the vehicle terminal executes each step of the above method.

[0107] The above description and accompanying drawings fully illustrate the embodiments of the present disclosure so that those skilled in the art can practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent possible changes only. Unless explicitly required, separate components and functions are optional, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms of "a", "an" and "the" are intended to include plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of listings containing one or more associated ones. In addition, when used in the present application, the term "comprise" and its variants "comprises" and / or comprising refer to the presence of a stated sub-sample, whole, step, operation, element, and / or component, but do not exclude the presence or addition of one or more other sub-samples, wholes, steps, operations, elements, components and / or groups of these. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the presence of other identical elements in the process, method or device comprising the elements. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments may refer to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can refer to the description of the method part.

[0108] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. Technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. Technicians can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0109] In the embodiments disclosed herein, the disclosed methods and products (including but not limited to devices, equipment, etc.) can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units can be only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some sub-samples can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to implement this embodiment. In addition, each functional unit in the embodiment of the present disclosure may be integrated in a processing unit, or each unit may exist physically alone, or two or more units may be integrated in one unit.

[0110] The flowchart and block diagram in the accompanying drawings show the possible architecture, functions and operations of the system, method and computer program product according to the embodiment of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of the code, and a part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. In some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. In the description corresponding to the flowchart and block diagram in the accompanying drawings, the operations or steps corresponding to different boxes can also occur in a different order from the order disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which can depend on the functions involved. Each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented by a dedicated hardware-based system that performs the specified functions or actions, or may be implemented by a combination of dedicated hardware and computer instructions.

Claims

1. A microcontroller with a secure boot function, characterized in that: include: A storage module, used to store information to be verified, wherein the information to be verified includes a loader signature value and / or an application summary value, the loader signature value is obtained by signing the boot loader corresponding to the microcontroller according to the first private key, and the application summary value is obtained by calculating the application file corresponding to the microcontroller according to the second key; A hardware security module is used to obtain a security key and read the information to be verified from the storage unit, and perform a security check on the read information to be verified according to the security key, so as to control the startup state of the microcontroller according to the security check result, wherein the security key includes a first public key and / or a second key, and there is a corresponding relationship between the first public key and the first private key.

2. The microcontroller according to claim 1, characterized in that The storage module is further used to store any one or more of the boot loader, the application file, and the first public key.

3. The microcontroller according to claim 2, characterized in that: The hardware security module obtains the first public key in the following manner: Pre-setting a check value corresponding to the first public key in the hardware security module, wherein the check value corresponding to the first public key is obtained by calculating the first public key; Reading a first public key from the storage module, and using the read first public key as a key to be verified; Calculating the key to be verified to obtain a check value corresponding to the key to be verified; Verifying the verification value corresponding to the key to be verified according to the verification value set in the hardware security module to obtain a public key verification result; If the public key verification result is verification passed, the key to be verified is used as the first public key in the hardware security module.

4. The microcontroller according to claim 3, characterized in that: The checksum corresponding to the first public key is calculated in the following way: Get the hash initial value and hash constant; Padding the end of the first public key to obtain a first character string, and padding the length information of the first public key to the first character string to obtain a second character string; Divide the second character string into a plurality of data groups according to a preset grouping granularity, and perform a logical bit operation on the data groups according to a hash initial value and a hash constant to obtain a hash value corresponding to the first public key; The hash value corresponding to the first public key is used as the verification value corresponding to the first public key.

5. The microcontroller according to claim 3 or 4, characterized in that: The hardware security module performs security verification on the read information to be verified according to the security key in at least one of the following ways: Performing security verification on the read loader signature value according to the first public key in the hardware security module to obtain a loader verification result; An application file is read from the storage module, and the read application file is calculated according to the second key in the hardware security module, so as to verify the read application summary value according to the calculated application summary value to obtain an application verification result.

6. The microcontroller according to claim 5, characterized in that: The hardware security module controls the startup state of the microcontroller according to the security check result in the following manner: At least one of the public key verification result, the loader verification result, and the application verification result is used as a security verification result: If the safety check results are all verified to be passed, the startup state of the microcontroller is set to allow startup; If the safety check result includes a check failure, the startup state of the microcontroller is set to startup failure.

7. A secure boot method, characterized in that: Applied to a hardware security module, the hardware security module is arranged in the microcontroller, the method comprises: Acquire a security key, wherein the security key includes a first public key and / or a second key; Reading information to be verified from a storage unit provided in the microcontroller, wherein the storage module is used to store the information to be verified, and the information to be verified includes a loader signature value and / or an application summary value, the loader signature value is obtained by signing a boot loader corresponding to the microcontroller according to a first private key, and the application summary value is obtained by calculating an application file corresponding to the microcontroller according to the second key; The read information to be verified is subjected to security verification according to the security key, so as to control the startup state of the microcontroller according to the security verification result, wherein there is a corresponding relationship between the first public key and the first private key.

8. The method according to claim 7, characterized in that Generate the first public key and the first private key in the following way: Get the key length; Determine a first random number and a second random number according to the key length, and generate an Euler function corresponding to the key length according to the first random number and the second random number; Determine a public key exponent and a private key exponent according to the Euler function, wherein the private key exponent is a modular inverse element of the public key exponent with respect to the Euler function; A first public key is generated according to the key length and the public key exponent, and a first private key is generated according to the key length and the private key exponent.

9. The method according to claim 7 or 8, characterized in that: Get the application summary value by: generating a subkey according to the second key; Dividing the application file into a plurality of data blocks according to a preset encryption block length; Each of the data blocks is encrypted by a preset encryption algorithm to obtain an encrypted ciphertext, so as to determine the application summary value from the encrypted ciphertext.

10. A vehicle terminal, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the vehicle terminal executes the method according to any one of claims 7 to 9.

Citation Information

Cited By

  • Memory module, control method thereof and electronic system

    CN119357979A

  • Memory module and control method thereof, and electronic system

    CN119357979B