System and method for securing executable code
Abstract
A system and method for the secure storage of executable code and the secure movement of such code from memory to a processor. The method includes the storage of an encrypted version of the code. The code is then decrypted and decompressed as necessary, before re-encryption in storage. The re-encrypted executable code is then written to external memory. As a cache line of executable code is required, a fetch is performed but intercepted. In the interception, the cache line is decrypted. The plain text cache line is then stored in an instruction cache associated with a processor.

Term
Term ended
Projected expiry passed 4 November 2024, 1.9 years ago.
- Priority
- Filed
- Published
- Projected expiry
- Today
10 claims: 2 independent, 8 dependent
- 1A system for secure execution of processor instructions, the system comprising:a first memory containing boot code and an image encrypted with a first key;a secure embedded processor system, comprising: a processor;an instruction cache in communication with said processor;a memory controller in communication with said instruction cache;and a security controller in communication with said instruction cache;and a second memory, external to said secure embedded processor system, in communication with said first memory, said memory controller, and said security controller, such that said image encrypted with said first key is transferred to said second memory, decrypted by said security controller, and re-encrypted by said security controller using a second key, and such that a cache line of said image encrypted with said second key is then read from said second memory, decrypted with said second key, and stored in staid instruction cache for execution by said processor.
- 5A method of providing for secure execution of processor instructions, comprising:a. booting a processor to load encrypted code to external memory;b. decrypting an uncompressed portion of the encrypted code using an image key to produce a first portion of decrypted uncompressed code;c. executing the first portion of decrypted uncompressed code;d. decrypting a compressed portion of the encrypted code with the image key, to produce an image;e. authenticating the image;f. decompressing the image so that it occupies a section of external memory starting at a first address and ending at an end address;and g. performing secure execution of the image.
Independent claims2
66 paragraphs in 6 sections, as filed
CROSS-REFERENCE TO RELATED APPLICATIONS
0001This application claims the benefit of U.S. Provisional Application Serial No. 60/518,323, filed November 10, 2003, incorporated herein by reference in its entirety.
STATEMENT REGARDING FEDERALLY-SPONSORED RESEARCH AND DEVELOPMENT
0002Not applicable.
REFERENCE TO MICROFICHE APPENDIX/SEQUENCE LISTING/TABLE/COMPUTER PROGRAM LISTING APPENDIX (submitted on a compact disc and an incorporation-by-reference of the material on the compact disc)
0003Not applicable.
BACKGROUND OF THE INVENTION
Field of the Invention
0004The invention described herein relates to information security, and more particularly to secure processing.
Related Art
0005Secure processing in a computing platform is a well known generic problem. In particular any unintended or undesired alteration of executable code can have dire operational consequences. For example, malicious code (e.g., a Trojan horse) can be inserted to executable code to cause the processor to perform actions that are undesirable and/or unpredictable. Alternatively, instructions can be permuted by a hostile party, so that operations are performed by the processor out of order. Again, the consequences can be undesirable. Other threats may not be malicious. A hardware failure in memory, for example, may serve to alter the executable code. Clearly, this effects the operation of the processor and its results.
0006In addition, security may an issue with respect to the programmed logic itself. The executable code itself may represent information that must be maintained as a secret. Revealing the executable code could represent a undesirable compromise of sensitive data. In general, executable code can be vulnerable in storage, as well as in transit between memory and a processor or its cache.
0007In light of such known threats and vulnerabilities, a system and method is needed that protects against the above scenarios, such that the processor performs only the intended operations and the confidentiality of its program is maintained.
SUMMARY OF THE INVENTION
0008The invention described herein provides for the secure storage of executable code and the secure movement of such code from memory to a processor. The invention includes the storage of an encrypted version of the code. The code is then decrypted and decompressed as necessary, before re-encryption in storage (e.g., in flash memory). The re-encrypted executable code is then written to external memory. As a cache line of executable code is required, a fetch is performed but intercepted. In the interception process, the cache line is decrypted. The resulting plain text cache line is then stored in an instruction cache associated with a processor.
0009According to an aspect of the invention, a system for secure execution of processor instructions is provided, the system comprising: <ul id="ul0001" list-style="none" compact="compact"><li>a first memory containing boot code and an image encrypted with a first key;</li><li>a secure embedded processor system, comprising: <ul id="ul0002" list-style="none" compact="compact"><li>a processor;</li><li>an instruction cache in communication with said processor;</li><li>a memory controller in communication with said instruction cache; and</li><li>a security controller in communication with said instruction cache; and</li></ul></li><li>a second memory, external to said secure embedded processor system, in communication with said first memory, said memory controller, and said security controller,</li><li>such that said image encrypted with said first key is transferred to said second memory, decrypted by said security controller, and re-encrypted by said security controller using a second key, and such that a cache line of said image encrypted with said second key is then read from said second memory, decrypted with said second key, and stored in staid instruction cache for execution by said processor.</li></ul>
0010Advantageously, said security controller comprises logic for decrypting said encrypted image using the Triple Data Encryption Standard (3DES) algorithm and said first key.
0011Advantageously, the system further comprises a key management module that comprises: <ul id="ul0003" list-style="none" compact="compact"><li>logic for receiving said first key in encrypted form;</li><li>logic for decrypting said encrypted first key using a session key; and</li><li>logic for forwarding said first key to said security controller.</li></ul>
0012Advantageously, said security controller comprises: <ul id="ul0004" list-style="none" compact="compact"><li>logic for re-encrypting said image using the Advanced Encryption Standard (AES) algorithm; and</li><li>logic for decrypting said cache line using said AES algorithm.</li></ul>
0013Advantageously, said logic for re-encrypting said image comprises logic that implements the cipher block chaining (CBC) mode of said AES algorithm: and said logic for decrypting said cache line comprises logic that implements said CBC mode of said AES algorithm.
0014Advantageously, said logic for re-encrypting said image comprises logic that implements the decryption mode of said CBC mode of said AES algorithm; and said logic for decrypting said cache line comprises logic that implements the encryption mode of said CBC mode of said AES algorithm.
0015Advantageously, said logic for re-encrypting said image uses an address of said second memory as an initialization vector (IV) for said AES algorithm, wherein said address corresponds to the location in said second memory of said cache line; and said logic for decrypting said cache line uses said address as said IV.
0016According to a further aspect of the invention, a method of providing for secure execution of processor instructions is provided, comprising: <ul id="ul0005" list-style="none" compact="compact"><li>a. booting a processor to load encrypted code to external memory;</li><li>b. decrypting an uncompressed portion of the encrypted code using an image key to produce a first portion of decrypted uncompressed code;</li><li>c. executing the first portion of decrypted uncompressed code;</li><li>d. decrypting a compressed portion of the encrypted code with the image key, to produce an image;</li><li>e. authenticating the image;</li><li>f. decompressing the image so that it occupies a section of external memory starting at a first address and ending at an end address; and</li><li>g. performing secure execution of the image.</li></ul>
0017Advantageously, said decryption steps b and d are performed using the triple data encryption standard (3DES) algorithm.
0018Advantageously, the method further comprises the following step performed before step a: <ul id="ul0006" list-style="none" compact="compact"><li>h. determining whether the image key has expired, such that steps a through g are performed only if the image key has not expired.</li></ul>
0019Advantageously, the method further comprises the following step, performed before step a: <ul id="ul0007" list-style="none" compact="compact"><li>h. creating encrypted code.</li></ul>
0020Advantageously, step h comprises:
0021i. compressing the image; <ul id="ul0008" list-style="none" compact="compact"><li>ii. hashing the image to create a hash value;</li><li>iii. encrypting the image; and</li><li>iv. storing the encrypted code.</li></ul>
0022Advantageously, said step h.ii. comprises hashing the image using the Secure Hash Algorithm 1 (SHA-1).
0023Advantageously, said step h.iii. comprises encrypting the image using the Triple Data Encryption Standard (3DES) algorithm.
0024Advantageously, said step h.iv. comprises storing the encrypted code into flash memory.
0025Advantageously, step a. comprises: <ul id="ul0009" list-style="none" compact="compact"><li>i. resetting the state of the processor;</li><li>ii. loading the image key;</li><li>iii. transferring the encrypted code into external memory; and</li><li>iv. switching the processor to a secure mode.</li></ul>
0026Advantageously, the external memory comprises double data rate synchronous dynamic random access memory (DDR-SDRAM).
0027Advantageously, said step a.iv. comprises: <ul id="ul0010" list-style="none" compact="compact"><li>A. clearing the state of the processor;</li><li>B. setting an instruction cache, associated with the processor, to an invalid state; and</li><li>C. limiting execution of the image to a portion of the external memory.</li></ul>
0028Advantageously, said step g comprises: <ul id="ul0011" list-style="none" compact="compact"><li>i. separately encrypting each cache line of the image;</li><li>ii. fetching an encrypted cache line;</li><li>iii. intercepting said fetch;</li><li>iv. decrypting the fetched encrypted cache line;</li><li>v. determining whether the decrypted cache line is valid;</li><li>vi. if the decrypted cache line is invalid, trapping the decrypted cache line; and</li><li>vii. if the decrypted cache line is valid, executing the decrypted cache line.</li></ul>
0029Advantageously, said step g.i. comprises encrypting each cache line using the Advanced Encryption Standard (AES), and said step g.iv. comprises decrypting the fetched encrypted cache line using the AES algorithm.
0030Advantageously, the AES algorithm is used in the cipher block chaining (CBC) mode.
0031Advantageously, said step g.i. comprises encrypting each cache line using the decryption mode of the AES algorithm, and said step g.iv. comprises decrypting the fetched encrypted cache line using the encryption mode of the AES algorithm.
0032Advantageously, the initialization vector (IV) for the AES algorithm for each cache line is the address, in external memory, of the cache line.
BRIEF DESCRIPTION OF THE DRAWINGS/FIGURES
0033FIG. 1 is a block diagram illustrating the overall structure and context of an embodiment of the invention.
0034FIG. 2 illustrates executable code in encrypted and compressed form in flash memory, according to an embodiment of the invention.
0035FIG. 3 illustrates external memory as it contains decrypted and decompressed executable code, according to an embodiment of the invention.
0036FIG. 4 illustrates the fetch process, in which a cache line of code is decrypted and forwarded to an instruction cache, according to an embodiment of the invention.
0037FIG. 5 is a flowchart illustrating the creation of an encrypted image, according to an embodiment of the invention.
0038FIG. 6 is a flowchart illustrating the overall process of accessing and using the encrypted image, according to an embodiment of the invention.
0039FIG. 7 is a flowchart illustrating the processor boot process in greater detail, according to an embodiment of the invention.
0040FIG. 8 is a flowchart illustrating the process of switching to a secure mode, according to an embodiment of the invention.
0041FIG. 9 is a flowchart illustrating the process of secure execution, according to an embodiment of the invention, according to an embodiment of the invention.
0042FIG. 10 is a flowchart illustrating a simplified version of the process of the invention, according to an embodiment of the invention.
DETAILED DESCRIPTION OF THE INVENTION
0043A preferred embodiment of the present invention is now described to with reference to the figures, where like reference numbers indicate identical or functionally similar elements. Also in the figures, the left most digit of each reference number corresponds to the figure in which the reference number is first used. While specific configurations and arrangements are discussed, it should be understood that this is done for illustrative purposes only. A person skilled in the relevant art will recognize that other configurations and arrangements can be used without departing from the spirit and scope of the invention. It will be apparent to a person skilled in the relevant art that this invention can also be employed in a variety of devices, systems, and applications.
I. Overview
0044A preferred embodiment of the present invention is now described with reference to the figures, where like reference numbers indicate identical or functionally similar elements. Also in the figures, the left most digit of each reference number corresponds to the figure in which the reference number is first used. While specific configurations and arrangements are discussed, it should be understood that this is done for illustrative purposes only. A person skilled in the relevant art will recognize that other configurations and arrangements can be used without departing from the spirit and scope of the invention. It will be apparent to a person skilled in the relevant art that this invention can also be employed in a variety of devices and applications.
II. System
0045The invention features a secure embedded processor system that is in communication with memory modules. An embodiment of the invention is illustrated generally in FIG. 1. A secure embedded processor system 105 is shown interfaced to an external memory module 160, and a flash memory module 175. Flash memory 175 stores executable code (known hereinafter as the image) in a compressed and encrypted form. As will be described in greater detail below, the encrypted compressed image is transferred to external memory 160 during the boot process. The image is then decrypted, decompressed, then re-encrypted for storage in external memory 160.
0046Instructions that are to be executed by processor 110 are fetched from external memory 160 one cache line at a time. The fetch, however, is intercepted by memory controller 150. A cache line that is fetched is then decrypted by security controller 140 before being loaded into the instruction cache 130.
0047Also shown in secure embedded processor system 105 is a key management module 170, which provides key management services for security controller 140. In an embodiment of the invention, an external interface 180 can also be provided to allow flash memory 175 to interface with system 105. A peripheral component interconnect (PCI) interface 185 can also be provided to allow communication with secure embedded processor system 105. PCI interface 185, external interface 180, key management module 170, security controller 140, and processor 110 are connected by an infrastructure 145, such as a bus.
0048Flash memory 175 is illustrated in greater detail in FIG. 2. FIG. 2 illustrates the organization of the image as it resides in flash memory 175. The image includes a segment of boot code 210. This is followed by two blocks of code 220 and 230. These two blocks are collectively encrypted with a first cryptographic key, referred to herein as an image key. In an embodiment of the invention, these code blocks are encrypted using the Triple Data Encryption Standard (3DES) algorithm. In the illustrated embodiment, code block 220 comprises logic required to decrypt the remaining block of code 230. Note that block 230 is compressed as well in the illustrated embodiment. Block 240 represents authentication data derived from blocks 210, 220, and 230. Block does not represent part of the image <i>per se.</i> In the illustrated embodiment, the authentication process is a hashed message authentication code (HMAC) process.
0049FIG. 3 illustrates the structure of the image as it resides in external memory 160 after the image has been decrypted and decompressed. The memory is shown occupying 10 KB of memory in a block 330. The starting address of this memory interval is addressed 310. The ending address for this interval is addressed 320. In an embodiment of the invention, the starting and ending addresses 310 and 320 are forwarded to memory controller 150. This serves as a security check, so that no instructions outside of these boundaries are allowed to be executed.
0050FIG. 4 illustrates the flow and processing of instructions during a fetch from external memory 160. After the image has been decrypted, the image is re-encrypted using a second key, to form a re-encrypted image 410. The re-encrypted image 410 is fetched on a cache line basis. A cache line 420 is retrieved for decryption purposes by decryption logic 440. In the illustrated embodiment, the address 430 of cache line 420 is used to initialize the decryption process. In an embodiment of the invention, the re-encryption process uses the Advanced Encryption Standard (AES) algorithm, in cipher block chaining (CBC) mode. Moreover, in an embodiment of the invention, the re-encryption process can use the AES/CBC process in the decrypt mode. Consequently, in such an embodiment the decryption process 440 actually uses the encryption mode of AES. The resulting plain text cache line 450 is then forwarded to instruction cache 130. The plain text cache line 450 is ultimately executed by processor 110.
0051Management and security functions related to protection of cryptographic keys are handled in part by key management module 170, shown in FIG. 1. In particular, in an embodiment of the invention, secure embedded processor system 105 receives the image key in encrypted form. The encrypted image key is decrypted by key management module 170 using a session key. The resulting plain text image key can then be used by security controller 140 as described above.
0052Moreover, a time constraint can be associated with an image key, so that the image key may only be used for a given duration, or only up until a particular point in time. After this point, the key can no longer be used, and is said to be expired. In an embodiment of the invention, security controller 140 can check whether the image key has expired prior to using this key. Alternatively, this check can be performed at the key management module 170.
III. Method
0053FIG. 5 illustrates the initial compression and encryption process for the image as it is stored in the flash memory. The process begins at step 510. In step 520, the image is compressed. In step 530, the image is hashed to produce an HMAC. In an embodiment of the invention, the Secure Hash Algorithm 1 (SHA-1) is used. In step 540, the compressed image is encrypted with an image key. As mentioned above, encryption can be performed using the 3DES algorithm. In step 550, the resulting compressed encrypted image is stored in flash memory. The process concludes at step 560.
0054The overall process of securely accessing and executing the image is illustrated in FIG. 6. The process begins at step 610. In step 620, the processor undergoes its boot operation. In step 630, the portion of the image that is uncompressed is decrypted using the image key. In step 640, this uncompressed code is executed. The logic in the uncompressed code portion of the code serves to decrypt the remaining image. In step 650, the remaining portion of the image is decrypted with the image key. In step 660, the image is authenticated. As described above, authentication can take place using the SHA-1 algorithm. In step 670, the image is decompressed. In step 680, secure execution can now take place. The process concludes at step 690.
0055The step of booting the processor (step 620 of FIG. 6) is illustrated in greater detail in FIG. 7. The process begins at step 710. In step 720, the device state is reset. In step 730, cryptographic keys are loaded for purposes of subsequent cryptographic processing. In step 740, the image is moved from flash memory to external memory. In an embodiment of the invention, the external memory can be implemented using double data rate synchronous dynamic random access memory (DDR SDRAM). In step 750, the system is switched to secure mode. The process concludes at step 760.
0056The process of switching to a secure mode (step 750 of FIG. 7) is illustrated in greater detail in FIG. 8. The process begins at step 810. In step 820, the processor state is cleared. In step 830, the instruction and data caches associated with a processor are set to the invalid state. This prevents any information that happens to be residing in these caches from being used by the processor for execution. In step 840, the upper and lower address boundaries of the image are forwarded to the memory controller, thereby limiting execution to the lower n kilobytes of DDR-SRAM. The process concludes at step 850.
0057The secure execution step (step 680 of FIG. 6) is illustrated in greater detail in FIG. 9. The process begins at step 910. In step 915, the image is encrypted with a session key on a per cache line basis. In an embodiment of the invention, the AES algorithm is used for this step in the CBC mode. Moreover, AES can be used in its decryption configuration for this encryption process. This allows for error correction throughout the image encryption process. In step 920, the encrypted image is written to external memory. In step 925, an instruction cache line is fetched, wherein the cache line is taken from within the boundary addresses. In step 930, the fetch is intercepted by the memory controller. In step 935, the cache line is decrypted by the security controller. If the encryption process used the AES/CBC algorithm in decryption mode, then the decryption step 935 will actually use the encryption mode of AES/CBC. After decryption of the cache line in step 935, a determination is made in step 940 as to whether the resulting instruction is valid. If not, then the instruction is trapped in step 945. Otherwise, the instruction is ready for execution in step 955. In step 960, a determination is made as to whether there are additional instructions to be fetched and executed, or whether the process is to halt. If the process halts, then the process concludes at step 950. Otherwise, the process returns to step 925, where an additional cache line is fetched.
0058An alternative method of the invention is illustrated in FIG. 10. The process begins at step 1005. In step 1010, the boot process is initiated from on-board read only memory (ROM). In step 1015, the boot code is submitted to the security module. In step 1020, the boot code is hashed. The security module retains the hash value during this step. In step 1025, execution of the boot code is commenced. In step 1030, the compressed code is hashed, such that the security module retains the resulting cache value. In step 1035, the hash value is signed. In step 1040, the encrypted image is transferred to external memory. As mentioned above, in an embodiment of the invention, external memory can be implemented as DDR-SRAM. In step 1045, the uncompressed code is decrypted with the image key. In step 1050, the uncompressed code is executed. In step 1055, the remaining image is decrypted with the image key. In step 1060, the remaining image is decrypted as necessary. The process concludes at step 1065.
IV. Conclusion
0059While various embodiments of the present invention have been described above, it should be understood that they have been presented by way of example, and not limitation. It would be apparent to persons skilled in the relevant art that various changes and detail can be made therein without departing from the spirit and scope of the invention. Thus the present invention should not be limited by any of the above described exemplary embodiments.
Contents6
11 sheets
Sheet 1 Sheet 2 Sheet 3 Sheet 4 Sheet 5 Sheet 6 Sheet 7 Sheet 8 Sheet 9 Sheet 10 Sheet 11
Every citation, both ways
| Document | Relation | Office | Cited during |
|---|---|---|---|
| EP2005642A1 | Cited by | European Patent Office (EPO) | Search report |
| WO2009058743A3 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| US8150036B2 | Cited by | United States of America | Applicant |
| US8856504B2 | Cited by | United States of America | Applicant |
| US11461476B2 | Cited by | United States of America | Applicant |
| GB2509422A | Cited by | United Kingdom | Search report |
| WO2009058743A2 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| US9489520B2 | Cited by | United States of America | Applicant |
| EP3712794A1 | Cited by | European Patent Office (EPO) | Search report |
| FR3094107A1 | Cited by | France | Search report |
| AU2008318885B2 | Cited by | Australia | Search report |
| WO2013048418A1 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| WO2014141159A1 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| GB2509422B | Cited by | United Kingdom | Search report |
| AU2008318885B9 | Cited by | Australia | Search report |
| WO2011156261A1 | Cited by | World Intellectual Property Organization (WIPO) | International search |
| EP0583140A1 | Cites | European Patent Office (EPO) | Search report |
| EP1273996A2 | Cites | European Patent Office (EPO) | Search report |
| US2002073316A1 | Cites | United States of America | Search report |
| US2002112158A1 | Cites | United States of America | Search report |
| US2002129244A1 | Cites | United States of America | Search report |
| US2003046563A1 | Cites | United States of America | Search report |
| US4558176A | Cites | United States of America | Search report |
| US5359659A | Cites | United States of America | Search report |
| US5666411A | Cites | United States of America | Search report |
| US5943421A | Cites | United States of America | Search report |
| US6523118B1 | Cites | United States of America | Search report |
| None | Non-patent | – | Applicant |
10 members in 4 offices; this record represents the family
Priority claims4
| Document | Office | Kind | Date |
|---|---|---|---|
| 518323P | United States of America | – | |
| 51832303 | United States of America | P | |
| 879349 | United States of America | – | |
| 87934904 | United States of America | A |
Members10
| Document | Office | Kind | |
|---|---|---|---|
| US2005100163A1 | United States of America | A1 | |
| EP1536308A2This record | European Patent Office (EPO) | A2 | |
| TW200527872A | Taiwan Province of China | A | |
| CN1677922A | China | A | |
| EP1536308A3 | European Patent Office (EPO) | A3 | |
| TWI298591B | Taiwan Province of China | B | |
| CN100542085C | China | C | |
| US7734932B2 | United States of America | B2 | |
| US2010241841A1 | United States of America | A1 | |
| US8799678B2 | United States of America | B2 |
12 legal events, as the office reported them to INPADOC
Over the term
Point at a mark for the eventEvents
| Event | Code | |
|---|---|---|
| Application deemed to be withdrawnWithdrawn18D | 18D | |
| Information on the status of an ep patent application or granted ep patentGrantedSTATUS: THE APPLICATION IS DEEMED TO BE WITHDRAWNSTAA | STAA | |
| First examination report despatched17Q | 17Q | |
| Party data changed (applicant data changed or rights of an application transferred)RAP1 | RAP1 | |
| Designation fees paidAKX | AKX | |
| Request for examination filed17P | 17P | |
| Designated contracting statesAK | AK | |
| Request for extension of the european patentAX | AX | |
| Search report despatchedORIGINAL CODE: 0009013PUAL | PUAL | |
| Designated contracting statesAK | AK | |
| Request for extension of the european patentAX | AX | |
| Public reference made under article 153(3) epc to a published international application that has entered the european phaseORIGINAL CODE: 0009012PUAI | PUAI |
Numbers
- Publication
- 1536308
- Application
- 40261950
Titles3
- German
- System und Verfahren zum Sichern von einem ausführbaren Kode
- English
- System and method for securing executable code
- French
- Système et procédé de sécurisation de code exécutable
Classification
- CPC, 2
- G06F21/72
- G06F21/51
- IPC, 4
- G06F1 00
- H04L9 00
- H04L9 06
- H04L9 14
Designated states2
- Contracting states, 1
- Türkiye
- Extension states, 1
- Yugoslavia, later Serbia and Montenegro (until 2006)