The present disclosure generally relates to secure central processing units (CPUs).
A secure central processing unit (CPU) is intended to make it possible to perform calculations that involve secret values in such a way that it is difficult to get unauthorized access to the secret values. If the secret values handled by code running in the secure CPU are important enough, attackers may have motivation to use resource intensive and delicate means, such as physical probing, in order to steal these secrets or some part of them.
Secure CPUs include cryptoprocessors, such as those found on smart cards, trusted platform modules, security chips for embedded systems, and so forth as is known in the art. Unfortunately, secure CPUs are not invulnerable to attack, particularly for well-equipped and determined opponents (e.g. by an intelligence agency, by way of a non-limiting example) who are willing to expend massive resources on an attack of the secure CPU.
The present disclosure will be understood and appreciated more fully from the following detailed description, taken in conjunction with the drawings in which:
In one embodiment, a system and method is described for dynamic encryption of CPU registers. A data item, encrypted according to a first key is stored in one register in a CPU register file. A second data item is encrypted according to a second key, and is written to another of the registers. A flag, associated with each of the registers, is stored, indicating whether the data item is encrypted according to the first or second key. One of the data items is decrypted by retrieving its associated flag, thereby determining according to which key the data item is encrypted. Thereupon, the data item is decrypted according to the determined key. The keys are updated by a controller once each of the flags are set. The controller changes the second key to be the first key, stores a new second key, and clears each of the flags. Related apparatus, systems and methods are also described.
Reference is now made to
The secure processing system 10 also comprises two encryption keys. A first encryption key 140 (denoted KEY_1 in the figure), and a second encryption key 130 (denoted KEY_0 in the figure). The two encryption keys are stored outside of the CPU 100, for use in the operation of the secure processing system 10 of FIG.
1. The first encryption key 140 and the second encryption key 130 are typically stored in memory (not depicted) external to the CPU 100. A random bit generator (RBG) 135, external to the CPU 100, is utilized in generation of the second encryption key 130, as will be explained below, with reference to
As noted above, if secret values which are used in operation by software running in the secure CPU 100 are valuable enough, attackers may have motivation to use costly and delicate means, such as physical probing, in order to steal these secret values or some part of the secrets (which may themselves be of use to the attackers). The CPU register file 110, where the secret values are stored, may be vulnerable to some forms of probing used by attackers, since, in order for the secure CPU 100 to use any data 145 (such as the secret values mentioned above), that data 145 must first be loaded to a one register of the CPU register file 110 (e.g., one of registers 180 and 190). Some systems try to avoid this vulnerability by first encrypting the data 145 before loading it to the one register (e.g., one of registers 180 and 190) of the CPU register file 110, and then decrypting the data 145 before it is used. However, such encryption and decryption operations are typically performed quickly and therefore are typically cryptographically weak operations, as there is typically not adequate time to perform complex cryptographically strong operations. If, in at least some cases the attackers know or correctly guesses a plaintext value (such as the data 145), which may be read by probing the register file, then the attackers effectively know pairs of plaintext data (such as the data 145) and its corresponding ciphertext value. In such cryptographically weak systems, when enough pairs of plaintext-ciphertext data are collected, the attackers may be able to determine or guess an encryption key, (such as first encryption key 140 and second encryption key 130) and thus, compromise the encryption.
In embodiments, the encryption key (such as first encryption key 140 and second encryption key 130) is changed from time to time. If time between two consecutive changes of the key is short enough, then, it is believed by the inventors that the attackers will not have sufficient time to collect enough data necessary to find the encryption key.
The operation of the system of
Each one register of the CPU register file 110 has an associated flag of the plurality of flags 120 that indicates whether the one register of the CPU register file 110 is encrypted with the first encryption key 140 or the second encryption key 130. By way of example, in
When a new value is written to one register of the CPU register file 110, the new value is encrypted with KEY_1 (i.e., key[CurrentKey]), and its associated flag NewKeyValid is set to 1.
A hardware controller mechanism 170 for updating the system of
When a value is read from one of the plurality of registers making up the CPU register file 110 (e.g., the “1011 . . . ” from item 190), the value is first decrypted by the decryptor 160, using an appropriate decryption key as indicated by the associated flag of the plurality of flags 120 (e.g., “1”, indicating KEY_1, for the CPU register value “1011 . . . ” of item 190). The decryption of the value by the decryptor 160 restores the data 145 to its unencrypted state.
As will be explained below with reference to
As mentioned above, the encryption key (i.e., first encryption key 140 and second encryption key 130) is changed from time to time. If the time between two consecutive changes of the key is short enough, the attackers will not have enough time to collect an adequate amount of data necessary to find the encryption key. Accordingly, a new second encryption key 130 is generated frequently by the RBG 175 in order to maintain security for the secure processing system 10 of
In some embodiments, however, a software driver (not depicted) may be triggered by a timer or other appropriate mechanism to ensure that all of the plurality of registers making up the CPU register file 110 are read frequently enough thereby resulting in a new second encryption key 130 being generated by the RBG 175. Alternatively, a hardware mechanism may perform periodic reading of the plurality of registers making up the CPU register file 110, re-writing the same value to the register from which the value was read, while changing the value of the associated flag of the plurality of flags 120 for each register, thereby resulting in all of the flags of the plurality of flags 120 associated with the plurality of registers making up the CPU register file 110 being set.
Persons of skill in the art will also appreciate that even if the current encryption key is in use long enough for the attackers to reveal the current key, the attackers still need to figure out which registers of the plurality of registers making up the CPU register file 110 are encrypted with the current encryption key, i.e., the first encryption key 140, and which registers of the plurality of registers making up the CPU register file 110 are encrypted with the new encryption key, i.e., the second encryption key 130. Accordingly, knowledge of the encryption key is a necessary but not sufficient condition for accessing the data stored in the plurality of registers making up the CPU register file 110.
Reference is now made to
The CPU 100 comprises the CPU register file 110 (RegFile). The CPU 100 also comprises decryption functions 210A, 210B which are implemented in hardware. Decryption functions 210A, 210B receive the values of individual registers in the CPU register file 110 and decrypt them, according to the key (either first encryption key 140 or second encryption key 130) by which they are encrypted.
The first encryption key 140 and the second encryption key 130, are provided to multiplexers 220A, 220B. A flag of the plurality of flags 120 associated with the appropriate register of the individual registers in the CPU register file 110 (i.e. the NewKeyValid field) is provided as an input to the multiplexers 220A, 220B from a memory 230. On the basis of a value of the flag, the multiplexers 220A, 220B provide one of either the first encryption key 140 or the second encryption key 130 to the decryption functions 210A, 210B. The flag is stored in a memory 230, from which it is provided to the multiplexers 220A, 220B. The memory 230 is provided to store the flag associated with each one register in the register file 110. Each flag associated with each one register in the register file 110 indicates whether the one register in the register file is encrypted according to the first encryption key 140 or the second encryption key 130.
The encryption functions 240A, 240B, which are implemented in hardware, receive the values to be stored in the individual registers in the CPU register file 110 and encrypt them, according to the first encryption key 140 as discussed above with reference to
The plurality of flags 120 (
It is appreciated that CPU 100 comprises, in addition to the appropriate logic circuit 235, dedicated hardware logic circuits, in the form of an application-specific integrated circuit (ASIC), field programmable gate array (FPGA), or full-custom integrated circuit, or a combination of such devices.
Alternatively or additionally, some or all of the functions described herein may be carried out by a programmable processor or digital signal processor (DSP), under the control of suitable software. This software may be downloaded to the processor in electronic form, over a network, for example. Alternatively or additionally, the software may be stored on tangible storage media, such as optical, magnetic, or electronic memory media.
A random bit generator (RBG) 250, which might be a true random bit generator or a pseudo-random bit generator, provides a random string of bits which become the first encryption key 140. The random string of bits may undergo further manipulation in order to add additional entropy to the system. By way of example, the random string of bits may be processed through a shift register (not depicted), which may comprise a linear-feedback shift register prior to being stored as the first encryption key 140.
It will be apparent to one of ordinary skill in the art that one or more of the components of the exemplary CPU 100 may not be included in some embodiments, and other components may be added in some embodiments, as is known in the art. The exemplary CPU 100 shown in
Reference is now made to
After a certain number of clock cycles, all of the registers of the register file 110 are full, and at a time indicated by t1 in the timing diagram 300, the string of bits comprising the first encryption key 140 assumes the value of the string of bits comprising the second encryption key 130. When all of the flags in the memory 230 (
Reference is now made to
An encryptor encrypts a second data item according to a randomly generated second encryption key, producing an encrypted second data item, which is to be written to one of the plurality of registers (step 420).
At step 430, a flag associated with each one of the plurality of registers is stored in a memory, the flag indicating whether the first data item and the second data item stored in its associated one of the plurality of registers is encrypted according to the first encryption key or according to the second encryption key.
At step 440 a data item, which comprises one of the first data item and the second data item, is decrypted. The decryption of the data item entails the following steps. At step 442 the flag associated with one of the plurality of registers for the data item is retrieved. At step 444, based on the retrieved flag, the decryptor determines according to which of the first encryption key and the second encryption key the data item is encrypted. At step 446, the data item is decrypted according to the determined one of the first encryption key and the second encryption key.
The first encryption key and the second encryption key is updated by a controlled once each one of the flags associated with each one of the plurality of registers is set (step 450). The updating entails the following steps. At step 452, the controller changes the second encryption key to be the first encryption key. At step 454 the controller stores a new randomly generated second encryption key. At step 456, the controller clears each flag associated with each one of the plurality of registers.
Upon a new first data item needing to be stored, the method can then return to step 410.
It is appreciated that software components of the present invention may, if desired, be implemented in ROM (read only memory) form. The software components may, generally, be implemented in hardware, if desired, using conventional techniques. It is further appreciated that the software components may be instantiated, for example: as a computer program product or on a tangible medium. In some cases, it may be possible to instantiate the software components as a signal interpretable by an appropriate computer, although such an instantiation may be excluded in certain embodiments of the present invention.
It is appreciated that various features of the invention which are, for clarity, described in the contexts of separate embodiments may also be provided in combination in a single embodiment. Conversely, various features of the invention which are, for brevity, described in the context of a single embodiment may also be provided separately or in any suitable subcombination.
It will be appreciated by persons skilled in the art that the present invention is not limited by what has been particularly shown and described hereinabove. Rather the scope of the invention is defined by the appended claims and equivalents thereof: