Microcontroller having security means

Abstract: A micro controller which has a first memory (5) in which invertedly enciphered program data is stored, a second memory (7) which stores cipher key data necessary for decoding the password stored in the first memory, a CPU (1) which controls writing data to or reading data from the first and second memories and a unit (9) which descrambles the cipher in the program data stored in the first memory based on the key data stored in the second memory, when the CPU accesses the first memory. The operation of this CPU is based on the program data which is decoded using the descrambling unit, which makes it possible to effectively block decoding or altering of programs and data.

Description: BACKGROUND OF THE INVENTION This invention relates to a micro controller and more particularly to micro controllers that are used where security is necessary such as in IC cards and data banks. In conventional micro controllers, program security was disregarded and the micro controller was operated directly from the program stored in the memory. In this kind of micro controller, the program stored in memory could easily be decoded or altered and so when used with IC cards or data banks that require a high level of security, maintaining security was not adequate. Patent document US-A-4 847 902 already discloses a micro controller system which can run encrypted programs. Such programs are secured against unauthorized copying or modification. SUMMARY OF THE INVENTION The object of this invention is to provide a micro controller that makes it possible to effectively block decoding or altering of programs or data. According to this invention, there is provided a micro controller comprising a first memory in which invertedly enciphered program data is stored, a second memory which stores cipher key data necessary for decoding the data stored in the first memory, a CPU which controls the writing of data to and the reading of data from the first and second memories, and means, based on the cipher key data stored in the second memory, for descrambling in the program data stored in the first memory when the CPU accesses the first memory. The operation of this CPU is based on the program data which is decoded using the said means for descrambling. By using a micro controller like this, the enciphered program data of the first memory is decoded using the descrambling means based on cipher key data stored in the second memory and the CPU is operated based on this decoded program data. In this way, the micro controller of this invention can block decoding or altering of programs and data and can be used in building a system with a high level of security. BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a block diagram of one embodiment of the construction of the micro controller of this invention; Figure 2 is a circuit diagram showing one detailed example of the descramble circuit of this invention; Figure 3 is a flowchart describing the operation of the function of an example of this invention. DESCRIPTION OF THE PREFERRED EMBODIMENT Figure 1 shows the construction of one embodiment of the micro controller of this invention. The micro controller of this embodiment comprises a CPU 1 and two memories 5 and 7 that are accessed by the CPU 1. The CPU 1 and the two memories 5 and 7 are connected by way of the address bus 11, the data bus 12 and the control bus 13. A memory access sensing circuit 3 is located along the address bus 11 and a descrambling circuit 9 is located along the data bus 12. The main program is stored in the memory 5 and is scrambled, that is, one portion of the data is invertedly enciphered. In memory 7 is stored the data which is the necessary cipher key for decoding the password hidden in the data of the memory 5. The memory access sensing circuit 3 senses whether the CPU 1 is accessing the memory 5 based on the address signal sent from the CPU 1 along the address bus 11 and the control signal sent from the CPU 1 along the control bus 13. Based on the cipher key data stored in the memory 7, the descrambling circuit 9 descrambles the data in the memory 5 which is accessed by the CPU 1. That is, it decodes the cipher. A detailed example of the descrambling circuit 9 is shown in Figure 2. The descrambling circuit 9 of this detailed example comprises a key decoder 2l and decoding circuits Si (i = 1, ... n) which correspond to the data lines Di (i = 1, ... n) for each data bit of the data code Do - Dn or n bit program code stored in the memory 5. Each of the decoding circuits Si comprises a D flip-flop F and a data inverting circuit INV which is made up of 2 AND circuits and 2 NOR circuits. Using data code Dl as an example, the memory access signal being sent to the memory 5 is input at the clock terminal of flip-flop F and an input terminal on one side of the AND 1 circuit inside of the inverting circuit. The output Q of the flip-flop F is input at the input terminal on the other wide of the AND 1 circuit and the output of the AND 1 circuit is input to one of the input terminals on the AND 2 circuit and the NOR 1 circuit. The data code D1 is input to the other input terminal on the AND 2 circuit and the NOR 1 circuit. The outputs of these are then input to the NOR circuit 2 and outputs as D1'. Next the operation of this embodiment will be explained using Figures 1 through 3. First, controlled by the CPU 1, the cipher key data for decoding stored in the memory 7 is sent to the descrambling circuit 9 by way of the address signal bus 11 and the control signal bus 13. The cipher key data is sent to the key decoder 21 of the descrambling circuit 9 and decoded. The flip-flop F of the decoding circuits Si are set to either "1" or "0" based on this decoded signal (see steps F31 and F32 of Figure 3). Next, when the CPU 1 accesses the memory 5, the memory access sensing circuit 3 senses this and sends a sensing signal to the descrambling circuit 9 (see step F33 of Figure 3). When this happens, the descrambling circuit 9 becomes enabled (see step F34 of Figure 3). At this time, if the flip-flop F of the decoding circuit Si is "1" then the enable signal of the data inverting circuit INV becomes "1" and the data Di on the data line connected to the decoding circuit Si is inverted. If the flip-flop F of the decoding circuit Si is "0" then the data Di on the data line connected to the decoding circuit Si is not inverted (see step F35 of Figure 3). The descrambled data D'1 - D'n are then sent to the CPU 1 and executed. When the CPU 1 accesses the memory 7 the entire descrambling circuit becomes disabled and the data from the memory 7 is sent to the CPU 1 without being descrambled. According to this embodiment, the scrambled programs or data stored in the memory 5 are descrambled by the descrambling circuit 9 using the key data stored in the memory 7 and the CPU 1 operates using the decoded programs or data. As a result, micro controller of this embodiment can effectively block decoding or altering of programs and data. Furthermore, if several types of decoding key data are stored in the memory 7, several types of cipher can be given to one program thus making it very difficult for a third party to decode them. Also, because descrambling circuits designed as a hardware can be freely operated using the software, it is not necessary to change the hardware to match the cipher types of the software. It becomes possible for the cipher key data to be set by the software and not by changing the hardware and so the software designers can determine the cipher key data without having to inform it the hardware designers thus increasing security and making it possible for use in all kinds of systems. Reference signs in the claims are intended for better understanding and shall not limit the scope.

Claims: A micro controller comprising: a first memory (5) in which invertedly enciphered program data is stored, characterized in that it further comprises a second memory (7) which stores cipher key data, a CPU (1) which controls writing data to or reading data from said first and second memories, and means (21) for decoding the cipher key data into a password with which the program can be descrambled, and means (9), for descrambling the cipher in the program data stored in said first memory when said CPU accesses said first memory, said CPU operating based on the program data which is decoded using said means for descrambling. A micro controller according to claim 1, wherein said second memory stores key data for several types of ciphers.

Inventors: SAITO YASUO, SAITO, YASUO
Applicants: TOSHIBA KK, TOSHIBA MICRO ELECTRONICS, KABUSHIKI KAISHA TOSHIBA, TOSHIBA MICRO-ELECTRONICS CORPORATION
Application year: 1991
Main classification: G06F12
IPC codes: G06F12, G06F21, G06F15, G06F1