Program loading method and device, electronic equipment and storage medium
By using the random number of the controller during the loading process of the startup program, and combining key enhancement and out-of-order processing, the security risks of the secure startup method in the existing technology are solved, and the data of the startup program is significantly improved Security and safety performance.
Patent Information
- Application Number
- CN202411202843.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-27
AI Technical Summary
The secure startup method in the prior art poses a security risk. The attacker can tamper with the summary values in the software program and memory, resulting in the loading of malicious programs, and the security performance is poor.
The random number introduced into the controller encrypts the ontology and verification values of the startup program, and decodes and decrypts the out-of-order data and encrypted data using the encryption key and the decryption key to ensure that the data can only be sent and obtained by the designated party, and through Key enhancement and out-of-order processing improve security.
It ensures the data security of the startup program to the maximum extent, improves the security performance of secure startup, and prevents malicious programs from loading and data leakage.
Smart Images

Figure CN119203146A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a program loading method, device, electronic equipment and storage medium. Background Art
[0002] Electronic information devices and systems in the prior art need to load a startup program before starting up, and then start the operating system by executing the startup program, and then they can work normally. Therefore, loading the startup program is often the first step in starting up the device.
[0003] In order to ensure secure booting, the prior art generates a set of proprietary summary values for software programs through a HASH algorithm, and then stores the summary values in a storage device such as Flash (flash memory) through asymmetric encryption. When the system starts, the BMC (Baseboard Management Controller) performs a HASH operation on the software program to be started in the memory to obtain the summary value of the program, and then uses the public key to decrypt the summary value in the Flash and other storage devices. The two summary values are compared and verified. If they are exactly the same, it means that the software program in the system is safe and reliable, and the program can be used for normal startup. Otherwise, the startup is stopped.
[0004] The startup method of the prior art still has certain security risks. For example, an attacker can tamper with the software program and the summary value in the memory, thereby causing a malicious program to be loaded. Summary of the invention
[0006] The present invention provides a program loading method, device, electronic equipment and storage medium, which ensure the data security of the startup program and improve the security performance of secure startup.
[0007] The present invention provides a program loading method, comprising the following steps: obtaining random data and encrypted data, the random data being generated according to a random number and a startup verification value, the encrypted data being data obtained by encrypting a startup program using an encryption key and the random number, the startup verification value being a verification value of the startup program, and the random number being a value randomly generated when writing the encrypted data; decoding the random data using the random number to obtain the startup verification value; obtaining the verification value of the encrypted data to obtain a real-time verification value; if the startup verification value and the real-time verification value are the same, decrypting the encrypted data according to a decryption key and the random number to obtain the startup program; and loading the startup program.
[0008] According to a program loading method provided by the present invention, the using of the random number to decode the out-of-order data to obtain the startup check value includes: using the random number to reconstruct the out-of-order data to obtain the startup check value.
[0009] According to a program loading method provided by the present invention, the use of the random number to reconstruct the disordered data to obtain the startup verification value includes: using the random number to reconstruct the disordered data to obtain reconstructed data; using a preset key to decrypt the reconstructed data to obtain the startup verification value.
[0010] According to a program loading method provided by the present invention, the encrypted data is decrypted according to the decryption key and the random number to obtain the startup program, including: key enhancement according to the decryption key and the random number to generate an enhanced key; decrypting the encrypted data according to the enhanced key to obtain the startup program.
[0011] According to a program loading method provided by the present invention, the method also includes: receiving a program summary value, the program summary value is a summary value of a writing program, the writing program is used to write the encrypted data into a memory; comparing the program summary value with a verification summary value; if the program summary value is the same as the verification summary value, establishing a trusted link with the writing program, the trusted link is used to receive the encrypted data.
[0012] According to a program loading method provided by the present invention, the key enhancement includes: XOR operation, key derivation function, and elliptic curve operation.
[0013] The present invention also provides a program loading device, comprising the following modules: an acquisition module, used to acquire random data and encrypted data, the random data being generated based on a random number and a startup verification value, the encrypted data being data obtained by encrypting a startup program using an encryption key and the random number, the startup verification value being a verification value of the startup program, the random number being a value randomly generated by a controller when writing the startup program, and the controller being used to load the startup program; a decoding module, used to decode the random data using the random number to obtain the startup verification value; a calculation module, used to obtain the verification value of the encrypted data to obtain a real-time verification value; a verification module, used to decrypt the encrypted data based on a decryption key and the random number to obtain the startup program if the startup verification value and the real-time verification value are the same; and a startup module, used to load the startup program.
[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the program loading methods described above is implemented.
[0015] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the program loading method described in any one of the above is implemented.
[0016] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned program loading methods.
[0017] The program loading method, device, electronic device and storage medium provided by the present invention introduce a random number of the controller to encrypt the body and check value of the startup program, thereby ensuring to the greatest extent that the disordered data and encrypted data can only be sent by the designated data writer, and also ensuring to the greatest extent that the disordered data and encrypted data can only be obtained by the controller, thereby ensuring the data security of the startup program and improving the security performance of secure startup. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 It is a flowchart of the program loading method provided by the present invention.
[0020] Figure 2 It is a structural schematic diagram of the program loading device provided by the present invention.
[0021] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] Electronic information equipment and systems need to load a startup program before starting up, and then they can work normally by executing the startup program to start the operating system. Therefore, how to ensure the correctness of loading the startup program when the server starts up is a very important thing.
[0024] If the wrong startup program is loaded, the server may malfunction at best, or the device may be damaged at worst, or even the server may be implanted with malware and its core information may be leaked. Therefore, secure startup devices are now widely used for startup protection to verify whether the loaded software program is safe and reliable. If it is safe and reliable, the server will be started. If it is not safe and reliable, the server startup will be stopped until the loaded program passes the secure startup verification.
[0025] In the prior art, only the digest value of the startup software program is compared and verified with the pre-stored digest value. If they are exactly the same, it means that the software program in the system is safe and reliable, and the program can be started normally. The security performance of the secure startup method in the prior art is poor, and there is still the possibility of being attacked.
[0026] In view of this, an embodiment of the present invention provides a program loading method, which introduces a random number from a controller to encrypt the body and check value of the startup program, thereby ensuring to the greatest extent that the disordered data and encrypted data can only be sent by the designated data writer, and also ensuring to the greatest extent that the disordered data and encrypted data can only be obtained by the controller, thereby ensuring the data security of the startup program and improving the security performance of secure boot.
[0027] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0028] Figure 1 This is one of the flowcharts of the program loading method provided by the present invention. The program loading method can be applied to electronic devices, and the electronic devices can be various types of devices with information processing capabilities during implementation. For example, the electronic devices can include personal computers, laptops, PDAs or servers, etc.; the electronic devices can also be mobile terminals, such as mobile phones, car computers, tablet computers or projectors, etc. Figure 1 As shown, the method may include the following steps 101 to 105: Step 101: Obtain random data and encrypted data, the random data is generated based on a random number and a startup verification value, the encrypted data is data obtained by encrypting a startup program using an encryption key and the random number, the startup verification value is a verification value of the startup program, and the random number is a randomly generated value when writing the encrypted data.
[0029] When the controller starts, it obtains the out-of-order data and the encrypted data from the memory.
[0030] The controller is a hardware system used to execute a startup program to achieve specific functions. Examples of controllers include baseboard management controllers, etc. The baseboard management controller executes the startup program to manage the server. The out-of-order data is generated based on a random number and a startup check value. The startup check value is a value calculated by using a preset check value generation algorithm such as a hash algorithm to calculate the startup program. The random number is a value randomly generated by the controller when the write program writes out-of-order data and / or encrypted data into the memory. The encrypted data is obtained by encrypting the startup program based on the encryption key and the random number. The memory can be a memory located outside the controller such as Flash.
[0031] For example, the controller is a baseboard management controller, and there is a corresponding software system for the baseboard management controller. The software system is a supporting software system for the baseboard management controller, and the software system is used to write startup software such as Image to the baseboard management controller. The baseboard manager is set on the server, and the software system is loaded on the writing device.
[0032] In one embodiment of the present application, the method also includes: receiving a program summary value, the program summary value is a summary value of a writing program, the writing program is used to write the encrypted data into a memory; comparing the program summary value with a verification summary value; if the program summary value is the same as the verification summary value, establishing a trusted link with the writing program, the trusted link is used to receive the encrypted data.
[0033] When the powered-on hardware system such as the baseboard management controller communicates with the software, the software needs to self-check and call the SHA algorithm to measure the entire software program to obtain a digest value, report the digest value to the register address reserved by the hardware, and wait for hardware verification.
[0034] The hardware system has a built-in OTP (One Time Programmable) memory, and the software hash summary value is pre-stored in the OTP. After the hardware system receives the hash measurement value, it compares the measurement value with the value stored in the OTP. If the two are the same, it means that the verification is successful.
[0035] After the hardware system is successfully verified, the communication port with the software is opened to establish a trusted link, otherwise data interaction with the software is rejected. For example, the hardware system sends a verification pass signal to the software side, which includes the port number, etc. Only when the software and hardware establish a trusted link can normal data transmission be carried out, ensuring the security of the random number sent by the hardware to the software in the next stage.
[0036] In the above embodiment, the summary value is verified to check whether the writing program is a matching program, so that the hardware system can only establish a link with the specified writing program, thereby ensuring the security of data in the hardware system.
[0037] The hardware system provides a set of random numbers to the software. For example, a true random number generator is set in the hardware system, which is a generator that can generate true random numbers. After the security check of the software system passes, the hardware system calls the internal true random number generator to generate a random number and sends the random number to the software. Furthermore, the random number will be updated by the true random number generator every time the security boot process is performed, ensuring that the random number used for security boot is different every time the software updates the image.
[0038] After receiving the random number, the software system uses the random data and the encryption key to encrypt the image to obtain the encrypted data. For example, the software system performs a key enhancement operation such as an XOR operation on the AES key to be used and the provided random number, and then performs an AES encryption operation on the image.
[0039] Since the AES key is saved by the user, it may be leaked. In addition, AES is a symmetric encryption algorithm, and the key value used for encryption and decryption is the same. If it is tested with a large amount of data, it is easy to be cracked. Therefore, a set of random numbers that will be updated every time the security boot is introduced is introduced, so that each AES encryption key is equivalent to a set of random values. Even if the user key value is leaked, a third party cannot truly decrypt the encrypted image.
[0040] After the encryption is completed, the software calls to generate a verification value for the encrypted Imgae. For example, the software uses the SHA algorithm to perform hash measurement on the encrypted Imgae to obtain a set of summary values, and then uses the RSA private key to encrypt the summary value to generate a signature value.
[0041] In order to further enhance the security of the signature value, the random number provided by the hardware is used to shuffle the generated signature value to obtain shuffled data. For example, the digest algorithm is the SHA-256 algorithm, the encryption algorithm is RSA-2048, the digest value generated by the SHA algorithm is 256 bits, and the signature value generated after encryption with the RSA-2048 private key is 2048 bits, such as: 101101101110…11000. The hardware system provides a set of 2048-bit random numbers, such as: 111001010110001…11011 as an example.
[0042] Because both the random number and the digest value are 2048-bit data, the sequence position of the random number and the sequence position of the signature value are matched one by one. When there are continuous 1s or continuous 0s in the random number sequence, the signature value at the corresponding position will be shifted. For the sequence of continuous 1s, a circular right shift of 1 is performed, and for the sequence of continuous 0s, a circular left shift of 1 is performed. No processing is performed on the position data where a single 1 or a single 0 appears. For example, if the first group of continuous 1s in the random number appears at the 0th, 1st and 2nd bits, which is "111", the data of the 0th, 1st and 2nd bits of the signature value "101" is circularly shifted right by one bit to become "110". If the first group of continuous 0s appears at the 3rd and 4th bits "00", the 3rd and 4th bits of the signature value "10" are circularly shifted left to become "01". For a single 1, such as the 5th bit of the random number, the 5th bit of the signature value is not processed. For the same single occurrence of 0, such as the 6th bit of the random number, the 6th bit of the signature value is not processed, and a set of disordered signature values can be obtained by repeating this process.
[0043] The above-mentioned disordering method of the present application is only used as an example, which is a simple method based on the convenience of hardware design and resource considerations. In other embodiments of the present application, disordering processing can also adopt different safer disordering algorithms.
[0044] The software system writes the encrypted Imgae and the random signature value into the Flash.
[0045] Step 102: Use the random number to decode the out-of-order data to obtain the startup check value.
[0046] The controller uses the random number stored internally to decode the out-of-order data to obtain a startup check value.
[0047] In one embodiment of the present application, the decoding of the out-of-order data using the random number to obtain the startup check value includes: reconstructing the out-of-order data using the random number to obtain the startup check value.
[0048] The disordered data is obtained by disordering the check value by random numbers, and the check value can be reconstructed according to the de-scrambling method corresponding to the disordering method.
[0049] Therefore, the hardware system uses the random numbers stored in the hardware system to de-randomize the data to obtain reconstructed data.
[0050] In the above embodiment, the check value is obtained by random number scrambling of the controller, thereby ensuring the security of the check value.
[0051] In one embodiment of the present application, the use of the random number to reconstruct the disordered data to obtain the startup verification value includes: using the random number to reconstruct the disordered data to obtain reconstructed data; and decrypting the reconstructed data using a preset key to obtain the startup verification value.
[0052] In some embodiments of the present application, the check value is encrypted before the shuffling process is performed. For example, the check value is a digest value calculated by the SHA algorithm. After the digest value is calculated, the check value is encrypted using an RSA private key and shuffled to obtain shuffled data.
[0053] Therefore, when the hardware system starts, it obtains the signature value from the Flash, and then uses the random number stored in the hardware system to de-scramble the signature value. After the processing is completed, the RSA public key in the OTP is called to decrypt the signature value.
[0054] In the above embodiment, the check value is doubly encrypted and obtained through encryption and scrambling, which reduces the risk of the check value being cracked and ensures to the greatest extent that the check value can only be obtained by the controller.
[0055] Step 103: Obtain the verification value of the encrypted data to obtain a real-time verification value.
[0056] Step 104: If the startup verification value and the real-time verification value are the same, the encrypted data is decrypted according to the decryption key and the random number to obtain the startup program.
[0057] Step 105: Load the startup program.
[0058] The hardware system calculates the check value of the encrypted data. For example, the encrypted data is the encrypted Image, and the check value is the hash value. The hardware system measures the SHA algorithm to obtain a set of summary values. This value is compared with the hash value obtained from the random data. If they are consistent, it proves that the Image in the Flash is the correct Image written by the user using the supporting software system, and can be started with confidence.
[0059] The control unit in the hardware system notifies the AES decryption module to use the AES key in the OTP and the random number stored internally to decrypt the encrypted Image, and then notifies the startup unit in the hardware system to use the Image to start. Otherwise, the startup is aborted and a startup failure notification is returned.
[0060] The above program loading method introduces the random number of the controller to encrypt the body and check value of the startup program, which maximizes the guarantee that the disordered data and encrypted data can only be sent by the designated data writer, and also maximizes the guarantee that the disordered data and encrypted data can only be obtained by the controller, thereby ensuring the storage security of the startup program and improving the security performance of secure startup.
[0061] In one embodiment of the present application, decrypting the encrypted data based on the decryption key and the random number to obtain the startup program includes: enhancing the key based on the decryption key and the random number to generate an enhanced key; decrypting the encrypted data based on the enhanced key to obtain the startup program.
[0062] In some embodiments of the present application, the startup software is encrypted after the encryption key and the random number are key-enhanced. Therefore, the hardware system performs key-enhancing on the decryption key and the random number to generate an enhanced key. The decryption key is a key corresponding to the encryption key used to encrypt the startup program. For example, if AES is used for encryption, the encryption key and the decryption key are the same value.
[0063] In the above embodiment, the encrypted data is encrypted after key enhancement by the decryption key and the random number, so that even if the decryption key is leaked, the attacker still cannot modify the startup program, further ensuring the security of the startup.
[0064] Furthermore, the key enhancement includes: XOR operation, key derivation function, and elliptic curve operation.
[0065] The encrypted data is decrypted using the obtained enhanced key to obtain the startup program.
[0066] In the above embodiment, the software version is first verified to be credible, and then a data communication link is established to ensure the issuance of random numbers. Then, the random numbers are used to enhance the security of AES encryption, and finally, the random numbers are used to protect and store the signature value. These three additional mechanisms greatly enhance the security performance of secure boot.
[0067] Based on the foregoing embodiments, an embodiment of the present invention provides a program loading device, and each module included in the device, and each unit included in each module, can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
[0068] The program loading device provided by the present invention is described below. The program loading device described below and the program loading method described above can be referred to each other.
[0069] Figure 2 Schematic diagram of the structure of the program loading device provided by the embodiment of the present invention. Figure 2 As shown, the device 200 includes an acquisition module 201, a decoding module 202, a calculation module 203, a verification module 204 and a startup module 205, wherein: An acquisition module 201 is used to acquire random data and encrypted data, wherein the random data is generated according to a random number and a startup check value, the encrypted data is data obtained by encrypting the startup program using an encryption key and a random number, the startup check value is a check value of the startup program, and the random number is a value randomly generated by a controller when writing the startup program, and the controller is used to load the startup program; A decoding module 202, configured to decode the disordered data using the random number to obtain the startup check value; The calculation module 203 is used to obtain the check value of the encrypted data to obtain a real-time check value; A verification module 204, configured to decrypt the encrypted data according to a decryption key and the random number to obtain the startup program if the startup verification value and the real-time verification value are the same; The startup module 205 is used to load the startup program.
[0070] In some embodiments, the decoding module 202 is specifically configured to use the random number to reconstruct the out-of-order data to obtain the startup check value.
[0071] In some embodiments, the decoding module 202 is specifically configured to use the random number to reconstruct the disordered data to obtain reconstructed data; and use a preset key to decrypt the reconstructed data to obtain the startup check value.
[0072] In some embodiments, the verification module 204 is specifically used to perform key enhancement based on the decryption key and the random number to generate an enhanced key; and decrypt the encrypted data based on the enhanced key to obtain the startup program.
[0073] In some embodiments, the device also includes a program verification module, which is used to receive a program summary value, wherein the program summary value is a summary value of a writing program, and the writing program is used to write the encrypted data into a memory; compare the program summary value with a verification summary value; if the program summary value is the same as the verification summary value, establish a trusted link with the writing program, and the trusted link is used to receive the encrypted data.
[0074] In some embodiments, the key enhancement includes: XOR operation, key derivation function, and elliptic curve operation.
[0075] Figure 3 A schematic diagram of the physical structure of the electronic device provided by the present invention, such as Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the program loading method, which includes: obtaining random data and encrypted data, the random data is generated according to a random number and a startup check value, the encrypted data is data obtained by encrypting the startup program using an encryption key and a random number, the startup check value is a check value of the startup program, the random number is a value randomly generated by the controller when writing the encrypted data, and the controller is used to load the startup program; using the random number to decode the random data to obtain the startup check value; obtaining the check value of the encrypted data to obtain the real-time check value; if the startup check value and the real-time check value are the same, decrypting the encrypted data according to the decryption key and the random number to obtain the startup program; loading the startup program.
[0076] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0077] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the program loading method provided by the above methods, which method includes: obtaining random data and encrypted data, the random data is generated based on a random number and a startup verification value, the encrypted data is data obtained by encrypting a startup program using an encryption key and a random number, the startup verification value is a verification value of the startup program, the random number is a value randomly generated by a controller when writing encrypted data, and the controller is used to load the startup program; using a random number to decode the random data to obtain a startup verification value; obtaining the verification value of the encrypted data to obtain a real-time verification value; if the startup verification value and the real-time verification value are the same, decrypting the encrypted data based on the decryption key and the random number to obtain the startup program; loading the startup program.
[0078] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0079] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the program loading method provided by the above-mentioned methods, the method comprising: obtaining random data and encrypted data, the random data being generated based on a random number and a startup verification value, the encrypted data being data obtained by encrypting a startup program using an encryption key and a random number, the startup verification value being a verification value of the startup program, the random number being a value randomly generated by a controller when writing encrypted data, and the controller being used to load the startup program; decoding the random data using a random number to obtain a startup verification value; obtaining the verification value of the encrypted data to obtain a real-time verification value; if the startup verification value and the real-time verification value are the same, decrypting the encrypted data based on a decryption key and a random number to obtain a startup program; and loading the startup program.
[0080] The above-mentioned computer-readable storage medium can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, - but not limited to - an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM) or flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0081] Computer-readable signal media may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0082] The program code embodied on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
[0083] Computer program code for performing the operations of the present specification may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0084] The device embodiments described above are merely illustrative, wherein 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 modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0085] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A program loading method, characterized in that: The method comprises: Obtaining random data and encrypted data, wherein the random data is generated according to a random number and a startup check value, the encrypted data is data obtained by encrypting a startup program using an encryption key and the random number, the startup check value is a check value of the startup program, and the random number is a value randomly generated when writing the encrypted data; Decoding the out-of-order data using the random number to obtain the startup check value; Obtaining a check value of the encrypted data to obtain a real-time check value; If the startup check value is the same as the real-time check value, decrypting the encrypted data according to the decryption key and the random number to obtain the startup program; The startup program is loaded.
2. The method according to claim 1, characterized in that The step of decoding the disordered data using the random number to obtain the startup check value includes: The random number is used to reconstruct the disordered data to obtain the startup check value.
3. The method according to claim 2, characterized in that The using the random number to reconstruct the disordered data to obtain the startup check value includes: Reconstructing the disordered data using the random number to obtain reconstructed data; The reconstruction data is decrypted using a preset key to obtain the startup verification value.
4. The method according to claim 1, characterized in that: The step of decrypting the encrypted data according to the decryption key and the random number to obtain the startup program includes: Performing key enhancement according to the decryption key and the random number to generate an enhanced key; The encrypted data is decrypted according to the enhanced key to obtain the startup program.
5. The method according to claim 1, characterized in that The method further comprises: receiving a program summary value, wherein the program summary value is a summary value of a writing program, and the writing program is used to write the encrypted data into a memory; comparing the program digest value with the checksum digest value; If the program digest value is the same as the verification digest value, a trusted link is established with the writing program, and the trusted link is used to receive the encrypted data.
6. The method according to claim 4, characterized in that The key enhancement includes: XOR operation, key derivation function, and elliptic curve operation.
7. A program loading device, characterized in that: The device comprises: an acquisition module, used to acquire random data and encrypted data, wherein the random data is generated according to a random number and a startup check value, the encrypted data is data obtained by encrypting a startup program using an encryption key and the random number, the startup check value is a check value of the startup program, the random number is a value randomly generated by a controller when writing the startup program, and the controller is used to load the startup program; A decoding module, used to decode the disordered data using the random number to obtain the startup check value; A calculation module, used to obtain a check value of the encrypted data to obtain a real-time check value; A verification module, configured to decrypt the encrypted data according to a decryption key and the random number to obtain the startup program if the startup verification value and the real-time verification value are the same; A startup module is used to load the startup program.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the program loading method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the program loading method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the program loading method according to any one of claims 1 to 6 is implemented.
