[go: up one dir, main page]

CN102221989A - Microprocessor and related operation method, and encryption and decryption method - Google Patents

Microprocessor and related operation method, and encryption and decryption method Download PDF

Info

Publication number
CN102221989A
CN102221989A CN2011101364478A CN201110136447A CN102221989A CN 102221989 A CN102221989 A CN 102221989A CN 2011101364478 A CN2011101364478 A CN 2011101364478A CN 201110136447 A CN201110136447 A CN 201110136447A CN 102221989 A CN102221989 A CN 102221989A
Authority
CN
China
Prior art keywords
key
instruction
microprocessor
branch
program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2011101364478A
Other languages
Chinese (zh)
Other versions
CN102221989B (en
Inventor
G.葛兰.亨利
泰瑞.派克斯
布兰特.比恩
汤姆士.A.克理斯宾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Via Technologies Inc
Original Assignee
Via Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US13/091,785 external-priority patent/US8719589B2/en
Priority to CN201310680122.5A priority Critical patent/CN103699833B/en
Application filed by Via Technologies Inc filed Critical Via Technologies Inc
Priority to CN201310674396.3A priority patent/CN103699832B/en
Priority to CN201310738005.XA priority patent/CN103713883B/en
Priority to CN201610227267.3A priority patent/CN105912305B/en
Priority to CN201310687857.0A priority patent/CN103839001B/en
Priority to CN201710066089.5A priority patent/CN107015926B/en
Priority to CN201611195519.5A priority patent/CN107102843B/en
Priority to CN201310681951.5A priority patent/CN103761070B/en
Priority to CN201310680125.9A priority patent/CN103645885B/en
Publication of CN102221989A publication Critical patent/CN102221989A/en
Publication of CN102221989B publication Critical patent/CN102221989B/en
Application granted granted Critical
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0875Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with dedicated cache, e.g. instruction or stack
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/71Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/70Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer
    • G06F21/71Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information
    • G06F21/72Protecting specific internal or peripheral components, in which the protection of a component leads to protection of the entire computer to assure secure computing or processing of information in cryptographic circuits
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP
    • G06F9/30079Pipeline control instructions, e.g. multicycle NOP
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/3017Runtime instruction translation, e.g. macros
    • G06F9/30178Runtime instruction translation, e.g. macros of compressed or encrypted instructions
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30181Instruction operation extension or modification
    • G06F9/30189Instruction operation extension or modification according to execution mode, e.g. mode flag
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0891Revocation or update of secret information, e.g. encryption key update or rekeying
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0894Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/40Specific encoding of data in memory or cache
    • G06F2212/402Encrypted data
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/45Caching of specific data in cache memory
    • G06F2212/452Instruction code
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2107File encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/12Details relating to cryptographic hardware or logic circuitry
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/20Manipulating the length of blocks of bits, e.g. padding or block truncation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Mathematical Physics (AREA)
  • Storage Device Security (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Executing Machine-Instructions (AREA)

Abstract

The invention relates to a microprocessor and a related operation method, and an encryption and decryption method. The microprocessor operates with an extraction unit: fetching a block of instruction data from an instruction cache of a microprocessor; (b) performing Boolean operation on the block by a data entity to generate plain character instruction data; and (c) providing the plain text instruction data to an instruction decoding unit. In a first case, the block includes encrypted command data and the data entity is the decryption key. In a second case, the block includes non-encrypted instruction data and the data entity is a binary zero value of a plurality of bits. The time required to perform the above-described contents , (b), and (c) is the same in the first condition and the second condition regardless of whether the instruction data of the block is encrypted or unencrypted.

Description

微处理器以及相关的操作方法、以及加密、解密方法Microprocessor and related operation method, and encryption and decryption method

技术领域technical field

本发明涉及微处理器(microprocessor)领域,特别是涉及用于增加微处理器所执行的程序的安全性。The present invention relates to the field of microprocessor (microprocessor), in particular to a method for increasing the security of programs executed by the microprocessor.

背景技术Background technique

很多软件程序在面临破坏计算机系统安全的攻击时,通常是脆弱不堪的。例如,黑客可藉由攻击一运行中程序的缓冲溢位区漏洞(buffer overflow vulnerability)植入不当程序码、并转移主控权给该不当程序码。如此一来,所植入的程序码将主导被攻击的程序。一种防范软件程序遭攻击的方案为指令集随机化(instruction set randomization)。概略解释之,指令集随机化技术会先将程序加密(encrypt)为某些形式,再于处理器将该程序自存储器提取后,于该处理器内解密(decrypt)该程序。如此一来,黑客便不易植入恶意指令,因为所植入的指令必须被适当地加密(例如,使用与所攻击程序相同的加密密钥或演算法)方会被正确地执行。例如,参阅文件「Counter Code-Injection Attacks with Instruction-Set Randomization,by Gaurav S.Kc,Angelos D.Keromytis,and Vassilis Prevelakis,CCS’03,October 27-30,2003,Washington,DC,USA,ACM 1-58113-738-9/03/0010」,其中叙述Bochs-x86Pentium模拟器(emulator)的改良版本。相关技术的缺点已被广泛讨论。例如,参阅数据「Where’s the FEEB?The Effectiveness of Instruction Set Randomization,by Ana Nora Sovarel,David Evans,and Nathanael Paul,http://www.cs.virginia.edu/feeb」。Many software programs are generally vulnerable to attacks that compromise the security of computer systems. For example, a hacker can implant improper program code by attacking a buffer overflow vulnerability of a running program, and transfer control rights to the improper program code. In this way, the implanted program code will dominate the attacked program. A solution to prevent software programs from being attacked is instruction set randomization. Roughly explained, the instruction set randomization technology first encrypts the program into some form, and then decrypts the program in the processor after the processor fetches the program from the memory. In this way, it is difficult for a hacker to implant malicious instructions, because the implanted instructions must be properly encrypted (for example, using the same encryption key or algorithm as the attacked program) to be correctly executed. For example, see the document "Counter Code-Injection Attacks with Instruction-Set Randomization, by Gaurav S.Kc, Angelos D. Keromytis, and Vassilis Prevelakis, CCS'03, October 27-30, 2003, Washington, DC, USA, ACM 1 -58113-738-9/03/0010", which describes an improved version of the Bochs-x86Pentium emulator (emulator). The disadvantages of related techniques have been widely discussed. See, for example, the data "Where's the FEEB? The Effectiveness of Instruction Set Randomization, by Ana Nora Sovarel, David Evans, and Nathanael Paul, http://www.cs.virginia.edu/feeb ."

发明内容Contents of the invention

本发明一种实施方式揭示一微处理器。该微处理器包括一指令高速缓冲存储器、一指令解码单元、以及一提取单元。该提取单元用于:(a)自该指令高速缓冲存储器提取一区块的指令数据;(b)以一数据实体对该区块执行一布林异运算,以产生纯文字指令数据;以及(c)将上述纯文字指令数据提供给该指令解码单元。在一第一状况下,该区块包括加密指令数据、且该数据实体为解密密钥。在一第二状况下,该区块包括非加密指令数据、且该数据实体为多个位的二进位零值。无论该区块的指令数据为加密或非加密,实行上述内容(a)、(b)以及(c)所需要的时间在该第一状况下以及该第二状况下是相同的。One embodiment of the invention discloses a microprocessor. The microprocessor includes an instruction cache memory, an instruction decoding unit, and a fetching unit. The fetch unit is used for: (a) fetching instruction data of a block from the instruction cache memory; (b) performing a Boolean XOR operation on the block with a data entity to generate plain text instruction data; and ( c) Providing the above-mentioned plain text instruction data to the instruction decoding unit. In a first case, the block includes encrypted instruction data, and the data entity is a decryption key. In a second condition, the block includes non-encrypted command data, and the data entity is a plurality of bits of binary zero value. Regardless of whether the command data of the block is encrypted or not, the time required to implement the above content (a), (b) and (c) is the same under the first situation and the second situation.

本发明另外一种实施方式揭示一方法,用以操作具有一指令高速缓冲存储器的一微处理器。该方法包括:(a)自该指令高速缓冲存储器提取一区块的指令数据;(b)以一数据实体对该区块进行一布林异运算,以产生纯文字指令数据;以及(c)供应上述纯文字指令数据给一指令解码单元。在一第一状况下,该区块包括加密指令数据、且该数据实体为解密密钥。在一第二状况下,该区块包括非加密指令数据、且该数据实体为多个位的二进位零值。无论该区块的指令数据为加密或非加密,实行上述内容(a)、(b)以及(c)所需要的时间在该第一状况下以及该第二状况下是相同的。Another embodiment of the present invention discloses a method for operating a microprocessor having an instruction cache. The method includes: (a) fetching a block of instruction data from the instruction cache; (b) performing a Boolean XOR operation on the block with a data entity to generate plain text instruction data; and (c) The plain text instruction data is supplied to an instruction decoding unit. In a first case, the block includes encrypted instruction data, and the data entity is a decryption key. In a second condition, the block includes non-encrypted command data, and the data entity is a plurality of bits of binary zero value. Regardless of whether the command data of the block is encrypted or not, the time required to implement the above content (a), (b) and (c) is the same under the first situation and the second situation.

本发明一种实施方式提供一微处理器。该微处理器包括一指令高速缓冲存储器以及一提取单元。该提取单元会自该指令高速缓冲存储器一序列多个提取地址提取一加密程序一序列多个区块的加密指令。在提取该序列各个区块时,提取单元更以多个密钥数值以及所提取该区块的提取地址的部份内容为一函数,生成解密密钥。针对提取出的该序列各个区块,提取单元还采用对应的解密密钥解密其中加密指令。该微处理器还包括一密钥切换指令,在该提取单元自该指令高速缓冲存储器提取该序列上述多个区块时,指示该微处理器更新该提取单元内的这些密钥数值。One embodiment of the present invention provides a microprocessor. The microprocessor includes an instruction cache and a fetch unit. The fetching unit fetches a sequence of encrypted instructions of a plurality of blocks of an encryption program from a sequence of a plurality of fetch addresses in the instruction cache. When extracting each block of the sequence, the extracting unit further uses a plurality of key values and part of the extracted address of the extracted block as a function to generate a decryption key. For the extracted blocks of the sequence, the extracting unit also uses the corresponding decryption key to decrypt the encrypted instructions therein. The microprocessor also includes a key switching instruction, which instructs the microprocessor to update the key values in the fetching unit when the fetching unit fetches the sequence of blocks from the instruction cache.

本发明另外一种实施方式揭示一种方法,操作具有一指令高速缓冲存储器的一微处理器。该方法包括自该指令高速缓冲存储器提取一程序多个第一加密指令,且将之以一第一解密密钥解密为多个第一非加密指令。该方法还包括将该第一解密密钥以一第二解密密钥取代,回应这些第一非加密指令中的一密钥切换指令。该方法还包括自该指令高速缓冲存储器提取该程序的多个第二加密指令,且将之以该第二解密密钥解密为多个第二非加密指令。Another embodiment of the present invention discloses a method of operating a microprocessor having an instruction cache. The method includes fetching a plurality of first encrypted instructions of a program from the instruction cache, and decrypting them into a plurality of first non-encrypted instructions with a first decryption key. The method also includes replacing the first decryption key with a second decryption key in response to a key switch command among the first non-encrypted commands. The method also includes fetching a plurality of second encrypted instructions of the program from the instruction cache, and decrypting them with the second decryption key into a plurality of second non-encrypted instructions.

本发明另外一种实施方式揭示一种方法,用于操作一微处理器。该方法包括自一指令高速缓冲存储器一序列多个提取地址提取一加密程序一序列多个区块的加密指令。该方法还包括在提取该序列各个区块时,以多个密钥数值以及所提取该区块的提取地址的部份内容为一函数生成解密密钥。该方法还包括针对该序列内各区块,使用对应的上述解密密钥解密其中的加密指令。该方法还包括在提取该序列上述多个区块时,执行一密钥切换指令。执行上述密钥切换指令包括更新用于生成上述解密密钥的这些密钥数值。Another embodiment of the present invention discloses a method for operating a microprocessor. The method includes fetching an encrypted program, a sequence of encrypted instructions of a plurality of blocks, from an instruction cache memory, a sequence of fetched addresses. The method also includes generating a decryption key by using a plurality of key values and part of the extraction address of the extracted block as a function when extracting each block of the sequence. The method also includes, for each block in the sequence, decrypting the encrypted instruction therein using the corresponding decryption key. The method also includes executing a key switching instruction when extracting the sequence of the plurality of blocks. Executing the key switching instruction includes updating the key values used to generate the decryption key.

本发明一种实施方式揭示一种微处理器。该微处理器包括一提取单元,使用第一解密密钥数据提取并且解密一分支与切换密钥指令。该微处理器还包括微代码。上述微代码在该分支与切换密钥指令的方向不被采用的状况下,令该提取单元采用上述第一解密密钥数据提取并且解密该分支与切换密钥指令之后的接续指令。该微代码还在该分支与切换密钥指令被采用的状况下,令该提取单元采用不同于上述第一解密密钥数据的第二解密密钥数据提取并且解密该分支与切换密钥指令的一目标指令。An embodiment of the present invention discloses a microprocessor. The microprocessor includes an extraction unit for extracting and decrypting a branch and switch key instruction using the first decryption key data. The microprocessor also includes microcode. When the direction of the branch and switch key instruction is not adopted, the microcode instructs the extracting unit to use the first decryption key data to extract and decrypt the continuation instruction after the branch and switch key instruction. The microcode also causes the extraction unit to extract and decrypt the branch and switch key instruction using second decryption key data different from the above-mentioned first decryption key data under the condition that the branch and switch key instruction is adopted. A target instruction.

本发明另外一种实施方式揭示一方法,以一微处理器处理一加密程序。该方法包括使用第一解密密钥数据提取并且解密一分支与切换密钥指令。此方法还包括,在该分支与切换密钥指令的方向不被采取的状况下,以上述第一解密密钥数据提取并且解密该分支与切换密钥指令之后的接续指令。该方法还包括,在该分支与切换密钥指令的方向被采取的状况下,以不同于上述第一解密密钥数据的第二解密密钥数据提取并且解密该分支与切换密钥指令的一目标指令。Another embodiment of the present invention discloses a method for processing an encryption program with a microprocessor. The method includes extracting and decrypting a branch and switch key instruction using the first decryption key data. The method further includes, under the condition that the direction of the branch and switch key instruction is not taken, extracting and decrypting a continuation instruction after the branch and switch key instruction with the above-mentioned first decryption key data. The method also includes extracting and decrypting a part of the branch and switch key instruction with second decryption key data different from the above-mentioned first decryption key data under the condition that the direction of the branch and switch key instruction is taken. target instruction.

本发明另外一种实施方式亦揭示一方法,用于加密一程序,以供用于解密与执行加密程序的一微处理器日后执行。该方法包括接收一非加密程序的一目的文件,其中包括传统分支指令,所指示的目标地址可于该微处理器执行该程序前判定。该方法还包括分析该程序以获得块信息。上述块信息将该程序划分成一序列多个块。各块包括一序列多个指令。上述块信息还包括各块相关的加密密钥数据。各块对应的加密密钥数据不相同。该方法还包括将上述传统分支指令中目标地址与自身坐落不同块者各自以一分支与切换密钥指令取代。该方法还包括基于上述块信息加密该程序。Another embodiment of the present invention also discloses a method for encrypting a program for later execution by a microprocessor for decrypting and executing the encrypted program. The method includes receiving an object file of an unencrypted program, including conventional branch instructions, indicating a target address that can be determined before the microprocessor executes the program. The method also includes analyzing the program to obtain block information. The above-mentioned block information divides the program into a sequence of multiple blocks. Each block includes a sequence of multiple instructions. The above block information also includes encryption key data related to each block. The encryption key data corresponding to each block is different. The method also includes replacing the target address and itself located in a different block in the traditional branch instructions with a branch and switch key instruction respectively. The method also includes encrypting the program based on the above block information.

本本发明另外一种实施方式亦揭示一方法,用于加密一程序,以供用于解密与执行加密程序的一微处理器日后执行。该方法包括接收一非加密程序的一目的文件,其中包括传统分支指令,所指示的目标地址仅能在该微处理器执行该程序时判定。该方法还包括分析该程序以获得块信息。上述块信息将该程序划分成一序列多个块。各块包括一序列多个指令。上述块信息还包括各块相关的加密密钥数据。各块对应的加密密钥数据不相同。该方法还包括将上述传统分支指令各自以一分支与切换密钥指令取代。该方法还包括基于上述块信息,加密该程序。Another embodiment of the present invention also discloses a method for encrypting a program for later execution by a microprocessor for decrypting and executing the encrypted program. The method includes receiving an object file of an unencrypted program, including conventional branch instructions, indicating target addresses that can only be determined when the microprocessor executes the program. The method also includes analyzing the program to obtain block information. The above-mentioned block information divides the program into a sequence of multiple blocks. Each block includes a sequence of multiple instructions. The above block information also includes encryption key data related to each block. The encryption key data corresponding to each block is different. The method further includes replacing each of the conventional branch instructions with a branch and switch key instruction. The method also includes encrypting the program based on the block information.

本发明一种实施方式揭示一微处理器。该微处理器包括一架构寄存器,该架构寄存器包括一位。该微处理器负责设定该位。该微处理器还包括一提取单元。该提取单元自一指令高速缓冲存储器提取加密指令、并在执行上述加密指令前将上述加密指令解密,以回应该微处理器将该位设定的操作。若接收到一中断,该微处理器储存该位的数值至一堆迭内存、并且随后将该位清除。在微处理器清除该位后,该提取指令是自该指令高速缓冲存储器提取非加密指令,并不对上述非加密指令作解密操作即执行之。该微处理器还自该堆迭内存将先前储存的数值用来修复该架构寄存器的该位,以回应自中断指令返回的操作。若判定该位修复后的数值为设定状态,该提取单元重新提取并且解密加密指令。One embodiment of the invention discloses a microprocessor. The microprocessor includes an architectural register including a bit. The microprocessor is responsible for setting this bit. The microprocessor also includes an extraction unit. The fetching unit fetches encrypted instructions from an instruction cache memory, and decrypts the encrypted instructions before executing the encrypted instructions, in response to the microprocessor's operation of setting the bit. If an interrupt is received, the microprocessor stores the value of the bit to a stack memory and then clears the bit. After the microprocessor clears the bit, the fetch instruction is to fetch the non-encrypted instruction from the instruction cache, and execute it without decrypting the above-mentioned non-encrypted instruction. The microprocessor also uses the previously stored value from the stack memory to restore the bit of the architectural register in response to a return from an interrupt instruction. If it is determined that the repaired value of the bit is set, the extraction unit re-extracts and decrypts the encrypted instruction.

本发明另外一种实施方式揭示一种方法,用于操作具有一指令高速缓冲存储器以及一架构寄存器的一微处理器。该方法包括设定该架构寄存器内的一位,并且随后自该指令高速缓冲存储器提取加密指令,并且在执行上述加密指令前将上述加密指令解密。在面对一中断时,该方法还包括储存该架构寄存器该位的数值,并且随后清除该位。在清除该位后,该方法还包括自该指令高速缓冲存储器提取非加密指令,并且不作解密即执行上述非加密指令。该方法还包括以先前储存的数值修复该架构寄存器该位,以回应自中断指令返回的操作。若判定该位修复后的数值为设定状态,该方法还包括重新提取并且解密并且执行加密指令。Another embodiment of the present invention discloses a method for operating a microprocessor having an instruction cache and an architectural register. The method includes setting a bit in the architectural register, and then fetching an encrypted instruction from the instruction cache, and decrypting the encrypted instruction before executing the encrypted instruction. In response to an interrupt, the method also includes storing the value of the bit of the architectural register, and subsequently clearing the bit. After clearing the bit, the method also includes fetching the non-encrypted instruction from the instruction cache and executing the non-encrypted instruction without decryption. The method also includes restoring the bit of the architectural register with a previously stored value in response to a return from the interrupt instruction. If it is determined that the repaired value of the bit is a set state, the method further includes re-extracting and decrypting and executing the encrypted instruction.

本发明另外一种实施方式揭示一微处理器。该微处理器包括一架构寄存器以及一提取单元,该架构寄存器包括一位。该微处理器储存该位的数值,以回应中断执行中程序的一要求。该位标示执行中程序为加密或非加密。该微处理器以先前储存的数值修复该位,并且重新提取被中断的程序作为执行中程序,以回应自中断指令返回的操作。若该位修复后的数值为设定状态,该微处理器在重新提取中断的程序之前,先将解密密钥数值修复,以使用修复的解密密钥数值解密所提取的指令。若该位修复后的数值为清除状态,该微处理器不作解密密钥数值修复、并且不对所提取的指令作解密。Another embodiment of the present invention discloses a microprocessor. The microprocessor includes an architectural register including one bit and a fetch unit. The microprocessor stores the value of the bit in response to a request to interrupt an executing program. This bit indicates whether the program in execution is encrypted or not encrypted. The microprocessor restores the bit with the previously stored value and refetches the interrupted program as the running program in response to the return from the interrupt instruction. If the repaired value of the bit is set, the microprocessor first restores the decryption key value before re-fetching the interrupted program, so as to use the repaired decryption key value to decrypt the fetched instruction. If the repaired value of the bit is cleared, the microprocessor does not restore the value of the decryption key, and does not decrypt the fetched instruction.

本发明另外一种实施方式揭示一种方法,用以操作一微处理器。该方法包括储存该微处理器一位的数值,以回应中断执行中程序的一要求。该位标示执行中程序为加密或非加密。回应自中断指令返回的操作,该方法还包括以先前储存的数值修复该位,并且重新提取中断的程序作为执行中程序。若该位修复后的数值为设定状态,该方法还包括在重新提取中断程序之前,将解密密钥数值修复,并且以修复后的解密密钥数值解密所提取的指令。若该位修复后的数值为清除状态,该方法不会作解密密钥修复操作,也不对提取的指令作解密。Another embodiment of the present invention discloses a method for operating a microprocessor. The method includes storing a value of one bit of the microprocessor in response to a request to interrupt an executing program. This bit indicates whether the program in execution is encrypted or not encrypted. In response to returning from the interrupt instruction, the method also includes resetting the bit with a previously stored value, and refetching the interrupted program as the running program. If the restored value of the bit is set, the method further includes restoring the decryption key value before re-extracting the interrupt program, and decrypting the fetched instruction with the restored decryption key value. If the repaired value of the bit is cleared, this method will not restore the decryption key, and will not decrypt the extracted instruction.

本发明一种实施方式揭示一种微处理器。该微处理器包括一储存元件,具有多个位置各自储存一个加密程序的解密密钥数据。该微处理器还包括一控制寄存器,以一字段标示该储存元件上述多个位置中与执行中的加密程序相关者。回应自中断指令返回的操作,该微处理器自存储器将先前储存的该字段的数值用来修复该控制寄存器。该微处理器还包括一提取单元,用以提取执行中的加密程序的加密指令、并且将之以该字段修复后的数值在该储存元件所标示的位置所储存的解密密钥数据解密。An embodiment of the present invention discloses a microprocessor. The microprocessor includes a storage element having a plurality of locations each storing decryption key data of an encryption program. The microprocessor also includes a control register, which uses a field to mark one of the above-mentioned multiple locations of the storage element that is related to the encryption program being executed. In response to a return from the interrupt instruction, the microprocessor restores the control register from memory with the previously stored value of the field. The microprocessor also includes an extracting unit, which is used to extract the encryption instruction of the encryption program being executed, and decrypt the decryption key data stored in the location marked by the storage element with the repaired value of the field.

本发明另外一种实施方式揭示一方法,用以操作具有一控制寄存器以及一储存元件的一微处理器,该储存元件内多个位置各自储存一个加密程序的解密密钥数据。该方法包括自存储器将先前储存的该字段的数值用来修复该控制寄存器内一字段,以回应自中断指令返回的操作,其中,该字段的数值标示该储存元件上述多个位置中与执行中加密程序有关。该方法还包括提取执行中的加密程序的加密指令。该方法还包括以该字段修复后的数值在该储存元件所标示的位置所储存的解密密钥数据解密所提取的加密指令。Another embodiment of the present invention discloses a method for operating a microprocessor having a control register and a storage element, wherein a plurality of locations in the storage element respectively store decryption key data of an encryption program. The method includes using a previously stored value of the field from the memory to restore a field in the control register in response to an operation returned from an interrupt instruction, wherein the value of the field indicates that the storage element is in the plurality of locations and is executing encryption procedure. The method also includes extracting encrypted instructions of the encrypted program in execution. The method further includes decrypting the extracted encrypted instruction with the decryption key data stored in the location indicated by the storage element with the repaired value of the field.

本发明一种实施方式揭示一种微处理器。该微处理器包括一分支目标地址高速缓冲存储器(BTAC)记录先前执行过的分支与切换密钥指令的历史信息。上述历史信息包括所记录的分支与切换密钥指令的目标地址以及标识符。上述标识符标示与所属的分支与切换密钥指令相关的多个密钥数值。该微处理器还包括一提取单元,耦接该分支目标地址高速缓冲存储器。该提取单元提取先前执行过的分支与切换密钥指令时,会接收该分支目标地址高速缓冲存储器所作的预测、并且自该分支目标地址高速缓冲存储器接收关于所提取的分支与切换密钥指令的上述目标地址以及标识符。该提取单元还根据所接收的目标地址提取加密指令数据、并且根据所接收的标识符所标示的多个密钥数值解密所提取的加密指令数据,以回应接收到的上述预测。An embodiment of the present invention discloses a microprocessor. The microprocessor includes a Branch Target Address Cache (BTAC) to record history information of previously executed branch and switch key instructions. The above historical information includes the recorded target addresses and identifiers of branch and switch key instructions. The above-mentioned identifiers indicate a plurality of key values related to the branch and switch key instruction. The microprocessor also includes a fetch unit coupled to the branch target address cache memory. The fetch unit, when fetching previously executed branch and switch key instructions, receives predictions made by the branch target address cache and receives information about the fetched branch and switch key instructions from the branch target address cache The above target address and identifier. The extraction unit also extracts encrypted instruction data according to the received target address, and decrypts the extracted encrypted instruction data according to the plurality of key values indicated by the received identifier, in response to the received prediction.

本发明另外一种实施方式揭示一种方法,用于操作一微处理器。该方法包括以一分支目标地址高速缓冲存储器(BTAC)记录先前执行过的分支与切换密钥指令的历史信息。上述历史信息包括所记录的分支与切换密钥指令的目标地址以及标识符。上述标识符标示与所属的分支与切换密钥指令相关的多个密钥数值。该方法更于先前执行过的分支与切换密钥指令被提取时接收该分支目标地址高速缓冲存储器所作的预测、并且自该分支目标地址高速缓冲存储器接收关于所提取的分支与切换密钥指令的上述目标地址以及标识符。该方法更根据所接收的目标地址提取加密指令数据、并且根据所接收的标识符所标示的多个密钥数值解密所提取的加密指令数据,以回应接收到的上述预测。Another embodiment of the present invention discloses a method for operating a microprocessor. The method includes recording history information of previously executed branch and switch key instructions with a branch target address cache (BTAC). The above historical information includes the recorded target addresses and identifiers of branch and switch key instructions. The above-mentioned identifiers indicate a plurality of key values related to the branch and switch key instruction. The method further receives predictions made by the branch target address cache when previously executed branch and switch key instructions are fetched, and receives information about the fetched branch and switch key instructions from the branch target address cache The above target address and identifier. The method further extracts encrypted command data according to the received target address, and decrypts the extracted encrypted command data according to the plurality of key values indicated by the received identifier, in response to the received prediction.

附图说明Description of drawings

图1为一方块图,图解根据本发明技术实现的一微处理器;Figure 1 is a block diagram illustrating a microprocessor implemented in accordance with the techniques of the present invention;

图2为一方块图,用以详细说明图解图1的提取单元;Fig. 2 is a block diagram for explaining the extracting unit of Fig. 1 in detail;

图3为一流程图,根据本发明技术,图解图2提取单元的操作;FIG. 3 is a flow chart illustrating the operation of the extraction unit of FIG. 2 in accordance with the techniques of the present invention;

图4为一方块图,根据本发明技术,图解图1标志寄存器的字段;Fig. 4 is a block diagram illustrating the fields of the flag register of Fig. 1 according to the technology of the present invention;

图5为一方块图,根据本发明技术,图解一密钥载入指令的格式;Figure 5 is a block diagram illustrating the format of a key load command according to the techniques of the present invention;

图6为一方块图,根据本发明技术,图解一密钥切换指令的格式;FIG. 6 is a block diagram illustrating the format of a key switching command according to the technology of the present invention;

图7为一流程图,根据本发明技术,图解图1微处理器的操作,其中执行图6的密钥切换指令;FIG. 7 is a flow chart illustrating the operation of the microprocessor of FIG. 1 in which the key switching instruction of FIG. 6 is executed, according to the technology of the present invention;

图8为一方块图,根据本发明技术,图解一加密程序的存储器用量,该加密程序包括多个图6所接露的密钥切换指令;FIG. 8 is a block diagram illustrating the memory usage of an encryption program including a plurality of key switching instructions disclosed in FIG. 6 according to the technology of the present invention;

图9为一方块图,根据本发明技术,图解一分支与切换密钥指令的格式;Figure 9 is a block diagram illustrating the format of a branch and switch key instruction in accordance with the techniques of the present invention;

图10为一流程图,根据本发明技术,图解图1微处理器的操作,其中执行图9的分支与切换密钥指令;Figure 10 is a flowchart illustrating the operation of the microprocessor of Figure 1 in which the branch and switch key instructions of Figure 9 are executed, in accordance with the teachings of the present invention;

图11为一流程图,根据本发明技术,图解一后处理器的操作,由软件工具实现,可用于后部处理一程序、且加密之,以由图1微处理器执行;Figure 11 is a flow chart illustrating the operation of a post-processor, implemented by software tools, for post-processing a program and encrypting it for execution by the microprocessor of Figure 1, according to the techniques of the present invention;

图12为一方块图,图解本发明另外一种实施方式的分支与切换密钥指令的格式;FIG. 12 is a block diagram illustrating the format of branch and switch key instructions in another embodiment of the present invention;

图13为一方块图,根据本发明技术,图解块地址范围表;Figure 13 is a block diagram illustrating a block address range table according to the technology of the present invention;

图14为一流程图,根据本发明技术,图解图1微处理器的操作,其中执行图12的分支与切换密钥指令;Figure 14 is a flowchart illustrating the operation of the microprocessor of Figure 1 in which the branch and switch key instructions of Figure 12 are executed, in accordance with the teachings of the present invention;

图15为一方块图,图解本发明另外一种实施方式的分支与切换密钥指令的格式;15 is a block diagram illustrating the format of branch and switch key instructions in another embodiment of the present invention;

图16为一方块图,根据本发明技术,图解块地址范围表;Fig. 16 is a block diagram illustrating a block address range table according to the technology of the present invention;

图17为一流程图,根据本发明技术,图解图1微处理器的操作,其中执行图15的分支与切换密钥指令;Figure 17 is a flowchart illustrating the operation of the microprocessor of Figure 1 in which the branch and switch key instructions of Figure 15 are executed, in accordance with the teachings of the present invention;

图18为一流程图,图解本发明技术另外一种实施方式,其中叙述一后处理器的操作,用于后部处理一程序、且加密之,由图1微处理器执行;Fig. 18 is a flow chart illustrating another embodiment of the present invention technology, wherein the operation of a post-processor is described for post-processing a program and encrypting it, which is executed by the microprocessor of Fig. 1;

图19为一流程图,根据本发明技术,图解图1微处理器的操作,用于应付一任务切换,切换于一加密程序以及一纯文字程序之间;FIG. 19 is a flow chart illustrating the operation of the microprocessor of FIG. 1 for handling a task switch between an encrypted program and a plain text program according to the technology of the present invention;

图20图解一流程图,根据本发明技术,图解图1微处理器所执行的系统软件的操作;Figure 20 illustrates a flowchart illustrating the operation of system software executed by the microprocessor of Figure 1 in accordance with the teachings of the present invention;

图21图解一方块图,根据本发明另外一种实施方式,图解图1标志寄存器的字段;FIG. 21 illustrates a block diagram illustrating the fields of the flag register in FIG. 1 according to another embodiment of the present invention;

图22为一流程图,根据本发明技术,图解采用图21的标志寄存器的图1微处理器的操作,用于应付一任务切换,切换于多个加密程序之间;Fig. 22 is a flow chart illustrating the operation of the microprocessor of Fig. 1 using the flag register of Fig. 21 according to the technology of the present invention, for coping with a task switching between a plurality of encryption programs;

图23为一流程图,根据本发明技术,图解采用图21的标志寄存器的图1微处理器的操作,用于应付一任务切换,切换于多个加密程序之间;Fig. 23 is a flowchart illustrating the operation of the microprocessor of Fig. 1 using the flag register of Fig. 21, according to the technology of the present invention, for coping with a task switch between a plurality of encryption programs;

图24为一方块图,根据本发明另外一种实施方式,图解图1密钥寄存器文档中的单一个寄存器;Fig. 24 is a block diagram illustrating a single register in the key register file of Fig. 1 according to another embodiment of the present invention;

图25为一流程图,根据本发明另外一种实施方式,图解采用图21标志寄存器以及图24密钥寄存器文档的图1微处理器的操作,以应付一任务切换,切换于多个加密程序之间;Fig. 25 is a flow chart illustrating the operation of the microprocessor of Fig. 1 using the flag register of Fig. 21 and the key register file of Fig. 24 to cope with a task switch and switch between multiple encryption programs according to another embodiment of the present invention between;

图26为一流程图,根据本发明另外一种实施方式,图解采用图21标志寄存器以及图24密钥寄存器文档的图1微处理器的操作,以应付一任务切换,切换于多个加密程序之间;Fig. 26 is a flow chart illustrating the operation of the microprocessor of Fig. 1 using the flag register of Fig. 21 and the key register file of Fig. 24 to cope with a task switch between multiple encryption programs according to another embodiment of the present invention between;

图27为一方块图,图解图1微处理器100部分内容的其他实施方式;FIG. 27 is a block diagram illustrating other embodiments of portions of the microprocessor 100 of FIG. 1;

图28为一方块图,根据本发明技术,详细图解图27的分支目标地址高速缓冲存储器(BTAC);28 is a block diagram illustrating in detail the Branch Target Address Cache (BTAC) of FIG. 27 in accordance with the teachings of the present invention;

图29为一方块图,根据本发明技术,详细图解图28的BTAC各单元的内容;FIG. 29 is a block diagram illustrating in detail the contents of each unit of the BTAC in FIG. 28 according to the technology of the present invention;

图30为一流程图,根据本发明技术,图解图27微处理器采用图28BTAC的操作;Figure 30 is a flow chart illustrating the operation of the microprocessor of Figure 27 using the BTAC of Figure 28 in accordance with the techniques of the present invention;

图31为一流程图,根据本发明技术,图解图27微处理器采用图28BTAC的操作;以及Figure 31 is a flowchart illustrating the operation of the microprocessor of Figure 27 using the BTAC of Figure 28 in accordance with the teachings of the present invention; and

图32为一流程图,根据本发明技术,图解图27微处理器对一分支与切换密钥指令的操作;以及Figure 32 is a flowchart illustrating the operation of the microprocessor of Figure 27 for a branch and switch key instruction, in accordance with the teachings of the present invention; and

附图符号说明Description of reference symbols

100~微处理器;                102~指令高速缓冲存储器;100~microprocessor; 102~instruction cache memory;

104~提取单元;                106~指令数据(可为加密);104~extraction unit; 106~command data (can be encrypted);

108~解码单元;                112~执行单元;108~decoding unit; 112~execution unit;

114~引出单元;                118~通用寄存器;114~exit unit; 118~general register;

122~安全存储区;              124~密钥寄存器文档;122~secure storage area; 124~key register file;

128~标志寄存器;              132~微代码单元;128~flag register; 132~microcode unit;

134~提取地址;                142~主密钥寄存器;134~extraction address; 142~master key register;

144~控制寄存器;              148~E位;144~control register; 148~E bit;

152~密钥扩展器;              154~多工器;152~key expander; 154~multiplexer;

156~异逻辑;                  162~纯文字指令数据;156~different logic; 162~plain text instruction data;

164~提取指令产生器;          172~两组密钥;164~extract instruction generator; 172~two sets of keys;

174~解密密钥;                176~多位的二进位零值;174~decryption key; 176~multi-digit binary zero value;

178~多工器154的输出;178~the output of multiplexer 154;

212~多工器A;                 214~多工器B;212~multiplexer A; 214~multiplexer B;

216~旋转器;                  218~加法/减法器;216~rotator; 218~addition/subtractor;

234~第一密钥;                236~第二密钥;234~the first key; 236~the second key;

238~旋转器的输出;            302-316~步骤方块;238~rotator output; 302-316~step block;

402~E位字段;402~E bit field;

408~多个位的标准x86标志;408~multiple standard x86 flags;

500~密钥载入指令;            502~操作码;500~Key loading instruction; 502~Operation code;

504~密钥寄存器文档目标地址;504~key register file target address;

506~安全存储区来源地址;506~source address of safe storage area;

600~密钥切换指令;            602~操作码;600~Key switching instruction; 602~Operation code;

604~密钥寄存器文档索引;604~key register document index;

702-708~方块步骤;           800~存储器用量;702-708~block steps; 800~memory usage;

900~分支与切换密钥指令;900~branch and switch key instructions;

902~操作码;                 904~密钥寄存器文档索引;902~operation code; 904~key register document index;

906~分支信息;               1002-1018~步骤方块;906~branch information; 1002-1018~step block;

1102-1106~步骤方块;         1200~分支与切换密钥指令;1102-1106~step block; 1200~branch and switch key instruction;

1202~操作码;                1300~块地址范围表:1202~operation code; 1300~block address range table:

1302~地址范围;              1304~密钥寄存器文档索引;1302~address range; 1304~key register document index;

1402-1418~步骤方块;         1500~分支与切换密钥指令;1402-1418~step block; 1500~branch and switch key instructions;

1502~操作码;                1600~块地址范围表:1502~operation code; 1600~block address range table:

1604~安全存储区地址;1604~safe storage area address;

1714~步骤方块;              1802-1806~步骤方块;1714~step block; 1802-1806~step block;

1902-1944~步骤方块;         2002-2008~步骤方块;1902-1944 ~ step block; 2002-2008 ~ step block;

2104~索引;                  2202-2216~步骤方块;2104~index; 2202-2216~step block;

2302-2316~步骤方块;         2402~淘汰位;2302-2316~step square; 2402~elimination bit;

2506~步骤方块;              2607、2609~步骤方块;2506~step block; 2607, 2609~step block;

2702~分支目标地址高速缓冲存储器(BTAC);2702~branch target address cache memory (BTAC);

2706~目标地址;              2708~采用/不采用指标;2706~target address; 2708~use/not use indicators;

2712~密钥切换逻辑;          2714~型式指标;2712~key switching logic; 2714~type index;

2716~密钥寄存器文档索引;2716~key register document index;

2802~BTAC阵列;              2808~BTAC单元;2802~BTAC array; 2808~BTAC unit;

2902~有效位;                2904~标记字段;2902~effective bit; 2904~mark field;

2906~目标地址;              2908~采用/不采用字段;2906~target address; 2908~use/not use field;

2912~密钥寄存器文档索引;2912~key register document index;

2914~型式字段;              3002-3004~步骤方块;2914~type field; 3002-3004~step block;

3102-3116~步骤方块;         3208-3222~步骤方块;以及3102-3116~step blocks; 3208-3222~step blocks; and

ZEROS~多位的二进位零值。ZEROS - multi-digit binary zero value.

具体实施方式Detailed ways

参阅图1,一方块图图解根据本发明技术所实现的一微处理器100。微处理器100包括一管线(pipeline),其中包括一指令高速缓冲存储器(instruction cache)102、一提取单元(fetch unit)104、一解码单元(decodeunit)108、一执行单元(execution unit)112、以及一引出单元(retire unit)114。微处理器100还包括一微代码单元(microcode unit)132,用以提供微代码指令(microcode instructions)给该执行单元112。微处理器100还包括通用寄存器(general purpose registers)118以及标志寄存器(EFLAGS register)128,以提供指令运算元(instruction operands)给执行单元112。而且,通过引出单元114,将指令执行结果更新于通用寄存器118以及标志寄存器128。在一种实施方式中,标志寄存器128是由传统x86标志寄存器修改实现,详细实施方式将于后续篇幅说明。Referring to FIG. 1, a block diagram illustrates a microprocessor 100 implemented in accordance with the techniques of the present invention. The microprocessor 100 includes a pipeline (pipeline), which includes an instruction cache (instruction cache) 102, a fetch unit (fetch unit) 104, a decoding unit (decodeunit) 108, an execution unit (execution unit) 112, and a retire unit 114 . The microprocessor 100 also includes a microcode unit 132 for providing microcode instructions to the execution unit 112 . The microprocessor 100 also includes general purpose registers 118 and flag registers (EFLAGS register) 128 for providing instruction operands to the execution unit 112 . Furthermore, the command execution result is updated in the general register 118 and the flag register 128 through the export unit 114 . In one implementation manner, the flag register 128 is realized by modifying the traditional x86 flag register, and the detailed implementation manner will be described later.

提取单元104自指令高速缓冲存储器102提取指令数据(instruction data)106。提取单元104操作于两种模式:一为解密模式(decryption mode),另一为纯文字模式(plain text mode)。提取单元104内一控制寄存器(control register)144的一E位(E bit)148决定该提取单元104是操作于解密模式(设定E位)、或操作于纯文字模式(清空E位)。纯文字模式下,提取单元104视自该指令高速缓冲存储器102所提取出的指令数据106为未加密、或纯文字指令数据,因此,不对指令数据106作解密。然而,在解密模式下,提取单元104视自该指令高速缓冲存储器102所提取出的指令数据106为加密指令数据,因此,需使用该提取单元104的一主密钥寄存器(master key register)142所储存的解密密钥(decryption keys)将之解密为纯文字指令数据,详细技术内容将参考图2以及图3进行讨论。The fetch unit 104 fetches instruction data (instruction data) 106 from the instruction cache 102 . The extraction unit 104 operates in two modes: one is a decryption mode, and the other is a plain text mode. An E bit (E bit) 148 of a control register (control register) 144 in the extraction unit 104 determines whether the extraction unit 104 operates in a decryption mode (setting the E bit) or operating in a plain text mode (clearing the E bit). In the plain text mode, the fetching unit 104 regards the command data 106 fetched from the command cache 102 as unencrypted or plain text command data, and therefore does not decrypt the command data 106 . However, in the decryption mode, the fetching unit 104 regards the command data 106 extracted from the command cache memory 102 as encrypted command data, therefore, a master key register (master key register) 142 of the fetching unit 104 needs to be used The stored decryption keys (decryption keys) decrypt it into plain text instruction data. The detailed technical content will be discussed with reference to FIG. 2 and FIG. 3 .

提取单元104亦包括一提取指令产生器(fetch address generator)164,用以产生一提取地址(fetch address)134,以自该指令高速缓冲存储器102提取指令数据106。提取地址134还供应给提取单元104的一密钥扩展器(key expander)152。密钥扩展器152自主密钥暂存142中选取两组密钥172,并对其实施运算以产生一解密密钥174,作为多工器154的第一输入。多工器154的第二输入为多位的二进位零值(binary zeros)176。E位148控制多工器154。若E位148被设定,多工器154选择输出该加密密钥174。若E位148被清除,多工器154选择输出多位的二进位零值176。多工器154的输出178将供应给异逻辑156作为其第一输入。异逻辑156负责对提取的指令数据106以及多工器输出178施行布林异或运算(Boolean exclusive-OR,XOR),以产生纯文字指令数据162。加密的指令数据106乃预先以异逻辑将其原本的纯文字指令数据以一加密密钥进行加密,其中该加密密钥的数值与该解密密钥174相同。提取单元104的详细实施方式将结合图2以及图3内容于稍后叙述。The fetch unit 104 also includes a fetch address generator 164 for generating a fetch address 134 for fetching the command data 106 from the command cache 102 . The extraction address 134 is also supplied to a key expander 152 of the extraction unit 104 . The key expander 152 selects two sets of keys 172 from the temporary key storage 142 and performs operations on them to generate a decryption key 174 as a first input of the multiplexer 154 . The second input of the multiplexer 154 is a multi-bit binary zeros 176 . The E bit 148 controls the multiplexer 154 . If the E bit 148 is set, the multiplexer 154 selects the encryption key 174 for output. If the E bit 148 is cleared, the multiplexer 154 selects the output multi-bit binary zero value 176 . The output 178 of the multiplexer 154 will be supplied to the exclusive logic 156 as its first input. The exclusive logic 156 is responsible for performing a Boolean exclusive-OR (Boolean exclusive-OR, XOR) operation on the extracted command data 106 and the multiplexer output 178 to generate the plain text command data 162 . The encrypted instruction data 106 is pre-encrypted with the original plain text instruction data using exclusive logic with an encryption key, wherein the value of the encryption key is the same as that of the decryption key 174 . The detailed implementation of the extracting unit 104 will be described later in conjunction with FIG. 2 and FIG. 3 .

纯文字指令数据162将供应给解码单元108。解码单元108负责将纯文字指令数据162的串流解码、并分割为多个X86指令,交由执行单元112执行。在一种实施方式中,解码单元108包括缓冲器(buffers)或队列(queus),以在解码之前或期间,缓冲存储的纯文字指令数据162的串流。在一种实施方式中,解码单元108包括一指令转译器(instruction translator),用以将X86指令转译为微指令microinstructions或micro-ops,交由执行单元112执行。解码单元108输出指令时,更会针对各指令输出一位值,该位值乃伴随该指令沿所述管线结构一路行进而至,用以指示该指令是否为加密指令。该位值将控制该执行单元112以及该引出单元114,使的根据该指令自该指令高速缓冲存储器102取出时是加密指令或纯文字指令而进行决策并且采取动作。在一种实施方式中,纯文字指令不被允许执行专供指令解密模式设计的特定操作。The plain text instruction data 162 will be supplied to the decoding unit 108 . The decoding unit 108 is responsible for decoding the stream of plain text instruction data 162 and dividing it into a plurality of X86 instructions for execution by the execution unit 112 . In one embodiment, the decoding unit 108 includes buffers or queues to buffer the stored stream of plain text instruction data 162 before or during decoding. In one embodiment, the decoding unit 108 includes an instruction translator for translating X86 instructions into microinstructions or micro-ops, which are executed by the execution unit 112 . When the decoding unit 108 outputs instructions, it will output a bit value for each instruction, and the bit value is accompanied by the instruction along the pipeline structure to indicate whether the instruction is an encrypted instruction. The bit value will control the execution unit 112 and the fetch unit 114 to make decisions and take actions according to whether the instruction is an encrypted instruction or a plain text instruction when fetched from the instruction cache 102 . In one embodiment, plain text instructions are not allowed to perform specific operations designed for the instruction decryption mode.

在一种实施方式中,微处理器100为一x86架构处理器,然而,微处理器100也可以其他架构的处理器实现。若一处理器可正确执行设计给x86处理器执行的大多数应用程序,则视之为x86架构的处理器。若应用程序执行后可获得预期结果,则可判断该应用程序是被正确执行。特别是,微处理器100是执行x86指令集的指令,且具有x86用户可用寄存器组(x86 user-visible register set)。In one embodiment, the microprocessor 100 is an x86 architecture processor, however, the microprocessor 100 can also be implemented by a processor of other architectures. A processor is considered an x86 architecture processor if it can correctly execute most applications designed for x86 processors. If the expected result can be obtained after the application program is executed, it can be judged that the application program is executed correctly. In particular, the microprocessor 100 executes instructions of the x86 instruction set, and has an x86 user-visible register set (x86 user-visible register set).

在一种实施方式中,微处理器100设计成供应一复合安全架构(comprehensive security architecture)-称为安全执行模式(secure execution mode,简称SEM)-以于其中执行程序。根据一种实施方式,SEM程序的执行可由数种处理器事件(processor events)引发,且不受一般(非SEM)操作封锁。以下举例说明限定于SEM下执行的程序所实现的功能,其中包括关键安全任务(critical security tasks)如:凭证核对以及数据加密、系统软件活动监控、系统软件完整性验证、资源使用追踪、新软件的安装控制...等。关于SEM的实施方式请参考本公司于2008年10月31日申请的美国专利申请案,案号12/263,131,(美国专利公开号为2009-0292893,于2009年11月26日公开);该案的优先权主张溯及2008年5月24日的美国专利临时申请案(案号61/055,980);本申请案相关技术部份可参照上述案件内容。在一种实施方式中,用于存储SEM数据为安全非易失性存储器(未显示在图示)-如高速缓冲存储器(flash memory)-可用于存储解密密钥,并藉由一隔离串行总线(private serial bus)耦接微处理器100,且其中所有数据乃AES加密(AES-encrypted)且经过签署验正(signature-verified)的。在一种实施方式中,微处理器100包括少量的单一次写入性非易失性存储器(non-volatile write-once memory,未显示于图示),用于存储解密密钥;其中一种实施方式可参考美国专利案7,663,957所揭示的一熔丝型非易失性存储器;可参照上述案件内容应用于本发明。本发明所揭示的指令解密特征的其中一项优点为:扩展安全执行模式(SEM)的应用范围,使安全性程序(secure program)得以存储在微处理器100外的存储器,无须限定完整存储于微处理器100内部。因此,安全性程序可利用存储器阶层架构所提供的完整空间以及功能。在一种实施方式中,部分或全部的结构性异常/中断(architectural exceptions/interrupts,例如,页面错误page faults、除错中断点debug breakpoints)...等,在SEM模式下是除能(disable)的。在一种实施方式中,部分或全部的结构性异常/中断在解密模式(即E位148为设定)下是除能(disable)的。In one embodiment, the microprocessor 100 is designed to provide a comprehensive security architecture (called a secure execution mode (SEM)) for executing programs therein. According to one embodiment, the execution of the SEM program can be triggered by several processor events and is not blocked from normal (non-SEM) operations. The following examples illustrate the functions implemented by programs that are limited to execution under the SEM, including critical security tasks such as: credential verification and data encryption, system software activity monitoring, system software integrity verification, resource usage tracking, new software The installation control of ...etc. Please refer to the U.S. patent application filed by our company on October 31, 2008 for the implementation of the SEM, case number 12/263,131, (U.S. Patent Publication No. 2009-0292893, published on November 26, 2009); The priority claim of the case can be traced back to the US Patent Provisional Application (Case No. 61/055,980) dated May 24, 2008; the relevant technical parts of this application can refer to the content of the above case. In one embodiment, the secure non-volatile memory (not shown) used to store the SEM data - such as a flash memory - can be used to store the decryption key and is accessed via an isolated serial The bus (private serial bus) is coupled to the microprocessor 100, and all data therein are AES-encrypted and signed-verified. In one embodiment, microprocessor 100 includes a small amount of single write-once non-volatile memory (non-volatile write-once memory, not shown in the figure) for storing decryption keys; one of For the implementation manner, reference may be made to a fuse type non-volatile memory disclosed in US Pat. No. 7,663,957; the contents of the above cases may be referred to and applied to the present invention. One of the advantages of the instruction decryption feature disclosed by the present invention is that it expands the scope of application of the Secure Execution Mode (SEM), so that the secure program (secure program) can be stored in the memory outside the microprocessor 100, and there is no need to limit the complete storage in the memory. Inside the microprocessor 100 . Thus, security programs can take advantage of the full space and functionality provided by the memory hierarchy. In one embodiment, some or all of the structural exceptions/interrupts (architectural exceptions/interrupts, for example, page faults, debug breakpoints, debug breakpoints)... etc. are disabled in SEM mode. )of. In one embodiment, some or all of the structural exceptions/interrupts are disabled in decrypted mode (ie, E bit 148 is set).

微处理器100还包括一密钥寄存器文档(key register file)124。密钥寄存器文档124包括多个寄存器,其中储存的密钥可藉由密钥切换指令(switch key instruction,后续讨论之)载入提取单元104的主密钥寄存器142,以解密所提取的加密指令数据106。The microprocessor 100 also includes a key register file 124 . The key register file 124 includes a plurality of registers, and the key stored therein can be loaded into the master key register 142 of the extraction unit 104 by a key switching instruction (switch key instruction, discussed later) to decrypt the extracted encrypted instruction Data 106.

微处理器100还包括一安全存储区(secure memory area,简写为SMA)122,用于存储解密密钥,该解密密钥待经图5所示的密钥载入指令(load key instruction)500进而载入密钥寄存器文档124。在一种实施方式中,安全存储区122限定以SEM程序存取。也就是说,安全存储区122不可藉一般执行模式(非SEM)下所执行的程序存取。此外,安全存储区122也不可藉处理器总线存取,且不属于微处理器100的高速缓冲存储器阶层的一部份。因此,举例说明之,高速缓冲清空操作(cache flush operation)不会导致安全存储区122的内容写入存储器。关于安全存储区122的读写,微处理器100指令集架构中设计有特定指令。一种实施方式是在安全存储区122中设计一隔离式随机存取存储器(private RAM),相关技术内容可参考2008年2月20日申请的美国专利申请案12/034,503(该案于2008年10月16日公开,公开号为2008/0256336);可参照上述案件内容应用于本发明。The microprocessor 100 also includes a secure memory area (secure memory area, abbreviated as SMA) 122 for storing the decryption key, which is to be loaded by the key loading instruction (load key instruction) 500 shown in FIG. The key register file 124 is then loaded. In one embodiment, the secure storage area 122 is restricted to be accessed by the SEM program. That is to say, the secure storage area 122 cannot be accessed by programs executed in the normal execution mode (non-SEM). Furthermore, the secure memory area 122 is also inaccessible via the processor bus and is not part of the cache memory hierarchy of the microprocessor 100 . Therefore, for example, a cache flush operation does not cause the contents of the secure storage area 122 to be written into memory. Regarding the reading and writing of the secure storage area 122 , specific instructions are designed in the instruction set architecture of the microprocessor 100 . One embodiment is to design an isolated random access memory (private RAM) in the safe storage area 122. For related technical content, reference can be made to U.S. patent application 12/034,503 filed on February 20, 2008 (this case was filed in 2008 It was published on October 16, and the publication number is 2008/0256336); it can be applied to the present invention with reference to the content of the above case.

起先,操作系统或其他特权程序(privileged program)下载密钥的初始化设定于该安全存储区122、密钥寄存器文档124、以及主密钥寄存器142。微处理器100起先会以该密钥的初始化设定以解密一加密程序。此外,加密程序本身可接续写入新的密钥至安全存储区122、并自安全存储区122将密钥载入密钥寄存器文档124(藉由密钥载入指令)、且自密钥寄存器文档124将密钥载入主密钥寄存器142(藉由密钥切换指令)。所述操作的优势在于:所揭示的密钥切换指令使得加密程序在执行当下得以切换解密密钥组(on-the-fly switching),以下将详述之。新的密钥可由加密程序指令自身的即时数据组成。在一种实施方式中,程序文档标头的一字段会指示程序指令是否为加密型式。Initially, an operating system or other privileged program download key is initially set in the secure storage area 122 , the key register file 124 , and the master key register 142 . The microprocessor 100 first decrypts an encrypted program with the initial setting of the key. In addition, the encryption program itself can then write new keys to the secure storage area 122, and from the secure storage area 122, load the key into the key register file 124 (by the key load command), and from the key register Document 124 loads the key into master key register 142 (via a key switch command). The advantage of the operation is that the disclosed key switching instruction enables on-the-fly switching of the encryption program during execution, which will be described in detail below. The new key can consist of the instant data of the encryption program instruction itself. In one embodiment, a field in the header of the program file indicates whether the program instructions are in encrypted form.

图1所描述的技术有多项优点。第一,自加密指令数据106所解密出来的纯文字指令数据无法由微处理器100外部获得。The technique described in Figure 1 has several advantages. First, the plain text command data decrypted from the encrypted command data 106 cannot be obtained outside the microprocessor 100 .

第二,提取单元104提取加密指令数据所需的时间与提取纯文字指令数据所需的时间相同。此特色关系着安全与否。反之,若有时间差存在,黑客可藉此破解加密技术。Second, the extraction unit 104 takes the same time to extract encrypted instruction data as it takes to extract plain text instruction data. This feature is related to safety or not. Conversely, if there is a time difference, hackers can use this to break the encryption technology.

第三,相较于传统设计,本发明所揭示的指令解密技术不会额外增加提取单元104所耗的时钟数量。如以下讨论,密钥扩展器152增加解密密钥的有效长度,该解密密钥用于解密一加密程序,且此方式不会使提取加密程序数据所需的时间长于提取纯文字程序数据所需的时间。特别是,因为密钥扩展器152的运作限时于以提取地址134查表该指令高速缓冲存储器102获得指令数据106之内完成,密钥扩展器152并不会增加一般的提取程序的时间。此外,因为多工器154以及密钥扩展器152一并限时于以提取地址134查表该指令高速缓冲存储器102获得指令数据106之内完成,故不会增加一般的提取程序的时间。异逻辑156是唯一添加于一般提取路径的逻辑运算,所幸异操作156的传播延迟相当小,不会增加工作周期。因此,本发明所揭示的指令解密技术不会增加提取单元104时钟数量负担。此外,相较于一般技术所应用于解密指令数据106的复杂解密机制,例如S盒(S-boxes),一般技术会增加提取以及解码指令数据106时所需的工作周期且/或所消耗的时钟数量。Third, compared with the traditional design, the instruction decryption technique disclosed in the present invention does not increase the number of clocks consumed by the fetch unit 104 additionally. As discussed below, key expander 152 increases the effective length of the decryption key used to decrypt an encrypted program in such a way that extraction of encrypted program data does not take longer than extraction of plain text program data time. In particular, because the operation of the key expander 152 is time-limited to be completed within the instruction data 106 obtained by looking up the instruction cache memory 102 with the fetch address 134, the key expander 152 does not increase the time of the general fetch procedure. In addition, because the multiplexer 154 and the key expander 152 are both completed within the time limit for obtaining the command data 106 by looking up the command cache memory 102 with the fetch address 134, the time of the general fetch procedure will not be increased. The exclusive logic operation 156 is the only logical operation added to the general extraction path. Fortunately, the propagation delay of the exclusive logic operation 156 is quite small and does not increase the duty cycle. Therefore, the instruction decryption technique disclosed in the present invention will not increase the burden on the number of clocks of the fetch unit 104 . In addition, compared to the complex decryption mechanism, such as S-boxes, applied to the decryption data 106 by the conventional technology, the conventional technology will increase the duty cycle required to fetch and decode the command data 106 and/or consume number of clocks.

接着,参考图2,一方块图详细图解图1的提取单元104。特别是,图1的密钥扩展器152也详细图列其中。先前已讨论采用异逻辑解密上述加密指令数据106的优点。然而,快且小的异逻辑有其缺点:若加密/解密密钥被重复使用,则异逻辑属于一种脆弱加密方法(weak encryption method)。不过,若密钥的有效长度等同所欲加密/解密的程序的长度,异逻辑加密会是一种强度极高的加密技术。微处理器100的特征在于可增长解密密钥的有效长度,以降低密钥重复使用的需求。第一,主密钥寄存器142所储存的数值(文档)为中大型尺寸:在一种实施方式中,其尺寸等同自指令高速缓冲存储器102所取出的指令数据106的提取量、或区块尺寸,为128位(16字节)。第二,加密扩展器152用于增长解密密钥的有效长度,例如,增至一实施方式所揭示的2084字节,将于后续篇幅详述。第三,加密程序可藉由密钥切换指令(或其变形)在操作中改变主密钥寄存器142内的数值,之后段落将详述之。Next, referring to FIG. 2 , a block diagram illustrates the extraction unit 104 of FIG. 1 in detail. In particular, the key expander 152 of FIG. 1 is also shown in detail. The advantages of using exclusive logic to decrypt the above-mentioned encrypted instruction data 106 have been discussed previously. However, fast and small XOR has its disadvantages: XOR is a weak encryption method if the encryption/decryption key is reused. However, if the effective length of the key is equal to the length of the program to be encrypted/decrypted, heterological encryption will be a very strong encryption technique. The microprocessor 100 features the ability to increase the effective length of the decryption key to reduce the need for key reuse. First, the value (file) stored in the master key register 142 is medium to large in size: in one embodiment, its size is equivalent to the extraction amount or block size of the instruction data 106 fetched from the instruction cache memory 102 , which is 128 bits (16 bytes). Second, the encryption extender 152 is used to increase the effective length of the decryption key, for example, to 2084 bytes disclosed in an embodiment, which will be described in detail later. Third, the encryption program can change the value in the master key register 142 during operation through the key switching command (or its variant), which will be described in detail in the following paragraphs.

在图2所示实施方式中,使用了五个主密钥寄存器142,编号0-4。然而,在其他实施方式中,也可以较少或较多量的主密钥寄存器142数量增长解密密钥长度。例如,一种实施方式采用12个主密钥寄存器142。密钥扩充器152包括一第一多工器A 212以及一第二多工器B 214,用以接收主密钥寄存器142所供应的密钥。提取地址134的部分内容用于控制多工器212/214。在图2所示实施方式中,多工器B 214为三转一多工器,而多工器A 212为四转一多工器。表格1显示多工器212/214如何根据各自的选择输入选取这些主密钥寄存器142(以上述编号识别)。表格2显示上述选择输入的产生方式,以及基于提取地址134的位[10:8]所呈的主密钥寄存器142组合。In the embodiment shown in Figure 2, five master key registers 142, numbered 0-4, are used. However, in other embodiments, the decryption key length may be increased by a smaller or larger number of master key registers 142 . For example, one embodiment employs 12 master key registers 142 . The key expander 152 includes a first multiplexer A 212 and a second multiplexer B 214 for receiving the key supplied by the master key register 142. Portions of address 134 are extracted for use in controlling multiplexers 212/214. In the embodiment shown in FIG. 2, the multiplexer B 214 is a three-turn-one multiplexer, and the multiplexer A 212 is a four-turn-one multiplexer. Table 1 shows how the multiplexers 212/214 select these master key registers 142 (identified by the numbers above) according to their respective select inputs. Table 2 shows how the above select inputs are generated, and the master key register 142 combination based on bits [10:8] of the fetch address 134 .

Figure BDA0000063520770000141
Figure BDA0000063520770000141

表格1Table 1

Figure BDA0000063520770000151
Figure BDA0000063520770000151

表格2Form 2

多工器B 214的输出236是供应给加法/减法器218。多工器A 212的输出234是供应给一旋转器(rotator)216。旋转器216接收提取地址134的位[7:4],据以旋转多工器输出234,决定旋转的字节数量。在一种实施方式中,提取地址134的位[7:4]在供应给旋转器216控制旋转的字节数量前增量,以上述表格3显示。旋转器216的输出238是供应给加法/减法器218。加法器/减法器218接收提取地址134的位[7]。若该位[7]为清空,加法/减法器218将旋转器216的输出238自多工器B 214的输出236减去。若该位[7]为设定,加法/减法器218将旋转器216的输出238加上多工器B 214的输出236。加法/减法器218的输出即图1所示的解密密钥174,将供应给多工器154。以下以图3的流程图详述相关技术。The output 236 of the multiplexer B 214 is supplied to the adder/subtractor 218. The output 234 of the multiplexer A 212 is supplied to a rotator 216. The rotator 216 receives bits [7:4] of the fetch address 134 and rotates the multiplexer output 234 accordingly to determine the number of bytes to rotate. In one embodiment, bits [7:4] of the fetch address 134 are incremented by the number of bytes supplied to the rotator 216 to control the rotation, as shown in Table 3 above. The output 238 of the rotator 216 is supplied to the adder/subtractor 218 . Adder/subtractor 218 receives bit[7] of fetch address 134 . If the bit [7] is clear, the adder/subtractor 218 subtracts the output 238 of the rotator 216 from the output 236 of the multiplexer B 214. If bit [7] is set, the adder/subtractor 218 adds the output 238 of the rotator 216 to the output 236 of the multiplexer B 214. The output of the adder/subtractor 218 , the decryption key 174 shown in FIG. 1 , is supplied to the multiplexer 154 . The related technology will be described in detail below with the flowchart of FIG. 3 .

接着,参阅图3,一流程图基于本发明技术图解图2提取单元104的操作。流程始于方块302。Next, referring to FIG. 3 , a flowchart illustrates the operation of the extraction unit 104 in FIG. 2 based on the technology of the present invention. Flow begins at block 302 .

在方块302,提取单元104以提取地址134读取指令高速缓冲存储器102,以开始提取一16字节的区块的指令数据106。指令数据106可为加密状态或为纯文字状态,视指令数据106是为一加密程序或一纯文字程序的一部分而定,由E位148标示。流程接着进入方块304。At block 302 , the fetch unit 104 reads the instruction cache 102 with the fetch address 134 to start fetching a 16-byte block of instruction data 106 . The command data 106 can be encrypted or plain text, depending on whether the command data 106 is part of an encrypted program or a plain text program, which is indicated by the E bit 148 . The flow then goes to block 304 .

参考方块304,根据提取地址134较高的数个位,多工器A 212以及多工器B 214分别自主密钥寄存器142所供应的密钥172中选取出一第一密钥234以及一第二密钥236。在一种实施方式中,提取地址134所供应的该些位施加于多工器212/214,以产生特定的密钥对(234/236 key pair)组合。在图2所示的实施方式中,所供应的主密钥寄存器142数量为5,因此,存在10组可能的密钥对。为了简化硬件设计,仅使用了其中8组;此设计将供应2048字节的有效密钥,将于后续段落详细讨论。然而,其他实施方式也可能使用其他数量的密钥寄存器142。以供应12个主密钥寄存器142的实施方式为例,主密钥寄存器142的可能组合有66组,若采用其中64组,所产生的有效密钥将为16384字节。整体而言,假设上述多个密钥数值总量为K(例如:5,且采用全部组合),该解密密钥、以及上述多个密钥数值各自的长度为W字节(例如:16字节),则产生的有效密钥将为W2*(K!/(2*(K-2)!))字节。流程接着进入方块306。Referring to block 304, according to the higher bits of the extracted address 134, the multiplexer A 212 and the multiplexer B 214 select a first key 234 and a first key 234 from the key 172 supplied by the main key register 142 respectively. Second key 236. In one embodiment, the bits provided by the extraction address 134 are applied to the multiplexer 212/214 to generate a specific key pair (234/236 key pair) combination. In the embodiment shown in FIG. 2, the number of master key registers 142 provisioned is five, so there are ten possible sets of key pairs. To simplify the hardware design, only 8 of these groups are used; this design will supply a valid key of 2048 bytes, which will be discussed in detail in subsequent paragraphs. However, other implementations may use other numbers of key registers 142 . Taking the embodiment of supplying 12 master key registers 142 as an example, there are 66 possible combinations of master key registers 142, and if 64 of them are used, the generated effective key will be 16384 bytes. In general, assuming that the total number of the above-mentioned multiple key values is K (for example: 5, and all combinations are used), the length of the decryption key and the above-mentioned multiple key values is W bytes (for example: 16 words section), then the resulting effective key will be W 2 *(K!/(2*(K-2)!)) bytes. The process then proceeds to block 306 .

在方块306,基于提取地址134的位[7:4],旋转器216使第一密钥234旋转相应数量的字节。例如,若提取地址134的位[7:4]为数值9,旋转器216将第一密钥234朝右旋转9个字节。流程接着进入方块308。At block 306 , based on bits [7:4] of the extraction address 134 , the rotator 216 rotates the first key 234 by a corresponding number of bytes. For example, if bits [7:4] of the extraction address 134 have a value of 9, the rotator 216 rotates the first key 234 to the right by 9 bytes. The flow then goes to block 308 .

在方块308,加法/减法器218将旋转后的第一密钥238加至/减自该第二密钥236,以产生图1的解密密钥174。在一种实施方式中,若提取地址134的位[7]为1,则加法/减法器218将旋转后的第一密钥234加至该第二密钥236;若提取地址134的位[7]为0,则加法/减法器218将旋转后的第一密钥234自该第二密钥236减去。接着,流程进入方块312。At block 308 , the adder/subtractor 218 adds/subtracts the rotated first key 238 to/from the second key 236 to generate the decryption key 174 of FIG. 1 . In one embodiment, if the bit [7] of the extraction address 134 is 1, the adder/subtractor 218 adds the rotated first key 234 to the second key 236; if the bit [7] of the extraction address 134 is [ 7] is 0, the adder/subtractor 218 subtracts the rotated first key 234 from the second key 236 . Then, the process enters block 312 .

在决策方块312,多工器154根据其控制信号判断所提取的该区块的指令数据106是来自一加密程序或一纯文字程序,所述控制信号来自控制寄存器144所供应的位E 148。若指令数据106为加密状态,流程进入方块314,反之,则流程进入方块316。In the decision block 312, the multiplexer 154 judges whether the extracted command data 106 of the block is from an encrypted program or a plain text program according to its control signal from the bit E 148 supplied by the control register 144. If the instruction data 106 is encrypted, the process enters block 314 , otherwise, the process enters block 316 .

在方块314,多工器154选择输出解密密钥174,且异逻辑156令加密指令数据106以及解密密钥174进行一布林异运算,以产生图1的纯文字指令数据162。流程止于方块314。At block 314 , the multiplexer 154 selects the output decryption key 174 , and the exclusive logic 156 performs a Boolean XOR operation on the encrypted command data 106 and the decryption key 174 to generate the plain text command data 162 of FIG. 1 . Flow ends at block 314 .

在方块316,多工器154选择输出16字节的二进位零值176,且异逻辑156令指令数据106(为纯文字)以及该16字节的二进位零值进行一布林异运算,以产生同样的纯文字指令数据162。流程止于此方块316。In block 316, the multiplexer 154 selects to output the 16-byte binary zero value 176, and the exclusive logic 156 makes the command data 106 (which is plain text) and the 16-byte binary zero value perform a Boolean XOR operation, to generate the same plain text instruction data 162. The flow ends at this block 316 .

参考图2以及图3所揭示内容,解密密钥174供应给所提取的该区块指令数据106进行异运算,且该解密密钥174是所选取的主密钥对234/236以及提取地址134的函数。相比于传统解密程序-使解密密钥为先前密钥值的一函数,其中持续修正密钥以供应新的在下一次工作区间使用-本发明所揭示的解密技术完全不同。以主密钥对234/236以及提取地址134为函数获得解密密钥174的方式有至少以下两种优点。第一,如以上所讨论,加密指令数据以及纯文字指令数据106的提取耗时相当,不会增加微处理器100所需的工作时钟。第二,遇到程序中的分支指令(branch instruction),提取指令数据106所需的时间不会增加。在一种实施方式中,一分支预测器(branch predictor)接收提取地址134,并预测该提取地址134所指的该区块的指令数据106是否存在一分支指令,并预测其方向以及目标地址。以图2所示实施方式为例,产出的解密密钥174是主密钥对234/236以及提取地址134的一函数,将在目标地址所指的该区块指令数据106送抵该异逻辑156的同一时间产出预测的目标地址的适当解密密钥174。与传统解密密钥运算手法针对目标地址计算解密密钥所必须的多个「倒带(rewind)」步骤相较,本发明所揭示技术在处理加密指令数据时不会产生额外的延迟。2 and 3, the decryption key 174 is supplied to the extracted block command data 106 for exclusive operation, and the decryption key 174 is the selected master key pair 234/236 and the extraction address 134 The function. Compared to traditional decryption procedures - making the decryption key a function of previous key values, where the key is continuously revised to provide new ones for the next working interval - the decryption technique disclosed in the present invention is completely different. The method of obtaining the decryption key 174 as a function of the master key pair 234/236 and the extraction address 134 has at least the following two advantages. First, as discussed above, the extraction of the encrypted command data and the plain text command data 106 takes the same amount of time and does not increase the operating clock required by the microprocessor 100 . Second, the time required to fetch instruction data 106 does not increase when a branch instruction (branch instruction) in the program is encountered. In one embodiment, a branch predictor (branch predictor) receives the fetch address 134, and predicts whether there is a branch instruction in the instruction data 106 of the block pointed by the fetch address 134, and predicts its direction and target address. Taking the embodiment shown in FIG. 2 as an example, the decryption key 174 produced is a function of the master key pair 234/236 and the extraction address 134, and the block instruction data 106 pointed to by the target address is sent to the corresponding block. At the same time the logic 156 produces the appropriate decryption key 174 for the predicted target address. Compared with the multiple "rewind" steps necessary to calculate the decryption key for the target address in the traditional decryption key calculation method, the technology disclosed in the present invention does not generate additional delay when processing encrypted command data.

另外,如图2以及图3所示,密钥扩展器152的旋转器216以及加法/减法器218的联合设计,使得解密密钥长度有效扩展,超越主密钥的长度。例如,主密钥共贡献32字节(2*16字节);更甚者,以黑客企图判断解密密钥174为何的角度而言,旋转器216以及加法/减法器218有效地将位于主密钥寄存器142的32字节的主密钥扩展为256字节的密钥序列。更具体地说,有效扩展后的密钥序列的字节n为:In addition, as shown in FIG. 2 and FIG. 3 , the combined design of the rotator 216 and the adder/subtractor 218 of the key expander 152 makes the length of the decryption key effectively extend beyond the length of the master key. For example, the master key contributes a total of 32 bytes (2*16 bytes); moreover, from the perspective of a hacker attempting to determine what the decryption key 174 is, the rotator 216 and the adder/subtractor 218 will effectively be located in the master key. The 32-byte master key of the key register 142 is expanded into a 256-byte key sequence. More specifically, byte n of the effective extended key sequence is:

kk 00 nno ±± kk 11 nno ++ xx

Figure BDA0000063520770000172
为第一主密钥234的字节n,且
Figure BDA0000063520770000173
为第二主密钥的字节n+x。如上所述,密钥扩展器152所产生的前八套16字节解密密钥174是由减法方式产生,且后八套是由加法方式产生。具体来说,选定的主密钥对234/236各自所提供的字节内容用于为16个连续的16字节区块的指令数据各个字节产生解密密钥174字节,详情请见表格3。举例说明,表格3第1列的符号”15-00”表示第二主密钥236的字节0的内容会经8位算数运算(an eight-bit arithmetic operation)自第一主密钥234的字节15减去,以获得一字节的有效解密密钥174,用以与一16字节区块的指令数据106中的字节15进行异运算。
Figure BDA0000063520770000172
is byte n of the first master key 234, and
Figure BDA0000063520770000173
is byte n+x of the second master key. As mentioned above, the first eight sets of 16-byte decryption keys 174 generated by the key expander 152 are generated by subtraction, and the last eight sets are generated by addition. Specifically, the byte content provided by the selected master key pair 234/236 is used to generate a decryption key 174 bytes for each byte of instruction data of 16 consecutive 16-byte blocks. For details, see Form 3. For example, the symbol "15-00" in the first column of Table 3 indicates that the content of byte 0 of the second master key 236 will be obtained from the first master key 234 through 8-bit arithmetic operation (an eight-bit arithmetic operation) Byte 15 is subtracted to obtain a one-byte effective decryption key 174 for exclusive operation with byte 15 in command data 106 of a 16-byte block.

15-00 14-15 13-14 12-13 11-12 10-11 09-10 08-09 07-08 06-07 05-06 04-0515-00 14-15 13-14 12-13 11-12 10-11 09-10 08-09 07-08 06-07 05-06 04-05

03-04 02-03 01-02 00-0103-04 02-03 01-02 00-01

15-01 14-00 13-15 12-14 11-13 10-12 09-11 08-10 07-09 06-08 05-07 04-0615-01 14-00 13-15 12-14 11-13 10-12 09-11 08-10 07-09 06-08 05-07 04-06

03-05 02-04 01-03 00-0203-05 02-04 01-03 00-02

15-02 14-01 13-00 12-15 11-14 10-13 09-12 08-11 07-10 06-09 05-08 04-0715-02 14-01 13-00 12-15 11-14 10-13 09-12 08-11 07-10 06-09 05-08 04-07

03-06 02-05 01-04 00-0303-06 02-05 01-04 00-03

15-03 14-02 13-01 12-00 11-15 10-14 09-13 08-12 07-11 06-10 05-09 04-0815-03 14-02 13-01 12-00 11-15 10-14 09-13 08-12 07-11 06-10 05-09 04-08

03-07 02-06 01-05 00-0403-07 02-06 01-05 00-04

15-04 14-03 13-02 12-01 11-00 10-15 09-14 08-13 07-12 06-11 05-10 04-0915-04 14-03 13-02 12-01 11-00 10-15 09-14 08-13 07-12 06-11 05-10 04-09

03-08 02-07 01-06 00-0503-08 02-07 01-06 00-05

15-05 14-04 13-03 12-02 11-01 10-00 09-15 08-14 07-13 06-12 05-11 04-1015-05 14-04 13-03 12-02 11-01 10-00 09-15 08-14 07-13 06-12 05-11 04-10

03-09 02-08 01-07 00-0603-09 02-08 01-07 00-06

15-06 14-05 13-04 12-03 11-02 10-01 09-00 08-15 07-14 06-13 05-12 04-1115-06 14-05 13-04 12-03 11-02 10-01 09-00 08-15 07-14 06-13 05-12 04-11

03-10 02-09 01-08 00-0703-10 02-09 01-08 00-07

15-07 14-06 13-05 12-04 11-03 10-02 09-01 08-00 07-15 06-14 05-13 04-1215-07 14-06 13-05 12-04 11-03 10-02 09-01 08-00 07-15 06-14 05-13 04-12

03-11 02-10 01-09 00-0803-11 02-10 01-09 00-08

15+08 14+07 13+06 12+05 11+04 10+03 09+02 08+01 07+00 06+15 05+1415+08 14+07 13+06 12+05 11+04 10+03 09+02 08+01 07+00 06+15 05+14

04+13 03+12 02+11 01+10 00+0904+13 03+12 02+11 01+10 00+09

15+09 14+08 13+07 12+06 11+05 10+04 09+03 08+02 07+01 06+00 05+1515+09 14+08 13+07 12+06 11+05 10+04 09+03 08+02 07+01 06+00 05+15

04+14 03+13 02+12 01+11 00+1004+14 03+13 02+12 01+11 00+10

15+10 14+09 13+08 12+07 11+06 10+05 09+04 08+03 07+02 06+01 05+0015+10 14+09 13+08 12+07 11+06 10+05 09+04 08+03 07+02 06+01 05+00

04+15 03+14 02+13 01+12 00+1104+15 03+14 02+13 01+12 00+11

15+11 14+10 13+09 12+08 11+07 10+06 09+05 08+04 07+03 06+02 05+0115+11 14+10 13+09 12+08 11+07 10+06 09+05 08+04 07+03 06+02 05+01

04+00 03+15 02+14 01+13 00+1204+00 03+15 02+14 01+13 00+12

15+12 14+11 13+10 12+09 11+08 10+07 09+06 08+05 07+04 06+03 05+0215+12 14+11 13+10 12+09 11+08 10+07 09+06 08+05 07+04 06+03 05+02

04+01 03+00 02+15 01+14 00+1304+01 03+00 02+15 01+14 00+13

15+13 14+12 13+11 12+10 11+09 10+08 09+07 08+06 07+05 06+04 05+0315+13 14+12 13+11 12+10 11+09 10+08 09+07 08+06 07+05 06+04 05+03

04+02 03+01 02+00 01+15 00+1404+02 03+01 02+00 01+15 00+14

15+14 14+13 13+12 12+11 11+10 10+09 09+08 08+07 07+06 06+05 05+0415+14 14+13 13+12 12+11 11+10 10+09 09+08 08+07 07+06 06+05 05+04

04+03 03+02 02+01 01+00 00+1504+03 03+02 02+01 01+00 00+15

15+15 14+14 13+13 12+12 11+11 10+10 09+09 08+08 07+07 06+06 05+0515+15 14+14 13+13 12+12 11+11 10+10 09+09 08+08 07+07 06+06 05+05

04+04 03+03 02+02 01+01 00+0004+04 03+03 02+02 01+01 00+00

表格3Form 3

给定适当的主密钥数值后,密钥扩展器152所产生的扩展密钥统计来说可有效预防异加密常见的攻击,包括令文件的加密区块以密钥长度位移、并对加密区块一并施行异运算,以下更详细讨论。密钥扩展器152对选定主密钥对234/236的影响是:在所述实施方式中,程序中以完全相同的密钥所加密的两个指令数据106字节的跨距可高达256字节。在其他具有不同区块尺寸的指令数据106、以及不同主密钥长度的实施方式中,以同样密钥加密的两个指令数据106字节的最大跨距可有不同的量。Given an appropriate master key value, the expanded key statistics generated by the key expander 152 can effectively prevent common attacks in different encryptions, including shifting the encrypted block of the file by the key length, and changing the encryption area Blocks are XORed together, discussed in more detail below. The effect of the key expander 152 on the selected master key pair 234/236 is: in the described embodiment, the span of two instruction data 106 bytes encrypted with the same key in the program can be as high as 256 bytes. byte. In other implementations with command data 106 of different block sizes and different master key lengths, the maximum span of two command data 106 bytes encrypted with the same key may have different amounts.

用来选定主密钥对234/236的主密钥寄存器142以及密钥扩展器152内的多工器212/214也会决定有效密钥长度的扩展程度。如以上讨论,图2所示实施方式供应有5个主密钥寄存器142,主密钥寄存器142所供应的内容因此可以10种方式组合,而多工器212/214是用于自上述10种可能组合方式中选择八种作用。表格3所示各密钥对234/236所对应的256字节有效密钥长度搭配八种主密钥对234/236组合后,所产生的有效密钥长度为2048字节。也就是说,程序中以完全相同的密钥加密的两个指令数据106字节的跨距可高达2048字节。The master key register 142 used to select the master key pair 234/236 and the multiplexers 212/214 in the key expander 152 also determine the degree of expansion of the effective key length. As discussed above, the embodiment shown in FIG. 2 is supplied with five master key registers 142, and the contents supplied by the master key registers 142 can therefore be combined in 10 ways, and the multiplexers 212/214 are used to select from the above 10 ways. Choose from eight effects in possible combinations. After the 256-byte effective key length corresponding to each key pair 234/236 shown in Table 3 is combined with the eight master key pairs 234/236, the resulting effective key length is 2048 bytes. That is to say, the span of 106 bytes of two instruction data encrypted with exactly the same key in the program can be as high as 2048 bytes.

为了更加说明密钥扩展器152所带来的优点,以下简短叙述异加密程序所常见的的攻击。若异加密运算所采用的密钥长度短于所加密/解密的程序指令数据的长度,密钥中的许多字节必须被重复使用,且被重复使用的字节数量视程序的长度而定。此弱点使异指令加密程序可被破解。第一,黑客尝试判断出重复密钥的长度,以下展示的说明(1)至(3)令之为n+1。第二,黑客假定指令数据内各个密钥长度区块(key-length block)是以同样密钥加密。以下列举根据一传统异加密运算加密得到的二密钥长度区块的数据:In order to further illustrate the advantages brought by the key expander 152, the common attacks of different encryption programs are briefly described below. If the length of the key used in the different encryption operation is shorter than the length of the encrypted/decrypted program instruction data, many bytes in the key must be reused, and the number of bytes to be reused depends on the length of the program. This weakness makes the encryption program of different instructions crackable. First, the hacker tries to determine the length of the repeated key, let it be n+1 in the descriptions (1) to (3) shown below. Second, the hacker assumes that each key-length block in the command data is encrypted with the same key. The following enumerates the data of the two-key length block encrypted according to a traditional heterogeneous encryption operation:

(( 11 )) bb nno 00 ^^ kk nno ,, .. .. .. ,, bb 11 00 ^^ kk 11 ,, bb 00 00 ^^ kk 00

(( 11 )) bb nno 11 ^^ kk nno ,, .. .. .. ,, bb 11 11 ^^ kk 11 ,, bb 00 11 ^^ kk 00

其中,

Figure BDA0000063520770000193
为第一密钥长度区块的数据的字节n,将被加密;为第二密钥长度区块的数据的字节n,将被加密;且kn为密钥的字节n。第三,黑客对所述两区块进行异运算,使其中密钥成分彼此相销,独留以下内容:in,
Figure BDA0000063520770000193
Byte n of the data of the first key length block will be encrypted; is byte n of the data of the second key length block to be encrypted; and k n is byte n of the key. Thirdly, the hacker performs XOR operation on the two blocks, so that the key components in them cancel each other, leaving only the following content:

(( 33 )) bb nno 00 ^^ bb nno 11 ,, .. .. .. ,, bb 11 00 ^^ bb 11 11 ,, bb 00 00 ^^ bb 00 11

最后,由于计算出的字节为单纯两个纯文字字节的函数,黑客可以统计分析纯文字内容的出现频率,以尝试求得纯文字字节的数值。Finally, since the calculated bytes are simply a function of two plain text bytes, hackers can statistically analyze the occurrence frequency of plain text content to try to obtain the value of plain text bytes.

然而,根据图2以及图3所揭示方式计算出的加密指令数据106字节的图样如以下说明(4)与(5)所示:However, the pattern of 106 bytes of encrypted instruction data calculated according to the method disclosed in FIG. 2 and FIG. 3 is shown in the following explanations (4) and (5):

(( 44 )) bb nno 00 ^^ (( kk nno xx ±± kk 00 ythe y )) ,, .. .. .. ,, bb 11 00 ^^ (( kk 11 xx ±± kk 22 ythe y )) ,, bb 00 00 ^^ (( kk 00 xx ±± kk 11 ythe y ))

(( 55 )) bb nno 11 ^^ (( kk nno xx ±± kk 11 ythe y )) ,, .. .. .. ,, bb 11 11 ^^ (( kk 11 xx ±± kk 33 ythe y )) ,, bb 00 11 ^^ (( kk 00 xx ±± kk 22 ythe y ))

其中标示所加密的第一16字节区块的指令数据的字节n,

Figure BDA0000063520770000205
标示所加密的第二16字节区块的指令数据的字节n,标示主密钥x的字节n,且
Figure BDA0000063520770000207
标示主密钥y的字节n。如前述,主密钥x与y为不同密钥。假定一种实施方式以五个主密钥寄存器142提供八种主密钥对234/236组合,2048字节序列中各字节是与两个独立的主密钥字节的一组合进行异运算。因此,当加密数据以任何方式于256字节的区块中移位并且彼此作异运算,所求得的字节都会存在两个主密钥的复杂成分,因此,不若说明(3)的内容,此处所得的运算结果不单纯只是纯文字字节。例如,假设黑客选择使同一256字节区块中的16字节区块对齐并彼此进行异操作使同样的密钥零字节在各段中被使用,字节0的运算结果如说明(6)所示,所获得的字节存在两个主密钥的复杂组合:in Byte n designating the instruction data of the encrypted first 16-byte block,
Figure BDA0000063520770000205
Byte n designating the instruction data of the encrypted second 16-byte block, identifies the byte n of the master key x, and
Figure BDA0000063520770000207
Indicates the byte n of the master key y. As mentioned above, the master keys x and y are different keys. Assuming that an implementation provides eight master key pairs 234/236 combinations with five master key registers 142, each byte in the 2048 byte sequence performs an exclusive operation with a combination of two independent master key bytes . Therefore, when the encrypted data is shifted in any way in the 256-byte block and XORed with each other, the obtained bytes will have the complex components of the two master keys, so it is not necessary to explain (3) Content, the operation result obtained here is not just pure text bytes. For example, assuming that the hacker chooses to align 16-byte blocks in the same 256-byte block and XOR each other so that the same key zero byte is used in each segment, the operation result of byte 0 is as described in (6 ), the obtained bytes are a complex combination of two master keys:

(( 66 )) bb 00 00 ^^ (( kk 00 xx ±± kk 11 ythe y )) ^^ bb 00 11 ^^ (( kk 00 xx ±± kk nno ythe y )) ,,

其中n不为1。where n is not 1.

再者,若黑客换成将选自不同256字节区块内的16字节区块对齐、且彼此作异运算,运算结果的字节0如说明(7)所示:Furthermore, if the hacker instead aligns 16-byte blocks selected from different 256-byte blocks and performs exclusive operations with each other, the byte 0 of the operation result is as shown in the description (7):

(( 77 )) bb 00 00 ^^ (( kk 00 xx ±± kk 11 ythe y )) ^^ bb 00 11 ^^ (( kk 00 uu ±± kk nno vv )) ,,

其中主密钥u与v中至少一个不同于主密钥x以及y。模拟随机主密钥数值所产生的有效密钥字节的异运算,可发现运算结果

Figure BDA0000063520770000212
呈现相当平滑的分布。Wherein at least one of master keys u and v is different from master keys x and y. Simulate the exclusive operation of the effective key bytes generated by the random master key value, and the operation result can be found
Figure BDA0000063520770000212
presents a fairly smooth distribution.

当然,若黑客选择将不同的2048字节长度区块内的16字节区块对齐、并且彼此进行异操作,黑客可能会获得与说明(3)类似的结果。然而,请参照以下内容。第一,某些程序-例如,安全性相关程序-可能短于2048字节。第二,相距2048字节的指令字节的统计相关性(statistical correlation)很可能非常小,导致很难破解。第三,如前述内容,所述技术的实施方式可以较多数量实现主密钥寄存器142,使解密密钥的有效长度扩展;例如,以12个主密钥寄存器142供应16384字节长度的解密密钥,甚至其他更长的解密密钥。第四,以下将讨论的密钥下载指令500以及密钥切换指令600更使程序设计师得以载入新的数值至主密钥寄存器142,以有效扩展密钥长度超过2048字节,或者,如果必要,也可扩展密钥长度至程序的完整长度。Of course, if the hacker chooses to align the 16-byte blocks in different 2048-byte length blocks and perform XOR operations with each other, the hacker may obtain a result similar to that in description (3). However, please refer to the following. First, some programs - eg, security-related programs - may be shorter than 2048 bytes. Second, the statistical correlation of instruction bytes 2048 bytes apart is likely to be very small, making it difficult to crack. Third, as mentioned above, the embodiment of the technology can implement a large number of master key registers 142, so that the effective length of the decryption key can be expanded; key, or even other longer decryption keys. Fourth, the key download instruction 500 and the key switch instruction 600 discussed below enable the programmer to load new values into the master key register 142 to effectively extend the key length beyond 2048 bytes, or if The key length can also be extended to the full length of the program if necessary.

现在,参考图4,一方块图根据本发明技术图解图1的标志寄存器128。根据图4所示的实施方式,标志寄存器128包括标准x86寄存器的多个位408;不过,为了此处叙述的新功能,图4所示实施方式会动用x86架构中一般为预留(RESERVED)的一位。特别说明,标志寄存器128包括一E位字段402。E位字段402用于修复控制寄存器144的E位148数值,用以于加密以及纯文字程序间切换和/或于不同加密程序间切换,以下将详细讨论的。E位字段402标示目前所执行的程序是否有加密。若目前所执行的程序有加密,E位字段402为设定状态,否则,为清除状态。当中断事件发生,控制权切换给其他程序(例如,中断interrupt、异常exception如页错误page fault、或任务切换task switch),储存标志寄存器128。反之,若控制权重回先前因中断事件中断的程序,则修复标志寄存器128。微处理器100的设计会在标志寄存器128修复时以标志寄存器128的E位402字段数值更新控制寄存器144的E位148数值,以下将详细讨论。因此,若中断事件发生时一加密程序正在执行(即提取单元104处于解密模式),当控制权交还给该加密程序时,以修复的E位字段402令E位148为设定状态,以修复提取单元104为解密模式。在一种实施方式中,E位148以及E位字段402为同一个具体硬件位,因此,储存标志寄存器128的E位字段402中数值即是储存E位148,且修复标志寄存器128的E位字段402的数值即是修复E位148。Referring now to FIG. 4, a block diagram illustrates the flag register 128 of FIG. 1 in accordance with the teachings of the present invention. According to the embodiment shown in FIG. 4, the flag register 128 includes a plurality of bits 408 of a standard x86 register; however, for the new functions described here, the embodiment shown in FIG. one of. In particular, the flag register 128 includes an E-bit field 402 . The E-bit field 402 is used to restore the value of the E-bit 148 of the control register 144 for switching between encryption and plain text programs and/or switching between different encryption programs, as will be discussed in detail below. The E-bit field 402 indicates whether the currently executed program is encrypted. If the currently executed program has encryption, the E bit field 402 is set, otherwise, it is cleared. When an interrupt event occurs, the control is switched to other programs (for example, an interrupt, an exception such as a page fault, or a task switch), and the flag register 128 is stored. On the contrary, if the control is returned to the program that was previously interrupted by the interrupt event, then the flag register 128 is repaired. The microprocessor 100 is designed to update the value of the E-bit 148 of the control register 144 with the value of the E-bit 402 field of the flags register 128 when the flags register 128 is repaired, as will be discussed in detail below. Therefore, if an encryption program is being executed (that is, the extraction unit 104 is in the decryption mode) when an interrupt event occurs, when the control right is returned to the encryption program, the E bit 148 is set to a set state with the repaired E bit field 402 to repair Extraction unit 104 is in decryption mode. In one embodiment, the E bit 148 and the E bit field 402 are the same specific hardware bit, therefore, storing the value in the E bit field 402 of the flag register 128 means storing the E bit 148, and repairing the E bit of the flag register 128 The value of field 402 is the repair E bit 148 .

参阅图5,一方块图图解根据本发明技术所实现的一密钥下载指令500的格式。密钥下载指令500包括一操作码(opcode)502字段,特地标示其为微处理器100指令集内的密钥下载指令500。在一种实施方式中,操作码字段502数值为0FA6/4(x86领域)。密钥下载指令500包括两个运算元:一密钥寄存器文档目标地址504以及一安全存储区来源地址506。该安全存储区来源地址506为安全存储区122中储存一16字节主密钥的一地址。密钥寄存器文档地址504标示密钥寄存器文档124内的一个寄存器的地址,此寄存器将载入自安全存储区122载出的16字节主密钥。在一种实施方式中,若一程序企图在微处理器100不为安全操作模式下执行密钥载入指令500,则视之为无效指令异常;此外,若安全存储区来源地址506数值位于有效安全存储区122之外,则视之为一般保护异常。在一种实施方式中,若一程序试图在微处理器100不为最高权限级别时(例如,x86环0权限/x86 ring 0)执行密钥下载指令500,则视之为无效指令异常。在某些状况下,16字节主密钥的构成可能包括在加密指令的即时数据字段内。所述即时数据可被一块一块移至安全存储区122组成16字节的密钥。Referring to FIG. 5, a block diagram illustrates the format of a key download command 500 implemented in accordance with the techniques of the present invention. The key download command 500 includes an opcode 502 field, specifically marking it as the key download command 500 in the instruction set of the microprocessor 100 . In one embodiment, the opcode field 502 has a value of 0FA6/4 (x86 domain). The key download instruction 500 includes two operands: a key register file target address 504 and a secure storage area source address 506 . The secure storage area source address 506 is an address in the secure storage area 122 storing a 16-byte master key. The key register file address 504 indicates the address of a register in the key register file 124 that will be loaded with the 16-byte master key loaded from the secure storage area 122 . In one embodiment, if a program attempts to execute the key load instruction 500 when the microprocessor 100 is not in a safe operation mode, it is regarded as an invalid instruction exception; Outside the secure storage area 122, it is regarded as a general protection exception. In one embodiment, if a program attempts to execute the key download instruction 500 when the microprocessor 100 is not at the highest privilege level (for example, x86 ring 0 privilege/x86 ring 0), it is considered an invalid instruction exception. In some cases, the composition of the 16-byte master key may be included in the immediate data field of the encryption command. The instant data can be moved to the secure storage area 122 block by block to form a 16-byte key.

现在,参阅图6,一方块图图解根据本发明技术所实现的一密钥切换指令600的格式。密钥切换指令600包括一操作码602字段,特地其为微处理器100指令集内的密钥切换指令600。密钥切换指令600还包括一密钥寄存器文档索引字段604,标示密钥寄存器文档124一序列寄存器中的开端,以自此将密钥载入主密钥寄存器142。在一种实施方式中,若一程序尝试在微处理器100不为安全操作模式时执行一密钥切换指令600,则视之为无效指令异常。在一种实施方式中,若一程序意图在微处理器100不为最高权限级别(例如,x86环0权限)时执行一密钥切换指令600,则视之为无效指令异常。在一种实施方式中,密钥切换指令600为原子操作型式(atomic),即不可中断;此处所讨论,用于载入密钥至主密钥寄存器142的其他指令也是如此-例如,以下将讨论的分支与切换密钥指令。Referring now to FIG. 6, a block diagram illustrates the format of a key switch command 600 implemented in accordance with the techniques of the present invention. The key switching instruction 600 includes an opcode 602 field, specifically it is the key switching instruction 600 in the instruction set of the microprocessor 100 . The key switch instruction 600 also includes a key register file index field 604 that identifies the beginning of a sequence of registers in the key register file 124 from which to load the key into the master key register 142 . In one embodiment, if a program attempts to execute a key switching instruction 600 when the microprocessor 100 is not in the secure operating mode, it is considered an invalid instruction exception. In one embodiment, if a program intends to execute a key switching instruction 600 when the microprocessor 100 is not at the highest privilege level (for example, x86 ring 0 privilege), it is regarded as an invalid instruction exception. In one embodiment, key switching instruction 600 is atomic, i.e., non-interruptible; the same is true for other instructions for loading a key into master key register 142 as discussed herein—for example, the following Discuss the branch and switch key instructions.

现在,参阅图7,一流程图图解图1的微处理器100的操作,其中,根据本发明技术执行图6介绍的密钥切换指令600。流程始于方块702。Referring now to FIG. 7, a flowchart illustrates the operation of the microprocessor 100 of FIG. 1 in which the key switching instruction 600 introduced in FIG. 6 is executed in accordance with the teachings of the present invention. Flow begins at block 702 .

在方块702,解码单元108将一密钥切换指令600解码,且将解码结果代入微代码单元132内实现密钥切换指令600的微代码程序。流程接着进入方块704。In block 702 , the decoding unit 108 decodes a key switching instruction 600 , and substitutes the decoding result into the microcode program in the microcode unit 132 to implement the key switching instruction 600 . The flow then goes to block 704 .

在方块704,微代码会根据密钥寄存器文档索引字段604自密钥寄存器文档124下载主密钥寄存器142的内容。较佳实施方式是:微代码以密钥寄存器文档索引字段604所标示的密钥寄存器为起始,自密钥寄存器文档124下载连续的n个寄存器内容作为n个密钥存入主密钥寄存器142,其中n为主密钥寄存器142的总数。在一种实施方式中,数值n可标示于密钥切换指令600的一额外空间,设定为少于主密钥寄存器142的总数。流程接着进入方块706。At block 704 , the microcode downloads the contents of the master key register 142 from the key register file 124 according to the key register document index field 604 . A preferred embodiment is: the microcode starts with the key register indicated by the key register file index field 604, and downloads the contents of n consecutive registers from the key register file 124 as n keys and stores them in the master key register 142, where n is the total number of master key registers 142. In one embodiment, the value n may indicate an extra space in the key switching command 600 , which is set to be less than the total number of master key registers 142 . The process then proceeds to block 706 .

在方块706,微代码使微处理器100分支至接续的x86指令(即该密钥切换指令600之后的指令),将导致微处理器100中较密钥切换指令600新的所有x86指令被清空,致使微处理器100内、较切换至接续x86指令的微操作新的所有微操作被清空。上述被清空的指令包括自指令高速缓冲存储器102提取出、缓冲暂存于提取单元104以及解码单元108内等待解密与解码的所有指令字节106。流程接着进入方块708。At block 706, the microcode causes the microprocessor 100 to branch to the next x86 instruction (i.e., the instruction after the key switch instruction 600), which will cause all x86 instructions in the microprocessor 100 that are newer than the key switch instruction 600 to be cleared , so that all micro-operations in the microprocessor 100 that are newer than the micro-operations switched to the subsequent x86 instructions are cleared. The cleared instructions include all instruction bytes 106 fetched from the instruction cache 102 , buffered and temporarily stored in the fetch unit 104 and the decode unit 108 waiting to be decrypted and decoded. The process then proceeds to block 708 .

在方块708,基于方块706分支至接续指令的操作,提取单元104开始利用方块704载入主密钥寄存器142的新一组密钥值自指令高速缓冲存储器102提取并且解密指令数据106。流程结束于方块708。At block 708 , based on the operation of the block 706 branch to the next instruction, the fetch unit 104 begins fetching and decrypting the instruction data 106 from the instruction cache 102 using the new set of key values loaded into the master key register 142 at block 704 . Flow ends at block 708 .

如图7所示,密钥切换指令600令正在执行中的加密程序在自指令高速缓冲存储器102提取出来的同时得以改变主密钥寄存器142内所储存、供解密该加密程序使用的内容。所述主密钥寄存器142动态调整技术使得加密该程序的有效密钥长度超越提取单元104先天支援的长度(例如,图2实施方式所提供的2048字节);如图8所示程序,若将之以图1微处理器100操作,黑客会更不易攻破计算机系统的安全防护。As shown in FIG. 7 , the key switching instruction 600 enables the encrypted program being executed to change the content stored in the master key register 142 for decrypting the encrypted program while being fetched from the instruction cache 102 . The dynamic adjustment technology of the master key register 142 makes the length of the effective key for encrypting the program exceed the length supported by the extracting unit 104 (for example, 2048 bytes provided by the embodiment of FIG. 2 ); By operating it with the microprocessor 100 shown in FIG. 1 , it will be more difficult for hackers to break through the security protection of the computer system.

现在,参阅图8,一方块图图解根据本发明技术所实现的一加密程序的一存储器用量(memory footprint)800,其中采用图6所示的密钥切换指令600。图8所示的加密程序存储器用量800包括连续数「块chunk」指令数据字节。每一「块」的内容为一序列多个指令数据字节(其中为预先加密的数据),且属于同一「块」的指令数据字节是由同样的一套主密钥寄存器142数值解密。因此,不同两「块」的界线是由密钥切换指令600定义。也就是说,各「块」的上、下界是由密钥切换指令600的位置区分(或者,以一程序的第一「块」为例,其上界为该程序的起始处;此外,以该程序的最后一「块」为例,其下界为该程序的结束处)。因此,各「块」指令数据字节是由提取单元104基于不同套主密钥寄存器142数值解密,意即各「块」指令数据字节的解密是根据前一「块」所供应的一密钥切换指令600所载入主密钥寄存器142数值。加密一程序的后处理器(post-processor)会知晓各密钥切换指令600所在的存储器地址,并且会利用此信息-即提取地址的相关地址位-结合密钥切换指令600密钥数值产生加密密钥字节,以加密该程序。一些目的文件格式(object file format)允许程序设计者标示程序载入存储器何处,或至少载明特定大小的对齐形式(例如,页面边界page boundary),以提供足够的地址信息加密该程序。此外,一些操作系统预设值是将程序载入页面边界上。Referring now to FIG. 8, a block diagram illustrates a memory footprint 800 of an encryption program implemented according to the techniques of the present invention, wherein the key switching instruction 600 shown in FIG. 6 is employed. The encrypted program memory usage 800 shown in FIG. 8 includes a consecutive number of "chunks" of instruction data bytes. The content of each "block" is a sequence of multiple command data bytes (which are pre-encrypted data), and the command data bytes belonging to the same "block" are decrypted by the same set of master key register 142 values. Therefore, the boundary between two different "blocks" is defined by the key switch command 600 . That is to say, the upper and lower bounds of each "block" are distinguished by the position of the key switching instruction 600 (or, taking the first "block" of a program as an example, the upper bound is the beginning of the program; in addition, Take the last "block" of the program, for example, whose lower bound is the end of the program). Therefore, each "block" of command data bytes is decrypted by the extraction unit 104 based on a different set of master key register 142 values, meaning that each "block" of command data bytes is decrypted according to a key supplied by the previous "block". The value loaded into the master key register 142 by the key switching instruction 600. The post-processor (post-processor) of an encryption program will know the memory address where each key switching instruction 600 is located, and will use this information—that is, extract the relevant address bits of the address—combined with the key value of the key switching instruction 600 to generate encryption key bytes to encrypt the program. Some object file formats allow the programmer to indicate where the program is loaded into memory, or at least specify a specific size alignment (eg, page boundary) to provide sufficient address information to encrypt the program. Also, some operating systems default to loading programs on page boundaries.

密钥切换指令600可安置于程序的任何地方。然而,若密钥切换指令600载入特定值至主密钥寄存器142供下一「块」指令数据字节解密使用、且密钥切换指令600(或甚至密钥载入指令500)的位置导致每一「块」的长度短于、或等于提取单元104所能应付的有效密钥长度(例如,图2实施方式所揭示的2048字节),则程序可被以有效长度等同整体程序长度的密钥加密,此为相当强健的加密方式。此外,即使密钥切换指令600的使用使得有效密钥长度仍短于加密程序的长度(即,同样一套主密钥寄存器142数值被用于加密一程序的多个「块」),改变「块」尺寸(例如,不限定全为2048字节)可增加黑客破解系统的困难度,因为,黑客必须先判断以同一套主密钥寄存器142数值加密的「块」位于何处,并且必须判断该些长度不一的「块」各自的尺寸。The key switching instruction 600 can be placed anywhere in the program. However, if the key switch instruction 600 loads a specific value into the master key register 142 for decryption of the next "block" of command data bytes, and the location of the key switch instruction 600 (or even the key load instruction 500) results in The length of each "block" is shorter than or equal to the effective key length that the extracting unit 104 can handle (for example, 2048 bytes disclosed in the embodiment shown in FIG. Key encryption, which is a fairly strong encryption method. Furthermore, even though the use of the key switching instruction 600 results in an effective key length that is still shorter than the length of the encryption program (i.e., the same set of master key register 142 values is used to encrypt multiple "blocks" of a program), changing " The "block" size (for example, not limited to 2048 bytes) can increase the difficulty for hackers to crack the system, because the hacker must first determine where the "block" encrypted with the same set of master key register 142 values is located, and must determine The respective dimensions of the "blocks" of varying lengths.

值得注意的是,以密钥切换指令600实现的动态密钥切换耗费相当大量的时钟数目,主要是因为管线必须清空。此外,在一种实施方式中,密钥切换指令600主要是以微代码(microcede)实现,通常较非微代码实现的指令慢。因此,程序码开发者须考虑密钥切换指令对效能的影响,在执行速度以及特定应用的安全性考量之间寻求平衡点。It is worth noting that dynamic key switching implemented with the key switching instruction 600 consumes a relatively large number of clocks, mainly because the pipeline must be flushed. Furthermore, in one embodiment, the key switching instruction 600 is implemented primarily in microcode, which is generally slower than instructions implemented in non-microcode. Therefore, program code developers must consider the impact of key switching instructions on performance, and seek a balance between execution speed and security considerations for specific applications.

现在,参阅图9,一方块图图解根据本发明技术实现的一分支与切换密钥指令900的格式。首先叙述该分支与切换密钥指令900的必要性。Referring now to FIG. 9, a block diagram illustrates the format of a branch and switch key instruction 900 implemented in accordance with the techniques of the present invention. First, the necessity of the branch and switch key instruction 900 is described.

根据以上实施例所揭示内容,加密程序交由提取单元104提取的各个16字节区块的指令数据是有先经过加密运算(采异技术),所采用的加密密钥等同提取单元104用来解密(异运算)所提取的各区块的指令数据106的各个16字节长的解密密钥174。如以上所述,解密密钥174的字节数值是由提取单元104基于以下两种输入计算而得:储存于主密钥寄存器142的主密钥字节数值、以及所提取的16字节区块的指令数据106的提取地址134的部分位(以图2所揭示实施方式为例,为位[10:4])。因此,加密一程序使的由微处理器100执行的一后处理器会知晓将储存于主密钥寄存器142的主密钥字节数值、以及一地址(或更限定为该地址的数个相关位);该地址指示加密程序将被载入存储器何处、且微处理器100将自此处一连串地提取出该加密程序数个区块的指令数据。基于上述信息,后处理器得以适切产生解密密钥174数值,用于加密该程序的各个16字节区块的指令数据。According to the content disclosed in the above embodiments, the instruction data of each 16-byte block extracted by the extraction unit 104 after the encryption program is encrypted first (differentiation technology), and the encryption key used is equivalent to that used by the extraction unit 104. Each 16-byte decryption key 174 of the extracted command data 106 of each block is decrypted (exclusive operation). As mentioned above, the byte value of the decryption key 174 is calculated by the extraction unit 104 based on the following two inputs: the byte value of the master key stored in the master key register 142, and the extracted 16-byte field Some bits of the fetch address 134 of the instruction data 106 of the block (take the embodiment disclosed in FIG. 2 as an example, bits [10:4]). Thus, encrypting a program enables a post-processor executed by microprocessor 100 to know the master key byte value to be stored in master key register 142, as well as an address (or more limited to a number associated with the address). bit); the address indicates where the encrypted program will be loaded into the memory, and the microprocessor 100 will sequentially extract the instruction data of several blocks of the encrypted program from here. Based on the above information, the post-processor can properly generate the value of the decryption key 174 for encrypting the instruction data of each 16-byte block of the program.

如以上所讨论,当一分支指令被预测到且/或被执行,提取单元104会以分支目标地址更新提取地址134。只要加密程序从未改变(经由密钥切换指令600)主密钥寄存器142内储存的主密钥数值,分支指令是由提取单元104透明控制。也就是说,提取单元104会采用同样的主密钥寄存器142数值估算解密密钥174,以供解密包括该分支指令的一区块的指令数据106、以及解密该分支指令的目标地址所指的一区块的指令数据106内的指令。然而,程序改变(经由密钥切换指令600)主密钥寄存器142数值的能力意味着提取单元104有可能以一套主密钥寄存器142数值估算解密密钥174解密包括该分支指令的一区块的指令数据106,并以不同的另外一套主密钥寄存器142数值估算解密密钥174解密该分支指令的目标地址所指的一区块的指令数据106内的指令。解决此问题的一种方法是限定分支目标地址于程序同一「块」中。另外一种解决方式是采用图9所揭示的分支与切换密钥指令900。As discussed above, when a branch instruction is predicted and/or executed, the fetch unit 104 updates the fetch address 134 with the branch target address. The branch instruction is transparently controlled by the fetch unit 104 as long as the encryption program never changes (via the key switching instruction 600 ) the master key value stored in the master key register 142 . That is to say, the extraction unit 104 will use the same value of the master key register 142 to estimate the decryption key 174 for decrypting the instruction data 106 of a block including the branch instruction and decrypting the target address of the branch instruction. Commands within the command data 106 of a block. However, the ability of the program to change (via the key switch instruction 600) the value of the master key register 142 means that it is possible for the fetch unit 104 to estimate the decryption key 174 with a set of master key register 142 values to decrypt a block containing the branch instruction The instruction data 106 of the branch instruction, and the decryption key 174 is estimated with a different set of master key register 142 values to decrypt the instruction in the instruction data 106 of a block indicated by the target address of the branch instruction. One way to solve this problem is to restrict branch target addresses to the same "block" of the program. Another solution is to use the branch and switch key instruction 900 disclosed in FIG. 9 .

再次参阅图9,一方块图图解根据本发明技术实现的一分支与切换密钥指令900的格式。分支与切换密钥指令900包括一操作码902字段,标示其为微处理器100指令集内的分支与切换密钥指令900。分支与切换密钥指令900还包括一密钥寄存器文档索引字段904,标示密钥寄存器文档124中一连串寄存器里的开端,以自此将密钥载入主密钥寄存器142。分支与切换密钥指令900还包括一分支信息字段906,记载分支指令的典型信息-如,计算目标地址的信息、以及分支条件。在一种实施方式中,若一程序在微处理器100不为安全执行模式时尝试执行一分支与切换密钥指令900,则视之为无效指令异常。在一种实施方式中,若一程序在微处理器100不为最高权限层级(例如,x86的环0权限)时试图执行分支与切换密钥指令900,则视之为无效指令异常。在一种实施方式中,分支与切换密钥指令900为原子操作型(atomic)。Referring again to FIG. 9, a block diagram illustrates the format of a branch and switch key instruction 900 implemented in accordance with the techniques of the present invention. The branch and switch key instruction 900 includes an opcode 902 field identifying it as a branch and switch key instruction 900 within the instruction set of the microprocessor 100 . The branch and switch key instruction 900 also includes a key register file index field 904 identifying the beginning of a chain of registers in the key register file 124 from which to load the key into the master key register 142 . The branch and switch key instruction 900 also includes a branch information field 906, which records typical information of the branch instruction—for example, the information of calculating the target address and the branch condition. In one embodiment, if a program attempts to execute a branch and switch key instruction 900 when the microprocessor 100 is not in the secure execution mode, it is considered an invalid instruction exception. In one embodiment, if a program attempts to execute the branch and switch key instruction 900 when the microprocessor 100 is not at the highest privilege level (eg, x86 ring 0 privilege), it is treated as an invalid instruction exception. In one embodiment, the branch and switch key instruction 900 is atomic.

参阅图10,一流程图图解图1微处理器100的操作,其中,根据本发明技术执行图9所揭示的分支与切换密钥指令900。流程始于方块1002。Referring to FIG. 10, a flow diagram illustrates the operation of the microprocessor 100 of FIG. 1 in which the branch and switch key instruction 900 disclosed in FIG. 9 is executed in accordance with the teachings of the present invention. Flow begins at block 1002 .

在方块1002,解码单元108解码一分支与切换密钥指令900且将之代入微代码单元132中实现该分支与切换密钥指令900的微代码程序。流程接着进入方块1006。At block 1002 , the decode unit 108 decodes a branch and switch key instruction 900 and substitutes it into the microcode program implementing the branch and switch key instruction 900 in the microcode unit 132 . The flow then enters block 1006 .

在方块1006,微代码解出分支方向(采用、或不采用)、以及目标地址。值得注意的是,对于无条件型分支指令(unconditional branch instruction),所述方向衡为采用。流程接着进入判断方块1008。At block 1006, the microcode resolves the branch direction (taken, or not taken), and the target address. It should be noted that, for an unconditional branch instruction (unconditional branch instruction), the direction balance is adopted. The flow then enters into decision block 1008 .

在判断方块1008,微代码判断方块1006所解出的方向是否为采用。若为采用,流程进入方块1014。反之,流程进入方块1012。In decision block 1008, the microcode determines whether the direction resolved in block 1006 is adoption. If yes, the process goes to block 1014 . Otherwise, the process goes to block 1012 .

在方块1012,微代码不切换密钥、或跳至目标地址,因为分支操作未被采用。流程结束于方块1012。At block 1012, the microcode does not switch keys, or jump to the target address, because the branch operation was not taken. The flow ends at block 1012.

在方块1014,微代码根据密钥寄存器文档索引字段904,将密钥自密钥寄存器文档124载入主密钥寄存器142。较佳实施例是,微代码以密钥寄存器文档索引字段904所标示的位置为起始,将密钥寄存器文档124内n个邻近寄存器所记载的n个密钥载入主密钥寄存器142,其中n为主密钥寄存器142的总数。在一种实施方式中,n值可记录于分支与切换密钥指令900的一额外空间,设定为小于主密钥寄存器142总数的值。流程接着进入方块1016。At block 1014 , the microcode loads the key from the key register file 124 into the master key register 142 according to the key register file index field 904 . In a preferred embodiment, the microcode starts from the position indicated by the key register file index field 904, and loads n keys recorded in n adjacent registers in the key register file 124 into the master key register 142, where n is the total number of master key registers 142 . In one embodiment, the value of n can be recorded in an extra space of the branch and switch key instruction 900 and set to a value smaller than the total number of master key registers 142 . The process then proceeds to block 1016 .

在方块1016,微代码使得微处理器100跳至方块1006所解出的目标地址,将导致微处理器100中较分支与切换密钥指令900新的所有x86指令被清空,致使微处理器100内、较分支至目标地址的微操作新的所有微操作被清空。上述被清空的指令包括自指令高速缓冲存储器102提取出、缓冲暂存于提取单元104以及解码单元108内等待解密与解码的所有指令字节106。流程接着进入方块1008。In block 1016, the microcode causes the microprocessor 100 to jump to the target address solved in block 1006, which will cause all x86 instructions newer than the branch and switch key instruction 900 in the microprocessor 100 to be cleared, causing the microprocessor 100 All micro-ops within and newer than the micro-op that branched to the target address are cleared. The cleared instructions include all instruction bytes 106 fetched from the instruction cache 102 , buffered and temporarily stored in the fetch unit 104 and the decode unit 108 waiting to be decrypted and decoded. The flow then enters block 1008 .

在方块1018,随着方块1016分支至目标地址的操作,提取单元104采用方块1014载入主密钥寄存器142的新一组密钥数值开始自指令高速缓冲存储器102提取且解密指令数据106。流程结束于方块1018。At block 1018 , following the branch to target address at block 1016 , fetch unit 104 begins fetching and decrypting instruction data 106 from instruction cache 102 using the new set of key values loaded into master key register 142 at block 1014 . Flow ends at block 1018.

现在,参阅图11,一流程图图解根据本发明技术所实现的一后处理器的操作。所述后处理器为软件工具,可用于后处理一程序并加密,以交由图1的微处理器100执行。流程始于方块1102。Referring now to FIG. 11, a flowchart illustrates the operation of a post-processor implemented in accordance with the techniques of the present invention. The post-processor is a software tool that can be used to post-process a program and encrypt it for execution by the microprocessor 100 of FIG. 1 . Flow begins at block 1102 .

在方块1102,后处理器接收一程序的一目的文件。根据一种实施方式,该目的文件内的分支指令的目标地址可在程序执行前确定;例如,指向固定目标地址的分支指令。在程序运行前决定好目标地址的分支指令尚有另一形式,例如,一相对分支指令(relative branch instruction),其中记载一偏移量,用来加上分支指令所在的存储器地址,以求得分支目标地址。反之,关于目标地址不会在程序执行前确定的分支指令,其中一种例子是基于寄存器或存储器所储存的运算元计算出目标地址,因此,其值在程序执行当中可能有变动。流程接着进入方块1104。At block 1102, the post-processor receives an object file for a program. According to one embodiment, the target address of the branch instruction in the object file can be determined before program execution; for example, a branch instruction pointing to a fixed target address. There is another form of the branch instruction that determines the target address before the program runs, for example, a relative branch instruction (relative branch instruction), which records an offset, which is used to add the memory address where the branch instruction is located to obtain Branch target address. Conversely, for a branch instruction whose target address will not be determined before program execution, one example is to calculate the target address based on operands stored in registers or memories, so its value may change during program execution. The flow then goes to block 1104 .

在方块1104,后微处理器将跨块分支指令(inter-chunk branch instruction)以分支与切换密钥指令900取代,所述指令900在密钥寄存器文档索引空间904储存有适当的数值,该数值乃基于分支指令的目标地址所坐落的「块」而设定。如图8所揭示内容,一「块」是由一序列多个指令数据字节所组成,将由同一套主密钥寄存器142数值解密。因此,跨块分支指令的目标地址所坐落的「块」不同于分支指令本身的「块」。值得注意的是,块内分支-即目标地址与本身位于同一「块」的分支指令-无须被替代。值得注意的是,产生出原始档(source file)以产出目的文件的程序设计及/或编译器可视需求明确包括分支与切换密钥指令900,以降低后处理器取代操作的负担。流程接着进入方块1106。At block 1104, the post-microprocessor replaces the inter-chunk branch instruction with the branch and switch key instruction 900, which has an appropriate value stored in the key register file index space 904, the value It is set based on the "block" in which the target address of the branch instruction is located. As shown in FIG. 8 , a "block" is composed of a sequence of multiple instruction data bytes to be decrypted by the same set of master key register 142 values. Therefore, the "block" in which the target address of the cross-block branch instruction is located is different from the "block" of the branch instruction itself. It's worth noting that intra-block branches -- that is, branch instructions whose target address is in the same "block" as itself -- don't have to be replaced. It should be noted that the program design and/or compiler that generates the source file to generate the target file may explicitly include the branch and switch key instruction 900 to reduce the burden of the post-processor replacement operation. The flow then goes to block 1106 .

在方块1106,后处理器加密该程序。后处理器知道每一「块」的存储器位置以及主密钥寄存器142数值,并将之用于加密该程序。流程结束于方块1106。At block 1106, the post-processor encrypts the program. The post-processor knows the memory location and master key register 142 value of each "block" and uses this to encrypt the program. Flow ends at block 1106 .

现在,参阅图12,一方块图图解本发明技术另一种实施方式所实现的一分支与切换密钥指令1200的格式。图12所示的分支与切换密钥指令1200适用于目标地址在程序执行前为未知的分支操作,以下将详细讨论。分支与切换密钥指令1200包括一操作码1202字段,用以标示其为微处理器100指令集内的分支与切换密钥指令1200。分支与切换密钥指令1200同样包括一分支信息字段906,功用与图9的分支与切换密钥指令900的该字段类似。在一种实施方式中,若一程序在微处理器100不为安全执行模式时试图执行分支与切换密钥指令1200,则视之为无效指令异常。在一种实施方式中,若一程序在微处理器100不为最高权限级别(例如,x86环0权限)时试图执行一分支与切换密钥指令1200,则视之为无效指令异常。在一种实施方式中,分支与切换密钥指令1200为原子型式。Referring now to FIG. 12, a block diagram illustrates the format of a branch and switch key instruction 1200 implemented in another embodiment of the present technology. The branch and switch key instruction 1200 shown in FIG. 12 is suitable for a branch operation whose target address is unknown before program execution, and will be discussed in detail below. The branch and switch key instruction 1200 includes an opcode 1202 field to identify it as a branch and switch key instruction 1200 in the instruction set of the microprocessor 100 . The branch and switch key instruction 1200 also includes a branch information field 906 , which has a function similar to that of the branch and switch key instruction 900 in FIG. 9 . In one embodiment, if a program attempts to execute the branch and switch key instruction 1200 when the microprocessor 100 is not in the secure execution mode, it is treated as an invalid instruction exception. In one embodiment, if a program attempts to execute a branch and switch key instruction 1200 when the microprocessor 100 is not at the highest privilege level (eg, x86 ring 0 privilege), it is treated as an invalid instruction exception. In one embodiment, the branch and switch key instruction 1200 is in atomic form.

现在,参阅图13,一方块图图解根据本发明技术实现的「块」地址范围表1300。表格1300包括多个单元。每一单元与加密程序的一「块」相关。每一单元包括一地址范围字段1302以及一密钥寄存器文档索引字段1304。地址范围字段1302标示所对应「块」的存储器地址范围。密钥寄存器文档索引字段1304标示密钥寄存器文档124内的寄存器,由分支与切换密钥指令1200将索引所指的寄存器所储存的密钥数值载入主密钥寄存器142,供提取单元104解密该「块」使用。以下参考图18进行讨论,表格1300于需要存取表格1300内容的分支与切换密钥指令1200执行前载入微处理器100。Referring now to FIG. 13, a block diagram illustrates a "block" address range table 1300 implemented in accordance with the techniques of the present invention. Form 1300 includes a number of cells. Each unit is associated with a "chunk" of the encryption program. Each cell includes an address range field 1302 and a key register file index field 1304 . The address range field 1302 indicates the memory address range of the corresponding "block". The key register file index field 1304 indicates the register in the key register file 124, and the key value stored in the register pointed to by the index is loaded into the master key register 142 by the branch and switch key instruction 1200 for decryption by the extraction unit 104 The "block" used. As discussed below with reference to FIG. 18 , the table 1300 is loaded into the microprocessor 100 before the branch and switch key instruction 1200 that needs to access the contents of the table 1300 is executed.

现在,参阅图14,一流程图图解图1微处理器100的操作,其中,根据本发明技术执行图12的分支与切换密钥指令1200。流程始于方块1402。Referring now to FIG. 14, a flowchart illustrates the operation of the microprocessor 100 of FIG. 1 in which the branch and switch key instruction 1200 of FIG. 12 is executed in accordance with the teachings of the present invention. Flow begins at block 1402 .

在方块1402,解码单元108解码一分支与切换密钥指令1200且将之代入微代码单元132中实现分支与切换密钥指令1200的微代码程序。流程接着进入方块1406。At block 1402 , the decoding unit 108 decodes a branch and switch key instruction 1200 and substitutes it into the microcode program in the microcode unit 132 implementing the branch and switch key instruction 1200 . The process then proceeds to block 1406 .

在方块1406,微代码解出分支方向(采用、或不采用)、且找出目标地址。流程接着进入判断方块1408。At block 1406, the microcode resolves the branch direction (taken, or not taken), and finds the target address. The flow then enters decision block 1408 .

在判断方块1408,微代码判断方块1406所解出的分支方向是否为采用。若为采用,流程进入方块1414。反之,流程进入方块1412。At decision block 1408, the microcode determines whether the branch direction resolved in block 1406 is taken. If yes, the process goes to block 1414 . Otherwise, the process goes to block 1412 .

在方块1412,微代码不切换密钥、或跳至目标地址,因为该分支未被采用。流程结束于方块1412。At block 1412, the microcode does not switch keys, or jump to the target address, because the branch was not taken. Flow ends at block 1412 .

在方块1414,微代码基于方块1406所解出的目标地址查询图13所示的表格1300,得到该目标地址所坐落的「块」所对应的密钥寄存器文档索引字段1304的内容。微代码接着基于密钥寄存器文档索引字段1304内所记载的索引,自密钥寄存器文档124将密钥数值载入主密钥寄存器142。较佳实施方式是,微代码根据密钥寄存器文档索引字段1304所储存的索引,自密钥寄存器文档124中将n个相邻寄存器储存的n个密钥值载入主密钥寄存器142的,其中,n为主密钥寄存器142的总数。在一种实施方式中,数值n可记录于分支与切换密钥指令1200的一额外字段中,设定为少于主密钥寄存器142总数。流程接着进入方块1416。In block 1414, the microcode queries the table 1300 shown in FIG. 13 based on the target address solved in block 1406, and obtains the content of the key register file index field 1304 corresponding to the "block" where the target address is located. The microcode then loads the key value from the key register file 124 into the master key register 142 based on the index recorded in the key register file index field 1304 . A preferred embodiment is that the microcode loads n key values stored in n adjacent registers from the key register file 124 into the master key register 142 according to the index stored in the key register file index field 1304, Wherein, n is the total number of master key registers 142 . In one embodiment, the value n may be recorded in an additional field of the branch and switch key instruction 1200 , set to be less than the total number of master key registers 142 . Flow then proceeds to block 1416 .

在方块1416,微代码致使微处理器100分支至方块1406所解出的目标地址,将导致微处理器100中较分支与切换密钥指令1200新的所有x86指令被清空,致使微处理器100内、较分支至目标地址的微操作新的所有微操作被清空。上述被清空的指令包括自指令高速缓冲存储器102提取出、缓冲暂存于提取单元104以及解码单元108内等待解密与解码的所有指令字节106。流程接着进入方块1418。In block 1416, the microcode causes the microprocessor 100 to branch to the target address solved in block 1406, which will cause all x86 instructions in the microprocessor 100 that are newer than the branch and switch key instruction 1200 to be cleared, causing the microprocessor 100 All micro-ops within and newer than the micro-op that branched to the target address are cleared. The cleared instructions include all instruction bytes 106 fetched from the instruction cache 102 , buffered and temporarily stored in the fetch unit 104 and the decode unit 108 waiting to be decrypted and decoded. The process then proceeds to block 1418 .

在方块1418,随着方块1416分支至目标地址的操作,提取单元104采用方块1414载入主密钥寄存器142的新一套密钥值,开始自指令高速缓冲存储器102提取并且解密指令数据106。流程结束于方块1418。At block 1418 , following the branch to target address at block 1416 , fetch unit 104 begins fetching and decrypting instruction data 106 from instruction cache 102 using the new set of key values loaded into master key register 142 at block 1414 . Flow ends at block 1418.

现在,参考图15,一方块图图解根据本发明技术另外一种实施方式所实现的一分支与切换密钥指令1500的格式。图15所示的分支与切换密钥指令1500以及其操作类似图12所示的分支与切换密钥指令1200。然而,取代自密钥寄存器文档124载入密钥至主密钥寄存器142,分支与切换密钥指令1500是自安全存储区122载入密钥至主密钥寄存器142,以下讨论之。Referring now to FIG. 15, a block diagram illustrates the format of a branch and switch key instruction 1500 implemented in accordance with another embodiment of the present technology. The branch and switch key instruction 1500 shown in FIG. 15 and its operation are similar to the branch and switch key instruction 1200 shown in FIG. 12 . However, instead of loading a key from the key register file 124 into the master key register 142, the branch and switch key instruction 1500 loads a key from the secure storage area 122 into the master key register 142, as discussed below.

现在,参考图16,一方块图图解根据本发明技术所实现的一「块」地址范围表1600。图16所示表格1600类似图13所示的表格1300。然而,取代包括一密钥寄存器文档索引字段1304,表格1600包括一安全存储区地址字段1604。安全存储区地址字段1604记载安全存储区122内的一地址,该地址储存的密钥值须由分支与切换密钥指令1500载入主密钥寄存器142,以供该提取单元1046解密该「块」时使用。以下讨论参考图18内容,表格1600是在需要查询该表格1600的分支与切换密钥指令1500被执行前载入微处理器100。在一种实施方式中,安全存储区122地址的较低数个位无须储存在安全存储区地址字段1604,特别是因为安全存储区122中储存一组密钥的位置的总量相当大(例如,16字节x 5)、且该组密钥可沿着一设定尺寸范为对齐。Referring now to FIG. 16, a block diagram illustrates a "block" address range table 1600 implemented in accordance with the techniques of the present invention. Table 1600 shown in FIG. 16 is similar to table 1300 shown in FIG. 13 . However, instead of including a key register file index field 1304 , table 1600 includes a secure storage area address field 1604 . The secure storage area address field 1604 records an address in the secure storage area 122, and the key value stored at the address must be loaded into the master key register 142 by the branch and switch key instruction 1500 for the extraction unit 1046 to decrypt the "block is used when . The following discussion refers to FIG. 18 . The table 1600 is loaded into the microprocessor 100 before the branch and switch key instruction 1500 that needs to look up the table 1600 is executed. In one embodiment, the lower bits of the secure store 122 address need not be stored in the secure store address field 1604, particularly because the total amount of locations in the secure store 122 to store a set of keys is relatively large (e.g. , 16 bytes x 5), and the set of keys can be aligned along a set size range.

现在,参阅图17,一流程图图解图1微处理器100的操作,其中根据本发明技术执行图15的分支与切换密钥指令1500。流程始于方块1702。图17的流程图的许多方块与图14的许多方块类似,因此采同样的编号。然而,方块1414是由方块1714取代,微代码基于方块1406所求得的目标地址查表图16的表格1600,以获得目标地址所坐落的「块」的安全存储区地址字段1604数值。微代码接着根据安全存储区地址字段1604数值自安全存储区122将密钥数值载入主密钥寄存器142。较佳实施方式是,微代码由安全存储区地址字段1604数值自安全存储区122将n个邻近16字节空间位置内所储存的n个密钥数值载入主密钥寄存器142,其中n为主密钥寄存器142的总数。在一种实施方式中,数值n可记载于分支与切换密钥指令1500中一额外字段,设定为少于主密钥寄存器142总数。Referring now to FIG. 17, a flowchart illustrates the operation of the microprocessor 100 of FIG. 1 in which the branch and switch key instruction 1500 of FIG. 15 is executed in accordance with the teachings of the present invention. Flow begins at block 1702 . Many blocks of the flowchart of FIG. 17 are similar to many blocks of FIG. 14 and thus are numbered the same. However, block 1414 is replaced by block 1714, and the microcode looks up the table 1600 of FIG. 16 based on the target address obtained in block 1406 to obtain the value of the secure storage area address field 1604 of the "block" where the target address is located. The microcode then loads the key value from the secure storage area 122 into the master key register 142 according to the value of the secure storage area address field 1604 . A preferred embodiment is that the microcode loads n key values stored in n adjacent 16-byte space positions from the secure storage area 122 into the master key register 142 from the secure storage area address field 1604 value, where n is The total number of master key registers 142. In one embodiment, the value n may be recorded in an additional field in the branch and switch key instruction 1500 , set to be less than the total number of master key registers 142 .

现在,参阅图18,一流程图图解根据本发明另外一种实施方式所实现的一后处理器的操作。所述后处理器可用于后处理一程序并加密,以交由图1的微处理器100执行。流程始于方块1802。Referring now to FIG. 18, a flowchart illustrates the operation of a post-processor implemented in accordance with another embodiment of the present invention. The post-processor can be used to post-process a program and encrypt it, so as to be executed by the microprocessor 100 of FIG. 1 . Flow begins at block 1802 .

在方块1802,后处理器接收一程序的目的文件。根据一种实施方式,该目的文件内的分支指令,可为目标地址在程序执行前判定、可为目标地址不可在程序执行前判定。流程接着进入方块1803。At block 1802, a post-processor receives an object file for a program. According to one embodiment, the branch instruction in the target file may be that the target address is determined before the program is executed, or that the target address cannot be determined before the program is executed. The flow then enters block 1803 .

在方块1803,后处理器建立图13或图16的「块」地址范围表1300或1600,以列入该目标档。在一种实施方式中,操作系统在载入且执行一加密程序前将表格1300/1600载入微处理器100,使分支与切换密钥指令1200/1500得以存取的。在一种实施方式中,后处理器在程序中插入指令,以在任何分支与切换密钥指令1200/1500执行前载入表格1300/1600至微处理器100。流程接着进入方块1804。At block 1803, the post-processor builds the "block" address range table 1300 or 1600 of Figure 13 or Figure 16 to include in the object file. In one embodiment, the operating system loads the table 1300/1600 into the microprocessor 100 prior to loading and executing an encryption program to allow access to the branch and switch key instructions 1200/1500. In one embodiment, the post-processor inserts instructions in the program to load the tables 1300/1600 into the microprocessor 100 before any branch and switch key instructions 1200/1500 are executed. The flow then goes to block 1804 .

在方块1804,类似先前所讨论、关于图11的方块1104的操作,后处理器将每个执行前目标地址可决定的跨块分支指令以图9的分支与切换密钥指令900取代,指令900基于分支指令目标地址所在「块」记载有合适的密钥寄存器文档索引字段904数值。流程接着进入方块1805。At block 1804, similar to the operations previously discussed with respect to block 1104 of FIG. 11 , the postprocessor replaces each cross-block branch instruction whose pre-execution target address can be determined with the branch and switch key instruction 900 of FIG. 9 , instruction 900 The appropriate key register file index field 904 value is recorded based on the "block" where the target address of the branch instruction is located. The flow then enters block 1805 .

在方块1805,后处理器根据方块1803所产生的表格型态(1300/1600)将每个限于执行过程中决定目标地址的分支指令以图12或图15所示的分支与切换密钥指令1200或1500取代。流程接着进入方块1806。In block 1805, the post-processor uses the branch instruction 1200 shown in FIG. 12 or FIG. or 1500 to replace. The process then proceeds to block 1806 .

在方块1806,后处理器加密该程序。该后处理器知道关于各「块」的存储器位置与主密钥寄存器142数值,将用于加密该程序。流程结束于方块1806。At block 1806, the post-processor encrypts the program. The postprocessor knows the memory location and master key register 142 value for each "block" that will be used to encrypt the program. Flow ends at block 1806 .

现在,参阅图19,一流程图图解图1微处理器100的操作,其中,根据本发明技术处理加密程序以及纯文字程序之间的任务切换。流程始于方块1902。Referring now to FIG. 19, a flow diagram illustrates the operation of the microprocessor 100 of FIG. 1 in which task switching between an encrypted program and a text-only program is handled in accordance with the techniques of the present invention. Flow begins at block 1902 .

在方块1902,标志寄存器128的E位字段402的E位以及图1控制寄存器144的E位148由微处理器100的一重置操作清空。流程接着进入方块1904。At block 1902 , the E bit of the E bit field 402 of the flags register 128 and the E bit 148 of the control register 144 of FIG. 1 are cleared by a reset operation of the microprocessor 100 . The flow then goes to block 1904 .

在方块1904,微处理器100在执行其重置微代码进行初始化后,开始提取并且执行使用者程序指令(例如,系统固件),其为纯文字程序指令。特别是,由于E位128为清空,如前所述,提取单元104视提取出来的指令数据106为纯文字指令。流程接着进入方块1906。At block 1904, after initialization by executing its reset microcode, the microprocessor 100 begins to fetch and execute user program instructions (eg, system firmware), which are plain text program instructions. In particular, since the E bit 128 is cleared, as mentioned above, the fetch unit 104 regards the fetched command data 106 as a plain text command. The process then proceeds to block 1906 .

在方块1906,系统固件(例如,操作系统、固件、基本输入输出系统BIOS...等)接收一要求(request),要执行一加密程序。在一种实施方式中,执行一加密程序的上述要求伴随、或由一切换操作指示,以切换至微处理器100的一安全执行模式,如以上讨论内容。在一种实施方式中,微处理器100仅在安全执行模式时,方允许操作于一解密模式(即,E位148为设定状态)。在一种实施方式中,微处理器100仅在系统管理模式(system management mode,例如,x86架构中常见的SSM),方允许以解密模式操作。流程接着进入方块1908。At block 1906, system firmware (eg, operating system, firmware, BIOS, . . . , etc.) receives a request to execute an encryption procedure. In one embodiment, the aforementioned requirement to execute an encryption program is accompanied by, or indicated by, a switch operation to switch to a secure execution mode of the microprocessor 100, as discussed above. In one embodiment, the microprocessor 100 is only allowed to operate in a decrypted mode (ie, the E bit 148 is set) when in the secure execution mode. In one embodiment, the microprocessor 100 is only allowed to operate in decryption mode in system management mode (eg, SSM common in x86 architecture). The flow then goes to block 1908 .

在方块1908,系统软件于主密钥寄存器142中载入其初始值,与程序中将被执行的第一「块」相关。在一种实施方式中,系统软件执行一密钥切换指令600下载密钥至主密钥寄存器142。在载入密钥至主密钥寄存器142之前,密钥寄存器文档124的内容可由一个或多个密钥载入指令500载入。在一种实施方式中,载入密钥至主密钥寄存器142以及密钥寄存器文档124之前,安全存储区122可先被写入密钥数值,其中,所述写入乃经由常见的安全通道技术,例如,AES或RSA加密通道,以防止黑客窥探其值。如以上所讨论,以上密钥数值可储存在一安全非易失性性存储器(例如快闪存储器)经由一隔离串行总线(private serial bus)耦接微处理器100,或者,可储存在微处理器100的一非易失性性单次写入存储器。如以上讨论,所述程序可包含在单一「块」中。也就是说,所述程序可不包括密钥切换指令600,整个程序可由单一套主密钥寄存器142数值解密。流程接着进入方块1916。At block 1908, the system software loads the master key register 142 with its initial value, associated with the first "block" in the program to be executed. In one embodiment, the system software executes a key switching instruction 600 to download the key to the master key register 142 . Before loading keys into master key register 142 , the contents of key register file 124 may be loaded by one or more key load instructions 500 . In one embodiment, before the key is loaded into the master key register 142 and the key register file 124, the secure storage area 122 can be written with the key value first, wherein the writing is through a common secure channel Techniques such as AES or RSA encrypt the channel to prevent hackers from snooping on its value. As discussed above, the above key values may be stored in a secure non-volatile memory (such as flash memory) coupled to the microprocessor 100 via an isolated serial bus (private serial bus), or may be stored in a microprocessor 100 A non-volatile write-once memory of the processor 100. As discussed above, the procedures may be contained within a single "chunk." That is to say, the program may not include the key switching instruction 600 , and the entire program may be decrypted by a single set of master key register 142 values. Flow then proceeds to block 1916 .

在方块1916,随着控制权转移至加密程序,微处理器100设定标志寄存器128的E位字段402标示目前所执行的程序为加密型式,且设定控制寄存器144的E位148,使提取单元104处于解密模式。微处理器100更致使管线内的指令被刷新,其动作类似图7方块706所实行的刷新操作。流程接着进入方块1918。At block 1916, as control is transferred to the encrypted program, the microprocessor 100 sets the E bit field 402 of the flag register 128 to indicate that the currently executing program is encrypted, and sets the E bit 148 of the control register 144 to enable extraction Unit 104 is in decryption mode. The microprocessor 100 further causes the instructions in the pipeline to be flushed, which is similar to the flushing operation performed by block 706 in FIG. 7 . The process then proceeds to block 1918 .

在方块1918,提取单元104提取加密程序内的指令106,并且参考图1至图3所揭示的技术将之以解密模式解密并且执行。流程接着进入方块1922。At block 1918 , the fetch unit 104 fetches the instructions 106 in the encrypted program, and decrypts and executes them in a decrypted mode with reference to the techniques disclosed in FIGS. 1-3 . The flow then goes to block 1922 .

在方块1922,微处理器100提取并且执行加密程序时,微处理器100接收到中断事件。举例说明,所述中断事件可为一中断interrupt、一异常exception(如页面错误page fault)、或任务切换task switch。当一中断事件发生,微处理器100管线所有待处理的指令会被清空。所以,若管线中有任何先前提取的加密指令,将之清空。此外,自指令高速缓冲存储器102所提取出、可能在缓冲储存在提取单元104以及解码单元108中等待被解密、解码的所有指令字节会被清空。在一种实施方式中,微代码被唤起回应中断事件。流程接着进入方块1924。At block 1922, while the microprocessor 100 is fetching and executing the encryption program, the microprocessor 100 receives an interrupt event. For example, the interrupt event may be an interrupt, an exception (such as a page fault), or a task switch. When an interrupt event occurs, all pending instructions in the pipeline of the microprocessor 100 are flushed. So, if there are any previously fetched encrypted instructions in the pipeline, it is flushed. In addition, all instruction bytes fetched from the instruction cache 102 that may be cached in the fetch unit 104 and the decode unit 108 waiting to be decrypted and decoded are cleared. In one embodiment, microcode is invoked in response to an interrupt event. The process then proceeds to block 1924 .

在方块1924,微处理器100储存标志寄存器128(以及微处理器100其他结构状态,包括受中断的加密程序的目前指令指标数值)至一堆迭式存储器(stack memory)。储存加密程序的E位字段402数值将使其得以在后续操作中修复(在方块1934)。流程接着进入方块1926。At block 1924, the microprocessor 100 stores the flags register 128 (and other structural state of the microprocessor 100, including the current instruction index value of the interrupted encryption routine) to a stack memory. Storing the encrypted program's E-bit field 402 value allows it to be restored in subsequent operations (at block 1934). Flow then proceeds to block 1926 .

在方块1926,当控制权转移到新的程序(例如,中断处理程序interrupt handler、异常处理程序exception handler、或新任务),微处理器100清空标志寄存器128的E位字段402、以及控制寄存器144的E位148,以应付纯文字的新程序。也就是说,图19所示实施例假设微处理器100同一时间只有允许运作一个加密程序,且已有一个加密程序在执行(但被中断)。图22至图26另外揭示有其他种的实施方式。流程接着进入方块1928。At block 1926, when control is transferred to a new program (e.g., an interrupt handler, an exception handler, or a new task), the microprocessor 100 clears the E bit field 402 of the flags register 128, and the control register 144 The E bit is 148 to cope with text-only new programs. That is to say, the embodiment shown in FIG. 19 assumes that the microprocessor 100 is only allowed to run one encryption program at a time, and an encryption program is already executing (but interrupted). Figures 22 to 26 additionally disclose other implementations. The process then proceeds to block 1928 .

在方块1928,提取单元104参考图1至图3所揭示内容以纯文字模式提取新程序的指令106。特别是,控制寄存器144内E位148的清空状态使得多工器154将指令数据106与多位的二进位零值176进行异运算,使得指令数据106不被解密操作。流程接着进入方块1932。At block 1928 , the fetch unit 104 fetches the instructions 106 of the new program in plain text mode with reference to the contents disclosed in FIGS. 1-3 . In particular, the clear state of the E bit 148 in the control register 144 enables the multiplexer 154 to perform an XOR operation on the instruction data 106 and the multi-bit binary zero value 176 so that the instruction data 106 is not decrypted. The process then proceeds to block 1932 .

在方块1932,新程序执行一返回操作自中断指令(例如,x86IRET)或类似指令返回,使得控制权回归加密程序。在一种实施方式中,自中断指令返回的操作由微代码实现。流程接着进入方块1934。At block 1932, the new program performs a return operation from an interrupt instruction (eg, x86 IRET) or similar instruction, so that control returns to the encryption program. In one embodiment, the operation of returning from the interrupt instruction is implemented by microcode. The process then proceeds to block 1934 .

在方块1934,回应前述自中断指令返回的操作,由于控制权移转回加密程序,微处理器100修复标志寄存器128,令标志寄存器128的E位字段402重回先前方块1924所储存的设定状态。流程接着进入方块1938。In block 1934, in response to the aforementioned operation returning from the interrupt instruction, since the control right is transferred back to the encryption program, the microprocessor 100 repairs the flag register 128, so that the E bit field 402 of the flag register 128 returns to the setting stored in the previous block 1924 state. The process then proceeds to block 1938 .

在方块1938,由于控制权移转回加密程序,微处理器100以标志寄存器128的E位字段402数值更新控制寄存器144的E位148,使得提取单元104重新提取并且解密该加密程序的指令数据106。流程接着进入方块1942。At block 1938, since the control right is transferred back to the encrypted program, the microprocessor 100 updates the E bit 148 of the control register 144 with the value of the E bit field 402 of the flag register 128, so that the extraction unit 104 re-fetches and decrypts the instruction data of the encrypted program 106. The process then proceeds to block 1942 .

在方块1942,微代码令微处理器100分支至先前方块1924储存于堆迭式存储器中的指令指标数值,使得微处理器100中所有x86指令清空、且使得微处理器100中所有微操作清空。所清空内容包括提取自指令高速缓冲存储器102、缓冲暂存在提取单元104以及解码单元108中等待被解密、解码的所有指令字节106。流程接着进入方块1944。At block 1942, the microcode causes the microprocessor 100 to branch to the instruction index value stored in the stack memory at the previous block 1924, causing all x86 instructions in the microprocessor 100 to be cleared and all micro-operations in the microprocessor 100 to be cleared . The cleared content includes all instruction bytes 106 fetched from the instruction cache memory 102 , buffered and temporarily stored in the fetch unit 104 and the decoding unit 108 waiting to be decrypted and decoded. The process then proceeds to block 1944 .

在方块1944,提取单元104重新开始提取该加密程序内的指令106,并且参考图1至图3所揭示技术以解密模式解密并且执行。流程结束于方块1944。At block 1944, the fetch unit 104 resumes fetching the instructions 106 in the encrypted program, and decrypts and executes them in a decrypted mode with reference to the techniques disclosed in FIGS. 1-3 . Flow ends at block 1944.

现在,参考图20,一流程图图解根据本发明技术实现的一系统软件的操作,由图1的微处理器100执行。图20流程可结合图19内容执行。流程始于方块2002。Referring now to FIG. 20, a flowchart illustrates the operation of a system software implemented in accordance with the techniques of the present invention, executed by the microprocessor 100 of FIG. The process in FIG. 20 can be executed in combination with the content in FIG. 19 . The process starts at block 2002.

在方块2002,系统软件收到一要求,欲执行一个新的加密程序。流程接着进入决策方块2004。At block 2002, the system software receives a request to execute a new encryption procedure. The flow then enters decision block 2004 .

在决策方块2004,系统软件判断此一加密程序是否为系统已在执行的程序之一。在一种实施方式中,系统软件以一标志标示一加密程序是否为系统中已在执行的程序之一。若此加密程序是系统已在执行的程序之一,流程进入方块2006,反之,则流程进入方块2008。At decision block 2004, the system software determines whether the encrypted program is one of the programs already being executed by the system. In one embodiment, the system software uses a flag to indicate whether an encryption program is one of the programs already executing in the system. If the encryption program is one of the programs already being executed by the system, the flow goes to block 2006 , otherwise, the flow goes to block 2008 .

在方块2006,系统软件等待该加密程序执行完毕且不再是系统执行中的程序之一。流程接着进入方块2008。At block 2006, the system software waits for the encryption program to finish executing and is no longer one of the programs being executed by the system. The flow then enters block 2008 .

在方块2008,微处理器100允许新的加密程序开始执行。流程结束于方块2008。At block 2008, the microprocessor 100 allows the new encryption program to begin execution. The process ends at block 2008.

现在,参考图21,一方块图根据本发明技术另外一种实施方式,图解图1标志寄存器128的字段。图21的标志寄存器128类似图4所示实施方式,相比的,还包括索引字段(index bits)2104。根据一种实施方式,包括索引字段2104类似E位402通常是x86架构所预留的位。索引字段2104用于应付多个加密程序的切换,以下详细讨论。较佳实施方式是,密钥切换指令600以及分支与切换密钥指令900/1200以本身的密钥寄存器索引字段604/904/1304更新标志寄存器128的索引字段2104。Referring now to FIG. 21, a block diagram illustrates the fields of the flag register 128 of FIG. 1 in accordance with another embodiment of the present technology. The flag register 128 in FIG. 21 is similar to the embodiment shown in FIG. 4 , but also includes an index field (index bits) 2104. According to one embodiment, the index field 2104 and the E bit 402 are generally reserved by the x86 architecture. The index field 2104 is used to cope with switching between multiple encryption programs, which will be discussed in detail below. In a preferred embodiment, the key switch instruction 600 and the branch and switch key instruction 900/1200 update the index field 2104 of the flag register 128 with their own key register index field 604/904/1304.

现在,参考图22,一流程图图解图1微处理器100的操作,其中,根据本发明技术采用图21所示的标志寄存器128实行多个加密程序之间的任务切换。流程接着进入方块2202。Referring now to FIG. 22, a flow diagram illustrates the operation of the microprocessor 100 of FIG. 1 in which task switching between multiple encryption routines is implemented using the flag register 128 shown in FIG. 21 in accordance with the teachings of the present invention. The flow then enters block 2202 .

在方块2202,一要求发向该系统软件,要执行一个新的加密程序。流程接着进入决策方块2204。At block 2202, a request is sent to the system software to execute a new encryption procedure. Flow then enters decision block 2204.

在决策方块2204,系统软件判断密钥寄存器文档124中是否有空间应付一个新的加密程序。在一种实施方式中,方块2202所产生的该要求会指出需要密钥寄存器文档124内多少空间。若密钥寄存器文档124中有空间应付新的加密程序,流程进入方块2208,反之,流程进入方块2206。At decision block 2204, the system software determines whether there is room in the key register file 124 for a new encryption program. In one embodiment, the request generated by block 2202 may indicate how much space within the key register file 124 is required. If there is room in the key register file 124 for the new encryption program, the process enters block 2208 , otherwise, the process enters block 2206 .

在方块2206,系统软件等待一个或多个加密程序完成、使密钥寄存器文档124腾出空间应付新的加密程序。流程接着进入方块2208。At block 2206, the system software waits for one or more encryption procedures to complete, freeing the key register file 124 for new encryption procedures. The flow then goes to block 2208 .

在方块2208,系统软件将密钥寄存器文档124内的空间配置给新的加密程序,并且随之填写标志寄存器128中的索引字段2104,以标示密钥寄存器文档124中新配置的空间。流程接着进入方块2212。At block 2208 , the system software allocates space in the key register file 124 to the new encryption program and then fills in the index field 2104 in the flag register 128 to identify the newly allocated space in the key register file 124 . The flow then enters block 2212.

在方块2212,系统软件在方块2208所配置的密钥寄存器文档124位置载入供新程序使用的密钥数值。如以上讨论,所载入的密钥数值可采用密钥下载指令500自安全存储区122载入,或者,在必要情况下,可以安全管道由微处理器100外部位置取得。流程接着进入方块2214。At block 2212 , the system software loads the key value for use by the new program at the key register file 124 location configured at block 2208 . As discussed above, the loaded key value can be loaded from the secure storage area 122 using the key download command 500 , or, if necessary, can be retrieved from a location external to the microprocessor 100 via a secure channel. The process then proceeds to block 2214.

在方块2214,系统软件基于密钥寄存器文档索引字段604/904/1304将密钥自密钥寄存器文档124载入主密钥寄存器142。在一种实施方式中,系统软件执行一密钥切换指令600载入密钥至主密钥寄存器142。流程接着进入方块2216。At block 2214, the system software loads the key from the key register file 124 into the master key register 142 based on the key register file index field 604/904/1304. In one embodiment, the system software executes a key switching instruction 600 to load the key into the master key register 142 . The process then proceeds to block 2216.

在方块2216,由于控制权移转至加密程序,微处理器100设定标志寄存器128的E位字段402以标示目前执行的程序为加密型式,并且设定控制寄存器144的E位148以设定提取单元104为解密模式。流程结束于方块2216。At block 2216, since control is transferred to the encrypted program, the microprocessor 100 sets the E bit field 402 of the flag register 128 to indicate that the currently executing program is encrypted, and sets the E bit 148 of the control register 144 to set Extraction unit 104 is in decryption mode. Flow ends at block 2216.

现在,参考图23,一流程图图解图1微处理器100的操作,其中,根据本发明技术采用图21所示的标志寄存器128应付多个加密程序之间的任务切换。流程始于方块2302。Referring now to FIG. 23, a flow diagram illustrates the operation of the microprocessor 100 of FIG. 1 in which the flag register 128 shown in FIG. 21 is employed to handle task switching between multiple encryption programs in accordance with the teachings of the present invention. Flow begins at block 2302.

在方块2302,目前执行的程序执行一返回操作,自一中断指令返回,引发一任务切换至新程序;所述新程序先前曾被执行过但被跳开,且其结构状态(例如,标志寄存器128、指令指标寄存器、以及通用寄存器)曾被储存在堆迭式存储器中。如先前所提过,在一种实施方式中,自中断指令返回的操作是由微代码实现。现在执行中的程序以及新的程序可为加密程序或纯文字程序。流程进入方块2304。At block 2302, the currently executing program performs a return operation, returning from an interrupt instruction, causing a task switch to a new program; the new program was previously executed but skipped, and its structural state (e.g., flag register 128, instruction pointer register, and general purpose register) were stored in the stacked memory. As mentioned previously, in one embodiment, the operation of returning from the interrupt instruction is implemented by microcode. The currently executing program and the new program can be encrypted programs or plain text programs. The flow goes to block 2304.

在方块2304,微处理器100根据堆迭式存储器修复标志寄存器128,以应付接续返回的程序。也就是说,微处理器100将接续程序(即目前跳换回的程序)先前跳换出去时储存于堆迭式存储器的标志寄存器128数值重新载入标志寄存器128。流程接着进入决策方块2306。In block 2304, the microprocessor 100 restores the flag register 128 according to the stacked memory to cope with the subsequent return of the program. That is to say, the microprocessor 100 reloads into the flag register 128 the value of the flag register 128 stored in the stack memory when the continuation program (that is, the program currently jumped back to) was previously jumped out. Flow then proceeds to decision block 2306.

在决策方块2306,微处理器100判断修复后的标志寄存器128的E位402是否为设定状态。若是,则流程进入方块2308;反之,则流程进入方块2312。At decision block 2306, the microprocessor 100 determines whether the E bit 402 of the repaired flags register 128 is set. If yes, the process enters into block 2308; otherwise, the process enters into block 2312.

在方块2308,微处理器100根据方块2304所修复的EFLAGS寄存器128索引字段2104数值将密钥载入密钥寄存器文档124。流程接着进入方块2312。At block 2308 , the microprocessor 100 loads the key into the key register file 124 according to the value of the index field 2104 of the EFLAGS register 128 repaired at block 2304 . The process then proceeds to block 2312 .

在方块2312,微处理器100将控制寄存器144的E位148的内容以方块2304所修复的标志寄存器128的E位字段402数值更新。因此,若接续的程序是一个加密程序,提取单元104会被设定为解密模式,反之,则设定为纯文字模式。流程接着进入方块2314。At block 2312 , the microprocessor 100 updates the contents of the E bit 148 of the control register 144 with the value of the E bit field 402 of the flags register 128 repaired at block 2304 . Therefore, if the following program is an encrypted program, the extracting unit 104 will be set to the decryption mode, otherwise, it will be set to the plain text mode. The process then proceeds to block 2314.

在方块2314,微处理器100以堆迭式存储器的内容修复指令指标寄存器、并且分支跳跃至指令指标所指的位置,所述动作将清除微处理器100所有x86指令,并且清除微处理器所有微操作。所清除的包括自指令高速缓冲存储器102所提取出、缓冲暂存于提取单元104、解码单元108中等待解密、解码的所有指令字节106。流程接着进入方块2316。At block 2314, the microprocessor 100 restores the instruction pointer register with the contents of the stack memory and branches to the location pointed to by the instruction pointer, which action will clear the microprocessor 100 of all x86 instructions and clear all micro-operations. What is cleared includes all instruction bytes 106 extracted from the instruction cache memory 102 and buffered and temporarily stored in the fetching unit 104 and the decoding unit 108 waiting to be decrypted and decoded. The process then proceeds to block 2316.

在方块2316,提取单元104参考图1至图3技术重新开始自接续程序中提取指令106,并视方块2312所修复的控制寄存器144的E位148数值以解密模式或纯文字模式操作。流程结束于方块2316。At block 2316, the fetch unit 104 resumes fetching instructions 106 from the continuation program with reference to the techniques of FIGS. Flow ends at block 2316.

现在,参考图24,一方块图根据本发明、图解图1密钥寄存器文档124的单一个寄存器的另外一种实施方式。根据图24所示的实施方式,每个密钥寄存器文档124还包括一位-为淘汰位2402(kill bit,以下简称K位)。K位2402用于应付微处理器100对多个加密程序的多任务(multitasking)操作,所述多个加密程序总计需要多于密钥寄存器文档124空间尺寸的密钥储存空间,以下将详述之。Referring now to FIG. 24, a block diagram illustrates another embodiment of a single register of the key register file 124 of FIG. 1, in accordance with the present invention. According to the embodiment shown in FIG. 24 , each key register file 124 also includes one bit—a kill bit 2402 (kill bit, hereinafter referred to as K bit). The K bit 2402 is used to cope with the multitasking operation of the microprocessor 100 on multiple encryption programs that require more key storage space than the size of the key register file 124 in total, as will be described in detail below Of.

现在,参考图25,一流程图图解图1微处理器100的操作,其中根据本发明技术以图21的标志寄存器128以及图24的密钥寄存器文档124实现多个加密程序之间的任务切换的另外一种实施方式。图25所示流程类似图22所示流程。不同处在于决策方块2204判定密钥寄存器文档124中没有足够可用空间时,图25流程会进入方块2506而非不存在于图25的方块2204。另外,若决策方块2204判定密钥寄存器文档124中尚有足够可用空间,则图25流程同样进入图22的方块2208至方块2216。Referring now to FIG. 25, a flowchart illustrates the operation of the microprocessor 100 of FIG. 1 in which task switching between multiple encryption programs is implemented in accordance with the teachings of the present invention with the flag register 128 of FIG. 21 and the key register file 124 of FIG. Another implementation of . The flow shown in FIG. 25 is similar to the flow shown in FIG. 22 . The difference is that when the decision block 2204 determines that there is not enough space available in the key register file 124 , the flow of FIG. 25 will enter block 2506 instead of block 2204 in FIG. 25 . In addition, if the decision block 2204 determines that there is still enough free space in the key register file 124, the process in FIG. 25 also enters blocks 2208 to 2216 in FIG. 22 .

在方块2506,系统软件将密钥寄存器文档124中已经被其他加密程序使用(即已经被配置)的空间(即寄存器)配置出来,并且设定所配置寄存器的K位2402为设定状态,并且随之设定标志寄存器128的索引字段2104以标示新配置空间在密钥寄存器文档124中的位置。K位2402的设定状态,是标示该寄存器中关于其他加密程序的密钥值将被方块2212的操作覆写为新的加密程序的密钥值。然而,如以下图26所叙述,其他加密程序的密钥值将在其返回程序中由方块2609重新载入。图25流程进入方块2506,会接着导向图22所示的方块2212,结束于方块2216。In block 2506, the system software configures the space (i.e., the register) that has been used (i.e. has been configured) by other encryption programs in the key register file 124, and sets the K bit 2402 of the configured register to a set state, and The index field 2104 of the flag register 128 is then set to indicate the location of the new configuration space in the key register file 124 . The setting state of the K bit 2402 indicates that the key values related to other encryption programs in the register will be overwritten with the key values of the new encryption program by the operation of block 2212 . However, as described below in FIG. 26, the key values of other encryption programs will be reloaded by block 2609 in their return routines. The process in FIG. 25 enters block 2506 , and then leads to block 2212 shown in FIG. 22 , and ends in block 2216 .

现在,参阅图26,一流程图图解图1微处理器100的操作,其中根据本发明技术以图21的标志寄存器128以及图24的密钥寄存器文档124实现多个加密程序之间的任务切换的另外一种实施方式。图26所示流程类似图23所示流程。不同处在于,若决策方块2306判定标志寄存器128的E位402为设定,图26令流程进入决策方块2607而非方块2308。Referring now to FIG. 26 , a flowchart illustrates the operation of the microprocessor 100 of FIG. 1 in which task switching between multiple encryption programs is implemented with the flag register 128 of FIG. 21 and the key register file 124 of FIG. 24 in accordance with the teachings of the present invention. Another implementation of . The flow shown in FIG. 26 is similar to the flow shown in FIG. 23 . The difference is that if the decision block 2306 determines that the E bit 402 of the flag register 128 is set, FIG. 26 makes the process enter the decision block 2607 instead of the block 2308 .

在决策方块2607,微处理器100判断密钥寄存器文档124中,由标志寄存器128索引字段2104数值(于方块2304中修复)所标示的任何寄存器的K位2402是否为设定状态。若是,则流程进入方块2609;若否,则流程进入方块2308。At decision block 2607, the microprocessor 100 determines whether the K bit 2402 of any register in the key register file 124 indicated by the value of the flags register 128 index field 2104 (repaired in block 2304) is set. If yes, the process goes to block 2609; if not, the process goes to block 2308.

在方块2609,微处理器100产生一异常警示(exception)交由一异常处理程序处理。在一种实施方式中,异常处理程序设计于系统软件中。在一种实施方式中,异常处理程序是由安全执行模式架构提供。根据方块2304所修复的标志寄存器128索引字段2104数值,异常处理程序将目前修复的加密程序(即现在所返回执行的加密程序)的密钥重新载入密钥寄存器文档124。异常处理程序可类似先前图19所提及的方块1908作动,将修复的加密程序的密钥载入密钥寄存器文档124,或者,在必要情况下,自微处理器100外部将密钥载入安全存储区122。同样地,若密钥寄存器文档124中被重新载入的寄存器有被其他加密程序使用,系统软件会令其寄存器的K位2402为设定状态。流程接着自方块2609进入2308,且方块2308至2316是参考图23内容。At block 2609, the microprocessor 100 generates an exception and sends it to an exception handler for processing. In one embodiment, the exception handling program is designed in the system software. In one embodiment, exception handlers are provided by the Safe Execution Mode framework. According to the value of the index field 2104 of the flag register 128 repaired by the block 2304, the exception handler reloads the key of the currently repaired encryption program (ie, the encryption program returned for execution) into the key register file 124. The exception handler can act similarly to block 1908 previously mentioned in FIG. into the secure storage area 122. Similarly, if the reloaded register in the key register file 124 is used by other encryption programs, the system software will set the K bit 2402 of the register to a set state. The process then enters 2308 from block 2609, and blocks 2308 to 2316 refer to the contents of FIG. 23 .

如图24至图26所教示,此处所叙述的实施方式令微处理器100得以实行多个加密程序的多任务操作,即便上述加密程序需要密钥暂存空间总合多于密钥寄存器124空间尺寸。As taught in FIGS. 24-26 , the embodiments described herein allow the microprocessor 100 to multitask with multiple encryption programs even though the encryption programs require more aggregate key scratchpad space than key register 124 space. size.

现在,参考图27,一方块图图解修改自图1微处理器100的本发明另外一种实施方式。与图1类似的元件是采用同样标号;例如,指令高速缓冲存储器102、提取单元104以及密钥寄存器文档124。然而,此处提取单元104被修正成还包括密钥切换逻辑2712,耦接图1所介绍的主密钥寄存器文档142以及密钥寄存器文档124。图27的微处理器100还包括一分支目标地址高速缓冲存储器(branch target address cache,BTAC)2702。BTAC 2702接收图1所揭示的提取地址134,且与指令高速缓冲存储器102的存取平行,皆是基于该提取地址134。根据提取地址134,BTAC 2702供应分支目标地址2706给图1所揭示的提取地址产生器164,供应一采用/不采用指标(T/NTindicator)2708以及一型式指标(type indicator)2714给密钥切换逻辑2712,并且供应一密钥寄存器文档(KRF)索引2716给密钥寄存器文档124。Referring now to FIG. 27, a block diagram illustrates another embodiment of the present invention modified from the microprocessor 100 of FIG. Components similar to those in FIG. 1 are numbered the same; for example, instruction cache 102 , fetch unit 104 , and key register file 124 . However, here the extraction unit 104 is modified to further include a key switching logic 2712 coupled to the master key register file 142 and the key register file 124 introduced in FIG. 1 . The microprocessor 100 of FIG. 27 also includes a branch target address cache (branch target address cache, BTAC) 2702. The BTAC 2702 receives the fetch address 134 disclosed in FIG. 1 and parallelizes the access to the instruction cache 102 based on the fetch address 134. According to the extraction address 134, the BTAC 2702 supplies the branch target address 2706 to the extraction address generator 164 disclosed in FIG. logic 2712 and supply a key register file (KRF) index 2716 to the key register file 124.

现在,参阅图28,一方块图根据本发明技术更详细图解图27的BTAC2702。BTAC 2702包括一BTAC矩阵2802,其中具有多个BTAC单元2808,图29图解BTAC单元2808的内容。BTAC 2802储存的信息包括先前执行过的分支指令的历史信息,以预测接续执行的分支指令的方向以及目标地址。特别是,BTAC 2802会采用储存的历史信息,基于提取的地址134预测先前执行过的分支指令后续发生的提取操作。分支目标地址高速缓冲的操作可参考常见的分支预测技术。然而,本发明所揭示的BTAC 2802是更修正成记录先前执行过的分支与切换密钥指令900/1200的历史信息,以进行相关的预测操作。特别是,储存的历史记录使得BTAC 2802得以在提取时间内预测所提取的分支与切换密钥指令900/1200将载入主密钥寄存器142的该组数值。此操作致能密钥切换逻辑2712在分支与切换密钥指令900/1200实际执行前将密钥数值载入,避免受限于需根据分支与切换密钥指令900/1200的执行清空微处理器100的管线内容,以下将详细讨论。此外,根据一种实施方式,BTAC 2802更被修正成储存包括先前执行过的密钥切换指令600的历史信息,以达到相同的效果。Referring now to FIG. 28, a block diagram illustrates the BTAC 2702 of FIG. 27 in greater detail in accordance with the teachings of the present invention. BTAC 2702 includes a BTAC matrix 2802 having a plurality of BTAC units 2808 therein, and FIG. 29 illustrates the contents of BTAC units 2808. The information stored in the BTAC 2802 includes historical information of previously executed branch instructions to predict the direction and target address of the next executed branch instructions. In particular, the BTAC 2802 uses stored history information to predict subsequent fetch operations for previously executed branch instructions based on the fetched address 134 . The operation of the branch target address cache can refer to common branch prediction techniques. However, the BTAC 2802 disclosed in the present invention is further modified to record the history information of the previously executed branch and switch key instructions 900/1200, so as to perform related predictive operations. In particular, the stored history allows the BTAC 2802 to predict, at fetch time, the set of values that the fetched branch and switch key instruction 900/1200 will load into the master key register 142. This operation enables the key switch logic 2712 to load the key value before the branch and switch key instruction 900/1200 is actually executed, avoiding being limited by the need to flush the microprocessor upon execution of the branch and switch key instruction 900/1200 The pipeline content of 100 will be discussed in detail below. In addition, according to one embodiment, the BTAC 2802 is further modified to store history information including previously executed key switching instructions 600, so as to achieve the same effect.

现在,参阅图29,一方块图根据本发明技术更详细图解图28BTAC单元2808的内容。每个单元2808包括一有效位2902指示所属单元2808是否为有效。每个单元2808还包括一标记字段2904,用以与提取地址134的部分内容比较。若提取地址134的索引部分选择的单元2808使得提取地址134的标记部分吻合其中有效标记2904,则提取地址134正中BTAC 2802。每个阵列单元2808还包括一目标地址字段2906,用于储存先前执行过的分支指令-包括分支与切换密钥指令900/1200-的目标地址。每个阵列单元2808还包括一采用/不采用字段2908,用以储存先前执行过的分支指令-包括分支与切换密钥指令900/1200-的方向(采用/不采用)记录。每个阵列单元2808还包括一密钥寄存器索引字段2912,用于储存先前执行过的分支与切换密钥指令900/1200的密钥寄存器文档索引904/1304记录,以下将详细讨论。根据一种实施方式,BTAC 2802是在其密钥寄存器文档索引字段2912储存先前执行过的密钥切换指令600的密钥寄存器文档索引604记录。每个阵列单元2808还包括一型式字段2914,指示所记录的指令的型式。例如,型式字段2914可标示所记录的历史指令为一呼叫(call)、返回(return)、条件跳跃(conditional jump)、无条件跳跃(unconditional jump)、分支与切换密钥指令900/1200、或密钥切换指令600。Referring now to FIG. 29, a block diagram illustrates in more detail the contents of the BTAC unit 2808 of FIG. 28 in accordance with the teachings of the present invention. Each cell 2808 includes a valid bit 2902 indicating whether the associated cell 2808 is valid. Each cell 2808 also includes a tag field 2904 for comparison with the portion of the extracted address 134 . If the unit 2808 selected by the index part of the fetch address 134 makes the tag part of the fetch address 134 coincide with the valid tag 2904, then the fetch address 134 hits the BTAC 2802. Each array unit 2808 also includes a target address field 2906 for storing target addresses of previously executed branch instructions, including branch and switch key instructions 900/1200. Each array unit 2808 also includes a take/not take field 2908 for storing direction (take/not take) records of previously executed branch instructions, including branch and switch key instructions 900/1200. Each array unit 2808 also includes a key register index field 2912 for storing key register file index 904/1304 records of previously executed branch and switch key instructions 900/1200, discussed in detail below. According to one embodiment, the BTAC 2802 stores the key register file index 604 record of the previously executed key switching instruction 600 in its key register file index field 2912. Each array element 2808 also includes a type field 2914 indicating the type of instruction recorded. For example, the type field 2914 can indicate that the recorded historical instruction is a call (call), return (return), conditional jump (conditional jump), unconditional jump (unconditional jump), branch and switch key instruction 900/1200, or password key switching instruction 600.

现在,参阅图30,一流程图图解图27微处理器100的操作,其中,根据本发明技术,所述微处理器100包括图28揭示的BTAC 2802。流程始于方块3002。Referring now to FIG. 30, a flowchart illustrates the operation of the microprocessor 100 of FIG. 27, which includes the BTAC 2802 disclosed in FIG. 28, in accordance with the present techniques. Flow begins at block 3002.

在方块3002,微处理器100执行一分支与切换密钥指令900/1200,以下将以图32详述。流程接着进入方块3004。At block 3002, the microprocessor 100 executes a branch and switch key instruction 900/1200, which will be described in detail with reference to FIG. 32 below. The flow then enters block 3004 .

在方块3004,微处理器100在BTAC 2802中配置一阵列单元2808给执行过的分支与切换密钥指令900/1200,将该分支与切换密钥指令900/1200解出的方向、目标地址、密钥寄存器文档索引904/1304、以及指令型式分别记录于所配置的该阵列单元2808的采用/不采用字段2908、目标地址字段2906、密钥寄存器文档索引字段2912、以及型式字段2914中,以作为该分支与切换密钥指令900/1200的历史信息。流程结束于方块3004。In block 3004, the microprocessor 100 configures an array unit 2808 in the BTAC 2802 for the executed branch and switch key instruction 900/1200, and the direction, target address, The key register file index 904/1304 and the instruction type are respectively recorded in the adopted/not used field 2908, the target address field 2906, the key register file index field 2912, and the type field 2914 of the configured array unit 2808, to As the history information of the branch and switch key instruction 900/1200. The process ends at block 3004.

现在,参阅图31,一流程图图解图27微处理器100的操作,其中,根据本发明技术,所述微处理器100包括图28揭示的BTAC 2802。流程始于方块3102。Referring now to FIG. 31, a flowchart illustrates the operation of the microprocessor 100 of FIG. 27, which includes the BTAC 2802 disclosed in FIG. 28, in accordance with the present techniques. Flow begins at block 3102.

在方块3102,提取地址134供应给指令高速缓冲存储器102以及BTCA2802。流程接着进入方块3104。At block 3102 , the fetch address 134 is supplied to the instruction cache 102 and the BTCA 2802 . The process then proceeds to block 3104 .

在方块3104,提取地址134正中BTAC 2802,且BTAC 2802将对应的阵列单元2808的目标地址2906、采用/不采用2908、密钥寄存器文档索引2912以及型式2914字段的内容分别以目标地址2706、采用/不采用指标2708、密钥寄存器文档索引2712、以及型式指标2714输出。特别是,型式字段2914用于指示所储存指令为一分支与切换密钥指令900/1200。流程接着进入决策方块3106。In block 3104, the extraction address 134 is centered on the BTAC 2802, and the BTAC 2802 converts the contents of the target address 2906, adopt/not adopt 2908, key register file index 2912 and type 2914 fields of the corresponding array unit 2808 to the target address 2706, adopt /Do not take the pointer 2708 , key register document index 2712 , and type pointer 2714 outputs. In particular, the type field 2914 is used to indicate that the stored instruction is a branch and switch key instruction 900/1200. Flow then proceeds to decision block 3106.

在决策方块3106,密钥切换逻辑2712藉由检验采用/不采用输出2708判断分支与切换密钥指令900/1200被BTAC 2802预测为会采用。若采用/不采用输出2708显示分支与切换密钥指令900/1200被预测为采用,流程接着进入方块3112;反之,流程接着进入方块3108。At decision block 3106, the key switch logic 2712 determines that the branch and switch key instruction 900/1200 is predicted to be taken by the BTAC 2802 by checking the take/not take output 2708. If the take/not take output 2708 shows that the branch and switch key instruction 900/1200 is predicted to be taken, then the flow proceeds to block 3112 ; otherwise, the flow proceeds to block 3108 .

在方块3108,微处理器100随着分支与切换密钥指令900/1200顺着输送一指示,显示BTAC 2802预测其不被采用。(此外,若采用/不采用输出2708显示该分支与切换密钥指令被预测为采用,微处理器100在方块3112随着该分支与切换密钥指令900/1200顺着输送一指示,显示BTAC 2802预测其会被采用)。流程结束于3108At block 3108, the microprocessor 100 sends an indication along with the branch and switch key instruction 900/1200, indicating that the BTAC 2802 predicts that it will not be taken. (Additionally, if the take/not take output 2708 indicates that the branch and switch key instruction is predicted to be taken, the microprocessor 100 sends an indication along with the branch and switch key instruction 900/1200 at block 3112, showing BTAC 2802 predicts its adoption). Process ended at 3108

在方块3112,提取地址产生器164以BTAC 2802于方块3104所预测的目标地址2706更新提取地址134。流程接着进入方块3114。At block 3112, the fetch address generator 164 updates the fetch address 134 with the target address 2706 predicted by the BTAC 2802 at block 3104. The process then proceeds to block 3114.

在方块3114,根据BTAC 2802于方块3104所预测的密钥寄存器文档索引2712,密钥切换逻辑2712以其所指示的密钥寄存器文档124位置更新主密钥寄存器142内的密钥数值。在一种实施方式中,必要状况下,密钥切换逻辑2712会拖延提取单元104提取指令数据106内的区块,直至主密钥寄存器142被更新。流程接着进入方块3116。At block 3114, based on the key register file index 2712 predicted by the BTAC 2802 at block 3104, the key switch logic 2712 updates the key value in the master key register 142 with its indicated key register file 124 location. In one embodiment, if necessary, the key switching logic 2712 delays the fetching unit 104 from fetching blocks in the instruction data 106 until the master key register 142 is updated. Flow then proceeds to block 3116.

在方块3116,提取单元104利用方块3114所载入的新主密钥寄存器142内容持续提取并且解密指令数据106。流程结束于方块3116。At block 3116 , the fetch unit 104 continues to fetch and decrypt the instruction data 106 using the new master key register 142 contents loaded at block 3114 . Flow ends at block 3116.

现在,参阅图32,一流程图图解图27微处理器100的操作,其中,根据本发明技术,执行一分支与切换密钥指令900/1200。图32流程在某一方面类似图10流程,且类似的方块是采以同样标号。虽然图32的讨论是参照图10内容,其应用可更考虑图14所介绍的分支与切换密钥指令1200操作。图32流程始于方块1002。Referring now to FIG. 32, a flow diagram illustrates the operation of the microprocessor 100 of FIG. 27 in which a branch and switch key instruction 900/1200 is executed in accordance with the teachings of the present invention. The flow chart of FIG. 32 is similar to the flow chart of FIG. 10 in some respects, and similar blocks are given the same reference numerals. Although the discussion of FIG. 32 refers to the content of FIG. 10 , its application can take into consideration the operation of the branch and switch key instruction 1200 introduced in FIG. 14 . The FIG. 32 process begins at block 1002 .

在方块1002,解码单元108解码一分支与切换密钥指令900/1200,且将之代入微代码单元132实现分支与切换密钥指令900/1200的微代码程序。流程接着进入方块1006。In block 1002, the decoding unit 108 decodes a branch and switch key instruction 900/1200, and substitutes it into the microcode unit 132 to implement the microcode program of the branch and switch key instruction 900/1200. The flow then enters block 1006 .

在方块1006,微代码解出分支方向(即采用/不采用)以及目标地址。流程接着进入方块3208。At block 1006, the microcode resolves the branch direction (ie, taken/not taken) and the target address. The process then proceeds to block 3208 .

在方块3208,微代码判断BTAC 2802是否为该分支与切换密钥指令900/1200提供一预测。若有提供,流程接着进入决策方块3214;若无提供,流程接着进入图10的方块1008。At block 3208, the microcode determines whether the BTAC 2802 provides a prediction for the branch and switch key instruction 900/1200. If provided, the process proceeds to decision block 3214 ; if not provided, the process proceeds to block 1008 of FIG. 10 .

在决策方块3214,微代码藉由将BTAC 2802输送出的采用/不采用指标2708以及目标地址2706与方块1006所解出的方向以及目标地址判断BTAC2802所做的预测是否正确。若BTAC 2802的预测正确,则流程结束;反之,则流程来到决策方块3216。In the decision block 3214, the microcode judges whether the prediction made by the BTAC 2802 is correct or not by taking the take/not take indicator 2708 and the target address 2706 sent by the BTAC 2802 and the direction and target address solved in block 1006. If the prediction of BTAC 2802 is correct, the process ends; otherwise, the process comes to decision block 3216.

在决策方块3216,微代码判断此不正确的BTAC 2802预测有没有被采用。若已被采用,流程进入方块3222;若无,流程进入图10的方块1014。At decision block 3216, the microcode determines whether the incorrect BTAC 2802 prediction was taken. If adopted, the process enters block 3222; if not, the process enters block 1014 in FIG. 10 .

在方块3222,微代码修复主密钥寄存器142的内容,因为BTAC 2802对分支与切换密钥指令900/1200所做的错误预测被采用,导致图31方块3104将错误的密钥数值载入其中。在一种实施方式中,密钥切换逻辑2712包括修复主密钥寄存器142所需的储存元件与逻辑。在一种实施方式中,微代码产生一异常警示交由一异常处理器修复主密钥寄存器142。此外,微代码使得微处理器100分支跳跃到该分支与切换密钥指令900/1200之后接续的x86指令,使得微处理器100中新于该分支与切换密钥指令900/1200的所有x86指令清空,并且使微处理器100中较分支至目标地址的微代码新的所有微代码清空。被清空的内容包括读取自指令高速缓冲存储器102、且缓冲暂存于提取单元104、解码单元108中等待被解码的所有指令字节106。随着分支至接续的指令,提取单元104开始使用主密钥寄存器142内的该组修复后的密钥数值自指令高速缓冲存储器102提取并且解密指令数据106。流程结束于方块3222。At block 3222, the microcode repairs the contents of the master key register 142 because the wrong prediction made by the BTAC 2802 for the branch and switch key instruction 900/1200 was taken, causing block 3104 of Figure 31 to load it with the wrong key value . In one embodiment, the key switching logic 2712 includes the storage elements and logic needed to repair the master key register 142 . In one embodiment, the microcode generates an exception alert for an exception handler to repair the master key register 142 . In addition, the microcode causes the microprocessor 100 to branch and jump to the x86 instruction following the branch and switch key instruction 900/1200 such that all x86 instructions in the microprocessor 100 newer than the branch and switch key instruction 900/1200 Clear, and clear all microcodes in the microprocessor 100 that are newer than the microcode that branches to the target address. The content to be emptied includes all instruction bytes 106 read from the instruction cache 102 and buffered and temporarily stored in the fetch unit 104 and the decode unit 108 waiting to be decoded. Following the branch to the subsequent instruction, the fetch unit 104 begins fetching and decrypting the instruction data 106 from the instruction cache 102 using the set of repaired key values in the master key register 142 . Flow ends at block 3222.

除了以上所述、由微处理器100实现的指令解密实施方式所带来的安全优势,发明人更发展出建议编码指南,其使用可结合以上实施方式,削弱藉由分析x86指令实际使用量、对加密x86码以统计技巧发展出的黑客攻击。In addition to the above-mentioned security advantages brought by the implementation of instruction decryption implemented by the microprocessor 100, the inventors have developed a suggested coding guideline, which can be used in combination with the above implementation methods to weaken the problem by analyzing the actual usage of x86 instructions, A hack developed with statistical techniques on encrypted x86 codes.

第一,由于黑客通常假设所提取的16字节的指令数据106全数为x86指令,因此,相对于程序执行流程,编码时应当在16字节区块之间加入「洞(holes)」。也就是说,其编码应当以多个指令跳跃一些指令字节,以未加密的字节产生多个「洞」,其中可填入适当的数值,以增加纯文字字节的熵值(entropy)。此外,倘若能更提升纯文字字节的熵值,其编码可尽可能采用即时数据值。此外,所述即时数据值可作为假线索,指向错误的指令操作码地址。First, since hackers usually assume that the extracted 16-byte instruction data 106 are all x86 instructions, relative to the program execution flow, "holes" should be added between 16-byte blocks during encoding. That is, its encoding should skip some instruction bytes with multiple instructions, and create multiple "holes" with unencrypted bytes, which can be filled with appropriate values to increase the entropy of plain text bytes . In addition, if the entropy value of plain text bytes can be further improved, its encoding can use real-time data values as much as possible. Additionally, the immediate data value can serve as a false clue pointing to the wrong instruction opcode address.

第二,所述编码可包括特别的NOP指令,其中包括“不理会”字段,填有适当数值以增加上述熵值。例如,x86指令0x0F0D05xxxxxxxx属于7字节的NOP,其中最后四个字节可为任意值。此外,NOP指令的操作码型式以及其「不理会」字节的数量更可有其他变化。Second, the encoding may include special NOP instructions including a "ignore" field filled with appropriate values to increase the entropy value mentioned above. For example, the x86 instruction 0x0F0D05xxxxxxxx is a 7-byte NOP, where the last four bytes can be any value. In addition, the opcode type of the NOP instruction and the number of "don't care" bytes may have other variations.

第三,许多x86指令具有与其他x86指令相同的基本功能。关于等效功能的指令,其编码可舍弃重复使用同样的指令,改采用多重型式和/或采用使纯文字熵值提升的型式。例如,指令0xC10107以及指令0xC10025作的是同样的事情。甚至,某些等效指令是以不同长度的版本呈现,例如,0xEB22以及0xE90022;因此,编码时可采用多种长度但相同效果的指令。Third, many x86 instructions have the same basic functionality as other x86 instructions. For instructions with equivalent functions, the code can abandon the repeated use of the same instruction, and instead adopt a multi-type format and/or adopt a type that increases the entropy value of the plain text. For example, instruction 0xC10107 and instruction 0xC10025 do the same thing. Furthermore, some equivalent instructions are presented in different length versions, for example, 0xEB22 and 0xE90022; therefore, instructions of various lengths but with the same effect can be used when encoding.

第四,x86架构允许使用冗余且无意义的操作码字首(opcode predix),因此,编码时可小心应用,以更增加上述熵值。例如,指令0x40以及0x2627646567F2F340作的是完全一样的事情。因为其中仅有8个安全的x86字首,他们需被小心地安插在编码中,以避免过度频繁地出现。Fourth, the x86 architecture allows the use of redundant and meaningless opcode prefixes, which can be carefully applied when encoding to increase the entropy value mentioned above. For example, instructions 0x40 and 0x2627646567F2F340 do exactly the same thing. Since there are only 8 safe x86 prefixes, they need to be carefully inserted into the code to avoid appearing too frequently.

虽然已经列举多种实施例以密钥扩展器对主密钥寄存器数值中的一对数值进行旋转以及加/减运算,尚有其他实施方式可考虑使用,其中,密钥扩展器可对多于两个的主密钥寄存器数值进行运算,此外,所进行的运算可不同于旋转以及加/减运算。此外,图6揭示的密钥切换指令600以及图9揭示的分支与切换密钥指令900还可有其他实施方式,例如,将新的密钥数值由安全存储区122载入主密钥寄存器142而非由密钥寄存器文档124载入,并且,图15所介绍的分支与切换密钥指令1500的其他实施方式是以索引字段2104储存安全存储区122的地址。此外,虽然已列举多种实施例调整BTAC 2702储存KRF索引结合分支与切换密钥指令900/1200使用,尚有其他实施方式是调整BTAC 2702储存安全存储区地址,以结合分支与切换密钥指令1500使用。While various embodiments have been described in which a key expander rotates and adds/subtracts a pair of values in a master key register value, other implementations are contemplated in which the key expander operates on more than Operations are performed on the values of the two master key registers, and in addition, the operations performed may be different from rotation and addition/subtraction operations. In addition, the key switch instruction 600 disclosed in FIG. 6 and the branch and switch key instruction 900 disclosed in FIG. 9 can also have other implementations, for example, the new key value is loaded from the secure storage area 122 into the master key register 142 Rather than being loaded by the key register file 124 , another implementation of the branch and switch key instruction 1500 described in FIG. 15 is to store the address of the secure storage area 122 in the index field 2104 . In addition, although various embodiments have been listed to adjust the BTAC 2702 to store the KRF index in conjunction with the branch and switch key instructions 900/1200, there are other implementations that adjust the BTAC 2702 to store the secure storage area address to combine the branch and switch key instructions 1500 used.

以上列举的本发明诸多实施方式仅是作为说明例使用,并非意图限制发明范围。相关计算机技术领域的技术人员可在不偏离本发明范围的前提下作出形式以及细节的诸多变形。例如,可以软件方式实现所述如函数、制作、模组化、模拟、说明、和/或测试此篇所讨论的设备与方法的方式。实现方式包括一般程序语言(例如,C、C++)、硬件描述语言包括Verilog HDL、VHDL...等、或其他可用的程序工具。所述软件可载于任何已知的计算机可读媒体,例如,磁带、半导体、磁盘、或光盘(例如,CD-ROM、DVD-ROM等)、网路、有线传输、无线或其他通讯媒体。所述设备与方法的实施方式可包含于半导体知识产权核心,例如一微处理器核心(例如以HDL实现),并可转成硬件以集成电路实现。此外,所述的设备与方法可由软、硬件结合方式实现。因此,本发明范围不应限定于所述任何实施方式,应当是以本发明的权利要求以及其等效技术界定。特别是,本发明技术可以一般用途计算机所采用的微处理器实现。值得注意的是,本领域技术人员可能不偏离权利要求所定义的发明范围、以所揭示的概念以及特殊实施例为基础、设计或修正提出其他架构产生与本发明相同的效果。The embodiments of the present invention listed above are only used as illustrative examples, and are not intended to limit the scope of the invention. Numerous changes in form and details may be made by persons skilled in the relevant computer arts without departing from the scope of the present invention. For example, the means of functioning, making, modularizing, simulating, illustrating, and/or testing the devices and methods discussed herein can be implemented in software. The implementation includes general programming languages (for example, C, C++), hardware description languages including Verilog HDL, VHDL, etc., or other available programming tools. The software can be carried on any known computer-readable medium, such as magnetic tape, semiconductor, magnetic disk, or optical disk (eg, CD-ROM, DVD-ROM, etc.), network, wired transmission, wireless or other communication media. Implementations of the described apparatus and methods may be included in a semiconductor intellectual property core, such as a microprocessor core (eg, implemented in HDL), and may be converted to hardware for implementation in an integrated circuit. In addition, the devices and methods described above can be implemented in a combination of software and hardware. Therefore, the scope of the present invention should not be limited to any of the above embodiments, but should be defined by the claims of the present invention and their equivalent techniques. In particular, the inventive technique may be implemented with microprocessors employed in general purpose computers. It is worth noting that those skilled in the art may design or modify other structures based on the disclosed concepts and specific embodiments without departing from the scope of the invention defined by the claims to produce the same effect as the present invention.

Claims (114)

1.一种微处理器,包括:1. A microprocessor comprising: 一指令高速缓冲存储器;an instruction cache memory; 一指令解码单元;以及an instruction decoding unit; and 一提取单元,用于:An extraction unit for: (a)自该指令高速缓冲存储器提取一区块的指令数据;(a) fetching a block of instruction data from the instruction cache; (b)以一数据实体对该区块实行一布林异运算,以产生纯文字指令数据;以及(b) performing a Boolean XOR operation on the block with a data entity to generate plain text instruction data; and (c)供应上述纯文字指令数据给该指令解码单元;(c) supplying the above-mentioned plain text instruction data to the instruction decoding unit; 其中,在一第一状况,该区块包括加密指令数据、且该数据实体为一解密密钥;Wherein, in a first situation, the block includes encrypted instruction data, and the data entity is a decryption key; 其中,在一第二状况,该区块包括非加密指令数据、且该数据实体为多个位的二进位零值;Wherein, in a second condition, the block includes non-encrypted instruction data, and the data entity is a binary zero value of multiple bits; 其中,无论该区块的指令数据是加密或非加密,上述第一状况以及第二状况执行上述内容(a)、(b)以及(c)所需的时间相同。Wherein, no matter whether the command data of the block is encrypted or unencrypted, the time required to execute the above-mentioned contents (a), (b) and (c) in the above-mentioned first situation and the second situation is the same. 2.如权利要求1所述的微处理器,其中,该提取单元套用一提取地址至该指令高速缓冲存储器,以自该指令高速缓冲存储器提取该区块的指令数据,其中,在自该指令高速缓冲存储器提取该区块的指令数据的期间,该提取单元还以该提取地址的部分内容以及多个密钥数值形成一函数产生该解密密钥。2. The microprocessor as claimed in claim 1, wherein the fetch unit applies a fetch address to the instruction cache to fetch the instruction data of the block from the instruction cache, wherein, from the instruction When the cache memory fetches the instruction data of the block, the fetching unit also uses part of the fetching address and a plurality of key values to form a function to generate the decryption key. 3.如权利要求2所述的微处理器,其中,为了以该提取地址以及上述多个密钥数值为函数产生该解密密钥,该提取单元还用于:3. The microprocessor as claimed in claim 2, wherein, in order to generate the decryption key as a function of the extraction address and the above-mentioned multiple key values, the extraction unit is also used for: 基于该提取地址的一第一部分,选取上述多个密钥数值的其中一对;selecting a pair of the plurality of key values based on a first part of the extraction address; 基于该提取地址的一第二部分,旋转所选取的该对密钥数值其中一个;以及rotating the selected one of the pair of key values based on a second portion of the extraction address; and 基于该提取地址的一第三部分,将旋转过的该密钥数值加至选取的另一个密钥数值、或将旋转过的该密钥数值自选取的另一个密钥数值减去,以产生该解密密钥。Based on a third portion of the extraction address, the rotated key value is added to or subtracted from the selected another key value to generate The decryption key. 4.如权利要求2所述的微处理器,其中,为了以该提取地址以及上述多个密钥数值为函数产生该解密密钥,该提取单元还用于:4. The microprocessor as claimed in claim 2, wherein, in order to generate the decryption key as a function of the extraction address and the above-mentioned plurality of key values, the extraction unit is also used for: 根据该提取地址的一第一部分,自上述多个密钥数值中选取出一第一密钥数值;selecting a first key value from the plurality of key values according to a first part of the extraction address; 根据该提取地址的该第一部分,自上述多个密钥数值中选取出一第二密钥数值;selecting a second key value from the plurality of key values according to the first part of the extraction address; 根据该提取地址的一第二部分,旋转该第一密钥数值;以及rotating the first key value based on a second portion of the extraction address; and 根据该提取地址的一第三部分,选择将旋转后的该第一密钥数值加入该第二密钥数值、或将旋转后的该第一密钥数值自该第二密钥数值减去,以产生该解密密钥。Selecting to add the rotated first key value to the second key value or to subtract the rotated first key value from the second key value according to a third part of the extraction address, to generate the decryption key. 5.如权利要求2所述的微处理器,其中,上述多个密钥数值总量为K,该解密密钥、以及上述多个密钥数值各自的长度为W字节,且该提取单元产生一序列多个解密密钥给自该指令高速缓冲存储器提取出的一序列多个区块的指令数据,其中,产生有上述多个密钥数值的字节的W2*(K!/(2*(K-2)!))个不同组合解密所提取的该序列上述多个区块。5. The microprocessor as claimed in claim 2, wherein the total amount of the above-mentioned multiple key values is K, the decryption key and the respective lengths of the above-mentioned multiple key values are W bytes, and the extraction unit generating a sequence of multiple decryption keys for a sequence of multiple blocks of command data extracted from the command cache, wherein W 2 *(K!/( 2*(K-2)!)) different combinations to decrypt the extracted sequence of blocks. 6.如权利要求1所述的微处理器,其中,该提取单元包括:6. The microprocessor as claimed in claim 1, wherein the extracting unit comprises: 一控制位,用于储存一标识,标示该提取单元是在一解密模式或者一纯文字模式;A control bit is used to store a flag indicating that the extraction unit is in a decryption mode or a plain text mode; 一多工器,包括:a multiplexer, comprising: 一输出;an output; 一第一数据输入,用于接收该解密密钥;a first data input for receiving the decryption key; 一第二数据输入,用于接收上述多个位的二进位零值;以及a second data input for receiving the binary zero value of the plurality of bits; and 一选择控制输入,用于接收该控制位的数值,在该第一状况下、该控制位的数值对应该解密模式时,以该解密密钥作为该输出,并且,在该第二状况下、该控制位的数值对应该纯文字模式时,以上述多个位的二进位零值作为该输出;以及a selection control input for receiving the value of the control bit, in the first case, when the value of the control bit corresponds to the decryption mode, the decryption key is used as the output, and, in the second case, When the value of the control bit corresponds to the plain text mode, the binary zero value of the above-mentioned bits is used as the output; and 一异逻辑,包括:A different logic, including: 一第一数据输入,用于接收该多工器的该输出;a first data input for receiving the output of the multiplexer; 一第二数据输入,用于接收所提取的该区块的指令数据;以及a second data input for receiving the fetched instruction data of the block; and 一输出,耦接至该指令解码单元,供应该异闸上述第一以及第二数据输入进行布林异运算后所得到的纯文字指令数据。An output, coupled to the instruction decoding unit, supplying the pure text instruction data obtained by performing Boolean XOR operation on the first and second data inputs of the different gate. 7.如权利要求6所述的微处理器,其中,该多工器的第一数据输入来自:7. The microprocessor of claim 6, wherein the first data input to the multiplexer is from: 一第一多工器,根据一提取地址的一第一部分自多个密钥数值中选取出一第一密钥数值;a first multiplexer for selecting a first key value from a plurality of key values according to a first part of an extraction address; 一第二多工器,根据该提取地址的该第一部分自上述多个密钥数值中选取出一第二密钥数值;a second multiplexer, selecting a second key value from the plurality of key values according to the first part of the extraction address; 一旋转器,根据该提取地址的一第二部分旋转该第一密钥数值;以及a rotator that rotates the first key value based on a second portion of the extraction address; and 一运算单元,根据该提取地址的一第三部分,选择将旋转后的该第一密钥数值加入该第二密钥数值、或将旋转后的该第一密钥数值自该第二密钥数值减去,以产生该解密密钥。An operation unit, according to a third part of the extraction address, choose to add the rotated first key value to the second key value, or add the rotated first key value from the second key value The value is subtracted to generate the decryption key. 8.一种操作方法,用以操作具有一指令高速缓冲存储器的一微处理器,该操作方法包括:8. An operating method for operating a microprocessor having an instruction cache memory, the operating method comprising: (a)自该指令高速缓冲存储器提取一区块的指令数据;(a) fetching a block of instruction data from the instruction cache; (b)以一数据实体对该区块实行一布林异运算,以产生纯文字指令数据;以及(b) performing a Boolean XOR operation on the block with a data entity to generate plain text instruction data; and (c)将上述纯文字指令数据供应给一指令解码单元;(c) supplying the above-mentioned plain text instruction data to an instruction decoding unit; 其中,在一第一状况下,该区块包括加密指令数据、且该数据实体为一解密密钥;Wherein, in a first situation, the block includes encrypted instruction data, and the data entity is a decryption key; 其中,在一第二状况下,该区块包括非加密指令数据、且该数据实体为多个位的二进位零值;Wherein, in a second condition, the block includes non-encrypted instruction data, and the data entity is a binary zero value of multiple bits; 其中,无论该区块的指令数据是加密或非加密,上述第一状况以及第二状况执行上述内容(a)、(b)以及(c)所需的时间相同。Wherein, no matter whether the command data of the block is encrypted or unencrypted, the time required to execute the above-mentioned contents (a), (b) and (c) in the above-mentioned first situation and the second situation is the same. 9.如权利要求8所述操作方法,其中,上述自该指令高速缓冲存储器提取该区块的步骤包括套用一提取地址至该指令高速缓冲存储器,该操作方法还包括:9. The operation method as claimed in claim 8, wherein the step of extracting the block from the instruction cache comprises applying an extraction address to the instruction cache, the operation method further comprising: 以该提取地址的部分内容与多个密钥数值所形成的一函数产生该解密密钥;generating the decryption key with a function formed by part of the extraction address and a plurality of key values; 其中,该解密密钥的产生是在自该指令高速缓冲存储器提取该区块的指令数据的期间内实行。Wherein, the generation of the decryption key is performed during the period of fetching the command data of the block from the command cache. 10.如权利要求9所述操作方法,其中,上述以该提取地址以及上述多个密钥数值为函数产生该解密密钥的步骤包括:10. The operation method according to claim 9, wherein the step of generating the decryption key as a function of the extraction address and the above-mentioned multiple key values comprises: 基于该提取地址的一第一部分,选取上述多个密钥数值的其中一对;selecting a pair of the plurality of key values based on a first part of the extraction address; 基于该提取地址的一第二部分,旋转所选取的该对密钥数值其中一个;rotating one of the selected pair of key values based on a second portion of the extraction address; 基于该提取地址的一第三部分,将旋转过的该密钥数值加至所选取的另一个密钥数值、或将旋转过的该密钥数值自所选取的另一个密钥数值减去,以产生该解密密钥。adding the rotated key value to or subtracting the rotated key value from the selected another key value based on a third portion of the extraction address, to generate the decryption key. 11.如权利要求9所述的操作方法,其中,上述以该提取地址以及上述多个密钥数值所形成的函数产生该解密密钥的步骤是为了多个连续区块的指令数据生成W2*(K!/(2*(K-2)!))字节的有效解密密钥长度,其中,该解密密钥、以及上述多个密钥数值各自的长度为W字节,且上述多个密钥数值总量为K。11. The operation method as claimed in claim 9, wherein the step of generating the decryption key using the function formed by the extraction address and the plurality of key values is to generate W2 for instruction data of a plurality of consecutive blocks The effective decryption key length of *(K!/(2*(K-2)!)) bytes, wherein, the length of the decryption key and the above-mentioned multiple key values is W bytes, and the above-mentioned multiple The total number of key values is K. 12.一种微处理器,包括:12. A microprocessor comprising: 一指令高速缓冲存储器;an instruction cache memory; 一提取单元,根据一序列多个提取地址数值自该指令高速缓冲存储器提取一加密程序中的具有一序列多个区块的加密指令,其中,提取该序列各个区块时,该提取单元更以该提取单元内多个密钥数值以及所提取该区块的提取地址数值的部分内容为一函数产生一解密密钥,以解密所提取该区块的加密指令;以及A fetching unit extracts an encrypted instruction having a sequence of multiple blocks in an encryption program from the instruction cache according to a sequence of multiple fetching address values, wherein, when fetching each block of the sequence, the fetching unit further uses A plurality of key values in the extraction unit and part of the extraction address value of the extracted block are a function to generate a decryption key to decrypt the encrypted instruction of the extracted block; and 一密钥切换指令,在该提取单元自该指令高速缓冲存储器提取该序列上述多个区块时,指示该微处理器更新该提取单元内的上述多个密钥数值。A key switching instruction, when the fetching unit fetches the sequence of the plurality of blocks from the instruction cache memory, instructs the microprocessor to update the values of the plurality of keys in the fetching unit. 13.如权利要求12所述的微处理器,其中该提取单元先天供应一有效解密密钥长度用于解密该加密程序,其中,该有效解密密钥长度取决于上述多个密钥数值的总量、以及该提取单元产生上述解密密钥的方式,其中,在该加密程序内以该密钥切换指令更新该提取单元内的上述多个密钥数值的操作将扩展该有效解密密钥长度,使之超越先天供应的长度。13. The microprocessor as claimed in claim 12, wherein the extraction unit inherently supplies an effective decryption key length for decrypting the encrypted program, wherein the effective decryption key length depends on the sum of the values of the plurality of keys amount, and the manner in which the extraction unit generates the above-mentioned decryption key, wherein the operation of updating the above-mentioned multiple key values in the extraction unit with the key switching instruction in the encryption program will extend the effective decryption key length, Make it beyond the length of innate supply. 14.如权利要求13所述的微处理器,其中,被扩展的该有效解密密钥长度与该加密程序一样长。14. The microprocessor of claim 13, wherein the extended effective decryption key length is as long as the encryption program. 15.如权利要求12所述的微处理器,还包括:15. The microprocessor of claim 12, further comprising: 一寄存器文档,储存多套密钥数值;A register file, storing multiple sets of key values; 其中,上述密钥切换指令标示一索引数值,指示该寄存器文档中上述多套密钥数值的其中一套的位置,该微处理器会以该密钥切换指令所标示的该索引数值,且该索引数值所指示的该套密钥数值更新该提取单元内用于产生上述解密密钥的上述多个密钥数值。Wherein, the above-mentioned key switching instruction marks an index value indicating the position of one of the above-mentioned multiple sets of key values in the register file, and the microprocessor will use the index value marked by the key switching instruction, and the The set of key values indicated by the index value updates the plurality of key values used to generate the decryption key in the extracting unit. 16.如权利要求12所述的微处理器,其中该微处理器包括一管线,该管线包括有:16. The microprocessor of claim 12, wherein the microprocessor comprises a pipeline comprising: 一执行单元位于该提取单元后;an execution unit is located after the fetch unit; 其中,该提取单元提取并且解密该加密程序的一第一以及一第二加密指令,而得到一第一以及一第二非加密指令;Wherein, the extraction unit extracts and decrypts a first and a second encrypted instruction of the encrypted program to obtain a first and a second non-encrypted instruction; 其中,若该密钥切换指令执行,该执行单元将用以解密第一加密指令的一第一解密密钥以一第二解密密钥取代,其中该第二解密密钥用以解密第二加密指令。Wherein, if the key switching instruction is executed, the execution unit replaces a first decryption key used to decrypt the first encrypted instruction with a second decryption key, wherein the second decryption key is used to decrypt the second encrypted instruction. 17.如权利要求16所述的微处理器,其中该微处理器更将程序顺序中新于该密钥切换指令的第一非加密指令的管道指令清空。17. The microprocessor of claim 16, wherein the microprocessor further clears a pipeline instruction of a first non-encrypted instruction newer than the key switch instruction in program order. 18.如权利要求12所述的微处理器,还包括:18. The microprocessor of claim 12, further comprising: 微代码,用于实现该密钥切换指令。The microcode is used to implement the key switching instruction. 19.如权利要求12所述的微处理器,其中,该微处理器还跳跃至程序顺序中位于该密钥切换指令之后的接续指令,以回应该密钥切换指令的执行。19. The microprocessor of claim 12, wherein the microprocessor further jumps to a subsequent instruction following the key switching instruction in program order in response to execution of the key switching instruction. 20.一种操作方法,操作具有一指令高速缓冲存储器的一微处理器,该操作方法包括:20. A method of operating a microprocessor having an instruction cache, the method of operating comprising: 自该指令高速缓冲存储器提取一程序中多个第一加密指令,且将之以一第一解密密钥解密为多个第一非加密指令;extracting a plurality of first encrypted instructions in a program from the instruction cache memory, and decrypting them into a plurality of first non-encrypted instructions with a first decryption key; 将该第一解密密钥以一第二解密密钥取代,以回应上述多个第一非加密指令中一密钥切换指令的执行;以及replacing the first decryption key with a second decryption key in response to execution of a key switch command among the plurality of first non-encryption commands; and 自该指令高速缓冲存储器提取该程序多个第二加密指令,且将之以该第二解密密钥解密成多个第二非加密指令。A plurality of second encrypted instructions of the program are fetched from the instruction cache memory, and decrypted into a plurality of second non-encrypted instructions with the second decryption key. 21.如权利要求20所述的操作方法,其中,该密钥切换指令标示一索引数值,以指示该微处理器内一寄存器文档的一位置,其中,上述将该第一解密密钥以该第二解密密钥取代的步骤包括自该索引数值所指示的该寄存器文档的位置将该第二解密密钥载入该微处理器一提取单元。21. The operation method as claimed in claim 20, wherein the key switching instruction marks an index value to indicate a position of a register file in the microprocessor, wherein the first decryption key is set in the The second decryption key replacing step includes loading the second decryption key into a fetch unit of the microprocessor from the location of the register file indicated by the index value. 22.如权利要求20所述的操作方法,其中,上述提取这些第二加密指令的步骤包括跳跃至程序顺序中该密钥切换指令之后接续的指令。22. The operating method according to claim 20, wherein the step of extracting the second encrypted instructions comprises jumping to the instruction following the key switch instruction in the program sequence. 23.如权利要求20所述的操作方法,其中,该程序包括一第一块连续指令以及紧随在后的一第二块连续指令,其中,该第一块连续指令包括这些第一加密指令、且该第二块连续指令包括这些第二加密指令,其中,该第一块连续指令是以该第一解密密钥加密、且该第二块连续指令是以该第二解密密钥加密,其中,该密钥切换指令是该第一块连续指令的最后一个指令。23. The operating method as claimed in claim 20, wherein the program comprises a first block of continuous instructions followed by a second block of continuous instructions, wherein the first block of continuous instructions includes the first encryption instructions , and the second block of continuous instructions includes the second encrypted instructions, wherein the first block of continuous instructions is encrypted with the first decryption key, and the second block of continuous instructions is encrypted with the second decryption key, Wherein, the key switching instruction is the last instruction of the first block of continuous instructions. 24.一种操作方法,用以操作一微处理器,该操作方法包括:24. An operating method for operating a microprocessor, the operating method comprising: 自一指令高速缓冲存储器的一序列多个提取地址提取一加密程序中的一序列多个区块的加密指令;fetching a sequence of encryption instructions of a plurality of blocks in an encryption program from a sequence of a plurality of fetch addresses of an instruction cache; 在提取该序列各个区块时,以多个密钥数值以及所提取该区块的提取地址的部份数值为一函数,生成一解密密钥;When extracting each block of the sequence, a decryption key is generated by using a plurality of key values and partial values of the extraction address of the extracted block as a function; 关于该序列中所提取的各区块,以所对应生成的上述解密密钥解密其中的加密指令;以及For each block extracted in the sequence, decrypt the encrypted instruction therein with the above-mentioned correspondingly generated decryption key; and 在提取该序列这些区块间执行密钥切换指令,其中,上述执行密钥切换指令的步骤包括更新用来生成上述解密密钥的这些密钥数值。Executing the key switching instruction between the blocks of the sequence, wherein the step of executing the key switching instruction includes updating the key values used to generate the decryption key. 25.如权利要求24所述的操作方法,其中,上述密钥切换指令是一个解密后的指令,由所提取该序列的这些区块的一的加密指令中解密而得。25. The operation method as claimed in claim 24, wherein the key switching instruction is a decrypted instruction obtained by decrypting the encrypted instruction of one of the extracted blocks of the sequence. 26.如权利要求24所述的操作方法,其中,由这些密钥数值以及对应的提取地址的部份数值所形成的该函数先天提供一有效解密密钥长度用于解密该加密程序,其中,该有效解密密钥长度先天的尺寸取决于这些密钥数值的总量以及上述解密密钥的产生操作方法,其中,在上述密钥切换指令更新这些密钥数值将扩展该有效解密密钥长度超越先天的尺寸。26. The operation method as claimed in claim 24, wherein, the function formed by the key values and the corresponding partial values of the extraction address inherently provides an effective decryption key length for decrypting the encrypted program, wherein, The inherent size of the effective decryption key length depends on the total amount of these key values and the above-mentioned decryption key generation operation method, wherein updating these key values in the above-mentioned key switching command will extend the effective decryption key length beyond Innate size. 27.如权利要求26所述的操作方法,其中,扩展后的该有效解密密钥长度与该加密程序等长。27. The operating method as claimed in claim 26, wherein the length of the extended effective decryption key is equal to the length of the encryption program. 28.如权利要求24所述操作方法,其中,上述密钥切换指令标示一索引数值指示微处理器中保存这些密钥数值的一位置,以用于执行上述更新步骤。28. The operation method as claimed in claim 24, wherein the key switching command marks an index value indicating a location in the microprocessor for storing the key values for performing the updating step. 29.一种微处理器,包括:29. A microprocessor comprising: 一提取单元,采用第一解密密钥数据提取并且解密一分支与切换密钥指令;以及an extraction unit extracts and decrypts a branch and switch key instruction using the first decryption key data; and 微代码,用于:Microcode for: 在该分支与切换密钥指令的方向不被采用的状况下,使该提取单元以上述第一解密密钥数据提取并且解密该分支与切换密钥指令之后的接续指令;以及Under the condition that the direction of the branch and switch key instruction is not adopted, the extracting unit extracts and decrypts the continuation instruction after the branch and switch key instruction with the above-mentioned first decryption key data; and 在该分支与切换密钥指令的方向被采用的状况下,使该提取单元以不同于该第一解密密钥数据的第二解密密钥数据提取并且解密该分支与切换密钥指令的一目标指令。causing the extraction unit to extract and decrypt an object of the branch and switch key instruction with second decryption key data different from the first decryption key data in the case where the direction of the branch and switch key instruction is adopted instruction. 30.如权利要求29所述的微处理器,其中,若该分支与切换密钥指令的方向被采用,上述微代码更在致使该提取单元以上述第二解密密钥数据解密该目标指令之前,更新该提取单元,而使该提取单元使用上述第二解密密钥数据而非上述第一解密密钥数据。30. The microprocessor of claim 29, wherein if the direction of the branch and switch key instruction is taken, said microcode further before causing said fetch unit to decrypt said target instruction with said second decryption key data , updating the extracting unit so that the extracting unit uses the second decryption key data instead of the first decryption key data. 31.如权利要求29所述的微处理器,其中,若该分支与切换密钥指令的方向被采用,该分支与切换密钥指令标示该微处理器中上述第二解密密钥数据的储存位置,以供该提取单元载入。31. The microprocessor of claim 29, wherein if the direction of the branch and switch key instruction is adopted, the branch and switch key instruction indicates the storage of the second decryption key data in the microprocessor The location for this extraction unit to load. 32.如权利要求29所述的微处理器,其中,若该分支与切换密钥指令的方向被采用,上述微代码更基于该目标指令的存储器地址判断上述第二解密密钥数据于该微处理器内的一储存位置,以供该提取单元载入。32. The microprocessor of claim 29 , wherein if the direction of the branch and switch key instruction is adopted, the microcode further determines that the second decryption key data is stored in the microcode based on the memory address of the target instruction. A storage location within the processor for the fetch unit to load. 33.如权利要求32所述的微处理器,其中,为了根据该目标指令的上述存储器地址判断该微处理器中上述第二解密密钥数据的该储存位置,上述微代码以上述存储器地址查询该微处理器内一表格,该表格记载有存储器地址范围至该微处理器内储存位置的一映射。33. The microprocessor as claimed in claim 32, wherein, in order to judge the storage location of the second decryption key data in the microprocessor according to the memory address of the target instruction, the microcode queries the memory address A table in the microprocessor records a mapping of memory address ranges to storage locations in the microprocessor. 34.如权利要求33所述的微处理器,其中,该微处理器的储存位置是设计在该微处理器的一寄存器中或一随机存取存储器中。34. The microprocessor of claim 33, wherein the storage location of the microprocessor is programmed in a register or a random access memory of the microprocessor. 35.如权利要求29所述的微处理器,其中该微处理器以原子型式执行该分支与切换密钥指令。35. The microprocessor of claim 29, wherein the microprocessor executes the branch and switch key instruction atomically. 36.如权利要求29所述的微处理器,其中,该提取单元还用于:36. The microprocessor of claim 29, wherein the extraction unit is also used for: 于解密该分支与切换密钥指令前,基于上述第一解密密钥数据以及用于提取该分支与切换密钥指令的一提取地址的部分内容,生成一解密密钥;Before decrypting the branch and switch key instruction, a decryption key is generated based on the first decryption key data and part of an extraction address for extracting the branch and switch key instruction; 其中,为了采用上述第一解密密钥数据解密该分支与切换密钥指令,该提取单元以所生成的该解密密钥对该分支与切换密钥指令实行布林异运算。Wherein, in order to decrypt the branch and switch key instruction using the first decryption key data, the extracting unit performs a Boolean XOR operation on the branch and switch key instruction with the generated decryption key. 37.一种操作方法,以一微处理器处理一加密程序,该操作方法包括:37. An operation method, processing an encryption program with a microprocessor, the operation method comprising: 采用第一解密密钥数据提取并且解密一分支与切换密钥指令;extracting and decrypting a branch and switch key instruction using the first decryption key data; 若该分支与切换密钥指令的方向不被采用,基于上述第一解密密钥数据提取并且解密该分支与切换密钥指令之后的接续指令;以及If the direction of the branch and switch key instruction is not adopted, extracting and decrypting a continuation instruction after the branch and switch key instruction based on the first decryption key data; and 若该分支与切换密钥指令的方向被采用,基于不同于上述第一解密密钥数据的第二解密密钥数据提取并且解密该分支与切换密钥指令的一目标指令。If the direction of the branch and switch key instruction is adopted, a target instruction of the branch and switch key instruction is extracted and decrypted based on the second decryption key data different from the first decryption key data. 38.如权利要求37所述的操作方法,其中,上述基于上述第一解密密钥数据解密该分支与切换密钥指令与接续指令的操作是由该微处理器中使用上述第一解密密钥数据的一提取单元执行,其中,若该分支与切换密钥指令的方向被采用,则该操作方法还包括:38. The operation method as claimed in claim 37, wherein the above-mentioned operation of decrypting the branch and switching key instruction and the continuation instruction based on the above-mentioned first decryption key data is performed by using the first decryption key in the microprocessor An extraction unit of data is executed, wherein, if the direction of the branch and switch key instruction is adopted, the operation method further includes: 在基于上述第二解密密钥数据解密该目标指令之前,更新该提取单元使用上述第二解密密钥数据而非上述第一解密密钥数据。Before decrypting the target instruction based on the second decryption key data, the extraction unit is updated to use the second decryption key data instead of the first decryption key data. 39.如权利要求37所述的操作方法,其中,若该分支与切换密钥指令的方向被采用,该分支与切换密钥指令标示该微处理器中上述第二解密密钥数据的一储存位置,以供该提取单元载入。39. The operating method as claimed in claim 37, wherein, if the direction of the branch and switch key instruction is adopted, the branch and switch key instruction indicates a storage of the second decryption key data in the microprocessor The location for this extraction unit to load. 40.如权利要求37所述的操作方法,若该分支与切换密钥指令的方向被采用,还包括:40. The operation method according to claim 37, if the direction of the branch and switch key instruction is adopted, further comprising: 根据该目标指令的存储器地址判断该微处理器中上述第二解密密钥数据的一储存位置,以供该提取单元载入。A storage location of the above-mentioned second decryption key data in the microprocessor is determined according to the memory address of the target instruction, so as to be loaded by the extracting unit. 41.如权利要求40所述的操作方法,其中,上述根据该目标指令的上述存储器地址判断该微处理器内上述第二解密密钥数据的该储存位置的步骤包括基于上述存储器地址查询该微处理器内一表格,该表格记录存储器地址范围至该微处理器储存位置的一映射。41. The operation method according to claim 40, wherein the step of judging the storage location of the second decryption key data in the microprocessor according to the memory address of the target instruction comprises querying the microprocessor based on the memory address A table within the processor that records a mapping of memory address ranges to storage locations of the microprocessor. 42.如权利要求41所述的操作方法,其中,该微处理器的储存位置位于该微处理器的一寄存器中或一随机存取存储器中。42. The operating method of claim 41, wherein the storage location of the microprocessor is located in a register or a random access memory of the microprocessor. 43.如权利要求37所述的操作方法,其中,该分支与切换密钥指令的执行是由该微处理器以原子型式操作。43. The operating method as claimed in claim 37, wherein the execution of the branch and switch key instruction is performed atomically by the microprocessor. 44.如权利要求37所述的操作方法,还包括:44. The method of operation of claim 37, further comprising: 在上述解密该分支与切换密钥指令的步骤之前,根据上述第一解密密钥数据以及用于提取该分支与切换密钥指令的一提取地址的部分内容生成一解密密钥;Before the step of decrypting the branch and switch key instruction, generate a decryption key according to the first decryption key data and part of an extraction address for extracting the branch and switch key instruction; 其中,上述基于上述第一解密密钥数据解密该分支与切换密钥指令的步骤包括以所生成的该解密密钥对该分支与切换密钥指令实行布林异运算。Wherein, the step of decrypting the branch and switch key instruction based on the first decryption key data includes performing a Boolean XOR operation on the branch and switch key instruction with the generated decryption key. 45.一种加密方法,用于加密一程序,以供用于解密与执行加密程序的一微处理器日后执行,该加密方法包括:45. An encryption method for encrypting a program for later execution by a microprocessor for decrypting and executing the encrypted program, the encryption method comprising: 接收关于一非加密程序的一目的文件,该非加密程序包括传统分支指令,上述传统分支指令的目标地址在该微处理器执行该程序之前被判定;receiving an object file for an unencrypted program, the unencrypted program including legacy branch instructions whose target addresses are determined before the microprocessor executes the program; 分析该程序以获得块信息,上述块信息将该程序划分成一序列多个块,其中,各个上述块包括一序列多个指令,其中,上述块信息还包括上述各个块的加密密钥数据,其中,各块的加密密钥数据并不相同;analyzing the program to obtain block information, the block information dividing the program into a sequence of multiple blocks, wherein each of the above blocks includes a sequence of multiple instructions, wherein the block information also includes encryption key data for each of the above blocks, wherein , the encryption key data of each block is not the same; 将上述传统分支指令中目标地址不与本身位于同一块者各自以一分支与切换密钥指令取代;以及Replacing the target addresses of the above traditional branch instructions that are not located in the same block as themselves with a branch and switch key instruction; and 基于上述块信息加密该程序。The program is encrypted based on the above block information. 46.如权利要求45所述的加密方法,其中,上述分支与切换密钥指令各自标示该微处理器内一储存空间,以储存上述分支与切换密钥指令的目标地址所在该块的加密密钥数据。46. The encryption method according to claim 45, wherein each of the above-mentioned branch and switch key instructions marks a storage space in the microprocessor to store the encryption key of the block where the target address of the above-mentioned branch and switch key instructions is located. key data. 47.如权利要求45所述的加密方法,其中,上述根据块信息加密该程序的步骤包括:47. The encryption method as claimed in claim 45, wherein said step of encrypting the program according to the block information comprises: 针对各块内各个区块的指令数据,基于所属块的加密密钥数据以及所属区块一存储器地址的部份内容生成一加秘密钥;以及For the instruction data of each block in each block, an encryption key is generated based on the encryption key data of the block and a part of a memory address of the block; and 以所生成的该加秘密钥对所对应该区块进行布林异运算。Perform a Boolean XOR operation on the corresponding block with the generated encryption key. 48.一种加密方法,用于加密一程序,以供用于解密与执行加密程序的一微处理器日后执行,该加密方法包括:48. An encryption method for encrypting a program for later execution by a microprocessor for decrypting and executing the encrypted program, the encryption method comprising: 接收一非加密程序的一目的文件,该非加密程序包括传统分支指令,上述传统分支指令的目标地址仅能在该微处理器执行该程序时判定;receiving an object file of an unencrypted program, the unencrypted program including conventional branch instructions whose target addresses can only be determined when the microprocessor executes the program; 分析该程序以获得块信息,上述块信息将该程序划分成一序列多个块,其中,各个上述块包括一序列多个指令,其中,上述块信息还包括上述各个块的加密密钥数据,其中,各块的加密密钥数据并不相同;analyzing the program to obtain block information, the block information dividing the program into a sequence of multiple blocks, wherein each of the above blocks includes a sequence of multiple instructions, wherein the block information also includes encryption key data for each of the above blocks, wherein , the encryption key data of each block is not the same; 将上述传统分支指令各自以一分支与切换密钥指令取代;以及replacing each of the above conventional branch instructions with a branch and switch key instruction; and 基于上述块信息,加密该程序。Based on the above block information, the program is encrypted. 49.如权利要求48所述的加密方法,还包括:49. The encryption method of claim 48, further comprising: 将上述块信息纳入该目的文件中,以于该微处理器执行该程序前载入该微处理器。The above-mentioned block information is incorporated into the object file, so as to be loaded into the microprocessor before the microprocessor executes the program. 50.如权利要求49所述的加密方法,其中,载于该目的文件中、于执行该程序前载入该微处理器的上述块信息为各个上述块在该微处理器中标示一储存空间,以储存关于各个上述块的上述加密密钥数据。50. The encryption method as claimed in claim 49, wherein, the above-mentioned block information loaded in the target file and loaded into the microprocessor before executing the program indicates a storage space in the microprocessor for each of the above-mentioned blocks , to store the above-mentioned encryption key data about each of the above-mentioned blocks. 51.如权利要求48所述的加密方法,其中,上述基于块信息加密该程序的步骤包括:51. The encryption method as claimed in claim 48, wherein said step of encrypting the program based on block information comprises: 针对各个上述块的各个区块的指令数据,基于所属块的加密密钥数据以及所属区块的一存储器地址的部分内容生成一加密密钥;以及For the instruction data of each block of each of the above blocks, an encryption key is generated based on the encryption key data of the block and a part of a memory address of the block; and 以所生成的上述加密密钥,对所对应的区块进行布林异运算。With the above generated encryption key, perform Boolean XOR operation on the corresponding block. 52.一种微处理器,包括:52. A microprocessor comprising: 一寄存器,具有一位,其中,该微处理器用于设定该位;以及a register having one bit, wherein the microprocessor is used to set the bit; and 一提取单元,用于自一指令高速缓冲存储器提取加密指令、并且在执行上述加密指令前解密上述加密指令,以回应该微处理器设定该位的操作;a fetch unit for fetching encrypted instructions from an instruction cache and decrypting said encrypted instructions before executing said encrypted instructions in response to the microprocessor setting the bit; 其中,该微处理器储存该位的数值至一存储器、且接着清除该位,以回应接收到的一中断事件;Wherein, the microprocessor stores the value of the bit to a memory, and then clears the bit in response to receiving an interrupt event; 其中,该微处理器清除该位后,该提取单元自该指令高速缓冲存储器提取非加密指令、并且不作解密即执行上述非加密指令;Wherein, after the microprocessor clears the bit, the extraction unit extracts the non-encrypted instruction from the instruction cache, and executes the above-mentioned non-encrypted instruction without decrypting it; 其中,该微处理器自该存储器将先前储存的数值用来修复该寄存器的该位,以回应自中断指令返回的操作;Wherein, the microprocessor uses the previously stored value from the memory to repair the bit of the register in response to the return operation from the interrupt instruction; 其中,若判断出该位修复后的值为设定状态,该提取单元会再次开始提取并且解密加密指令。Wherein, if it is determined that the value of the bit after repair is set, the extracting unit will start extracting and decrypting the encrypted instruction again. 53.如权利要求52所述的微处理器,其中,该寄存器的该位为x86架构标志寄存器的一预留位。53. The microprocessor of claim 52, wherein the bit of the register is a reserved bit of the x86 architecture flags register. 54.如权利要求52所述的微处理器,其中:54. The microprocessor of claim 52, wherein: 若该位为设定,为了解密加密指令,该提取单元以一解密密钥对加密指令进行布林异运算;并且If the bit is set, in order to decrypt the encrypted instruction, the extraction unit performs a Boolean XOR operation on the encrypted instruction with a decryption key; and 若该位为清除,该提取单元以多位的二进位零值对非加密指令进行布林异运算。If the bit is cleared, the fetch unit performs a Boolean XOR operation on non-encrypted instructions with multi-bit binary zero values. 55.如权利要求52所述的微处理器,其中,该微处理器用于执行一系统软件接收执行具有加密指令的一第一程序的一要求,并且,在具有加密指令的一第二程序正由该微处理器执行的状况下,待该第二程序执行完毕后方执行该第一程序。55. The microprocessor as claimed in claim 52, wherein the microprocessor is configured to execute a system software to receive a request to execute a first program having encrypted instructions, and, during a second program having encrypted instructions Under the condition of being executed by the microprocessor, the first program is executed after the second program is executed. 56.一操作方法,用以操作具有一指令高速缓冲存储器以及一寄存器的一微处理器,该操作方法包括:56. An operating method for operating a microprocessor having an instruction cache and a register, the operating method comprising: 令该寄存器的一位为设定,且随后自该指令高速缓冲存储器提取加密指令、并在执行上述加密指令前将上述加密指令解密;setting a bit of the register, and then fetching the encrypted instruction from the instruction cache, and decrypting the encrypted instruction before executing the encrypted instruction; 储存该架构寄存器该位的数值、并接着清除该位,以回应所接收到的一中断事件;storing the value of the bit of the architectural register and then clearing the bit in response to receiving an interrupt event; 在清除该位后,自该指令高速缓冲存储器提取非加密指令,并且不作解密即执行上述非加密指令;After the bit is cleared, unencrypted instructions are fetched from the instruction cache and executed without decryption; 以先前储存的数值修复该寄存器的该位,以回应自中断指令返回的操作;以及restoring the bit of the register with the previously stored value in response to a return from the interrupt instruction; and 若判定该位修复后的数值为设定状态,回复上述提取、解密并且执行加密指令的操作。If it is determined that the restored value of the bit is the set state, reply to the above operations of extracting, decrypting, and executing the encrypted instruction. 57.如权利要求56所述的操作方法,其中该架构寄存器的该位为x86架构标志寄存器的一预留位。57. The operating method as claimed in claim 56, wherein the bit of the architectural register is a reserved bit of an x86 architectural flag register. 58.如权利要求56所述的操作方法,其中:58. The method of operation of claim 56, wherein: 若该位为设定,上述解密加密指令的步骤包括以一解密密钥对加密指令进行布林异运算;以及If the bit is set, the step of decrypting the encrypted instruction includes performing a Boolean XOR operation on the encrypted instruction with a decryption key; and 若该位为清空,上述不对非加密指令作解密的操作包括以多位的二进位零值对非加密指令作布林异运算。If the bit is cleared, the above-mentioned operation of not decrypting the non-encrypted instruction includes performing a Boolean XOR operation on the non-encrypted instruction with a multi-bit binary zero value. 59.如权利要求56所述的操作方法,还包括:59. The method of operation of claim 56, further comprising: 接收一要求,目的是执行具有加密指令的一第一程序;并且receiving a request for the purpose of executing a first program with encrypted instructions; and 若该微处理器正在执行具有加密指令的一第二程序,则等待直至该第二程序执行完毕后方执行该第一程序。If the microprocessor is executing a second program with encrypted instructions, it waits until the second program is executed before executing the first program. 60.一微处理器,包括:60. A microprocessor comprising: 一寄存器,具有一位;以及a register, having one bit; and 一提取单元;an extraction unit; 其中,若接收到中断执行中程序的一要求,该微处理器储存该位的数值,其中,该位指示执行中的程序为加密或非加密;Wherein, if receiving a request to interrupt the program in execution, the microprocessor stores the value of the bit, wherein the bit indicates that the program in execution is encrypted or non-encrypted; 其中,该微处理器以先前储存的数值修复该位、并且重新提取被中断的程序作为执行中程序,以回应自中断指令返回的操作;wherein the microprocessor restores the bit with a previously stored value, and refetches the interrupted program as a running program in response to a return from the interrupt instruction; 其中,若该位修复后的数值为设定状态,该微处理器在重新提取所中断的程序前将解密密钥数值修复,并且以修复后的解密密钥数值解密所提取的指令;Wherein, if the value after the repair of the bit is set, the microprocessor restores the decryption key value before re-extracting the interrupted program, and decrypts the extracted instruction with the repaired decryption key value; 其中,若该位修复后的数值为清除状态,该微处理器不会修复密钥数值、也不会将提取的指令解密。Wherein, if the repaired value of the bit is cleared, the microprocessor will neither repair the key value nor decrypt the extracted instruction. 61.如权利要求60所述的微处理器,其中,该位为x86架构标志寄存器的一位。61. The microprocessor of claim 60, wherein the bit is a bit of an x86 architecture flags register. 62.如权利要求60所述的微处理器,其中,该微处理器是将该位的数值储存于一存储器,其中,该微处理器是自该存储器存取得先前储存的数值用于修复该位。62. The microprocessor of claim 60, wherein the microprocessor stores the value of the bit in a memory, wherein the microprocessor stores a previously stored value from the memory for restoring the bit bit. 63.如权利要求60所述的微处理器,其中:63. The microprocessor of claim 60, wherein: 为了以修复后的解密密钥数值解密所提取的指令,该微处理器以修复后的解密密钥数值发展出一解密密钥对所提取的指令进行布林异运算;并且to decrypt the fetched instruction with the restored decryption key value, the microprocessor develops a decryption key with the restored decryption key value and performs a Boolean XOR operation on the fetched instruction; and 为了不对所提取的指令作解密操作,该微处理器以多位的二进位零值对所提取的指令作布林异运算。In order not to perform a decryption operation on the fetched instructions, the microprocessor performs a Boolean XOR operation on the fetched instructions with multi-bit binary zero values. 64.如权利要求60所述的微处理器,其中,为了修复解密密钥数值,该微处理器自一储存元件将解密密钥数值载入一寄存器文档,其中,该储存元件储存有多个加密程序各自的解密密钥数值,其中,该寄存器文档是储存正在执行的该个程序的解密密钥数值。64. The microprocessor of claim 60, wherein, to restore the decryption key value, the microprocessor loads the decryption key value into a register file from a storage element, wherein the storage element stores a plurality of The respective decryption key values of the encrypted programs, wherein the register file stores the decryption key values of the program being executed. 65.如权利要求64所述的微处理器,其中,该微处理器还用于执行一系统软件接收执行新的加密程序的一要求,若该储存元件没有足够的自由空间储存上述新的加密程序的解密密钥数值,等待直至该储存元件腾出足够的自由空间方执行上述新的加密程序。65. The microprocessor as claimed in claim 64, wherein the microprocessor is also used for executing a system software to receive a request to execute a new encryption program, if the storage element does not have enough free space to store the new encryption The decryption key value of the program, wait until the storage element frees up enough free space to execute the above-mentioned new encryption program. 66.一操作方法,用于操作一微处理器,该操作方法包括:66. A method of operating for operating a microprocessor, the operating method comprising: 于储存该微处理器一位的数值,以回应所接收到的中断执行中程序的一要求,其中,该位标示上述执行中程序为加密或非加密;storing a value of a bit of the microprocessor in response to a request received to interrupt a running program, wherein the bit indicates whether the running program is encrypted or non-encrypted; 回应自中断指令返回的操作,将先前储存的数值用来修复该位,并且重新提取中断的程序如同执行中程序运作;In response to a return from the interrupt instruction, the previously stored value is used to restore the bit, and the interrupted program is re-fetched to behave as the running program; 若该位修复后的数值为设定状态,在重新提取中断的程序之前,将解密密钥数值修复,以采用修复后的解密密钥数值解密所提取的指令;以及If the restored value of the bit is set, before re-extracting the interrupted program, restore the decryption key value, so as to use the restored decryption key value to decrypt the extracted instruction; and 若该位修复后的数值为清除状态,则不修复解密密钥数值,并且不解密所提取的指令。If the repaired value of the bit is cleared, the decryption key value is not repaired, and the fetched instruction is not decrypted. 67.如权利要求66所述的操作方法,其中,上述储存该位的数值的步骤包括储存该位的数值至一存储器,其中,上述以先前储存的数值修复该位的步骤包括自该存储器将先前储存的数值复原至该位。67. The method of operation as claimed in claim 66, wherein the step of storing the value of the bit comprises storing the value of the bit to a memory, wherein the step of restoring the bit with the previously stored value comprises storing the value of the bit from the memory The previously stored value is restored to this bit. 68.如权利要求66所述的操作方法,其中:68. The method of operation of claim 66, wherein: 上述采用修复后的解密密钥数值解密所提取的指令的步骤包括将自修复后的解密密钥数值所推得的一解密密钥对所提取的指令作布林异运算;以及The step of decrypting the extracted instruction using the restored decryption key value includes performing a Boolean XOR operation on the extracted instruction with a decryption key derived from the restored decryption key value; and 上述不解密所提取的指令的步骤包括以多位的二进位零值对所提取的指令作布林异运算。The step of undecrypting the fetched instructions includes performing a Boolean XOR operation on the fetched instructions with multi-bit binary zero values. 69.如权利要求66所述的操作方法,其中,上述修复解密密钥数值的步骤包括自一储存元件将解密密钥数值载入一寄存器文档,其中,该储存元件储存多个加密程序各自的解密密钥数值,其中,该寄存器文档是储存正在执行中的该个加密程序的解密密钥数值。69. The operation method as claimed in claim 66, wherein the step of restoring the decryption key value comprises loading the decryption key value into a register file from a storage element, wherein the storage element stores the respective The decryption key value, wherein the register file stores the decryption key value of the encryption program being executed. 70.如权利要求69所述的操作方法,还包括:70. The method of operation of claim 69, further comprising: 接收执行新的加密程序的一要求;receiving a request to implement a new encryption procedure; 若该储存元件没有足够的自由空间储存该个新的加密程序的解密密钥数值,等待直至该储存元件有足够的自由空间后,方执行该个新的加密程序。If the storage element does not have enough free space to store the decryption key value of the new encryption program, wait until the storage element has enough free space before executing the new encryption program. 71.一种微处理器,包括:71. A microprocessor comprising: 一储存元件,包括多个位置,用以各自储存一加密程序的解密密钥数据;A storage element, including a plurality of locations, used to respectively store decryption key data of an encryption program; 一控制寄存器,包括一字段,标示该储存元件上述多个位置的一对应执行中的加密程序,其中,该微处理器自存储器将先前储存的该字段的数值修复至该控制寄存器,以回应自中断指令返回的操作,;A control register including a field indicating a corresponding encryption program in execution for the plurality of locations of the storage element, wherein the microprocessor restores the previously stored value of the field to the control register from the memory in response to the The operation returned by the interrupt instruction; 一提取单元,提取执行中加密程序的加密指令,并将之以该字段修复后的数值,在该储存元件所标示的位置其所储存的解密密钥数据解密。An extracting unit extracts the encryption instruction of the encryption program in execution, and decrypts the decryption key data stored in the position indicated by the storage element with the repaired value of the field. 72.如权利要求71所述的微处理器,其中,关于令该微处理器执行新的加密程序的要求,该微处理器更设定该控制寄存器该字段标示该储存元件上配置给上述新的加密程序储存解密密钥数据的位置。72. The microprocessor as claimed in claim 71 , wherein, regarding the request for the microprocessor to execute a new encryption program, the microprocessor further sets the field of the control register to indicate that the storage element is allocated to the new encryption program. The location where the encryption program stores the decryption key data. 73.如权利要求72所述的微处理器,其中,该微处理器更将上述新的加密程序的解密密钥数据载入这些位置中对应配置者,并且自这些位置中对应配置者载入该提取单元。73. The microprocessor as claimed in claim 72, wherein, the microprocessor further loads the decryption key data of the above-mentioned new encryption program into the corresponding configurator in these locations, and loads the corresponding configurator from these locations. The extraction unit. 74.如权利要求71所述的微处理器,其中,该储存元件包括一寄存器文档或一存储器,其中,该储存元件上述多个位置各自包括一寄存器储存解密密钥数据或一存储器位置储存解密密钥数据。74. The microprocessor of claim 71 , wherein the storage element comprises a register file or a memory, wherein each of the plurality of locations of the storage element comprises a register storing decryption key data or a memory location storing decryption key data key data. 75.如权利要求71所述的微处理器,其中,该提取单元更以该字段修复后的数值在该储存元件所标示的位置所储存的解密密钥数据对所提取的加密指令执行布林异运算,以解密所提取的加密指令。75. The microprocessor as claimed in claim 71, wherein the extracting unit further uses the decryption key data stored in the position indicated by the storage element to execute Boolean on the extracted encrypted instruction by using the repaired value of the field. exclusive operation to decrypt the extracted encrypted instructions. 76.如权利要求71所述的微处理器,其中该控制寄存器包括修复上述字段的x86架构标志寄存器。76. The microprocessor of claim 71, wherein the control registers include an x86 architecture flags register that fixes said field. 77.如权利要求71所述的微处理器,其中,回应上述自中断指令返回的操作,若该字段修复后的数值在该储存元件所标示的位置所相关的一位为设定,该微处理器在该提取单元解密所提取出的加密指令前发出一异常警示。77. The microprocessor as claimed in claim 71, wherein, in response to the above-mentioned operation returning from the interrupt instruction, if the value after the repair of the field is set at the bit associated with the position indicated by the storage element, the microprocessor The processor issues an exception warning before the fetch unit decrypts the fetched encrypted instruction. 78.如权利要求77所述的微处理器,其中,回应该异常警示,该微处理器在该提取单元解密所提取的加密指令之前,将执行中的加密程序的解密密钥数据重新载入该字段修复后的数值在该储存元件所标示的位置。78. The microprocessor as claimed in claim 77, wherein, in response to the abnormal warning, the microprocessor reloads the decryption key data of the encrypted program in execution before the fetch unit decrypts the fetched encrypted instruction The repaired value of the field is at the position indicated by the storage element. 79.如权利要求77所述的微处理器,其中,该位被设定为设定状态,以显示在上述自中断指令返回的操作执行前,所欲重启的加密程序在该储存元件上所对应的位置所储存的解密密钥数据已被覆写。79. The microprocessor as claimed in claim 77, wherein the bit is set to a set state to show that the encrypted program to be restarted is stored on the storage element before the operation of returning from the interrupt instruction is executed. The decryption key data stored in the corresponding location has been overwritten. 80.如权利要求79所述的微处理器,其中,储存元件内位置覆写状况是发生在该微处理器开始执行一个新的加密程序、但该储存元件没有足够的自由空间储存该个新的加密程序的解密密钥数据时。80. The microprocessor as claimed in claim 79, wherein the location overwriting condition in the storage element occurs when the microprocessor starts to execute a new encryption program, but the storage element does not have enough free space to store the new encryption program. The encryption program's decryption key data. 81.如权利要求79所述的微处理器,其中储存元件内位置覆写状况是发生在该微处理器回应该异常警示、将所执行程序对应的解密密钥数据重新载入该字段修复后的数值在该储存元件所指示的位置时。81. The microprocessor as claimed in claim 79, wherein the location overwriting condition in the storage element occurs after the microprocessor responds to the abnormal warning and reloads the decryption key data corresponding to the executed program into the field for repair When the value is at the position indicated by the storage element. 82.如权利要求71所述的微处理器,其中该微处理器更执行系统软件以:82. The microprocessor of claim 71, wherein the microprocessor further executes system software to: 接收执行新的加密程序的要求;Receive requests to implement new encryption procedures; 在该储存元件内的自由空间不足以储存上述新的加密程序的解密密钥数据时,等待直至该储存元件得以供应足够自由空间后,方执行上述新的加密程序。When the free space in the storage element is not enough to store the decryption key data of the new encryption program, wait until the storage element is provided with enough free space before executing the new encryption program. 83.一种操作方法,用以操作具有一控制寄存器以及一储存元件的一微处理器,该储存元件内多个位置用以各自储存一加密程序的解密密钥数据,上述操作方法包括:83. An operating method for operating a microprocessor having a control register and a storage element, and a plurality of locations in the storage element are used to respectively store decryption key data of an encryption program, the above-mentioned operating method comprising: 将该控制寄存器的一字段以先前储存于存储器内的该字段的数值修复,以回应自中断指令返回的操作,其中,该字段的数值标示执行中的加密程序于该储存元件多个位置何者;restoring a field of the control register with a value of the field previously stored in the memory in response to an operation returning from an interrupt instruction, wherein the value of the field indicates which of a plurality of locations of the storage element an encryption program in execution; 提取执行中的加密程序的加密指令;以及extracting encrypted instructions of the encrypted program in execution; and 采用该字段修复后的数值,在该储存元件所指示的位置其所储存的解密密钥数据解密所提取的加密指令。Using the repaired value of the field, the decryption key data stored in the location indicated by the storage element is used to decrypt the extracted encrypted instruction. 84.如权利要求83所述的操作方法,还包括:84. The method of operation of claim 83, further comprising: 在解密所提取的加密指令前,将该字段修复后的数值在该储存元件中所标示的位置其所储存的解密密钥数据载入该微处理器的一提取单元。Before decrypting the extracted encrypted instruction, the stored decryption key data is loaded into an extraction unit of the microprocessor at the position indicated by the repaired value of the field in the storage element. 85.如权利要求83所述的操作方法,还包括:85. The method of operation of claim 83, further comprising: 配置该储存元件上多个位置的一储存被要求由该微处理器执行的一个新的加密程序的解密密钥数据;configuring a plurality of locations on the storage element to store decryption key data required for a new encryption program to be executed by the microprocessor; 设定该控制寄存器该字段的数值,以标示上述配置步骤于该储存元件中配置的该位置;以及。setting the value of the field of the control register to indicate the position allocated in the storage element by the above allocation step; and. 将该个新的加密程序的解密密钥数据载入上述配置步骤于该储存元件中配置的该位置。The decryption key data of the new encryption program is loaded into the location configured in the storage element in the above configuration step. 86.如权利要求83所述的操作方法,其中,上述解密所提取的加密指令的步骤包括以该字段修复后的数值在该储存元件所标示的位置其所储存的解密密钥数据对所提取的加密指令进行布林异运算。86. The operation method as claimed in claim 83, wherein the step of decrypting the extracted encrypted instruction comprises extracting the stored decryption key data at the position indicated by the storage element with the repaired value of the field The encrypted instruction performs Boolean XOR operation. 87.如权利要求83所述的操作方法,还包括:87. The method of operation of claim 83, further comprising: 回应上述自中断指令返回的操作,若该字段修复后的数值在该储存元件所标示的位置所相关的一位为设定,在解密所提取出的加密指令前发出一异常警示。In response to the above-mentioned return operation from the interrupt command, if the value after the repair of the field is set in the corresponding bit of the position indicated by the storage element, an abnormal warning is issued before decrypting the extracted encrypted command. 88.如权利要求87所述的操作方法,还包括:88. The method of operation of claim 87, further comprising: 回应该异常警示,在解密所提取的加密指令之前,将执行中的加密程序的解密密钥数据重新载入该字段修复后的数值在该储存元件所标示的位置。Responding to the abnormal warning, before decrypting the extracted encryption instruction, reload the decryption key data of the encryption program in execution into the position indicated by the repaired value of the field in the storage element. 89.如权利要求87所述的操作方法,还包括:89. The method of operation of claim 87, further comprising: 在上述自中断指令返回的操作执行前,覆写遮盖了将重启的加密程序在该储存元件上所对应的位置所储存的解密密钥数据;Before the above-mentioned operation returning from the interrupt instruction is executed, overwrite and cover the decryption key data stored in the corresponding position of the encryption program to be restarted on the storage element; 令该位为设定状态,以标示上述覆写操作曾发生。Leave this bit set to indicate that the above-mentioned overwrite operation has occurred. 90.如权利要求89所述的操作方法,还包括:90. The method of operation of claim 89, further comprising: 判定该储存元件不存在足够的自由空间给该微处理器将执行的一个新的加密程序;Determining that the storage element does not have enough free space for a new encryption program to be executed by the microprocessor; 其中,回应上述判定该储存元件不存在足够自由空间的步骤,以覆写方式配置该储存单元内的位置给该个新的加密程序。Wherein, in response to the above-mentioned step of determining that the storage element does not have enough free space, the location in the storage unit is allocated to the new encryption program in an overwriting manner. 91.如权利要求89所述的操作方法,其中,91. The method of operation of claim 89, wherein, 回应该异常警示,以覆写方式将所执行程序对应的解密密钥数据重新载入该字段修复后的数值在该储存元件所指示的位置。In response to the abnormal warning, the decryption key data corresponding to the executed program is reloaded into the position indicated by the repaired value of the field in the storage element by overwriting. 92.如权利要求83所述的操作方法,还包括:92. The method of operation of claim 83, further comprising: 接收执行一个新的加密程序的要求;以及receive a request to implement a new encryption procedure; and 在该储存元件没有足够自由空间储存该个新的加密程序的解密密钥数据的状况下,等待直至该储存元件得以供应足够的自由空间,方执行该个新的加密程序。When the storage element does not have enough free space to store the decryption key data of the new encryption program, the new encryption program cannot be executed until the storage element is provided with enough free space. 93.一微处理器,包括:93. A microprocessor comprising: 一分支目标地址高速缓冲存储器,记录先前执行过的分支与切换密钥指令的历史信息,其中,上述历史信息包括所记录的分支与切换密钥指令的目标地址以及标识符,上述标识符标示与所属的分支与切换密钥指令相关的多个密钥数值;A branch target address cache memory, which records historical information of previously executed branch and switch key instructions, wherein the above historical information includes the recorded target addresses and identifiers of the branch and switch key instructions, and the identifiers indicate the same Multiple key values related to the branch to which the key is switched; 一提取单元,耦接该分支目标地址高速缓冲存储器、并且用于:a fetch unit, coupled to the branch target address cache, and used for: 于提取先前执行过的分支与切换密钥指令时,接收该分支目标地址高速缓冲存储器所作的预测、并且自该分支目标地址高速缓冲存储器接收关于所提取的分支与切换密钥指令的上述目标地址以及标识符;以及receiving a prediction made by the branch target address cache when fetching previously executed branch and switch key instructions, and receiving the target addresses for the fetched branch and switch key instructions from the branch target address cache and the identifier; and 根据所接收的目标地址提取加密指令数据、并且根据所接收的标识符所标示的多个密钥数值解密所提取的加密指令数据,以回应接收到的上述预测。extracting encrypted instruction data according to the received target address, and decrypting the extracted encrypted instruction data according to the plurality of key values indicated by the received identifier, in response to the received prediction. 94.如权利要求93所述的微处理器,其中该提取单元将所提取的加密指令数据与一解密密钥作布林异运算以解密,其中,该解密密钥是以所接收的标识符标示的密钥数值为一函数产生。94. The microprocessor as claimed in claim 93, wherein the extracting unit performs a Boolean XOR operation on the extracted encrypted command data and a decryption key to decrypt, wherein the decryption key is based on the received identifier The indicated key value is generated by a function. 95.如权利要求93所述的微处理器,其中上述标识符包括一索引,指示用于储存密钥数值的一寄存器文档内的一位置。95. The microprocessor of claim 93, wherein said identifier includes an index indicating a location within a register file for storing key values. 96.如权利要求95所述的微处理器,其中,该提取单元还包括:96. The microprocessor as claimed in claim 95, wherein the extraction unit further comprises: 一主密钥寄存器文档,储存该提取单元解密所提取的加密指令数据所需的多个密钥数值;以及a master key register file, storing a plurality of key values required by the extracting unit to decrypt the extracted encrypted instruction data; and 密钥切换逻辑,耦接该分支目标地址高速缓冲存储器以及该主密钥寄存器文档,基于自该分支目标地址高速缓冲存储器所接收的该索引,将该索引在该寄存器文档所指示的位置所储存的多个密钥数值用于更新上述主密钥寄存器文档。key switching logic, coupled to the branch target address cache and the master key register file, stores the index at a location indicated by the register file based on the index received from the branch target address cache The multiple key values of are used to update the master key register document above. 97.如权利要求96所述微处理器,其中,若该分支目标地址高速缓冲存储器对所提取的分支与切换密钥指令的预测不正确,该微处理器随后修复上述主密钥寄存器文档的数值为更新前的值。97. The microprocessor of claim 96, wherein if the branch target address cache prediction of the fetched branch and switch key instruction is incorrect, the microprocessor subsequently repairs the master key register file The value is the value before the update. 98.如权利要求93所述的微处理器,其中,该分支目标地址高速缓冲存储器更记录先前执行过的传统分支指令的历史信息,其中,无论是分支与切换密钥指令还是传统分支指令的历史信息,皆包括型式指标,标示所记录的指令是属于分支与切换密钥指令还是传统分支指令。98. The microprocessor of claim 93, wherein the branch target address cache further records history information of previously executed legacy branch instructions, wherein, whether it is a branch and switch key instruction or a legacy branch instruction The history information, both including type indicators, indicates whether the recorded instruction is a branch and switch key instruction or a traditional branch instruction. 99.如权利要求93所述的微处理器,其中该提取单元产生一提取地址用于自一指令高速缓冲存储器提取指令,其中,该提取地址还用于存取该分支目标地址高速缓冲存储器。99. The microprocessor of claim 93, wherein the fetch unit generates a fetch address for fetching instructions from an instruction cache, wherein the fetch address is also used for accessing the branch target address cache. 100.如权利要求93所述的微处理器,其中上述历史信息还包括先前执行过的分支与切换密钥指令的采用/不采用指标,若该分支目标地址高速缓冲存储器所提供的采用/不采用指标预测目前提取的分支与切换密钥指令将被采用,回应所接收的预测,以该提取单元提取所接收的目标地址上的加密指令数据、并且将之基于所接收的标识符所标示的多个密钥数值解密。100. The microprocessor as claimed in claim 93, wherein said history information further comprises adoption/non-adoption indicators of previously executed branch and switch key instructions, if the adopted/non-adopted indicators provided by the branch target address cache memory Using an index to predict that the currently fetched branch and switch key instructions will be taken, in response to the received prediction, the fetch unit fetches encrypted instruction data at the received target address and bases it on the received identifier as indicated Multiple key value decryption. 101.如权利要求93所述的微处理器,其中,若该微处理器随后判定该分支目标地址高速缓冲存储器已正确地预测所提取的分支与切换密钥指令,该微处理器免于清空本身管线。101. The microprocessor of claim 93, wherein the microprocessor is exempt from flushing if the microprocessor subsequently determines that the branch target address cache has correctly predicted the fetched branch and switch key instruction pipeline itself. 102.如权利要求93所述的微处理器,其中,若该微处理器执行一分支与切换密钥指令、并且判定该分支目标地址高速缓冲存储器无法预测该提取单元对该分支与切换密钥指令的操作,该微处理器会:102. The microprocessor of claim 93, wherein if the microprocessor executes a branch and switch key instruction and determines that the branch target address cache cannot predict the branch and switch key instruction operation, the microprocessor will: 清空本身管线;Empty its own pipeline; 根据该分支与切换密钥指令所指示的一目标地址提取加密指令数据;并且extracting encrypted instruction data according to a target address indicated by the branch and switch key instruction; and 根据该分支与切换密钥指令所指示的多个密钥数值解密所提取的加密指令数据。The extracted encrypted instruction data is decrypted according to a plurality of key values indicated by the branch and switch key instruction. 103.如权利要求93所述的微处理器,其中,该分支目标地址高速缓冲存储器更储存先前执行过的密钥切换指令的历史信息,其中,密钥切换指令的上述历史信息包括标识符,用于标示与所属的密钥切换指令相关的多个密钥数值,其中,无论是分支与切换密钥指令或是密钥切换指令,皆包括型式指标,标示所记录的指令是属于分支与切换密钥指令还是密钥切换指令。103. The microprocessor of claim 93, wherein the branch target address cache further stores history information of previously executed key switch instructions, wherein the history information of the key switch instructions includes identifiers, It is used to mark multiple key values related to the key switch command to which it belongs. Whether it is a branch and switch key command or a key switch command, it includes a type indicator, indicating that the recorded command belongs to the branch and switch The key command is also the key switching command. 104.一种操作方法,用以操作一微处理器,该操作方法包括:104. A method of operating for operating a microprocessor, the method of operating comprising: 记录先前执行过的分支与切换密钥指令的历史信息于一分支目标地址高速缓冲寄存器,其中,上述历史信息包括所记录的分支与切换密钥指令的目标地址以及标识符,上述标识符标示与所属的分支与切换密钥指令相关的多个密钥数值;Recording historical information of previously executed branch and switch key instructions in a branch target address cache register, wherein the above historical information includes the recorded target addresses and identifiers of the branch and switch key instructions, and the identifiers indicate the same Multiple key values related to the branch to which the key is switched; 于提取先前执行过的分支与切换密钥指令时,接收该分支目标地址高速缓冲存储器所作的预测、并且自该分支目标地址高速缓冲存储器接收关于所提取的分支与切换密钥指令的上述目标地址以及标识符;以及receiving a prediction made by the branch target address cache when fetching previously executed branch and switch key instructions, and receiving the target addresses for the fetched branch and switch key instructions from the branch target address cache and the identifier; and 根据所接收的目标地址提取加密指令数据、并且根据所接收的标识符所标示的多个密钥数值解密所提取的加密指令数据,以回应接收到的上述预测。extracting encrypted instruction data according to the received target address, and decrypting the extracted encrypted instruction data according to the plurality of key values indicated by the received identifier, in response to the received prediction. 105.如权利要求104所述操作方法,其中,上述解密所提取的加密指令数据的步骤是将所提取的加密指令数据与一解密密钥作布林异运算,其中,该解密密钥是以所接收的标识符标示的多个密钥数值为一函数产生。105. The operation method as claimed in claim 104, wherein the step of decrypting the extracted encrypted instruction data is to perform a Boolean XO operation between the extracted encrypted instruction data and a decryption key, wherein the decrypted key is obtained by The plurality of key values indicated by the received identifier are generated by a function. 106.如权利要求104所述操作方法,其中,上述标识符包括一索引,指示用于储存密钥数值的一寄存器文档内的一位置。106. The method of operation of claim 104, wherein said identifier comprises an index indicating a location within a register file for storing key values. 107.如权利要求106所述操作方法,还包括:107. The method of operation of claim 106, further comprising: 以一主密钥寄存器文档储存解密所提取的加密指令数据所需的多个密钥数值;以及storing a plurality of key values required to decrypt the extracted encrypted command data with a master key register file; and 基于自该分支目标地址高速缓冲存储器所接收的该索引,将该索引在该寄存器文档所指示的位置所储存的多个密钥数值用于更新上述主密钥寄存器文档,以回应接收的上述预测。based on the index received from the branch target address cache, using key values stored by the index at locations indicated by the register file to update the master key register file in response to receiving the prediction . 108.如权利要求107所述的操作方法,还包括:108. The method of operation of claim 107, further comprising: 若该分支目标地址高速缓冲存储器对所提取的分支与切换密钥指令的预测不正确,随后修复上述主密钥寄存器文档的数值为更新前的值。If the prediction of the extracted branch and switch key instruction by the branch target address cache memory is incorrect, then the value of the above-mentioned master key register file is restored to the value before updating. 109.如权利要求106所述的操作方法,还包括:109. The method of operation of claim 106, further comprising: 在该分支目标地址块取存储器记录先前执行过的传统分支指令的历史信息,其中,无论是分支与切换密钥指令还是传统分支指令的历史信息,皆包括型式指标,标示所记录的指令是属于分支与切换密钥指令还是传统分支指令。Record the history information of previously executed traditional branch instructions in the branch target address block fetch memory, wherein, whether it is the branch and switch key instruction or the history information of the traditional branch instructions, all include type indicators, indicating that the recorded instructions belong to Branch and switch key instructions are traditional branch instructions. 110.如权利要求104所述操作方法,还包括:110. The method of operation of claim 104, further comprising: 产生一提取地址用于自一指令高速缓冲存储器提取指令;并且generating a fetch address for fetching instructions from an instruction cache; and 以该提取地址存取该分支目标地址高速缓冲存储器。The branch target address cache is accessed with the fetch address. 111.如权利要求104所述的操作方法,其中,111. The method of operation of claim 104, wherein, 上述历史信息还包括先前执行过的分支与切换密钥指令的采用/不采用指标,若该分支目标地址高速缓冲存储器所提供的采用/不采用指标预测目前提取的分支与切换密钥指令将被采用,回应所接收的预测,该操作方法包括提取所接收的目标地址上的加密指令数据、并且将之基于所接收的标识符所标示的多个密钥数值解密。The above-mentioned historical information also includes adoption/non-adoption indicators of previously executed branch and switch key instructions. Employing, responsive to the received prediction, the method of operation includes extracting encrypted instruction data at the received target address and decrypting it based on a plurality of key values indicated by the received identifier. 112.如权利要求104所述操作方法,还包括:112. The method of operation of claim 104, further comprising: 若该微处理器随后判定该分支目标地址高速缓冲存储器已正确地预测所提取的分支与切换密钥指令,省略清空该微处理器管线的操作。If the microprocessor subsequently determines that the branch target address cache has correctly predicted the fetched branch and switch key instruction, flushing the microprocessor pipeline is omitted. 113.如权利要求104所述的操作方法,还包括:113. The method of operation of claim 104, further comprising: 执行一分支与切换密钥指令;Execute a branch and switch key instruction; 若判定该分支目标地址高速缓冲存储器无法预测该分支与切换密钥指令的操作,则执行:If it is determined that the branch target address cache memory cannot predict the operation of the branch and switch key instruction, then execute: 清空该微处理器的管线;emptying the pipeline of the microprocessor; 根据该分支与切换密钥指令所指示的一目标地址提取加密指令数据;并且extracting encrypted instruction data according to a target address indicated by the branch and switch key instruction; and 根据该分支与切换密钥指令所指示的多个密钥数值解密所提取的加密指令数据。The extracted encrypted instruction data is decrypted according to a plurality of key values indicated by the branch and switch key instruction. 114.如权利要求104所述的操作方法,还包括:114. The method of operation of claim 104, further comprising: 于该分支目标地址高速缓冲存储器记录先前执行过的密钥切换指令的历史信息,其中,密钥切换指令的上述历史信息包括标识符,用于标示与所属的密钥切换指令相关的多个密钥数值,其中,无论是分支与切换密钥指令或是密钥切换指令,皆包括型式指标,标示所记录的指令是属于分支与切换密钥指令还是密钥切换指令。Record the history information of the previously executed key switching instruction in the branch target address cache memory, wherein the above-mentioned history information of the key switching instruction includes an identifier, which is used to identify multiple encryption keys related to the key switching instruction. Key value, wherein, whether it is a branch and switch key command or a key switch command, it includes a type indicator, indicating whether the recorded command belongs to a branch and switch key command or a key switch command.
CN201110136447.8A 2010-05-25 2011-05-25 Microprocessor and related operation method, and encryption and decryption method Active CN102221989B (en)

Priority Applications (9)

Application Number Priority Date Filing Date Title
CN201710066089.5A CN107015926B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method
CN201310674396.3A CN103699832B (en) 2010-05-25 2011-05-25 Microprocessor and related method of operation
CN201310738005.XA CN103713883B (en) 2010-05-25 2011-05-25 Decryption key generation device and method
CN201610227267.3A CN105912305B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method, and encryption method
CN201310687857.0A CN103839001B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method
CN201310681951.5A CN103761070B (en) 2010-05-25 2011-05-25 Microprocessor and associated method of operation, and encryption method
CN201310680122.5A CN103699833B (en) 2010-05-25 2011-05-25 Microprocessor and related method of operation
CN201611195519.5A CN107102843B (en) 2010-05-25 2011-05-25 Microprocessor and method for safely executing instructions therein
CN201310680125.9A CN103645885B (en) 2010-05-25 2011-05-25 Microprocessor and related method of operation

Applications Claiming Priority (14)

Application Number Priority Date Filing Date Title
US34812710P 2010-05-25 2010-05-25
US61/348,127 2010-05-25
US13/091,487 2011-04-21
US13/091,785 US8719589B2 (en) 2010-05-25 2011-04-21 Microprocessor that facilitates task switching between multiple encrypted programs having different associated decryption key values
US13/091,641 2011-04-21
US13/091,547 2011-04-21
US13/091,547 US8700919B2 (en) 2010-05-25 2011-04-21 Switch key instruction in a microprocessor that fetches and decrypts encrypted instructions
US13/091,487 US8671285B2 (en) 2010-05-25 2011-04-21 Microprocessor that fetches and decrypts encrypted instructions in same time as plain text instructions
US13/091,828 2011-04-21
US13/091,698 2011-04-21
US13/091,698 US8683225B2 (en) 2010-05-25 2011-04-21 Microprocessor that facilitates task switching between encrypted and unencrypted programs
US13/091,785 2011-04-21
US13/091,828 US8645714B2 (en) 2010-05-25 2011-04-21 Branch target address cache for predicting instruction decryption keys in a microprocessor that fetches and decrypts encrypted instructions
US13/091,641 US8639945B2 (en) 2010-05-25 2011-04-21 Branch and switch key instruction in a microprocessor that fetches and decrypts encrypted instructions

Related Child Applications (9)

Application Number Title Priority Date Filing Date
CN201310674396.3A Division CN103699832B (en) 2010-05-25 2011-05-25 Microprocessor and related method of operation
CN201310738005.XA Division CN103713883B (en) 2010-05-25 2011-05-25 Decryption key generation device and method
CN201310680122.5A Division CN103699833B (en) 2010-05-25 2011-05-25 Microprocessor and related method of operation
CN201611195519.5A Division CN107102843B (en) 2010-05-25 2011-05-25 Microprocessor and method for safely executing instructions therein
CN201310687857.0A Division CN103839001B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method
CN201610227267.3A Division CN105912305B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method, and encryption method
CN201310680125.9A Division CN103645885B (en) 2010-05-25 2011-05-25 Microprocessor and related method of operation
CN201310681951.5A Division CN103761070B (en) 2010-05-25 2011-05-25 Microprocessor and associated method of operation, and encryption method
CN201710066089.5A Division CN107015926B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method

Publications (2)

Publication Number Publication Date
CN102221989A true CN102221989A (en) 2011-10-19
CN102221989B CN102221989B (en) 2014-07-16

Family

ID=44778550

Family Applications (3)

Application Number Title Priority Date Filing Date
CN201611195519.5A Active CN107102843B (en) 2010-05-25 2011-05-25 Microprocessor and method for safely executing instructions therein
CN201710066089.5A Active CN107015926B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method
CN201110136447.8A Active CN102221989B (en) 2010-05-25 2011-05-25 Microprocessor and related operation method, and encryption and decryption method

Family Applications Before (2)

Application Number Title Priority Date Filing Date
CN201611195519.5A Active CN107102843B (en) 2010-05-25 2011-05-25 Microprocessor and method for safely executing instructions therein
CN201710066089.5A Active CN107015926B (en) 2010-05-25 2011-05-25 Microprocessor and related operating method

Country Status (1)

Country Link
CN (3) CN107102843B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252426A (en) * 2013-06-28 2014-12-31 国际商业机器公司 Multiple volume encryption of storage devices using self encrypting drive (sed)
CN107003936A (en) * 2014-12-27 2017-08-01 英特尔公司 Memory protection with non-readable page
CN111213132A (en) * 2017-10-12 2020-05-29 德州仪器公司 Serve CPU-demanding requests with in-flight prefetching
US11469890B2 (en) * 2020-02-06 2022-10-11 Google Llc Derived keys for connectionless network protocols

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107612684B (en) * 2017-10-20 2020-09-15 中博龙辉装备集团股份有限公司 Data Symmetric Encryption Method Based on Proprietary Instruction Set of Localized Processor Platform

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1722046A (en) * 2004-06-30 2006-01-18 富士通株式会社 Secure processor and program for secure processor
CN1737879A (en) * 2004-08-20 2006-02-22 松下电器产业株式会社 Encrypted instruction processing equipment
US20060136715A1 (en) * 2004-12-22 2006-06-22 Kyeong Soo Han MAC security entity for link security entity and transmitting and receiving method therefor
US7702100B2 (en) * 2006-06-20 2010-04-20 Lattice Semiconductor Corporation Key generation for advanced encryption standard (AES) Decryption and the like

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5926642A (en) * 1995-10-06 1999-07-20 Advanced Micro Devices, Inc. RISC86 instruction set
US6704871B1 (en) * 1997-09-16 2004-03-09 Safenet, Inc. Cryptographic co-processor

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1722046A (en) * 2004-06-30 2006-01-18 富士通株式会社 Secure processor and program for secure processor
CN1737879A (en) * 2004-08-20 2006-02-22 松下电器产业株式会社 Encrypted instruction processing equipment
US20060136715A1 (en) * 2004-12-22 2006-06-22 Kyeong Soo Han MAC security entity for link security entity and transmitting and receiving method therefor
US7702100B2 (en) * 2006-06-20 2010-04-20 Lattice Semiconductor Corporation Key generation for advanced encryption standard (AES) Decryption and the like

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252426A (en) * 2013-06-28 2014-12-31 国际商业机器公司 Multiple volume encryption of storage devices using self encrypting drive (sed)
CN107003936A (en) * 2014-12-27 2017-08-01 英特尔公司 Memory protection with non-readable page
CN107003936B (en) * 2014-12-27 2021-03-30 英特尔公司 Memory protection with non-readable pages
CN111213132A (en) * 2017-10-12 2020-05-29 德州仪器公司 Serve CPU-demanding requests with in-flight prefetching
US11469890B2 (en) * 2020-02-06 2022-10-11 Google Llc Derived keys for connectionless network protocols

Also Published As

Publication number Publication date
CN107102843B (en) 2021-04-20
CN107015926B (en) 2020-08-07
CN102221989B (en) 2014-07-16
CN107102843A (en) 2017-08-29
CN107015926A (en) 2017-08-04

Similar Documents

Publication Publication Date Title
CN103645885B (en) Microprocessor and related method of operation
US9892283B2 (en) Decryption of encrypted instructions using keys selected on basis of instruction fetch address
CN105843776B (en) Microprocessor and method for safely executing instruction therein
US20160104011A1 (en) Microprocessor with on-the-fly switching of decryption keys
US20160104010A1 (en) Microprocessor with secure execution mode and store key instructions
CN102221989B (en) Microprocessor and related operation method, and encryption and decryption method
TWI437489B (en) Microprocessors and operating methods thereof and encryption/decryption methods

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant