Method and apparatus for transmitting boot code with improved data security
By generating a public and private key pair on the programming device, creating an encrypted boot loader binary, and performing the decryption process on the microcontroller, the security risk of transmitting encrypted boot code is solved and data transmission is secure and reliable. sex.
Patent Information
- Application Number
- CN202080032789.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-29
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-04-29
AI Technical Summary
When transmitting encrypted startup code and decryption software, there are security risks such as theft, uncontrolled copying and modification, making it difficult to ensure the security of data transmission.
Create an encrypted bootloader binary including bootloader, password, encrypted public key and decryption routine by generating a public and private key pair at the programming device, estimating and limiting transfer time to ensure execution on the microcontroller The decryption process prevents potential attackers from manipulating the transmitted data.
Significantly improves the transmission security of startup code, prevents attackers from reading, modifying or manipulating the boot loader binary file, ensures strict time limits and inspections of data during transmission, and enhances data security.
Smart Images

Figure CN113785294B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for transmitting a startup code from a programming device to a microcontroller with improved data security. The invention also relates to a programming device and a microcontroller. The invention further relates to a use, a program element and a computer-readable medium. Background Art
[0002] A microcontroller that does not yet have any executable software or firmware installed requires basic software or firmware, the so-called boot code, in order to perform its functions. Since (at least in some cases) this is software that needs to be kept confidential, it is in encrypted form, at least in some cases. Since the encrypted software itself cannot be executed on a computer or microcontroller, decryption software must be provided in order to start the boot code. Transmitting this decryption software makes both the decryption software and the encrypted boot code vulnerable to security-related actions by potential attackers, such as theft, uncontrolled copying and / or modification of the decryption software and / or the boot code. Summary of the invention
[0003] The object of the present invention is to increase the transmission security at least in the case of certain of the mentioned actions.
[0004] According to a first aspect, a method for transferring software from a programming device to a microcontroller with improved data security is described.
[0005] A microcontroller is a computer designed or adapted to perform a predefined control task. In at least some embodiments, a microcontroller may be designed or adapted to be used as a so-called "general purpose computer", for example, having the tasks of a personal computer. A microcontroller may be a special purpose computer or may be a standard computer, and / or use standard software and / or special purpose software to perform at least some of its intended tasks. The software may be, for example, software, firmware, microcode, FPGA readable instructions and / or files, which may or may use a component of the microcontroller to determine its sequence. The boot code may contain ideas and / or routines that are worth protecting and / or may need to be kept confidential. The boot code may be in encrypted form, and / or may be transmitted in encrypted form.
[0006] The programming device is a computer at least suitable for transferring software, firmware and / or other files to the microcontroller. The programming device is also suitable for executing a routine based on random number generation. The programming device is classified as trusted. In addition, the programming device has at least one boot code and a decryption software, which can be executed on the microcontroller after at least one further decryption, if necessary. The boot code can be transferred from the programming device to the microcontroller via a line that is not classified as trusted.
[0007] The method for transmitting a boot code from a programming device to a microcontroller with improved data security comprises the following steps:
[0008] a) Creating a first public key, a first private key and a password by the programming device.
[0009] The public / private key pair is used as the basis for encryption. Creating the keys and passwords may include using standard routines and / or using special hardware to generate the public / private key pair and random numbers.
[0010] b) generating, by the programming device, a boot loader binary file for execution on the microcontroller, the boot loader binary file comprising at least:
[0011] - a bootloader for execution on this microcontroller,
[0012] - the password,
[0013] - the first public key encrypted by the password,
[0014] a set of bootloader routines encrypted by the password for execution on the microcontroller, the set of encrypted bootloader routines comprising:
[0015] a generation routine for generating a second public key and a second private key, and a decryption routine for decrypting at least the first public key;
[0016] - a decryption routine for execution on the microcontroller, for decrypting the bootloader routines encrypted by the password;
[0017] The bootloader binary file can be implemented as a compilation of enumerated software parts or a chain of these parts. In a modification, the set of bootloader routines encrypted by a password can include other and / or further routines and can in particular be more extensive. At least the bootloader has a code that can be executed directly on the microcontroller. Encrypting the set of encrypted bootloader routines can be used, for example, to prevent manipulation of the bootloader routines substantially during transmission or during transmission time ("on-the-fly manipulation").
[0018] c) An estimation by the programming device of a tolerable total processing time, which is composed of the processing times of steps d) to f).
[0019] Steps d) to f) described in detail below essentially include the transmission time of a first amount of data from the programming device to the microcontroller, the transmission time of a second amount of data from the microcontroller to the programming device, and the defined processing time of a predefined routine (e.g. contained in the above-mentioned boot loader binary file). If the boot loader binary file includes more or fewer routines to be executed than the above-mentioned routines, the total processing time can be changed accordingly. The estimation of the tolerable total processing time "by the programming device" can be performed, for example, by a routine on the programming device (e.g. using an estimate of the file size). The estimate can be based on a series of measurements that repeatedly measure the total processing time of steps d) to f) for the illustrative transmission (or have been measured before the estimate) and use this total processing time, for example, to determine the maximum value and / or time dispersion of the illustrative transmission. The estimation can be performed, for example, by a developer and / or supported by a tool. The total processing time determined and / or estimated according to this series of measurements and / or by other methods is transmitted to the programming device; the programming device uses this time as the estimated total processing time. A tolerable total processing time may also be determined based on the series of measurements (eg, based on the measured temporal dispersion and / or other factors).
[0020] d) Transferring the boot loader binary file from the programming device to the microcontroller.
[0021] The bootloader binary contains the above data, or in modifications may contain more or less data or routines to be executed. In modifications, the password may also be transferred separately from the rest of the bootloader binary; this may affect the estimated total processing time.
[0022] e) Executed by the microcontroller
[0023] The bootloader code,
[0024] the decryption routine for decrypting the bootloader routines encrypted by the password, and
[0025] The decrypted boot loader routine.
[0026] The bootloader has code that can be executed directly on the microcontroller. The bootloader may, for example, first execute a "start code", which may, for example, depend on the details of the microcontroller. The bootloader may then execute a decryption routine to decrypt these bootloader routines that are encrypted by a password. The password contained in the bootloader binary (or otherwise communicated) may be used to decrypt these routines. Then, or possibly after a predefined pause, the bootloader routine may be executed. If the bootloader binary contains the above routine, the following bootloader routine is executed on the microcontroller:
[0027] - a generation routine for generating a second public / private key pair (and possibly for encrypting the second public key by the first public key), and
[0028] - A decryption routine for decrypting the first public key.
[0029] f) Transmitting the (possibly encrypted) second public key from the microcontroller to the programming device.
[0030] g) terminating the method if the actual processing time of steps d) to f) is outside the tolerable total processing time.
[0031] The running and / or transmission times of the above-mentioned steps of the method - and possibly also their predefined variations - can be predetermined within a narrow framework and / or measured with small deviations (e.g. in the above-mentioned series of measurements). For example, a tolerable total processing time for steps d) to f) can be determined from the measurement of a series of processing times, e.g. on the basis of the measured time dispersion and / or other factors (e.g. within a narrow time range). This tolerable total processing time can then be compared with the actual processing time. Thus, the programming device can, for example, wait for the end of the transmission of step f) starting from step d), as long as it has been determined as a tolerable total processing time.
[0032] h) If the actual processing time of steps d) to f) is within the tolerable total processing time, the programming device encrypts the boot code by means of the second public key and transmits the encrypted boot code from the encoding device to the microcontroller.
[0033] Therefore, the described method can be used to transfer the boot code to the microcontroller more safely. This at least significantly hinders and / or prevents an attacker from reading, modifying the boot loader binary file at the same time, and / or loading the modified boot loader binary file instead of the original boot loader binary file onto the microcontroller. This advantage still exists even if a potential attacker can simultaneously read and / or manipulate the communication between the programming device and the microcontroller (and in the opposite direction) in real time. This is because, for example, strict time limits (and checks) mean that, for example, interruptions to the transmission by a potential attacker will be noticed. In addition, the actions required for manipulation will take too long and will therefore be noticed. These actions can include, for example, reading, identifying, manipulating and transmitting the manipulated boot loader binary file. The encrypted boot code is also difficult to read and difficult to use for unauthorized programming of the microcontroller.
[0034] In one embodiment, the tolerable total processing time is defined by a maximum total processing time, a minimum total processing time, or a time window between the maximum total processing time and the minimum total processing time.
[0035] This embodiment can for example detect if a potential attacker interrupts a transmission and / or uses a routine to replace parts of the bootloader binary, for example, because this would cause steps d) to f) to take too long, i.e. exceed the tolerable total processing time. This embodiment can also detect if, after discovering the transmission in step d), the potential attacker performs the transmission as expected in step f) (or performs the transmission "immediately"), because the transmission would be able to occur faster than the minimum total processing time. Using a time window can combine these advantages.
[0036] In some embodiments, the set of encrypted bootloader routines (in the bootloader binary file) further includes a routine for generating a pause of a predefined duration. In addition to the above bootloader routines, the routine is executed on the microcontroller in step e). These embodiments may have a changed total processing time.
[0037] The routine may include a predefined number of repetitions of a command of a defined length. The duration of the pause may be selected by a random number generator. The duration of the pause may be between a predefined minimum and maximum length. The duration of the pause is known only to the programming device; thus, this embodiment allows further improvement of the security provided by checking the total processing time.
[0038] In some embodiments, the set of encrypted bootloader routines (in the bootloader binary file) further includes a read protection routine. In addition to the bootloader routines described above, the routine is executed on the microcontroller in step e). These embodiments may have a changed total processing time.
[0039] This routine may for example include setting registers that determine read protection for certain areas of memory or the entire memory of the microcontroller. This may prevent reading, for example, the boot code and / or other memory areas of the microcontroller.
[0040] In some embodiments, the set of boot loader routines further includes a routine for reading a serial number of the microcontroller, and the boot code further includes the serial number, with the further steps of:
[0041] f1) The serial number is also transmitted from the microcontroller to the programming device. These embodiments may have varying overall processing times.
[0042] For example, this can ensure that the boot code is only executed on this microcontroller - or possibly on a range of microcontrollers. The serial number can also be used for further specific modifications of the boot code (eg useful and / or required for a range of microcontrollers).
[0043] In one embodiment, the boot loader binary file further includes a first public key.
[0044] In addition, this embodiment includes the following steps:
[0045] f2) If the first public key sent by the microcontroller is different from the first public key sent by the programming device, the method is terminated.
[0046] Step f2) is performed after step f) and possibly step f1) and before steps g) and h). This embodiment may have a varying total processing time.
[0047] This check further increases the probability of detecting manipulation.
[0048] Another aspect relates to a programming device for transferring a boot code to a microcontroller with improved data security, the programming device being designed
[0049] Create the first private key and password;
[0050] A boot loader binary file is generated for execution on the microcontroller, the boot loader binary file comprising at least:
[0051] - Bootloader,
[0052] - the password,
[0053] - the first public key encrypted by the password,
[0054] a set of bootloader routines encrypted by the password for execution on the microcontroller, the set of encrypted bootloader routines comprising:
[0055] a generation routine for generating a second public key and a second private key, and
[0056] a decryption routine for decrypting the first public key; and
[0057] - a decryption routine for execution on the microcontroller, for decrypting the bootloader routines encrypted by the password;
[0058] Estimate the total tolerable processing time;
[0059] sending the boot loader binary file from the programming device to the microcontroller;
[0060] receiving at least one second public key from the microcontroller;
[0061] If the actual processing time from sending the boot loader binary file to receiving the second public key is outside the tolerable total processing time, terminating the method; and
[0062] If the actual processing time from sending the boot loader binary file to receiving the second public key is within the tolerable total processing time, the boot code is encrypted by the second public key and the encrypted boot code is sent to the microcontroller.
[0063] Another aspect relates to a microcontroller for transmitting a boot code from a programming device with improved data security, the microcontroller being designed
[0064] receiving a boot loader binary file from the programming device, the boot loader binary file comprising at least one boot loader code, the password, a decryption routine for decrypting a boot loader routine encrypted by the password, and a set of boot loader routines encrypted by the password;
[0065] executing the bootloader code, the decryption routine, and the decrypted bootloader routine;
[0066] sending at least the second public key to the programming device; and
[0067] The encrypted boot code is received from the programming device.
[0068] Another aspect relates to the use of a programming device as described above and / or below, a microcontroller as described above and / or below, and / or a method as described above and / or below for transmitting a boot code from a programming device to a microcontroller with improved data security.
[0069] Another aspect relates to a program element which, when executed on a programming device, instructs the programming device to carry out a method as described above and / or below.
[0070] Another aspect relates to a computer-readable medium having stored thereon a program element as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] For further clarification, the present invention will be described based on the embodiments shown in the accompanying drawings. These embodiments are intended to be understood only as examples and not as limitations.
[0072] Figure 1 A message sequence chart according to an embodiment is schematically shown. DETAILED DESCRIPTION
[0073] Figure 1A message sequence chart (MSC) 100 is shown, which schematically outlines an embodiment of a method for transmitting a boot code from a programming device 10 to a microcontroller 20 with improved data security. The programming device 10 is a computer that is at least suitable for transmitting software, firmware and / or other files to a microcontroller. In addition, the programming device 10 is suitable for executing routines based on random number generation. The microcontroller 20 is a computer designed or suitable for performing predefined control tasks. For this purpose, the microcontroller 20 requires basic software or firmware, the so-called boot code, in order to perform its functions. If there is not yet any executable software or firmware on the microcontroller 20, the microcontroller 20 requires basic software or firmware, the so-called boot code.
[0074] In step 101, the programming device 10 creates a first public key, a first private key and a password. In step 102, the programming device 10 generates a boot loader binary file suitable for execution on the microcontroller 20. The boot loader binary file includes at least a boot loader for execution on the microcontroller 20, a password, a first public key encrypted by the password, a set of boot loader routines encrypted by the password suitable for execution on the microcontroller 20, and a decryption routine suitable for execution on the microcontroller for decrypting these boot loader routines encrypted by the password. The set of encrypted boot loader routines includes at least one generation routine for generating a second public key and a second private key, and
[0075] A decryption routine for decrypting the first public key. In addition, the set of encrypted bootloader routines may optionally also include, for example, a routine for generating a pause of a predefined duration, a read protection routine, a routine for reading a serial number of a microcontroller, and / or further routines suitable for execution on the microcontroller 20. The pause is advantageously generated by executing a function having a runtime behavior that is characteristic of the corresponding microcontroller. Therefore, the pause duration is to be understood as an identifiable characteristic of the microcontroller.
[0076] In step 103, the programming device 10 estimates a tolerable total processing time 110, which consists of the processing times of the subsequent steps 104 to 106 (marked by the dashed box 110). This estimate can, for example, access statistics of a series of measured time periods previously performed. In step 104, the boot loader binary file is transferred from the programming device 10 to the microcontroller 20. This transfer can, for example, be initiated and / or performed by the programming device 10.
[0077] In step 105, the microcontroller 20 executes the bootloader code, the decryption routine for decrypting the password-encrypted bootloader routines, and at least a portion of the set of password-encrypted bootloader routines. In step 106, at least the second public key is transmitted from the microcontroller 20 to the programming device 10. The transmission can be initiated and / or performed by the microcontroller 20, for example.
[0078] In step 107, the programming device 10 checks the actual processing time of steps 104 to 106. If the actual processing time of steps 104 to 106 is outside the tolerable total processing time, the method is terminated (not shown in the MSC). The method may also be terminated at other points depending on the bootloader routine and / or further plausibility checks and / or checks.
[0079] If the actual processing time of steps 104 to 106 is within the tolerable total processing time, the boot code is encrypted by means of the second public key and, in step 108, the encrypted boot code is transmitted from programming device 10 to microcontroller 20. In step 109, the boot code and / or further program sections can then be executed on microcontroller 20.
[0080] List of Reference Numerals
[0081] 10. Programming equipment
[0082] 20 Microcontroller
[0083] 100 Message Sequence Chart (MSC)
[0084] Steps 101-109
[0085] 110 Tolerable total processing time
Claims
1. A method for transmitting a startup code from a programming device (10) to a microcontroller (20) with improved data security, comprising the following steps: a) creating a first public key, a first private key and a password by means of the programming device (10); b) generating, by means of the programming device (10), a boot loader binary file for execution on the microcontroller (20), the boot loader binary file comprising at least: a boot loader for executing on the microcontroller (20); the password; The first public key encrypted by the password; a set of bootloader routines encrypted by the password for execution on the microcontroller (20), the set of encrypted bootloader routines comprising a generation routine for generating a second public key and a second private key and a decryption routine for decrypting the first public key; as well as a decryption routine for execution on the microcontroller for decrypting the bootloader routines encrypted by the password; c) estimating, by means of the programming device (10), a tolerable total processing time, which consists of the processing time of steps d) to f); d) transferring the boot loader binary file from the programming device (10) to the microcontroller (20); e) executing by the microcontroller (20) The bootloader code, the decryption routine for decrypting the bootloader routines encrypted by the password, and Decrypted bootloader routine; f) transmitting at least the second public key from the microcontroller (20) to the programming device (10); g) terminating the method if the actual processing time of steps d) to f) is outside the tolerable total processing time; as well as h) if the actual processing time of steps d) to f) is within the tolerable total processing time, The programming device (10) then encrypts the startup code using the second public key and transmits the encrypted startup code from the programming device (10) to the microcontroller (20).
2. The method according to claim 1, in, The tolerable total processing time is defined by a maximum total processing time, a minimum total processing time, or a time window between the maximum total processing time and the minimum total processing time.
3. The method according to claim 1 or 2, in, The set of encrypted boot loader routines further includes a routine for generating a pause of a predefined duration.
4. The method according to claim 1 or 2, in, The set of encrypted boot loader routines further includes a read protection routine.
5. The method according to claim 1 or 2, in, The set of bootloader routines further includes a routine for reading the serial number of the microcontroller, and Wherein, the startup code further includes the serial number, and has the following further steps: f1) also transmits the serial number from the microcontroller (20) to the programming device (10).
6. The method according to claim 1 or 2, wherein: The boot loader binary file further includes the first public key, with the following further steps: f2) If the first public key sent by the microcontroller (20) is different from the first public key sent by the programming device (10), the method is terminated.
7. A programming device (10) for transferring a boot code to a microcontroller (20) with improved data security, the programming device (10) being designed to perform the following method steps: creating a first private key, a first public key and a password; A boot loader binary file is generated for execution on the microcontroller (20), the boot loader binary file comprising at least: Bootloader; the password; The first public key encrypted by the password; a set of bootloader routines encrypted by the password for execution on the microcontroller (20), the set of encrypted bootloader routines including a generation routine for generating a second public key and a second private key and a decryption routine for decrypting the first public key; and a decryption routine for execution on the microcontroller for decrypting the bootloader routines encrypted by the password; Estimate the total tolerable processing time; sending the boot loader binary file from the programming device (10) to the microcontroller (20); receiving at least one second public key from the microcontroller (20); terminating the method steps if the actual processing time from sending the boot loader binary file to receiving the second public key is outside the tolerable total processing time; and If the actual processing time from sending the boot loader binary file to receiving the second public key is within the tolerable total processing time, the boot code is encrypted by the second public key and the encrypted boot code is sent to the microcontroller (20).
8. A microcontroller (20) for transmitting a boot code from a programming device (10) according to claim 7 with improved data security, the microcontroller (20) being designed to receiving a boot loader binary file from the programming device (10), the boot loader binary file comprising at least one boot loader code, the password, a decryption routine for decrypting a boot loader routine encrypted by the password, and a set of boot loader routines encrypted by the password; executing the bootloader code, the decryption routine, and the decrypted bootloader routine; sending at least the second public key to the programming device (10); and An encrypted boot code is received from the programming device (10).
9. A computer-readable medium having stored thereon program elements which, when executed on a programming device (10), instruct the programming device (10) to execute the method as claimed in one of claims 1 to 6.
Citation Information
Patent Citations
Method for booting and dumping a confidential image on a trusted computer system
US20170111354A1
