TW200536332A - Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine - Google Patents

Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine Download PDF

Info

Publication number
TW200536332A
TW200536332A TW094107792A TW94107792A TW200536332A TW 200536332 A TW200536332 A TW 200536332A TW 094107792 A TW094107792 A TW 094107792A TW 94107792 A TW94107792 A TW 94107792A TW 200536332 A TW200536332 A TW 200536332A
Authority
TW
Taiwan
Prior art keywords
cryptographic
block
instruction
register
password
Prior art date
Application number
TW094107792A
Other languages
Chinese (zh)
Other versions
TWI264911B (en
Inventor
Glenn G Henry
Thomas A Crispin
Terry Parks
Original Assignee
Via Tech 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 US10/826,433 external-priority patent/US7519833B2/en
Application filed by Via Tech Inc filed Critical Via Tech Inc
Publication of TW200536332A publication Critical patent/TW200536332A/en
Application granted granted Critical
Publication of TWI264911B publication Critical patent/TWI264911B/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/30007Arrangements for executing specific machine instructions to perform operations on data operands

Abstract

The present invention provides an apparatus and method for performing cryptographic operations on a plurality of input data blocks within a processor, where the size of the input data blocks is programmable. In one embodiment, an apparatus for performing cryptographic operations is provided. The apparatus includes a cryptographic instruction and execution logic. The cryptographic instruction is received by a computing device as part of an instruction flow executing on the computing device. The cryptographic instruction prescribes one of the cryptographic operations, and also one of a plurality of data block sizes. The execution logic is operatively coupled to the cryptographic instruction. The execution logic executes the one of the cryptographic operations. The execution logic has a block size controller that employs the one of a plurality of data block sizes during execution of the one of the cryptographic operations.

Description

200536332 九、發明說明: 【相關參考專利】 本申請案係主張下列美國專利之臨時申請案的優先 權:200536332 IX. Description of the invention: [Related reference patents] This application claims the priority of the following US patent provisional applications:

序列號 申請曰 標題 60/506971 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR OPTIMIZING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 60/507001 9/29/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING SYSTEM TRANSPARENT BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 60/506978 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR EMPLOYING CONFIGURABLE BLOCK CIPHER CRYPTOGRAPHIC ALGORITHMS 60/507004 9/29/2003 APPARATUS AND METHOD FOR PROVIDING USER-GENERATED KEY SCHEDULE IN A MICROPROCESSOR CRYPTOGRAPHIC ENGINE 60/507002 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PROVIDING 200536332Serial Number Application Title 60/506971 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR OPTIMIZING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 60/507001 9/29/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING SYSTEM TRANSPARENT BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 60/506978 // 2003 MICROPROCESSOR APPARATUS AND METHOD FOR EMPLOYING CONFIGURABLE BLOCK CIPHER CRYPTOGRAPHIC ALGORITHMS 60/507004 9/29/2003 APPARATUS AND METHOD FOR PROVIDING USER-GENERATED KEY SCHEDULE IN A MICROPROCCESSOR CRYPTOGRAPHIC ENGINE 60/503002 PRODUCTION 2003 / METHOD002 PRODUCTION 2003 APPROVED

i CONFIGURABLE CRYPTOGRAPHIC BLOCK CIPHER ROUND RESULTS 60/506991 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR ENABLING CONFIGURABLE DATA BLOCK SIZE IN A CRYPTOGRAPHIC ENGINE 60/507003 9/29/2003 APPARATUS FOR ACCELERATING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS IN A MICROPROCESSOR 60/464394 4/18/2003 ADVANCED CRYPTOGRAPHY UNIT 60/506979 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PROVIDING CONFIGURABLE CRYPTOGRAPHIC KEY SIZE 60/508927 10/3/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING SYSTEM TRANSPARENT CIPHER BLOCK CHAINING MODE CRYPTOGRAPHIC FUNCTIONS 60/508679 10/3/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING 200536332i CONFIGURABLE CRYPTOGRAPHIC BLOCK CIPHER ROUND RESULTS 60/506991 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR ENABLING CONFIGURABLE DATA BLOCK SIZE IN A CRYPTOGRAPHIC ENGINE 60/507003 9/29/2003 APPARATUS FOR ACCELERATING BLOCK CIPHER CRYPROMCTOPROCTROC PORTOGRAPH 4/18/2003 ADVANCED CRYPTOGRAPHY UNIT 60/506979 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PROVIDING CONFIGURABLE CRYPTOGRAPHIC KEY SIZE 60/508927 10/3/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING SYSTEM TRANSPARENT CIPHER BLOCK CHAINING MODE CRYPTO TO 508679 10/3/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING 200536332

SYSTEM TRANSPARENT CIPHER BLOCK FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 60/508076 10/3/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING SYSTEM TRANSPARENT OUTPUT BLOCK FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 60/508604 10/3/2003 APPARATUS AND METHOD FOR GENERATING A CRYPTOGRAPHIC KEY SCHEDULE IN A MICROPROCESSOR 本申請案係下列正在審理中的美國專利臨時申請案 中的一部份,該些申請案具有相同的受讓人和發明人。SYSTEM TRANSPARENT CIPHER BLOCK FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 60/508076 10/3/2003 APPARATUS AND METHOD FOR PERFORMING OPERATING SYSTEM TRANSPARENT OUTPUT BLOCK FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 60/508604 10/3/2003 APPARATUS AND METHOD FOR SECURITY PROCESSING CERTIFICATION This application is part of the following pending US patent provisional applications, which have the same assignee and inventor.

序列號 申請曰 標題 10/674057 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PERFORMING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 本申請案涉及下列正在審理中的美國專利臨時申請 案,該些申請案具有相同的受讓人和發明人。Serial Number Application Title 10/674057 9/29/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PERFORMING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS This application is related to the following pending US patent provisional applications, which have the same assignee and invention people.

序列號 申請曰 標題 10/730167 12/5/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PERFORMING BLOCK CIPHER CRYPTOGRAPHIC 200536332Serial number Application title 10/730167 12/5/2003 MICROPROCESSOR APPARATUS AND METHOD FOR PERFORMING BLOCK CIPHER CRYPTOGRAPHIC 200536332

FUNCTIONS 1 10800768 3/15/2004 MICROPROCESSOR APPARATUS AND METHOD FOR OPTIMIZING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 10/727973 12/4/2003 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 10/800938 3/15/2004 MICROPROCESSOR APPARATUS AND METHOD FOR EMPLOYING CONFIGURABLE BLOCK CIPHER CRYPTOGRAPHIC ALGORITHMS 10/800983 3/15/2004 APPARATUS AND METHOD FOR PROVIDING USER-GENERATED KEY SCHEDULE IN A MICROPROCESSOR CRYPTOGRAPHIC ENGINE 10/826435 4/16/2004 MICROPROCESSOR APPARATUS AND METHOD FOR PROVIDING CONFIGURABLE CRYPTOGRAPHIC BLOCK CIPHER ROUND RESULTS 10/826475 4/16/2004 MICROPROCESSOR APPARATUS AND METHOD FOR PROVIDING 200536332FUNCTIONS 1 10800768 3/15/2004 MICROPROCESSOR APPARATUS AND METHOD FOR OPTIMIZING BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 10/727973 12/4/2003 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT BLOCK CIPHER CRYPTOGRAPHIC FUNCTIONS 10/800938 FORROCING APPLICATION CONFIGURABLE BLOCK CIPHER CRYPTOGRAPHIC ALGORITHMS 10/800983 3/15/2004 APPARATUS AND METHOD FOR PROVIDING USER-GENERATED KEY SCHEDULE IN A MICROPROCESSOR CRYPTOGRAPHIC ENGINE 10/826435 4/16/2004 MICROPROCESSOR APPARATUS AND METHOD FOR PRODURING CRYPTOGRAPHIC PROCESS 826475 4/16/2004 MICROPROCESSOR APPARATUS AND METHOD FOR PROVIDING 200536332

CONFIGURABLE CRYPTOGRAPHIC KEY SIZE 10/826,814 4/16/2004 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT CIPHER BLOCK CHAINING MODE CRYPTOGRAPHIC FUNCTIONS 10/826428 4/16/2004 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT CIPHER BLOCK FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 10/826745 4/16/2004 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT OUTPUT FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 10/826632 4/16/2004 APPARATUS AND METHOD FOR GENERATING A CRYPTOGRAPHIC KEY SCHEDULE IN A MICROPROCESSORCONFIGURABLE CRYPTOGRAPHIC KEY SIZE 10 / 826,814 4/16/2004 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT CIPHER BLOCK CHAINING MODE CRYPTOGRAPHIC FUNCTIONS 10/826428 4/16/2004 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT CIPHER BLOCK FEPTO CRYPTO 745 CRYPTOGRAPHIC CRYPTO BLOCK UNCEDTOPHIC / 2004 APPARATUS AND METHOD FOR PERFORMING TRANSPARENT OUTPUT FEEDBACK MODE CRYPTOGRAPHIC FUNCTIONS 10/826632 4/16/2004 APPARATUS AND METHOD FOR GENERATING A CRYPTOGRAPHIC KEY SCHEDULE IN A MICROPROCESSOR

本案引用美國專利申請案第10/826433號之優先權,申請日為2004年 4 月 16 日,名稱為「MICROPROCESSOR APPARATUS AND METHOD FOR ENABLING CONFIGURABLE DATA BLOCK SIZE IN AThis case refers to the priority of US Patent Application No. 10/826433, the application date is April 16, 2004, and the name is "MICROPROCESSOR APPARATUS AND METHOD FOR ENABLING CONFIGURABLE DATA BLOCK SIZE IN A

CRYPTOGRAPHIC ENGINE 200536332 【發明所屬之技術領域】 本發明係有關於微電子領域,特別是有關於一種在一 計算裝置中執行密碼運算之裝置及方法,其中計算裝置允 許資料區塊大小依據指令階段之程式化而運作。 【先前技術】 早期之電腦系統係獨立操作於其他電腦系統之外,據 此,執行於此電腦系統中之應用程式所需之輸入資料,若 非儲存於此電腦系統,就是由應用程式設計人員在執行時 提供;而應用程式執行結果及產生之輸出資料,其形式一 般為列印輸出之紙張,或者是寫入磁帶、磁碟或是此電腦 系統其他類型之儲存裝置之檔案。輸出檔案可當成之後在 相同電腦系統中執行之應用程式之輸入檔案,或者,當輸 出資料先前被儲存成檔案於可移除或可輸送之儲存裝置 時,其也可以提供給不同但相容之電腦系統之應用程式使 用。在這些早期的系統,保護機密資訊的需求係公認,並 且在其他資訊安全措施中,密碼應用程式被發展及應用以 防止機密資訊未被授權揭露。這些密碼程式一般係以加密 或解密的方式在儲存裝置中儲存成檔案的輸出資料。 其後沒幾年,使用者開始發現藉由網路將電腦連接可 以提供資訊共享存取的好處,因此網路架構、操作系統、 以及資料傳輸協定等均發展成不僅支援存取共享資料的 能力,更是其顯著的特徵。例如:使用者的電腦工作站可 以在不同工作站或網路檔案伺服器存取檔案,或者利用網 際網路獲得新聞及其他資訊,或者對數以百計的其他電腦 傳送及接收電子訊息(如電子郵件),或者與經銷商的電腦 系統連接並提供信用卡或銀行資訊以購買產品,或者在餐 廳、機場或其他公共場合利用無綉網路進行上述之任何活 10 200536332 動。因此,保護機密資料及傳輸免於未授權揭露的需求已 急速的成長,而在某些特定的狀況下,使用者被迫保護其 機密資料的情況也大大的增加。目前新聞頭條通常集中在 電腦資訊安全問題’例如垃圾郵件(Sparrl)、駭客、身分 盜取、反向工程、惡作劇以及信用卡詐騙等係公眾所關注 的前幾名。而當這些從各方面侵入私人領域的動機由無心 的錯誤到有預謀的網路攻擊,負責的執行單位以新法律、 嚴厲的執行以及公共教育節目回應。然而,這些回應並未 有效遏止危及電腦資訊的浪潮。昔日是政府、金融機構、 軍方所專注關切的間諜,現在對一般人而言也已成為重要 的問題;間諜讀取他們的電子郵件或從他們的家用電腦存 取他們檢查帳戶的交易。在商業之前,熟悉該項技藝者可 察知從小到大的社團法人目前應用其資源卓越的部分以 保護財產資訊。 資訊安全領域提供我們技術及裝置以加密資料,並使 其僅能由指定的個體加以解碼,此為所知的密碼 (cryptography):當特另lJ應用於保護儲存或傳輸於電腦之 間的資訊時,密碼最常被應用於轉換機密資料(稱為“明 文”;plaintext或cleartext)成為難以理解的形式(稱為 “密文”;ciphertext)。轉變明文成為密文的轉換過程稱為 加密(encryption; enciphering; ciphering),而轉變密 文回明文的反向轉換過程稱為解密(decryption; deciphering; inverse ciphering) 〇 在密碼學的領域中’幾種程序及協定已發展到允許使 用者不須具備許多知識及努力即可執行密碼運算,並且針 對這些使用者使其可以傳輸或者提供其加密形式的資訊 產品給不同的使用者。連同加密資訊,傳送者通常會提供 接收者一“密碼鑰匙(crypto§raPhic key)”以使接收者可 以解碼所加密的資§札,因此使付接收者能夠恢復或者獲得 200536332 存取未加密的原始資訊。熟悉該項技藝者可察知這些程序 及協定一般係以暗語(Password)保護、數學演算法R及 應用程式特別設計的形式加以實現以加密及解密機密資 訊。 幾種類变的演算法目前使用於加密及解密資料。灣算 法根據上述一類型(例如一種RSA演算法,公開鑰匙密瑪 演算法)利用兩密碼鑰匙(一公開鑰匙(public key)與〜私 人錄匙(private key)),加密或解密資料。根據一些公開 鑰匙演算法,接收者的公開鑰匙係被傳送者用來加密傳送 給接收者的資料,因為有一數學關係存在於使用者的公開 鑰匙與私人鑰匙之間,因此接收者必須利用其私人鑰匙解 密此傳輸以恢復此資料。雖然這類型的密碼演算法廣泛使 用於現今,但其加密及解密的運算卻是極慢甚至於少量的 資料。一第二類型的演算法,如所知的對稱鑰匙演算法, 提供同量等級的資料安全並且可以較快執行。這些演算法 稱為對稱鑰匙演算法,因為他們對加密及解密資訊使用單 一密碼鑰匙。在公開區段,目前有三種盛行單一鑰匙 (single-key)密碼演算法:資料加密標準(Data Encryption Standard; DES)、三重資料加密標準 (Triple DES)以及進階加密標準(Advanced Encryption Standard; AES卜因為這些演算法保護機密資料的強 度’美國政府機關目前正使用這些演算法,但熟悉該項技 藝者預期這些演算法中至少一個演算法,在不久的將來會 變成商業及非官方交易的標準。根據所有這些對稱鑰匙演 算法,明文及密文被劃分在指定大小中的區塊以進行加密 及解密。例如··進階加密標準執行密碼運算於128位元 區塊的大小’並且使用128位元、192位元以及256位 元的密碼输起長度。其他對稱錄匙演算法,例如Rijndael Cipher也允許192位元以及256位元的資料區塊。據 12 200536332 此,就一區塊加密運算而言,一 1G 2 4位元的明文訊息加 密成8個128位元的區塊。 所有對稱鑰匙演算法利用相同形式的次運算以加密 一區塊的明文,並且根據許多更常被應用的對稱鑰匙演算 法,一初始密碼錄匙被擴展成複數個錄匙(例如:一 “錄匙 排程”),每一鑰匙係用以當成次運算的一對應密碼“回合” 且執行於明文區塊。例如:鑰匙排程的第一鑰匙係用以執 行次運算的第一密碼回合於明文區塊,第一回合的結果係 用以當成第二回合的輸入,其中第二回合利用鑰匙排程的 第二鑰匙以產生第二結果,並且一具體指定數量後來的回 ► 合執行產生一最終回合結果,即密文本身。根據進階加密 標準演算法,在每一回合的次運算係參照於文獻中的次位 元(或 S-box)、移列(ShiftRows)、混攔(MixColums)以 及加入回合鍵(AddRoundKey)等。一區塊密文的解密係 類似的處理並伴隨例外的執行在每一回合,且回合的最終 結果係一區塊的明文,上述之例外係指密文輸入反加密及 反次運算執行(例如·· Inverse MixColumns、Inverse ShiftRows) 〇 資料加密標準及三重資料加密標準演算法利用不同 • 特定的次運算,但是這些次運算係類似進階加密標準演算 法的次運算,因為其利用相似的方式以轉換一區塊的明文 成為一區塊的密文。 執行密碼運算於多連續的文字區塊,所有對稱鑰匙演 算法利用相同類別的模式,這些模式包含電子密碼本 (electronic code book; ECB)模式、密碼區塊鏈結 (cipher block chaining; CBC)模式、密碼反饋模式 (cipher feedback; CFB)以及輸出反饋模式(output feedback; 〇FB)。這些模式中有些利用一附加初始化向 13 200536332CRYPTOGRAPHIC ENGINE 200536332 [Technical field to which the invention belongs] The present invention relates to the field of microelectronics, and more particularly to a device and method for performing cryptographic operations in a computing device, where the computing device allows the size of the data block to be based on the program in the instruction phase And operate. [Previous technology] Early computer systems operated independently of other computer systems. According to this, the input data required by applications running in this computer system, if not stored in this computer system, was designed by application programmers. Provided at the time of execution; and the application execution results and the output data generated are generally in the form of printed output paper or files written on magnetic tapes, disks, or other types of storage devices of this computer system. The output file can be used as an input file for an application program that subsequently executes on the same computer system, or, when the output data was previously stored as a file on a removable or transportable storage device, it can also be provided to a different but compatible Application of computer system. In these early systems, the need to protect confidential information was recognized, and among other information security measures, password applications were developed and applied to prevent unauthorized disclosure of confidential information. These password programs are generally encrypted or decrypted and stored as output files in a storage device. Within a few years, users began to realize that the benefits of information sharing access can be provided by connecting computers through the Internet. Therefore, the network architecture, operating system, and data transfer protocols have been developed to not only support the ability to access shared data. , Is its remarkable feature. For example, users' computer workstations can access files on different workstations or network file servers, or use the Internet to obtain news and other information, or send and receive electronic messages (such as email) to hundreds of other computers , Or connect with the dealer's computer system and provide credit card or bank information to purchase products, or use a non-woven network to perform any of the above activities in restaurants, airports or other public places. 10 200536332 As a result, the need to protect confidential information and transmissions from unauthorized disclosure has grown rapidly, and under certain circumstances, users have been forced to protect their confidential information. At present, news headlines usually focus on computer information security issues, such as Sparrl, hacking, identity theft, reverse engineering, pranks, and credit card fraud, among the top public concerns. And when these motives for invading the private sphere from various aspects range from unintentional mistakes to premeditated cyber attacks, the responsible enforcement unit responds with new laws, rigorous enforcement, and public education programs. However, these responses have not effectively stopped the wave of endangered computer information. The spies that used to be the focus of government, financial institutions, and the military are now becoming an important issue for the average person; spies read their e-mails or access transactions from their home computers to check their accounts. Prior to commercialization, those skilled in the art could know that corporate legal persons from small to large are currently using the outstanding parts of their resources to protect property information. In the field of information security, we provide our technology and equipment to encrypt data and make it decoded only by specified individuals. This is known as cryptography: when special applications are used to protect information stored or transmitted between computers At this time, passwords are most often used to convert confidential information (called "plaintext"; plaintext or cleartext) into an incomprehensible form (called "ciphertext"; ciphertext). The conversion process from plaintext to ciphertext is called encryption; enciphering; ciphering, and the reverse conversion from ciphertext to plaintext is called decryption; deciphering; inverse ciphering. Such procedures and protocols have been developed to allow users to perform cryptographic operations without requiring a lot of knowledge and effort, and for these users to enable them to transmit or provide their products in encrypted form to different users. Along with the encrypted information, the sender usually provides the receiver with a "crypto§raPhic key" so that the receiver can decode the encrypted data, thus enabling the recipient to recover or obtain 200536332 access to unencrypted data. Original information. Those skilled in the art will know that these procedures and protocols are generally implemented in the form of password protection, mathematical algorithms R, and applications specially designed to encrypt and decrypt confidential information. Several variant algorithms are currently used to encrypt and decrypt data. The algorithm uses two cryptographic keys (a public key and ~ private key) to encrypt or decrypt data according to the above type (such as an RSA algorithm and a public key algorithm). According to some public key algorithms, the receiver's public key is used by the sender to encrypt the data transmitted to the receiver. Because a mathematical relationship exists between the user's public key and the private key, the receiver must use its private The key decrypts this transmission to recover this information. Although this type of cryptographic algorithm is widely used today, its encryption and decryption operations are extremely slow or even a small amount of data. A second type of algorithm, known as the symmetric key algorithm, provides the same level of data security and can be executed faster. These algorithms are called symmetric key algorithms because they use a single cryptographic key for encrypting and decrypting information. In the public sector, there are currently three popular single-key cryptographic algorithms: Data Encryption Standard (DES), Triple DES, and Advanced Encryption Standard (AES). Because of the strength of these algorithms to protect confidential information 'US government agencies are currently using these algorithms, but those skilled in the art expect that at least one of these algorithms will become the standard for commercial and unofficial transactions in the near future According to all these symmetric key algorithms, plaintext and ciphertext are divided into blocks of a specified size for encryption and decryption. For example, the advanced encryption standard performs cryptographic operations on a 128-bit block size and uses 128 Bit, 192-bit, and 256-bit password input length. Other symmetric key-recording algorithms, such as Rijndael Cipher, also allow 192-bit and 256-bit data blocks. According to 12 200536332, a block is encrypted. In terms of operation, a 1G 2 4-bit plaintext message is encrypted into 8 128-bit blocks. All symmetric key algorithms Using the same form of secondary operations to encrypt a block of plaintext, and according to many more commonly used symmetric key algorithms, an initial password recording key is expanded into a plurality of recording keys (eg, a "recording key schedule") Each key is used as a corresponding password “round” of the secondary operation and is executed in the plaintext block. For example, the first key of the key schedule is the first password used to perform the secondary operation in the plaintext block. The result of one round is used as the input of the second round, where the second round uses the second key scheduled by the key to produce the second result, and a specific specified number of subsequent rounds ► The execution of the round produces a final round result, ie The cipher text body. According to the advanced encryption standard algorithm, the sub-operations in each round refer to the sub-bits (or S-box), shift shift (ShiftRows), mixed blocks (MixColums), and add round keys. (AddRoundKey), etc. The decryption of a block of ciphertext is similarly processed with exceptions in each round, and the final result of a round is the plaintext of a block, and the above exception refers to the ciphertext Inverse encryption and inverse operations (such as · Inverse MixColumns, Inverse ShiftRows) 〇 Data encryption standards and triple data encryption standard algorithms use different special operations, but these operations are similar to the advanced encryption standard algorithms This operation uses a similar method to convert a block of plaintext to a block of ciphertext. To perform cryptographic operations on multiple consecutive text blocks, all symmetric key algorithms use the same kind of patterns, which include electrons Electronic code book (ECB) mode, cipher block chaining (CBC) mode, cipher feedback mode (CFB), and output feedback mode (output feedback; FB). Some of these modes use an additional initialization to 13 200536332

量於執行次運算期間,有些使用執行於第一區塊明文之第 一位置密碼回合的密文輸出當成附加的輸入給執行於第 二區塊明文之第二位置密碼回合。除此’本應用的領域對 現今對稱錄起密碼演算法所應用的每一密碼演算及次運 算提供更深層的討論。就具體指定執行標準而言,讀者可 由美國聯邦資訊處理標準公告46_3 (Federal Information Processing Standards Publication; FIPS-46-3),1999年10月25曰出版,得到資料加密 標準及三重資料加密標準的詳細探討;以及美國聯邦資訊 處理標準公告197 (FIPS-197),2001年11月26曰出 版,得到進階加密標準的詳細探討。上述提及的兩種標準 係由美國國家標準暨技術局(National Institute of Standards and Technology; NIST)所發布及主張,在 此列為參考以供本發明所有意圖及目的之說明。除上述所 巧及的標準,教導(tutorial)、白皮書、套件(toolkit)以及 資源文章均可透過網際網路http: //csrc.nist.gov/在 NIST的電腦資源安全中心(c〇rnputer SecurityDuring the execution of the second operation, some ciphertext output using the first position password round executed in the plaintext of the first block is used as additional input to the second position password round executed in the plaintext of the second block. In addition to this, the field of this application provides a deeper discussion of every cryptographic algorithm and sub-operation applied to today's symmetric recording cryptographic algorithms. As far as specific implementation standards are specified, readers can obtain the details of data encryption standards and triple data encryption standards from Federal Information Processing Standards Publication 46_3 (FIPS-46-3), published on October 25, 1999. Discussions; and Federal Information Processing Standards Bulletin 197 (FIPS-197), published on November 26, 2001, for a detailed discussion of advanced encryption standards. The two standards mentioned above are issued and claimed by the National Institute of Standards and Technology (NIST), which are hereby incorporated by reference for the purpose of describing all intents and purposes of the present invention. In addition to the standards mentioned above, tutorials, white papers, toolkits, and resource articles can be accessed via the Internet: http://csrc.nist.gov/ at NIST's Computer Resource Security Center (c〇rnputer Security

Resource Center; CSRC)獲得。 熟悉該項技藝者可察知有許多的應用程式能夠執行 在可以執行密碼運算(例如:加密及解密)的電腦系統。實 ,上,某些操作系統(例如:微軟Window xp、Linux) 加密/解密的服務於密碼基元(Primitive)、密碼 3 及諸如此類的形式。然而’本發明人已觀 = = ; =在某些方面的缺陷’因此藉由第- 第 ioo”i、干今電腦密碼應用之方塊圖10〇。方塊圖 =:二電=? r連接區域網路(i〇cai 102、_路栲安^7域網路105也連接第二電腦工作说 2網路4田案儲存裝置(⑽赠k file stomge device 14 200536332 106、第一路由器(first router) 107或其他介面形式到 廣域網路(wide area network,WAN) 110 (例如:網際 網路)以及像是符合IEEE 802.11的無線網路路由哭 (wireless network router) 108,筆記型電腦(lapt〇p computer) 104則是透過無線網路1〇9與無線路由器 108成為介面。在廣域網路11〇方面,第二路由写、 (second router) 111提供介面給第三電腦工作站1〇3。 如上概述,現今的使用者在工作期間面臨許多次的電 腦資訊安全問題。例如:在現今多工(multi-tasking)操 , 作系統的控制下,使用者工作站1 〇 1可以同時執行多個 _ 任務(task)且每一任務要求密碼運算。使用者工作站1〇1 要求執行加密/解密應用程式(encryption/ decryption application) 112 (無論是操作系統的一部分或是由操作 系統所引動(invoke))以儲存區域檔案於網路檔案儲存裝 置106,在檔案儲存的同時,使用者可以傳送一加密訊息 給在工作站102的第二使用者,其中工作站1〇2也要求 執行加密/解密應用程式112的一範例,而加密訊息可能 是即時(例如:即時訊息)或者是非即時(例如:電子郵件)。 此外,使用者可以透過廣域網路11 〇從工作站1 〇3存取 · • 或提供其金融資料(例如:信用卡號、金融交易等)或者其 他形式的機密資料。工作站1〇3也可以代表是家庭辦公 或其他遠端電腦103,其可以讓工作站101的使用者離 開辦公室時用以存取區域網路1 〇5的任何共享資源 101、102、106、107、108以及109。上述提及的每 一活動均要求引動加密/解密應用程式i 12的相對範 例,並且無線網路109目前普遍地提供於咖啡店、機場、 學校以及其他公眾場所,因而促使使用者筆記型電腦1〇4 不僅對其他使用者傳送/接收的訊息進行加密/解密,並 且也對透過無線網路109到無線路由器1Q8的所有通訊 15 200536332 進行加密及解密。 熟悉該項技藝者可因此察知在工作站101-1CK中連 同每一要求密碼運算的活動,須有一相對的要求以引動 (invoke)力口密/解密應用程式1 12的範例,因此電腦 101-104在最近的將來有可能同時執行數以百計的密碼 運算。 本發明人注意到上述電腦系統101-104藉由引動加 密/解密應用程式112的至少一範例以執行密碼運算之 方法的限制。例如:透過程式規劃的軟體執行一指定功能 就比透過硬體執行相同功能還慢。且每次執行加密/解密 > 應用程式112時,正在電腦101-104執行的任務就必須 暫緩執行,並且密碼運算的參數(例如:明文、密文、模 式以及鑰匙等)必須透過操作系統傳送給加密/解密應用 程式112為完成密碼運算所引動的範例。並且因為密碼 演算須在一指定的資料區塊引動許多回合的次運算,加密 /解密應用程式112的執行引動許多電腦指令的執行而 對整體系統的處理速度產生不利的影響。熟悉該項技藝者 可察知在微軟Outlook傳送少量加密電子郵件訊息的時 間會相當於只傳送未加密電子郵件訊息的五倍。 ® 此外,目前的技術受限於操作系統介入的延遲。大部 分的應用程式並無提供完整的鑰匙產生或加密/解密元 件;其利用操作系統的元件或外掛應用程式以完成上述之 任務,此外操作系統因中斷及其他正在執行應用程式的請 求而轉移其執行。 並且,本發明人注意到在現今電腦系統101-104的 密碼運算係相類似於微處理器尚未有浮點單元時的浮點 數學運算。早期的浮點單元運算係由軟體所執行,因此執 行的非常慢;同浮點運算,由軟體執行的密碼運算也是極 16 200536332 慢。當浮點技術更進一步發 % 指令以供執行,這些浮點助^ ’孚點輔助處理器提供浮點 執行快了許多,但卻增”’^了 =理器執行浮點運算比軟體 助處理器目前以附加在電^統的成本。相同地,密碼辅 透過並列琿或其他介面^^反或以外接裝置與主處理器 式存在,這些輔助處理哭能 ^例如:USB)成為介面的形 所執行的快了許多。但碼運算的完成比由純軟體 成本,需要額外的電源、而且理,給系統配置增加了 資料通路不像主微處理器那樣a ^了系統之可靠性。由於 同處理器的執行乃更易被監聽。δ—模組上’所以密碼共 中因此本發明人=忍將密碼硬體加入現今微處理器的 需要,藉此,要求巧鼻的應用程式可藉由一單獨、基 7L(at〇miC)的密碼指示微處理器執行密碼運算。本發 明人也確認應以此功能限定操作系統介入及管理的要 求,並且期望密碼指$可以使用於應隸式的權限層級 (privilege level)以及被碼硬體可相稱(c〇mp〇rt with)於 現今微處理器的一,架巧,並且密碼硬體及相關聯的密碼 指令可支援相容先泊^操作系統及應用程式。更期望的是 提供執行密碼運算的衣置及方法,其可阻止未授權的監 視,其可支援及可私式化有關多密碼演算;其可支援核對 及測試實體特定的後碼^算;其可允許使用者提供鑰匙也 可自行產生输匙;其支挺多資料區塊大小及鑰匙長度(key size);以及其提供可程式化區塊加密/解密模式如電子密 螞本模式、密瑪區塊鏈結模式、密碼反饋模式以及輸出反 饋模式。 【發明内容】 本發明係用以解決上述習知技藝中的問題及缺點。本 發明提供一較佳的技術以執行密碼運算於一微處理器中。 17 200536332 本發明之一較佳實施例,提供一種執行密碼運算之裝 置,而此裝置係包含一密碼指令電路,其用以產生一密碼 指令,以及一執行邏輯電路。密碼指令係由一計算裝置接 收並將其當成一執行於此計算裝置之指令流之一部分,並 且此密碼指令指定複數個密碼運算其中之一,且亦指定複 數個資料區塊大小其中之一。執行邏輯電路係操作耦合於 密碼指令電路,此執行邏輯電路執行被指定之密碼運算, 且此執行邏輯電路包含一區塊大小控制器,而此區塊大小 控制器在被指定之密碼運算執行期間使用被指定之資料 區塊大小。 > 本發明之一較佳實施例,提供一種執行密碼運算之裝 置,此裝置包含位於一元件内之一密碼單元以及一區塊大 小邏輯電路。密碼單元執行複數個密碼運算其中之一,回 應接收一指令流内之一密碼指令,其中此密碼指令指定被 指定之密碼運算。密碼指令在執行被指定之密碼運算時亦 指定使用之一區塊大小。被指定之區塊大小邏輯電路係操 作耦合於密碼單元内,並且在被指定之密碼運算執行時, 指定上述之裝置使用被指定之區塊大小。 本發明之一較佳實施例,提供一種在一元件執行密碼 • 運算之方法,此方法包含接收一密碼指令,此密碼指令在 密碼運算其中之一執行期間指定使用一資料區塊大小;以 及在執行被指定之密碼運算時,使用被指定之資料區塊大 /J、〇 【實施方式】 以下所述為應用習知技術而製造或使用文中特定應 用及需求知本發明所列舉之例子。然而,實施例中所提及 之各種修改係用以彰顯與習知技術之不同處,此一般原則 18 200536332 可應用於其他實施例中。因此 施例。 不發明亞诈限定於特定實 鑑於上述所討論的密碼運曾 a兩 / ^ ^ t # ^ ^ # , ^ ib ^ ^ ^ ^ f ^ ^ / 中繼續探討,而接下來本發明 ^ :岡,在第二圖 加以討論。本發明摞供一播右M W根據弟—圖到第十五圖 曾0番β 士月^供種在見今電腦系統中執行穷踩、宣 ΪΪίί =法,其透過主要機制展現優秀的Resource Center; CSRC). Those skilled in the art will know that there are many applications that can run on computer systems that can perform cryptographic operations (such as encryption and decryption). In fact, some operating systems (for example: Microsoft Window xp, Linux) provide encryption / decryption in the form of cryptographic primitives, passwords 3, and the like. However, 'the present inventor has observed ==; = defects in some respects'. Therefore, the block diagram 10 of the computer password application by the first-ioioi i, block diagram == Erdian =? R connection area Network (i〇cai 102, _ Lu Anan ^ 7 domain network 105 is also connected to the second computer to work 2 network 4 field storage device (k file stomge device 14 200536332 106, first router) ) 107 or other interface forms to a wide area network (WAN) 110 (for example, the Internet) and wireless network router 108 such as IEEE 802.11, a laptop (laptoop) computer) 104 is an interface through wireless network 109 and wireless router 108. In wide area network 11, the second router write, (second router) 111 provides the interface to the third computer workstation 103. As outlined above, Today's users face many problems of computer information security during work. For example, under the control of the current multi-tasking operation system, the user workstation 101 can perform multiple tasks simultaneously (task And each task Require cryptographic calculations. User workstation 101 requests encryption / decryption application 112 (either part of the operating system or invoked by the operating system) to store area files in network files The storage device 106, while the file is stored, the user can send an encrypted message to the second user at the workstation 102, where the workstation 102 also requires an example of the encryption / decryption application 112 to be executed, and the encrypted message may be Real-time (for example: instant messaging) or non-real-time (for example: email). In addition, users can access from workstations 103 through the wide area network 11 〇 • or provide their financial information (such as credit card numbers, financial transactions, etc.) ) Or other forms of confidential information. Workstation 103 can also represent a home office or other remote computer 103, which can allow users of workstation 101 to access any shared resources of local area network 105 when they leave the office. 101, 102, 106, 107, 108, and 109. Every activity mentioned above requires encryption / decryption Using the relative example of the program i 12, and the wireless network 109 is currently commonly provided in coffee shops, airports, schools, and other public places, thus prompting the user's notebook computer 104 to not only perform messages sent / received by other users Encrypt / decrypt, and also encrypt and decrypt all communications 15 200536332 through wireless network 109 to wireless router 1Q8. Those skilled in the art can therefore understand that in the workstation 101-1CK, together with every activity that requires cryptographic operations, there must be a relative request to invoke the secret / decryption application 1 12 example, so the computer 101-104 It is possible to perform hundreds of cryptographic operations simultaneously in the near future. The inventor noticed the limitation of the above-mentioned computer systems 101-104 to perform a cryptographic operation by activating at least one example of the encryption / decryption application 112. For example, it is slower to perform a specified function through software programmed than to perform the same function through hardware. And every time you execute the encryption / decryption > application 112, the tasks being performed on the computer 101-104 must be suspended, and the parameters of the cryptographic operations (such as plaintext, ciphertext, mode, and key) must be transmitted through the operating system. An example of the encryption / decryption application 112 being used to complete a cryptographic operation. And because the cryptographic calculation needs to induce many rounds of secondary operations in a specified data block, the execution of the encryption / decryption application 112 leads to the execution of many computer instructions, which adversely affects the processing speed of the overall system. Those skilled in the art will know that sending a small amount of encrypted e-mail messages in Microsoft Outlook will take five times as long as sending only unencrypted e-mail messages. ® In addition, current technology is limited by delays in operating system intervention. Most applications do not provide complete key generation or encryption / decryption components; they use operating system components or plug-in applications to accomplish the above tasks, and the operating system transfers them due to interruptions and requests from other running applications carried out. Also, the inventors noticed that the cryptographic operation system of the current computer systems 101-104 is similar to the floating-point mathematical operation when the microprocessor has no floating-point unit. Early floating-point unit operations were performed by software, so they were very slow. As with floating-point operations, cryptographic operations performed by software were extremely slow. When the floating-point technology further issues% instructions for execution, these floating-point helpers ^ 'Fu-point auxiliary processors provide floating-point execution much faster, but increase "' ^ = = the processor performs floating-point operations than software-assisted processing At present, the cost of the device is added to the electrical system. Similarly, the password auxiliary exists through a parallel connection or other interfaces ^^ or external devices and the main processor type, these auxiliary processing can be used as an interface. The execution is much faster. But the completion of the code calculation is more costly than pure software. It requires additional power and processing. It adds a data path to the system configuration, unlike the main microprocessor, which increases the reliability of the system. The execution of the processor is easier to be monitored. Δ-on the module, so the password is shared, so the inventor = tolerate the need to add cryptographic hardware to today's microprocessors, so that applications requiring clever noses can use a A separate, 7L (at 0 miC) -based password instructs the microprocessor to perform cryptographic operations. The inventor also confirmed that this function should be used to limit the requirements for operating system intervention and management, and it is expected that the password means that $ can be used in applications The privilege level and coded hardware can be matched with the current microprocessors. It is clever, and the cryptographic hardware and associated cryptographic commands can support compatible preemption. ^ Operating system and applications. It is more desirable to provide clothes and methods for performing cryptographic operations, which can prevent unauthorized surveillance, which can support and personalize related multi-password calculations; which can support verification and testing of entity-specific It can allow users to provide keys or generate keys themselves; it supports multiple data block sizes and key sizes; and it provides programmable block encryption / decryption modes such as electronic Mimaben mode, Mima block chain mode, password feedback mode and output feedback mode. [Summary] The present invention is to solve the problems and disadvantages of the above-mentioned conventional techniques. The present invention provides a better technology to Cryptographic operations are performed in a microprocessor. 17 200536332 A preferred embodiment of the present invention provides a device for performing cryptographic operations. The device includes a cryptographic instruction circuit. To generate a cryptographic instruction and an execution logic circuit. The cryptographic instruction is received by a computing device as part of an instruction stream executed on the computing device, and the cryptographic instruction specifies one of a plurality of cryptographic operations, and One of a plurality of data block sizes is also specified. The execution logic circuit is operatively coupled to a cryptographic instruction circuit, the execution logic circuit performs a designated cryptographic operation, and the execution logic circuit includes a block size controller, and this area The block size controller uses the specified data block size during the execution of the specified cryptographic operation. ≫ A preferred embodiment of the present invention provides a device for performing cryptographic operation, the device includes a cryptographic device located in a component Unit and a block size logic circuit. The cryptographic unit performs one of a plurality of cryptographic operations in response to receiving a cryptographic instruction in an instruction stream, wherein the cryptographic instruction specifies a designated cryptographic operation. The password instruction also specifies the use of a block size when performing the specified cryptographic operation. The designated block size logic circuit is operatively coupled to the cryptographic unit, and when the designated cryptographic operation is performed, the aforementioned device is designated to use the designated block size. A preferred embodiment of the present invention provides a method for performing a cryptographic operation on a component. The method includes receiving a cryptographic instruction that specifies a data block size during execution of one of the cryptographic operations; and When performing the specified cryptographic operation, use the specified data block size / J, 〇 [Embodiment] The following describes the examples of the present invention that are manufactured or used for the application of known technologies for specific applications and requirements. However, various modifications mentioned in the embodiments are used to highlight the differences from the conventional technology. This general principle 18 200536332 can be applied to other embodiments. Hence the examples. Not inventing sub-fraud is limited to a specific reality in view of the cryptographic operations discussed above / ^ ^ t # ^ ^ #, ^ ib ^ ^ ^ ^ f ^ ^ / / continue to explore, and then the present invention ^: Gang, This is discussed in the second figure. According to the present invention, the present invention is shown on the right. According to the brother-picture to the fifteenth picture, Zeng 0 Fan Shi Shiyue ^ for seeding in the modern computer system to perform poor tread, propaganda method, which demonstrates excellent through the main mechanism

先前(legacy)架構的相容性、演象= 了預、 防止駭客入侵以及可測試性等等二/ 、σ主式性、 明參知'第二圖,方塊圖2〇〇描繪當今電腦系 行密碼運算的技術。方塊圖2〇〇包含-微處理哭、2 其擷取指令及從系統記憶體中一稱為應用°記 (aPPhCatl〇n memory) 203存取應用程式相關的資&筱 而程式控制及應用記憶體203中資料的存取通常是由 於系統記憶體保護範圍的操作系統軟體(〇13^的比 system software) 202所管理。如上所述,當一執行應 用程式(例如:電子郵件程式或檔案儲存程式)要求執行密 碼運异時,此執行應用程式必須藉由指示(direct)微處理 器201執行相當數量的指令以完成密碼運算。這些指令 可能是執行應用程式本身的子程式,也可能是連結到此執 行應用程式的外掛應用程式,或者是由操作系統202所 提供的服務。姑且不論他們的關聯性,熟悉該項技藝者可 察知這些指令將駐於某些指定或分派的記憶體範圍。為達 討論目的,這些記憶體範圍顯示在應用記憶體203並且 包含一密碼鑰匙產生應用程式(key generation application) 204,其中密碼输匙產生應用程式204產 生或接收一密碼输匙並且擴展此鑰匙成一使用於密碼回 合運算中的餘匙排程(key schedule) 205。就多區塊加密 19 200536332 運算而言,區塊加密應用程式(encryption application) 206被引動(invoke)。加密應用程式206執行存取明文 (plaintext)區塊210、錄匙排程205以及密碼參數 (cryptographic parameters) 209 的指令,其中密碼參 數209係進一步指示明確的密碼運算,如模式、输匙排 程位置等,且在要求特定模式時,加密應用程式206也 可存取初始向量(initialization vector) 208。加密應用 206執行其内的指令以產生對應的密文(ciphertext)區塊 2 11。同理,區塊解密應用程式(decryption application) 207被引動以執行區塊解密運算。解密應用程式207執 行存取密文區塊211、錄匙排程205以及密碼麥數209 的指令,其中密碼參數209係進一步指示明確的密碼運 鼻’並且在要求特定模式時,也可存取初始向量208。解 密應用程式207執行其内的指令以產生對應的明文區塊 210。 值得注意的是必須執行相當數量的指令以產生密碼 鑰匙及加密或解密文字區塊。上述提及的FIPS說明書包 含許多虛擬碼致能相當數量指令之範例,因此,熟悉議項 技藝者可察知一個簡單的加密運算將要求數以百計的指 令,並且每一指令須經由微處理器201執行以完成所要 求的密碼運算。並且,完成密碼運算的指令執行對正在執 行的應用程式之主目的(例如:檔案管理、即時訊息、電 子郵件、遠端檔案存取、信用卡交易)而言一般係屬多餘包 結果讓使用者誤為目前執行的應用程式執行效率不佳。至 於獨立或外掛的加密及解密應用程式206及207,這此 應用程式206及207的引動及管理也必須服從操作系& 202的其他請求,例如支援中斷、例外(exception)以及 更惡化之問題的類似事件。並且電腦系統所要求每—同時 的密碼運算,密碼鑰匙產生應用程式204、解密應用程 20 200536332 2 Ο 7及初始向量2 Ο 8的個別實例必須被配置在應用記憶 體203,且預期由微處理器201所要求執行之同時密碼 運算的數目也將隨時間而增加。 本發明人注意到目前電腦系統密碼技術的問題與限 制,並且確認在微處理器中提供執行密碼運算之裝置及方 法的需要。藉此,本發明提供一微處理器及相關的方法, 透過其内的密碼單元執行密碼運算,此密碼單元係藉由單 一密碼指令的程式執行密碼運算。本發明現在將以第三圖 到第十二圖為參考加以討論。 | 請參照第三圖,其為本發明一較佳實施例執行密碼運 算之微處理'器的方塊圖300。方塊圖300描繪一微處理 器301,其透過記憶體匯流排(memory bus) 319與系統 記憶體(system memory) 321耦合連接,且微處理器 301包含從指令暫存器接收指令的一轉譯邏輯電路 (translation logic) 303。轉譯邏輯電路303包含邏輯電 路、裝置或微碼(例如:微指令或本機指令),或邏輯電路、 裝置或微碼的組合,或用以轉譯指令成為指令相關序列的 等效元件。這些在轉譯邏輯電路303中執行轉譯的元件 可能與在微處理器301中執行其他功能的電路、微碼共 ’用,而根據本應用的範圍,微碼是對照至少一個微指令的 術語。一微指令(也可參照成一本機指令)係一單元層級執 行的一指令,例如微指令係由精簡指令集電腦(reduced instruction set computer; RISC)微處理器直接執行。 至於複雜指令集電腦(complex instruction set computer; CISC)微處理器,如x86相容的微處理器, 其x86指令被轉譯為關聯的微指令並且由複雜指令集電 腦微處理器中的單元直接執行。轉譯邏輯電路303耦合 微指令符列(micro instruction queue) 304,且此微指 令仔列304具有複數個微指令通道(micro instruction 21Legacy architecture compatibility, imagery = pre-prevention, hacking prevention, and testability, etc. / / sigma mastery, clear reference 'Second picture, block diagram 2000 depicts today's computers Department of cryptographic operations. Block diagram 200 includes-micro processing cry, 2 its fetching instructions, and a system called application memory (aPPhCation memory) 203 to access application-related information & program control and application The access to the data in the memory 203 is usually managed by the operating system software 202 (the system software) 202 which is protected by the system memory. As mentioned above, when an execution application (such as an e-mail program or a file storage program) requests execution of a password exception, the execution application must direct the microprocessor 201 to execute a considerable number of instructions to complete the password. Operation. These instructions may be subroutines that execute the application itself, or plug-ins that link to this execution application, or services provided by the operating system 202. Regardless of their relevance, those skilled in the art will know that these instructions will reside in certain designated or allocated memory ranges. For discussion purposes, these memory ranges are shown in the application memory 203 and include a key generation application 204, where the key generation application 204 generates or receives a key entry and expands the key into a Key schedule 205 used in crypto round operations. In terms of multi-block encryption 19 200536332 operation, the block encryption application 206 is invoked. The encryption application 206 executes instructions for accessing the plaintext block 210, the key recording schedule 205, and the cryptographic parameters 209, where the cryptographic parameter 209 further indicates a clear cryptographic operation, such as a mode and a key input schedule. Location, etc., and the encryption application 206 can also access the initialization vector 208 when a specific mode is required. The cryptographic application 206 executes instructions therein to generate a corresponding ciphertext block 2 11. Similarly, a block decryption application 207 is invoked to perform a block decryption operation. The decryption application program 207 executes the instructions for accessing the ciphertext block 211, the key recording schedule 205, and the password number 209. The password parameter 209 further indicates a clear password operation and is also accessible when a specific mode is required. Initial vector 208. The decryption application 207 executes instructions therein to generate a corresponding plaintext block 210. It is worth noting that a considerable number of instructions must be executed to generate a cryptographic key and encrypt or decrypt a block of text. The FIPS specification mentioned above contains many examples of virtual code enabling a considerable number of instructions. Therefore, those skilled in the art of negotiating can perceive that a simple cryptographic operation will require hundreds of instructions, and each instruction must pass through a microprocessor. 201 executes to complete the required cryptographic operation. In addition, the execution of the instruction to complete the cryptographic operation is generally an unnecessary package for the main purpose of the running application (for example: file management, instant messaging, email, remote file access, credit card transactions). Inefficient execution for currently running applications. As for independent or external encryption and decryption applications 206 and 207, the activation and management of these applications 206 and 207 must also comply with other requests from the operating system & 202, such as support for interruptions, exceptions, and worsening problems Similar events. And the computer system requires that every instance of cryptographic operations, cryptographic key generation application 204, decryption application 20 200536332 2 0 7 and initial vector 2 0 8 must be configured in the application memory 203, and is expected to be processed by the micro processor The number of simultaneous cryptographic operations required by the processor 201 will also increase over time. The inventors noticed the problems and limitations of the current cryptographic technology of computer systems, and confirmed the need to provide a device and method for performing cryptographic operations in a microprocessor. Accordingly, the present invention provides a microprocessor and a related method for performing cryptographic operations through a cryptographic unit therein. The cryptographic unit performs cryptographic operations by a program of a single cryptographic instruction. The invention will now be discussed with reference to the third to twelfth drawings. Please refer to the third figure, which is a block diagram 300 of a microprocessor for performing cryptographic operations according to a preferred embodiment of the present invention. Block diagram 300 depicts a microprocessor 301 that is coupled to system memory 321 through a memory bus 319, and the microprocessor 301 includes a translation logic that receives instructions from an instruction register. Circuit (translation logic) 303. The translation logic circuit 303 includes a logic circuit, a device, or a microcode (for example, a micro instruction or a native instruction), or a combination of a logic circuit, a device, or a microcode, or an equivalent element for translating an instruction into a sequence related to an instruction. These translation elements in the translation logic circuit 303 may be used in conjunction with circuits and microcodes that perform other functions in the microprocessor 301. According to the scope of this application, microcode is a term referring to at least one microinstruction. A microinstruction (also referred to as a local instruction) is an instruction executed at a unit level. For example, a microinstruction is directly executed by a reduced instruction set computer (RISC) microprocessor. As for a complex instruction set computer (CISC) microprocessor, such as an x86-compatible microprocessor, its x86 instructions are translated into associated micro instructions and executed directly by units in the microprocessor of the complex instruction set computer . The translation logic circuit 303 is coupled to a micro instruction queue 304, and the micro instruction queue 304 has a plurality of micro instruction channels (micro instruction 21

行邏輯電路貫施例中,密碼單元316並列操作與在執 元、浮點數。° 28内的其他執行單元(未繪出),例如整數單 邏輯電路、1凡等。在本應用範圍一“單元”的實施係包含 衣置或微碼(例如:微指令或本機指令),或邏 200536332 entries) 305、306。微指令由微指令仔列304提供給包 含一暫存器組(register file) 307的暫存階段邏輯電路, 而此暫存器組307包含複數個暫存器(register) 308-313,其内容在執行一指定的密碼運算前就已建立。 暫存器308-313指到系統記憶體321中含有執行指定密 竭運算資料的對應位置323-327。暫存階段耦合到載入 邏輯電路(load logic) 314,此載入邏輯電路314係與取 口寅料以執行指定密碼運鼻的資料快取(data cache) 315成介面,而此資料快取315藉由記憶體匯流排319 輕己到糸統自己憶體321。執行邏輯電路(execution logic) 32f耦合到載入邏輯電路314並且執行由前面階段傳來 指令所指定的運算。執行邏輯電路328包含邏輯電 壯裝置或彳政碼(例如:微指令或本機指令),或邏輯電路、 =$或微碼的組合,或用以執行由指令指定之運算的等效 與在科ΐϊΐ執行邏輯電路328中執行運算的元件可能 執行^二雷=301中執行其他功能的電路、微碼共用。 此宓碼單-路包含密碼單元(cryptograPhy unit) 316, 定i瑪運接收從載入邏輯電路314被要求執行指 密碼運瞀=、二貝料。微指令指示密碼單元316執行指定 相對應J數ζ ί個輸入文字區塊(inpu ttext) 3 2 6以產生 元316包人羅輸^出文字區塊(output text) 327。密碼單 指令),或ίί輯電路、裝置或微碼(例如:微指令或本機 碼運算的等▲耳-電路、裝置或微碼的組合,或用以執行密 元件能與,元件。這些在密碼單元316中執行運算白^ 碼共用處理器301中執行其他功能的電路、微 22 200536332In the embodiment of the row logic circuit, the cryptographic unit 316 operates in parallel with the in-execution and floating-point numbers. ° Other execution units (not shown) within 28, such as integer single logic circuit, 1 fan, etc. The implementation of a "unit" in this application scope includes clothing or microcode (for example: microinstructions or local instructions), or logic 200536332 entries) 305, 306. The microinstruction is provided by the microinstruction array 304 to the temporary stage logic circuit including a register file 307, and the register group 307 includes a plurality of registers 308-313, the contents of which It was created before performing a specified cryptographic operation. The registers 308-313 refer to the corresponding locations 323-327 in the system memory 321 that contain data for performing the specified exhaustive operation. The temporary storage stage is coupled to a load logic circuit 314, which is used as a data cache 315 interface to fetch data to perform a specified password operation, and this data cache 315 uses the memory bus 319 to light himself to the system memory 321. Execution logic 32f is coupled to the load logic circuit 314 and executes the operations specified by the instructions passed in the previous stages. The execution logic circuit 328 contains a logic device or a government code (for example, a micro instruction or a local instruction), or a logic circuit, a combination of = $ or a micro code, or an equivalent and The elements that perform operations in the execution logic circuit 328 may perform circuits and microcodes that perform other functions in ^ Erlei = 301. This code single-way contains a cryptograPhy unit 316, which is received from the loading logic circuit 314 and is required to execute the password operation. The microinstruction instructs the cryptographic unit 316 to execute the designation corresponding to the number J of the input text blocks (inpu ttext) 3 2 6 to generate the element 316 including the output text block 327. Password instructions), or a series of circuits, devices, or microcodes (for example, microinstructions or native code calculations, etc.)-a combination of ear-circuits, devices, or microcodes, or used to perform dense components and components. These A circuit that performs operations in the crypto unit 316 and performs other functions in the code sharing processor 301, micro 22 200536332

輯電路、裝置或微碼的組合,或用以執行指定功能或指定 運算的等效元件。這些在特定單元中執行指定功能或指定 運算的元件可能與在微處理器301中執行其他功能的電 路、微碼共用。例如:一實施例中,一整數單元包含邏輯 電路、裝置或微碼(例如:微指令或本機指令),或邏輯電 路、裝置或微碼的組合,或用以執行整數指令的等效元 件;一浮點單元包含邏輯電路、裝置或微碼(例如:微指 令或本機指令),或邏輯電路、裝置或微碼的組合,或用 以執行浮點指令的等效元件·,則在整數單元中執行整數指 令的元件可能與在浮點單元中執行浮點指令的其他電 路、微碼等共用。在一與x86架構相容的實施例中,密 碼單元316與整數單元、浮點單元、多媒體延伸集 (Mathematic Matrix Extension,MMX)單元、串流延$ 集(Streaming SIMD Extensions,SSE)單元並列操作 根據本應用範圍,當一實施例可以正確執行設計給χ86 ,處理器執行之大部分應用程式時,此實施例ϋ χ86 m ΐ ’ 一應用程式正確執行而得到其預期的結果。毛 代Χ86相容實施例預期密碼單元並列操作鱼 Χ86執行單元之子集。密碼單元316 到 ^ 並且提供相對應複數個輸出文字區電 儲存邏輯電路以7也耦合到指定輸出文J 27’而此 J記憶體321儲存的資料快取315。枓327給! 二到寫回邏輯電路(write back 1〇 貝料快取315来 運算完成時,寫回邏輯電路318 /報:當所指定 07中的暫存器3〇8_313。在—每播更新在暫存器級 同步經過每-:上述lyi指令與時 谨狄丨白奴302、303、304、307、3]4所誕及之邏輯 异可以同時執行而相似於在線執行運曾316-318以使 在系統記憶體321中,—要炎扣^ ° 要〜密碼運算的應用 23 200536332 程式可以直接指示微處理器301透過單一密碼指令322 (參照用以說明的密碼指令(XCRYPT instruction) 322) 執行此運算。在一複雜指令集電腦微處理器實施例中,密 碼指令322包含一指定密碼運算的微指令。在一實施例 中,密碼指令322利用一存在指令集架構中的一空閒或 未使用指令運算碼。在一 x86架構相容的實施例中,密 碼指令322係一 4位元組指令包含一 x86重複前置(REP prefix)(如0xF3)、兩位元組未使用x86運算碼(opcode) (如0x0FA7)、一位元組有關於一指定區塊密碼模式以應 用於執行一指定密碼運算。在一實施例中,根據本發明的 密碼指令322可以在系統權限供給應用程式的層級執 行,因而可以程式規劃於指令的程式流以提供給微處理器 301不論是由應用程式直接或在操作系統320的控制 下。因為僅有一密碼指令322指示微處理器301執行指 定的密碼運算,而運算的完成對操作系統320應是顯而 易見。 在操作中,操作系統320引動一應用程式以執行於 微處理器301。如部分指令流於應用程式的執行期間,一 密碼指令322從系統記憶體321提供給擷取邏輯電路 (fetch logic) 302。然而,在密碼指令322執行之前,在 程式流的指令指示微處理器301初始化暫存器308-312 的内容以使他們指到系統記憶體321中的位置 323-327,其包含一密碼控制字組(cryptographic control word) 323、一 初始密碼錄匙(initial cryptographic key) 324 或一鑰匙排程(key schedule) 324、一 初始向量(initialization vector) 325(如果需 要)、運算用的輸入文字(input text) 326、以及輸出文字 (output text) 327 〇在執行密碼指令322之前須先初始 化暫存器308-312,因為密碼指令322與一附加於暫存 24 200536332 器3〇8-312 5有區塊計數的暫存胃3ι3,其中區塊計 數係在輸326區塊加密或解 塊的數目。 因此轉譯邏輯電路期從擷取邏輯電路咖取回密碼指 令並且轉:筆一成:序列相产,數指令以指示微處理器 301執盯指疋的始、碼運异。一第一複數個令3〇5_3〇6 於相對應微指令序列中,指示密鱗元316從載入邏輯 電路3M載人資料,並且開始執行指定數目的密碼回合 以產生相對應區塊的輸出貧料,提供 快取315A combination of editing circuits, devices, or microcode, or equivalent components used to perform specified functions or operations. These components that perform a specific function or a specific operation in a specific unit may be shared with a circuit or microcode that performs other functions in the microprocessor 301. For example, in one embodiment, an integer unit includes a logic circuit, device, or microcode (eg, a microinstruction or a native instruction), a combination of a logic circuit, a device, or a microcode, or an equivalent element for executing an integer instruction ; A floating-point unit contains a logic circuit, device, or microcode (for example, a microinstruction or a native instruction), or a combination of a logic circuit, device, or microcode, or an equivalent element used to execute a floating-point instruction. Elements that execute integer instructions in integer units may be shared with other circuits, microcode, etc. that execute floating-point instructions in floating-point units. In an embodiment compatible with the x86 architecture, the cryptographic unit 316 operates in parallel with integer units, floating point units, Mathematic Matrix Extension (MMX) units, and Streaming SIMD Extensions (SSE) units. According to the scope of this application, when an embodiment can correctly execute most of the applications designed for χ86 and the processor, this embodiment ϋ χ86 m ΐ 'An application executes correctly and gets its expected result. The Mao X86 compatible embodiment anticipates that the cryptographic unit operates in parallel with a subset of the X86 execution units. The password units 316 to ^ also provide corresponding output text fields. The storage logic circuit is also coupled to the designated output J 27 ′ at 7 and the data cache 315 stored in this J memory 321.枓 327 Here! Two to write back to the logic circuit (write back to 10 bytes cache 315 to complete the operation, write back to the logic circuit 318 / report: when the specified register 30 in 2008 07_313. On-every broadcast update in the temporary storage Device-level synchronization passes through each-: The above-mentioned lyi instruction and the logic difference of the white slave 302, 303, 304, 307, and 3) can be performed simultaneously, similar to the online execution of operations 316-318, so that the In the system memory 321, it is necessary to use ^ ° to calculate the application of the password. 23 200536332 The program can directly instruct the microprocessor 301 to perform this operation through a single password instruction 322 (refer to the XCRYPT instruction 322). In an embodiment of a complex instruction set computer microprocessor, the cryptographic instruction 322 includes a microinstruction that specifies a cryptographic operation. In one embodiment, the cryptographic instruction 322 utilizes an idle or unused instruction operation stored in an instruction set architecture. In an x86-compatible embodiment, the cryptographic instruction 322 is a 4-byte instruction that includes an x86 repeat prefix (such as 0xF3), and the two-byte unused x86 opcode. (Such as 0x0FA7), one bit The invention relates to a designated block password mode to be applied to perform a designated cryptographic operation. In one embodiment, the cryptographic instruction 322 according to the present invention can be executed at the system permission supply application level, and thus can be programmed in the program of the instruction. The stream is provided to the microprocessor 301, either directly by the application or under the control of the operating system 320. Because there is only a cryptographic instruction 322 instructing the microprocessor 301 to perform a specified cryptographic operation, the completion of the operation should be to the operating system 320 Obviously, in operation, the operating system 320 causes an application program to execute on the microprocessor 301. If some instructions flow during the execution of the application program, a password instruction 322 is provided from the system memory 321 to the fetch logic circuit (fetch logic ) 302. However, before the execution of the password instruction 322, the instructions in the program flow instruct the microprocessor 301 to initialize the contents of the registers 308-312 so that they point to the locations 323-327 in the system memory 321, which contains a Cryptographic control word 323, an initial cryptographic key 324 A key schedule 324, an initialization vector 325 (if needed), input text 326 for operation, and output text 327 〇 Before executing password instruction 322 Initialize the temporary register 308-312, because the password instruction 322 and a temporary register attached to the temporary register 24 200536332 3308-312 5 have a block count of the temporary buffer 3ι3, where the block count is encrypted in the input 326 block or The number of deblocks. Therefore, the translating logic circuit retrieves the password instruction from the fetching logic circuit and translates: pen 10%: serial production, counting instructions to instruct the microprocessor 301 to execute the start and code of the instruction. A first plurality of orders 3005_306 in the corresponding microinstruction sequence instructs the dense scale element 316 to load the human data from the logic circuit 3M, and starts to execute the specified number of password rounds to generate the output of the corresponding block. Poor material, providing cache 315

儲存於系統記憶體321中的輪出文字327給儲存邏輯電 路317。-第二:复數個微指令(未綠 應微指令序 列中,指示在微處理器3〇1中其他執行 )執行 其他未完成指定密碼運算所需的運算,例如:管理包含暫 時結果及計數之非架構暫存器(未繪出)、更新輸出及輸入 文子指標暫存态311-312、更新輸入文字區塊326之加 密/解密初始向量指標暫存器(initializati〇n vector pointer register) 310 (如果需要)、處理未處理的中斷等 等。在一實施例中,暫存器308-313係架構性暫存器。 架構性暫存器308-313係為實現特定微處理器之指令集 架構(instruction set architecture,ISA)中所定義的一 種暫存器。 在一實施例中,密碼單元316分成複數個階段因此 允許相繼輸入文字區塊326的管線處理。 第三圖的方塊圖300教示本發明所需之元件,因此 省略許多在現今微處理器301中的邏輯以求圖示之簡 潔。然而,熟悉該項技藝者可察知現今特定實現的微處理 器301係包含許多階段及邏輯電路,在此為圖示之簡潔 而將其部分合併。例如··載入邏輯電路314在一快取線 對準階段之後可以嵌入隨一快取介面階段的一位址產生 h I又。然而垔要且應 >主意的是,在複數個輸入义字區塊 25 200536332 326上之一完全密碼運算,係根據本發明藉由一單一指令 322的運算對操作系統320的考量係顯而易見,並且單 一指令322的執行係藉由與微處理器301中其他執行單 元並聯操作及協調的密碼單元316所完成。本發明密碼 單元316在實施組態中的替代實施例係類似前幾年微處 理器中浮點單元的硬體。密碼單元316的操作及相關密 碼指令322係完全相容先前操作系統及程式同時操作, 並且也將在之後更加詳細的探討。 請參照第四圖,其為本發明之一基元(atomic)密碼指 令400實施例的方塊圖。密碼指令400包含一選項前置 釀攔位(optional prefix field) 401、一重複前置欄位 (repeat prefix field) 402、一運算碼欄位(〇pc〇de field) 403、一 區塊密碼模式(block cipher mode)欄位 404。 在一實施例中,欄位401-404的内容相稱於χ86指令集 架構,而其替代的實施例可考慮相容於其他指令集架構。 操作上,選項前置欄位401在許多指令集架構中係 甩以致能(enable)或禁能(disable)部分主,要微處理器的 處理特徵,像是指示16位元或32位元的運算、指示處 理或存取特定的記憶體區段等。重複前置攔位402係用 Φ 以指示由密碼指令400所指定的密碼運算係在複數個輸 入資料區塊(如明文或密文)完成。重複前置襴位402也^ 示一相稱微處理器利用其内複數個架構暫存器的内容^ 成指標指到系統記憶體中含有完成指定密碼運算所需來 數的位置。如上所述,在一 x86相容實施例中,重複前 置攔位402的值是〇xF3 ’並且根據χ86架構協定,密 碼指令與x86重複字串指令,如:rEp.m〇v,在形式上& 常相似。例如··當本發明由一 X86相容微處理器實施例 執行時,重複前置攔位402係參照一儲存在架構 ECX中之區塊計數變數、一儲存在暫存器ESI中之來源 26 200536332 位址指標(指到輸入資料以供密碼運算)以及一 $器E D!中之@的位址指標(指到記憶體中的輸出^ UM6鄉的一實施例,中’科明更擴展傳統重複 子 =$的概念成為更可參照一儲存在暫存器£DX中 =控=子I且指標、一儲存在暫存器ΕΒχ中之密碼输匙指 在暫存器谓中對-初始向量的指標(如果 才曰疋始瑪板式要求)。 運f碼攔位403指定微處理器完成一密碼運算,此 由控制字組指標所隱示參照儲存在記憶體中 八隹二接t組。本發明認為運算碼值的較佳選擇係存在指 :本1中—空閒或未使用的運算碼值,藉此在一相稱微 處理器中保留與先前操作系統及應用軟體的相容。例如: 如上所述,一χ86相容實施例的運算碼欄位4〇3使用 Γ 0/=7 ί指示ί行指定的的密碼運算。區塊密碼模式欄 曰不特疋的區塊密碼模式以供特定的密算使 用,並且將參照第五圖加以探討。 j山’逆#便 和Hi係第四圖基元密碼運算指令之區塊密碼模式 的ί格50〇。值QxC8指示使用電子密碼本方 式π肩碼運异,值〇xD〇指示使用密碼區塊鏈结方式完 ί==χ;0指示使用密碼反饋方=以 Ϊ塊密碼模式χ襴位:式f成密碼運算。 上戌W 具他所有的值係保留,而這些模 式係描述於上述所提及的FIPS的文件中。 請參照第六圖,其為本發明― 相容微處理器_中較例t 塊圖。微處理器600包含构敌、广金二^兀 的貝靶例方 _嫩到轉譯邏4員電=令則f執行。擷取邏輯電路 寸了 路(translatl〇nl〇gic) 6〇;2,而 27 200536332The carousel characters 327 stored in the system memory 321 are provided to the storage logic circuit 317. -Second: a plurality of microinstructions (in the sequence of non-green response microinstructions, instructing other execution in the microprocessor 3101) to perform other operations required for the unfinished cryptographic operation, such as management of temporary results and counting Non-architecture register (not shown), update output and input sub-pointer temporary state 311-312, update initial / encrypted initial vector pointer register of input text block 326 310 ( If needed), handling unhandled interrupts, and so on. In one embodiment, the registers 308-313 are architectural registers. The architectural registers 308-313 are a type of registers defined in the instruction set architecture (ISA) of a particular microprocessor. In one embodiment, the cryptographic unit 316 is divided into a plurality of stages thus allowing pipeline processing of successive input text blocks 326. The block diagram 300 of the third figure teaches the elements required by the present invention, and therefore many of the logic in the current microprocessor 301 is omitted for simplicity of illustration. However, those skilled in the art will recognize that today's specific implementation of the microprocessor 301 contains many stages and logic circuits, and for the sake of brevity in the illustration, some of them are combined. For example, the load logic circuit 314 may be embedded after a cache line alignment stage to generate h I with a bit address in a cache interface stage. However, it is important and should be > the idea is that one of the complete cryptographic operations on the plurality of input word blocks 25 200536332 326 is based on the consideration of the operating system 320 by a single instruction 322 operation according to the present invention. And the execution of the single instruction 322 is completed by a cryptographic unit 316 which is operated and coordinated in parallel with other execution units in the microprocessor 301. An alternative embodiment of the cryptographic unit 316 of the present invention in the implementation configuration is similar to the hardware of a floating point unit in a microprocessor of previous years. The operation of the password unit 316 and the related password instruction 322 are fully compatible with the simultaneous operation of the previous operating system and programs, and will be discussed in more detail later. Please refer to the fourth figure, which is a block diagram of an embodiment of an atomic cipher instruction 400 according to the present invention. The password instruction 400 includes an optional prefix field 401, a repeat prefix field 402, an opcode field 403, and a block password mode. (Block cipher mode) field 404. In one embodiment, the contents of fields 401-404 are commensurate with the x86 instruction set architecture, and alternative embodiments may be considered compatible with other instruction set architectures. Operationally, the option leading field 401 is used in many instruction set architectures to enable or disable part of the master. It requires the processing characteristics of the microprocessor, such as indicating 16-bit or 32-bit Computing, instructing to process or access specific memory segments, etc. The repeated leading block 402 uses Φ to indicate that the cryptographic operation specified by the cryptographic instruction 400 is completed in a plurality of input data blocks (such as plaintext or ciphertext). The repeated leading bit 402 also shows that a symmetric microprocessor uses the contents of a plurality of architectural registers therein. The index refers to the position in the system memory that contains the number required to complete the specified cryptographic operation. As described above, in an x86 compatible embodiment, the value of the repeated pre-stop 402 is 0xF3 'and according to the x86 architecture agreement, the cryptographic instruction and the x86 repeated string instruction, such as: rEp.m0v, are in the form Up & is often similar. For example, when the present invention is implemented by an X86 compatible microprocessor embodiment, the repeated pre-stop 402 refers to a block count variable stored in the ECX architecture, a source stored in the register ESI26 200536332 Address indicator (refers to the input data for password calculation) and @ address indicator (refers to the output to the memory in ED!) @@ An embodiment of UM6 Township, China's Keming expands the tradition The concept of repeater = $ becomes more referable to a register stored in the register £ DX = control = sub I and the index, a cryptographic key stored in the register EBB refers to the initial vector in the register predicate. Index (if it is only required by the imaginary board). The f-code block 403 specifies that the microprocessor completes a cryptographic operation, which is implicitly referenced by the control block index and stored in memory. The present invention considers that the better choice of opcode values refers to the following: in the first-idle or unused opcode values, thereby maintaining compatibility with the previous operating system and application software in a symmetric microprocessor. For example: As described above, the opcode field 403 of a χ86 compatible embodiment Use Γ 0 / = 7 to indicate the specified cryptographic operation. The block cipher mode column indicates the special block cipher mode for specific cryptographic use, and will be discussed with reference to the fifth figure. Inverse #Hi and Hi are 50 in the block cipher mode of the fourth figure of the elementary cryptographic operation instruction. The value QxC8 indicates the use of the electronic code in the way of the π shoulder code. End of the method == χ; 0 indicates the use of a cryptographic feedback party = Ϊ block cipher mode χ 襕 bit: formula f into a cryptographic operation. All the values above are reserved, and these modes are described in the above mentioned Please refer to the sixth figure, which is a block diagram of the comparative example in the present invention-compatible microprocessor_. The microprocessor 600 includes the target example of the enemy and the broad gold target. To translate logic 4 members of electricity = order then f execute. Extract logic circuit translatl0nl0gic 6〇; 2, and 27 200536332

轉譯邏輯電路602包含邏輯電路、裝置或微碼(例如:微 指令或本機指令),或邏輯電路、裝置或微碼的組合,或 用以轉譯指令成為相關序列微指令的等效元件。這些在轉 譯邏輯電路602中執行轉譯的元件可能與在微處理器 600中執行其他功能的電路、微碼共用。轉譯邏輯電路 602包含一轉譯器(translator) 603,而此轉譯器603係 耦合到一微碼唯讀記憶體(microcode RQM) 604。中斷 邏輯電路(interrupt logic) 626藉由匯流排634耦合到 轉譯邏輯電路602。複數個軟體及硬體中斷信號627係 由指示未處理中斷給轉譯邏輯電路6〇2之中斷邏輯電路 626處理。轉譯邏輯電路602耦合到微處理器600相繼 的階段包含一暫存階段(register stage) 605、定址階段 (address stage) 606、載入階段(i〇ad stage) 607、執 行P白段(execution stage) 608、儲存階段(store stage) 618、以及寫回階段(write back stage) 619。每一相繼 階段包含邏輯電路以完成由擷取邏輯電路所提供相 關,言執行的特定功能,如先前在第三圖的微處理器中所 討論f照類似名稱的元件。描繪在第六圖中χ86相容微 處理器600之實施例係以在執行階段6〇8中之執行邏輯 電路(execution logic) 632為特徵,其包含平行執行單 元 610、612、614、616、617。一整數單元 610 從科 指令佇列609接收執行整數微指令;一浮點單元612從 微^令佇列611接收執行浮點數微指令;一多媒體延伸 ft & 614從微指令㈣613接收執行多媒體延伸集微 / 7,一串流延伸集單元616從微指令佇列615接收執 行,流延伸集微指令。在本發明之一 χ86實施例,一密 ,^兀617藉由一载入匯流排620、一暫停(stall)信號 匯 非及i存匯流排622 _合到串流延伸集單 兀6。密碼早兀617共用串流延伸集單元的微指令符 28 200536332The translation logic circuit 602 includes a logic circuit, device, or microcode (for example, a microinstruction or a native instruction), or a combination of a logic circuit, a device, or a microcode, or an equivalent element for translating an instruction into a related sequence of microinstructions. These elements that perform translation in the translation logic circuit 602 may be shared with circuits and microcode that perform other functions in the microprocessor 600. The translating logic circuit 602 includes a translator 603, and the translator 603 is coupled to a microcode RQM 604. Interrupt logic 626 is coupled to the translation logic 602 via a bus 634. The plurality of software and hardware interrupt signals 627 are processed by an interrupt logic circuit 626 which indicates unprocessed interrupts to the translation logic circuit 602. The successive stages of the translation logic circuit 602 coupled to the microprocessor 600 include a register stage 605, an address stage 606, a loading stage (607), and an execution stage (execution stage). ) 608, a store stage 618, and a write back stage 619. Each successive stage contains logic circuits to perform the specific functions provided by the fetch logic circuits, as previously discussed in the microprocessor of the third figure, with similarly named components. The embodiment of the χ86 compatible microprocessor 600 depicted in the sixth figure is characterized by execution logic 632 in the execution phase 608, which includes parallel execution units 610, 612, 614, 616, 617. An integer unit 610 receives and executes integer microinstructions from branch instruction queue 609; a floating point unit 612 receives and executes floating point microinstructions from instruction queue 611; a multimedia extension ft & 614 receives and executes multimedia from microinstructions 613 Extension set micro / 7, a stream extension set unit 616 receives and executes from the micro instruction queue 615, and the stream extension set micro instruction. In one χ86 embodiment of the present invention, a password 617 is connected to the stream extension set unit 6 by a loading bus 620, a stall signal bus, and a storage bus 622. Cryptographic early instruction 617 shared micro-instruction unit of stream extension set 28 200536332

列615。一替代實施例可將密碼單元617獨立並聯操作 像是單元610、612以及614。整數單元610耦合到一 x86旗標(EFLAGS)暫存器624,此旗標暫存器包含一 X 位元6 2 5,而此X位元6 2 5的狀態係配置用以指示密碼 運算是否正在處理。在一實施例中,此X位元625係一 x86旗標暫存器624的第30位元。此外,整數單元610 存取一機器特殊暫存器(machine specific register) 628以評估一 E位元629的狀態,而此E位元629的狀 態指示密碼單元617是否位於微處理器600。整數單元 6 10也存取一 D位兀631於^特徵控制暫存器(feature control register) 630,以致能或禁能密碼單元617。如 弟二圖的微處理器301實施例,第六圖的微處理器6〇〇 以必要元件為特徵教示本發明一 x86相容實施例的内 容,並且為求圖示簡潔而合併或省略微處理器的其他元 件。熟悉該項技藝者可察覺用以完全介面的其他元件,像 是資料快取、匯流排介面單元、時脈產生以及分配邏輯電 路等均未繪出。 在操作中’指令是由擷取邏輯電路601從記憶體(未 繪出)擷取並且與一時脈信號(未繪出)同步提供給&譯邏 輯電路602。轉譯邏輯電路602轉譯每個指令^為二相 對應序列的微指令,其與時脈信號同步持續地提 理器 600 的後續階段 605-608、618、619。^ 二 ί指令中的每一個微指令指示一個次運算的執行,而次運 异被要求元成由一相對指令所指定的一整體運管,如— 址階段606產生一位址、暫存階段605從指定^在哭^ ==复勃的兩。運算ίί整數單元内相加、藉“存階段 一所產生的結果於記憶體等。根據轉譯中的指 ^ ^ 輯電路602利用轉譯器6G3直接產生—序列的微=邏 29 200536332Column 615. An alternative embodiment may operate cryptographic units 617 independently in parallel, such as units 610, 612, and 614. The integer unit 610 is coupled to an x86 flag (EFLAGS) register 624. The flag register contains an X bit 6 2 5 and the state of the X bit 6 2 5 is configured to indicate whether a cryptographic operation is performed. Processing. In one embodiment, the X bit 625 is the 30th bit of an x86 flag register 624. In addition, the integer unit 610 accesses a machine specific register 628 to evaluate the state of an E bit 629, and the state of the E bit 629 indicates whether the crypto unit 617 is located in the microprocessor 600 or not. The integer unit 6 10 also accesses a D bit 631 in a feature control register 630 to enable or disable the password unit 617. As shown in the second embodiment of the microprocessor 301, the sixth microprocessor of the sixth embodiment features the necessary components to teach the content of an x86 compatible embodiment of the present invention, and for the sake of concise illustration, the microcomputer is merged or omitted. Other components of the processor. Those skilled in the art can perceive other components used for a complete interface, such as data cache, bus interface units, clock generation, and distribution logic circuits. In operation, the instruction is fetched from the memory (not shown) by the fetch logic circuit 601 and supplied to the & interpret logic circuit 602 in synchronization with a clock signal (not shown). The translation logic circuit 602 translates each instruction ^ into a two-phase corresponding sequence of micro-instructions, which continuously synchronizes with the clock signal to the subsequent stages 605-608, 618, 619 of the processor 600. ^ Each microinstruction in the two ί instructions indicates the execution of a secondary operation, and the secondary operation is required to be transformed into an overall operation specified by a relative instruction, such as the address phase 606 to generate a single address and the temporary storage phase. 605 from the designated ^ Crying ^ == full of two. The operation is to add in integer units, and to borrow the results produced by the first stage into memory, etc. According to the instructions in the translation circuit 602, it is directly generated by the translator 6G3-the micro of the sequence = logic 29 200536332

或是從微瑪唯讀記憶體604擷取此序列,或是利用轉譯 杰603直接產生此序列的部份並且從微碼唯讀記憶體 604擷取此序列剩下的部分。微指令透過微處理器600 的相繼階段605-608、618、619持續地與時脈同步進 行。當微指令到達執行階段608,執行邏輯電路63^連 同其運算元(在暫存階段605從暫存器所恢復,或在 階段606由邏輯電路所產生,或藉由載入邏輯電路 料快取所恢復),藉由放置微指令在一對應的微指令列 609、611、613、615而將其依指定路線傳送給 執行單元610、612、614、616、617。執行單元61曰〇、 612、614、616、617執行微指令並提供結果 段618。在一實施例,微指令包含攔位指示其是否可 里6 ;富管X别勃.4子。 /、 回應先荊所述之擷取一個密碼指令,轉譯邏 602產生相關微指令’其指不在微處理器6〇〇後繼 605-608 ^8^9中的邏輯電路執行指定的密石馬^ 算。據此,一第一複數個相關微指令係直接依路徑 密碼單元617並且指示密碼單元617由載入匯流排6 载入資料,或載入一區塊的輸入資料並且開始執行指 目的密碼回合以產生一區塊的輸出資料,或藉由儲存 618透過儲存排622將所產生的區塊輸出資^ 於記憶體。一弟二複數個相關微指令依其& # ^ 實行單元61〇、,12、614、616以執;于=以1 等次運算係完成指定密碼運算之必需,例如E位^ 的測試、致能^立元631、設定χ位元625以指示歲碼 ^乍進行中^暫存階段605更新暫存(例如,計數^ ,、輸入文:么標暫存器、輸出文字指標暫存器丨、由 辦邏輯電路626所指示之中斷信號627的處理等 微指令係用以提供指定密碼運算的最佳執行 j 30 200536332 令成v為介φ藉由與③、碼單70微指令序列巾的整數單元#於 :成為二面,因此整數運算可與宓 Μ指令係包含於相關微指 *仃凡成。 號027恢復。田或所古允卉或亚從待處理中斷信 於χ86加摄* 口為所有對搶焉參數的指標與資料俜楹视 於:86架構暫存器,當執行中斷睥,I::能=,供 $當從中斷返回,這些狀態被恢^ 保存’並 令測試X位元625的 回,微指 行。如果是,當中斷發生時:匕::-:碼運算在進 輸入資料區塊。相關异重覆於處理中之特別 627之前#'用以允許在處理中斷信紫 作的浐浐斬六斤在序列輸入文字區塊上之一序列宓碼广 作的扣払暫存器及中間的結果。 汴幻山碼知 運瞀:二f;第七圖,其為第六圖之微處理器中指示宓碼a 運厂之乾例微指令700欄位的方 一微運算碼攔位(micro opcode fi 包含 ^HMdata register fiL) (二egist^r制中7〇3。微運算碼攔位7〇i指定攔= 疋次運异並且指定邏輯電路於微處理器6〇〇 一特Either the sequence is retrieved from the Weimar read-only memory 604, or a part of this sequence is directly generated using the translator 603 and the rest of the sequence is retrieved from the microcode read-only memory 604. The micro-instructions are continuously synchronized with the clock through the successive stages 605-608, 618, 619 of the microprocessor 600. When the microinstruction reaches the execution stage 608, the execution logic circuit 63 ^ together with its operands (recovered from the register in the temporary storage stage 605, or generated by the logical circuit in stage 606, or by loading the logic circuit material cache (Recovered), by placing a micro instruction in a corresponding micro instruction row 609, 611, 613, 615 and transmitting it to the execution unit 610, 612, 614, 616, 617 according to a specified route. The execution unit 61, 612, 614, 616, 617 executes micro instructions and provides a result segment 618. In one embodiment, the micro-instruction includes a stop indicating whether it is 6; rich tube X Bieber. 4 sub. / 、 Respond to the retrieval of a password instruction described by Jing Jing, the translation logic 602 generates the relevant microinstruction 'which means that the logic circuit in the microprocessor 600 and subsequent 605-608 ^ 8 ^ 9 executes the specified dense stone horse ^ Count. According to this, a first plurality of related micro-instructions directly follow the path password unit 617 and instruct the password unit 617 to load data from the loading bus 6, or load a block of input data and start executing the target password round to Generate a block of output data, or save the generated block output data to memory through storage bank 622 through storage 618. One or two related micro-instructions are based on its &# ^ implementation units 61〇, 12, 614, 616; Yu = necessary to complete the specified cryptographic operation with a 1st order operation system, such as the test of E bit ^, Enable ^ Li Yuan 631, set χ bit 625 to indicate the age code ^ is in progress ^ Temporary stage 605 to update the temporary cache (for example, count ^, input text: what standard register, output text indicator register丨 The micro-instructions such as the processing of the interrupt signal 627 indicated by the logic circuit 626 are used to provide the best execution of the specified cryptographic operation. J 30 200536332 Let v be the medium φ, and ③, code list 70 micro-instruction sequence towel The integer unit # 于: becomes two sides, so the integer operation can be included in the relevant micro-fingers * 仃 凡 成. No. 027 recovery. Tian or So Gu Yunhui or Ya from the pending interrupt letter added at χ86 * The port is all indicators and information on the grab parameters. Ignore: 86 architecture register, when the execution is interrupted, I :: can =, for $ when returning from the interrupt, these states are restored ^ Save 'and make Test the return of X bit 625, the micro-finger line. If it is, when the interrupt occurs: Dagger ::-: Code operation Enter the input data block. The related differences are repeated before the special 627 in processing # 'to allow the processing of interrupted letters to cut six pounds in one of the sequence input text blocks.払 Temporary register and intermediate results. 汴 Magic mountain code knows operation: 2f; The seventh figure, which is the method in the microprocessor in the sixth figure, indicates the code 700 field of the dry instruction microinstruction of the factory. A micro opcode block (micro opcode fi contains ^ HMdata register fiL) (two egist ^ r system 703. Micro opcode block 7〇i designated block = 运 times the difference and designated logic circuit in the microprocessor 60〇 一 特

段以執行次運算。微運算碼攔位701的指值匕一階 明的一密碼單元執行指示的微指令。在一實二根J 2固指定的值。-第-值載入(XL〇AD)指$資料從—己J 體位置恢復,而其位址係由資料暫存器攔位7〇2 思 J稱之一架構暫存器的内容所指定。這資料被 :: 存器攔位703内容所具體指定密碼單元内的—斬曰 =恢復的資料(例如:密碼鑰匙資料、控制字組:^态。 字資料、初始向量)係提供給密碼單元。微運算碼=$ $ 的第二值儲存(XST〇R)指出由密碼單元所產生的 存在一記憶位置,而其位址係由資料暫存器攔位= 容所指稱之一架構暫存器的内容所指定。在滋碼亡内 階段實施例,暫存器欄位703的内容指示‘數 31 200536332 料區塊之一儲存於与& r (data Md) 704、內上體。輸出資料區塊係由資料襴位 存取。根據本發明碼單元所提似供齡邏輯電路 體的細節,將元所執行載人和儲存微指令更具 -弟八圖及第九圖加以討論。 請參照第八圖,立&斤 暫存器欄位703的信其為弟七圖之載入微指令格式7〇〇 係產生回應-密^表格。如前所述…序列微指令 複數個微指令,其:曰:,:畢。此序列微指令包含-第-數個微指令,其係由n ^碼早兀指不執行,以及一第二複 並列功能單元所=錢理11中密碼單元以外之至少一個 如更新計數器、健ίΐ複數個微指令指示次運算,例 態位元於機H特^针=、Ϊ構暫存11、測試並設定狀 資料、密碼泉數f。弟一複數個微指令提供鑰匙 元產味松及輪入貧料給密碼單元並且指示密碼單 入並加密^匕以二記憶體恢復的鑰匙排程)以載 料。-载,並且儲存輸出文字資 載入一宓碼鑰二^ $供給铪碼單元以載入控制字組資料、 入文字資料並指示密碼單、$入初始向量貧料、載入輪 微指令在暫存器欄位:指定密石馬運一载入 入一控制字la到其内部控制 °^G係指示密碼單元载 管線處理,在暫存階P子組暫存器。當這微指令進行 記憶體中儲存控制字I的采構控制字組指標暫存器存取 成為一實體位址以供記情位址邏輯電路轉譯此位址 取控制字組,然後傳給密rf取。載入邏輯電路從快取擷 ObO 10指示密碼單元載^入^早^。同樣地,暫存器攔位值 文字資料,並且在載入之後由育料攔位7〇4所提供的輪入 制字組,輸入資料由儲存f f f指定的密碼運算。類似控 器存取。值〇b〇l〇於+番木構9存器中所儲存的一暫存 入資料給内部暫存器曰輪、入、t由資料襴位704所提供的輪 。载入到輪入-1暫存器的資 32 200536332 料不是輸入文字資料(當管線處理時)就是一初始向量。值 Ob 110及Obl 11分別指示密碼單元載入一密碼鑰匙或使 用者產生鑰匙排程中一鑰匙之較低及較高位元。根據本應 用,使用者係定義成執行一特定功能或特定運算,而使用 者可具體化成一應用程式、一操作系統、一機器或者一個 人。因此,在一實施例中,使用者產生鑰匙排程係由一應 用程式所產生,而在另一實施例中,使用者產生鑰匙排程 係由一個人所產生。 在一實施例中,暫存器攔位值Ob 100及Ob 101係考 慮一密碼單元有兩階段,藉此,可以管線處理相繼的輸入 文字區塊貧料。因此對管線處理相繼的輸入貧料區塊而 言,一第一載入微指令執行提供一第一區塊的輸入文字資 料給輸入-1,接著執行一第二載入微指令提供一第二區塊 的輸入文字資料給輸入-0,並且指示密碼單元開始執行指 定的密碼運算。當一使用者產生之錄匙排程被用以執行密 碼運算時,對應使用者產生之錄匙排程中餘匙數量的載入 微指令係依設定路徑傳送給密碼單元,此密碼單元指示載 入此錄匙排程中每一回合錄匙。 在載入微指令中暫存器欄位703其他所有的值係保 留。 請參照第九圖,其為第七圖之儲存微指令格式700 暫存器攔位703的值之表格。一儲存微指令係發布(issue) 給密碼單元,以指示其提供所產生的輸出文字區塊給儲存 邏輯電路,儲存於記憶體中由資料暫存器欄位702所提 供的位址。據此,本發明的轉譯邏輯電路為一特定的輸出 文字區塊所發布之一儲存微指令係在為一其所對應輸入 文字區塊所發布之一儲存微指令之後。暫存器欄位703 之值Ob 100係指示密碼單元提供關聯其内部的輸出-0暫 33 200536332 存為給彳諸在:盘知 供給輸存=容與輪人文字區塊提 之内部輪出、]、2關聯。:^’芩,暫存器攔位值Obioi 關聯。據此,二存器、係二^^文字資料提供給輸入-1相 個輸入文隨麵ϋ制字組資料.之後,複數 布密碼微^ ^可以被f線輪达,係透過密瑪單元依序發 指示密碼單入·輪入4二載入.輸入-0 (載入.輸入-〇也 -〇、載入.輪入二始密瑪t异)、儲存.輸出-1、儲存.輸出 塊運算)等等。~ 、載入.輸入-0 (開始下兩個輪入文字區Segment to perform secondary operations. An instruction of the micro-operation code block 701 indicates a micro-instruction executed by a cryptographic unit. Specify the value of J 2 solid in a real two roots. -The first-value loading (XL〇AD) means that the data is restored from the location of the body, and its address is specified by the data register block 702, which is the content of one of the architecture registers. . This data is: The data in the cipher unit specified by the content of the register block 703—Choose = recovered data (for example: cipher key data, control block: ^ state. Word data, initial vector) are provided to the cipher unit. . The second value store (XST〇R) of the micro-operation code = $ indicates that there is a memory location generated by the cryptographic unit, and its address is blocked by the data register = one of the architecture registers that the content refers to Specified by the content. In the embodiment of the code phase, the content of the register field 703 indicates ‘number 31 200536332. One of the data blocks is stored in & r (data Md) 704, the inner body. The output data block is accessed by the data bit. According to the details of the logic circuit body for the age provided by the code unit of the present invention, the manned and stored micro instructions executed by the unit are further discussed in the eighth figure and the ninth figure. Please refer to the eighth figure. The letter of the register field 703 is the loader micro-instruction format 700 of the seventh figure. The response-password form is generated. As mentioned before ... sequence microinstructions A plurality of microinstructions: This sequence of micro-instructions includes -the first-number of micro-instructions, which are not executed by the n ^ code early fingers, and at least one other than the password unit in Qianli 11 such as the update counter, health A plurality of micro-instructions indicate sub-operations, and the example bit is at the machine H. Special pin =, the structure temporarily stores 11, tests and sets the state data, and the password spring number f. My brother provided a plurality of micro-instructions with a key to produce miso and turn into poor materials to the cipher unit and instructed the cipher to enter and encrypt the key (schedule with the two memory recovery key schedule) to load the material. -Load, and store and output the text data. Load a code key and two ^ $ for the code unit to load control block data, enter text data and indicate a password list, $ enter the initial vector lean material, and load the round microinstruction in Register field: Specifies that Mi Shimayun will load a control word la to its internal control. ^ G indicates that the cryptographic unit is loaded with pipeline processing, and is in the temporary stage P subgroup register. When this micro-instruction is used to store the control word I in the memory, the control register pointer register is accessed as a physical address for the memory address logic circuit to translate this address to take the control word, and then pass it to the secret. rf take. The loading logic circuit fetches ObO 10 from the cache and instructs the crypto unit to load ^ early ^. Similarly, the register block value is text data, and after being loaded by the rotation block provided by the breeding block 704, the input data is calculated by storing the password specified by f f f. Similar to controller access. A value of 0b0l0 is temporarily stored in the +9 memory of the Fanwood structure. It is used to store the data in the internal register, which is provided by the data bit 704. The data loaded into the round-in-1 register is either input text (when the pipeline is processing) or an initial vector. The values Ob 110 and Obl 11 instruct the cryptographic unit to load a cryptographic key or the lower and higher bits of a key in the user's key generation schedule, respectively. According to this application, a user is defined to perform a specific function or a specific operation, and the user can be embodied as an application program, an operating system, a machine, or a person. Therefore, in one embodiment, the user-generated key schedule is generated by an application, and in another embodiment, the user-generated key schedule is generated by one person. In one embodiment, the register block values Ob 100 and Ob 101 take into account that a cryptographic unit has two stages, whereby the pipeline can process successive input text block leans. Therefore, for pipeline processing of successive input lean blocks, a first load microinstruction execution provides a first block of input text data to input -1, and then executes a second load microinstruction to provide a second The input text of the block is given to input -0, and instructs the cryptographic unit to start the specified cryptographic operation. When a key recording schedule generated by a user is used to perform a cryptographic operation, a load microcommand corresponding to the number of remaining keys in the key recording schedule generated by the user is transmitted to the password unit according to a set path, and the password unit instructs to load the key. Record the key for each round in the recording schedule. All other values in the register field 703 in the load microinstruction are reserved. Please refer to the ninth figure, which is a table storing the values of the register buffer 700 of the micro instruction format 700 in the seventh figure. A storage microinstruction is issued to the crypto unit to instruct it to provide the generated output text block to the storage logic circuit and store it in the memory at the address provided by the data register field 702. Accordingly, a storage microinstruction issued by the translation logic circuit of the present invention for a specific output text block is after a storage microinstruction issued for a corresponding input text block. The value of register 100 in field 703 is Ob 100, which instructs the crypto unit to provide its internal output. ,], 2 associations. : ^ ’芩, the register block value Obioi association. According to this, the two registers and the two ^^ text data are provided to input -1 phase input text to make the block data. After that, the plural passwords ^ ^ can be reached by the f-line wheel, which is through the Mimar unit. Instruction passwords are sent in order, 4 turns into loading. Enter -0 (load.enter -〇 也 -〇, load. Rotation into the first two dense t), save.output -1, save. Output block operation) and so on. ~, Load. Enter -0 (start the next two rounds of text area

控制字組loon f,其為本發明指定密碼運算參數之範例 者程式設計^ t式的方塊圖。控制字組1 _係由使用 組1000,並且在執行密碼運算之前,控制字 哭。據此,itt提供給相稱微處理器中的—架構暫存 ΐ入序列賴齡對應到—密碼指令時,一 構暫“ 了…^布以指不微處理器去讀取包含指標的架 =σσ、攸記憶體(快取)恢復控制字組1000以及載入 二制字組1000到密碼單元的内部控制字組暫存器。控制 字組1000包含一保留(RSVD)攔位1001、一資料區塊大 小(DSIZE)攔位1002、一鑰匙大小(KSIZE)攔位1003、 一加密/解密(E/D)攔位1〇〇4、一中間結果(IRSLT)欄位 1005、一鑰匙產生(KGEN)欄位1006、一演算(ALG)欄 位1007以及一回合計算(RCNT)欄位1008。 保留欄位1001所有的值係保留。資料區塊大小欄位 1002的内容係指示執行加密及解密時使用輸入及輸出文 字區塊之大小。在一實施例中,資料區塊大小欄位1002 不是指示一 128位元區塊、一 192位元區塊,就是指示 一 256位元區塊。鑰匙大小欄位1〇〇3的内睿係指示一 用以完成加密或解密之密碼鑰匙的大小。在一實施例中, 每处大小搁位10 0 3不是指示^一 12 8位元錄匙、 192 34 200536332 位元錄匙,就是指示一 2 5 6位元錄匙。加密/解密攔位 1004指出密碼運算係加密運算或指出密碼運算係解密運 算。鑰匙產生攔位1006指示在記憶體中係使用者產生之 鑰匙排程或在記憶體中係單一密碼鑰匙;如果為單一鑰匙 時,微指令發布給密碼單元與密碼鑰匙以指示單元根據演 算欄位1007之内容所具體指定的密碼演算以擴展鑰匙 成為一錄匙排程。在一實施例,演算搁位1 〇 ◦ 7之特定值 具體指示資料加密標準演算法、三重資料加密標準演算法 或者進階加密標準演算法如先前所述之討論。替代實施例 可考慮其他密碼演算法,例如Rijndael Cipher、Twofish I Cipher等。回合計算欄位1008的内容指示一數量的密 碼回合,其根據具體指示的演算法完成於每一輸入文字區 塊。雖然上述提及的標準指示每一輸入文字區塊固定前置 數量的密碼回合,但回合計算欄位1008允許一程式設計 者從標準指示修改回合的數量。在一實施例中,程式設計 者可指定每一區塊從0-15回合。最後,中間結果欄位 1005指示是否一輸入文字區塊的加密/解密,是根據演 算欄位1007所指定之密碼演算法,以回合計算攔位 1008所指定回合的數量執行,或者加密/解密是根據演 算攔位1007所指定之密碼演算法,以回合計算欄位 1008所指定回合的數量執行,而其最終回合的執行代表 一中間結果而不是一最終結果。熟悉該項技藝者可察知許 多密碼演算法除了最終回合的次運算之外係執行相同的 次運算於每一回合。因此程式設計中間結果欄位1005提 供中間結果而不是最後結果,藉此,允許程式設計者可核 對演算法實現之中間的步驟。例如:獲得增加的中間值以 核對演算法實行,假設,執行一回合的加密於一文字區 塊,然後執行兩回合於相同文字區塊,然後三回合等。提 供可程式化回合及中間值結果的功能可讓使用者檢查密 35 200536332 碼執行、除錯以及達到改變鑰匙結構及回合計數。 請參照第十一圖,其為第十圖中控制字組1QOO之資 料區塊大小欄位1002範例值之表格1100。資料區塊大 小欄位1002之000值係指示一計算裝置依據本發明執 行使用一 128位元區塊大小之輸入以及輸出區塊之密碼 運算,其中這些區塊由記憶體提供,且分別由一輸入指標 暫存器及一輸出指標暫存器之内容所指到。資料區塊大小 欄位1002之001值係指示此計算裝置執行使用一 192 位元區塊大小之輸入以及輸出區塊之密碼運算。資料區塊 大小欄位1002之010值係指示此計算裝置執行使用一 . 256位元區塊大小之輸入以及輸出區塊之密碼運算。資料 區塊大小欄位1002之所有其餘值係保留。 請參照第十二圖,其為本發明之一密碼單元1200的 較佳實施例方塊圖。密碼單元1200包含一微指令暫存器 (micro opcode register) 1203,此微指令暫存器 1203 透過一微指令匯流排1214接收密碼微指令(例如載入與 儲存〜微指令)。密碼單元1200也包含一控制字組暫存器 (control word register) 1204、一第一輸入(輸入-0)暫 存器1205以及一第二輸入(輸入-1)暫存器1206、一第 _ 一鑰匙(鑰匙-◦)暫存器1207以及一第二鑰匙(鑰匙-1)暫 存器1208。資料透過一載入匯流排(load bus) 1211提 供給暫存器1204-1208,如微指令暫存器1203中一載 入微指令内容所指定。密碼單元1200也包含區塊密碼邏 輯電路1201,此區塊密碼邏輯電路1201耦合到所有的 暫存器1203-1208以及也耦合到密碼鑰匙隨機存取記憶 體(RAM) 1202。區塊碼邏輯電路1201提供一暫停信號 (stall signal) 1213並且也提供區塊結果給一第一輸出 (輸出-◦)暫存器1209以及一第二輸出(輸出-1)暫存器 1210。輸出暫存器1209-1210透過一儲存匯流排1212 36 200536332 將内容依指定路徑傳送給在一相稱微處理器中的相繼階 段。在一實施例中,微指令暫存器1203係32位元大小; 暫存器1204、1207及1208係128位元大小;以及暫 存器1205-1206及1209-1210係256位元大小。 在操作中,密碼微指令與資料一起連續提供給微指令 暫存器1203,其中資料係指定給控制字組暫存器1204、 或輸入暫存器 1205-1206之一、或鑰匙暫存器 1207-1208之一。在參照第八圖及第九圖討論的實施例 中,控制字組藉由一載入微指令載入到控制字組暫存器 1204。因此密碼錄匙或錄匙排程經由連續的載入微指令 • 載入。當一 128位元密碼鑰匙載入時,一載入微指令因 此提供給指定的鑰匙-0暫存器1207。當一大於128位 元密碼鑰匙載入時,一載入微指令因此提供給指定的鑰匙 -0暫存器1207,並且連同一載入微指令提供給指定的鑰 匙-1暫存器1208。當一使用者產生之鑰匙排程載入時, 連續載入微指令提供給指定鑰匙-0暫存器1207。鑰匙排 程中的每一鑰匙被載入且依序被放置在鑰匙隨機存取記 憶體1202以供其相對應的密碼回合使用。隨此,輸入文 字資料(如果沒有要求一初始向量)載入到輸入-1暫存器 φ 1206,如果要求一初始向量,則經由一載入微指令載入 到輸入-1暫存器1206。對輸入-0暫存器1205的一載入 微指令指示密碼單元以載入輸入文字資料給輸入-◦暫存 器1205,並且開始在輸入-0暫存器1205内的輸入文字 資料執行密碼回合,其根據控制字組暫存器1204之内容 所提供的參數使用在輸入_ 1或在兩輸入暫存器 1205-1206 (當輸入資料係管線處理)中的初始向量。根 據收到指定輸入-〇暫存器1205的載入微指令,區塊密 碼邏輯電路1201開始執行由控制字組内容所指定的密 碼運算。當單一密碼鑰匙要求擴展,區塊密碼邏輯電路 37 200536332 1201產生鑰逛排程中的备— a曰卜、,⑯ 存取記㈣H㈣存錢匙隨機 12〇1產生一鐵匙排程或者不;區塊密碼邏輯電路 第-回合的鑰匙係快取體中載入鑰匙排程, 使得第-區塊密碼回碼邏輯1201中以 體1202而處理。-值初於化瑜匙隨機存取記憶 繼續執行指定的密石馬運算 碼邏輯電路1201 運算完成n續從#輸μ料塊直到 必外l从令扭 機存取記憶體1202擷取回合 所要求。密碼單元·執行The control word loon f, which is an example of specifying cryptographic operation parameters according to the present invention, is programmed as a block diagram of the formula t. Control word group 1 _ is used by group 1000, and the control word cries before performing a cryptographic operation. According to this, when the architecture provided by the itt to the commensurate microprocessor—the temporary storage input sequence corresponds to the password instruction—a structure is temporarily “…” means that the microprocessor does not read the frame containing the index = σσ, memory (cache) recovery control block 1000, and internal control block register that loads binary block 1000 into the crypto unit. Control block 1000 contains a reserved (RSVD) block 1001, a data Block size (DSIZE) block 1002, a key size (KSIZE) block 1003, an encryption / decryption (E / D) block 1004, an intermediate result (IRSLT) field 1005, a key generation ( KGEN) field 1006, a calculation (ALG) field 1007, and a round calculation (RCNT) field 1008. All values in the reserved field 1001 are reserved. The content of the data block size field 1002 indicates that encryption and decryption are performed The size of the input and output text blocks is used. In one embodiment, the data block size field 1002 indicates either a 128-bit block, a 192-bit block, or a 256-bit block. The key The internal core of the size field 003 indicates that one is used to complete encryption or decryption. The size of the cipher key. In one embodiment, each of the size slots 103 is either an indication of a 128-bit recording key, a 192 34 200536332-bit recording key, or a 256-bit recording key. The encryption / decryption block 1004 indicates that the cryptographic operation is an encryption operation or indicates that the cryptographic operation is a decryption operation. The key generation block 1006 indicates that the user generates a key schedule in the memory or a single cryptographic key in the memory; if it is In the case of a single key, a micro instruction is issued to a cryptographic unit and a cryptographic key to instruct the unit to expand the key into a recording key schedule according to the cryptographic calculation specified in the content of the calculation field 1007. In one embodiment, the calculation stall 1 ◦ The specific value of 7 specifically indicates the data encryption standard algorithm, triple data encryption standard algorithm, or advanced encryption standard algorithm as discussed previously. Alternative embodiments may consider other cryptographic algorithms, such as Rijndael Cipher, Twofish I Cipher, etc. The content of the round calculation field 1008 indicates a number of password rounds, which are completed in each input text area according to the algorithm of the specific instructions Although the above-mentioned standard indicates a fixed number of cipher rounds per input text block, the round calculation field 1008 allows a programmer to modify the number of rounds from the standard instructions. In one embodiment, the programmer Each block can be specified from 0-15 rounds. Finally, the intermediate result field 1005 indicates whether the encryption / decryption of an input text block is based on the password algorithm specified in the calculation field 1007, and the block 1008 is calculated by round. The specified number of rounds is executed, or encryption / decryption is performed according to the cryptographic algorithm specified in calculus block 1007, with the number of rounds specified in round calculation field 1008, and the execution of its final round represents an intermediate result instead of one Final Results. Those skilled in the art will know that many cryptographic algorithms perform the same number of operations in each round except for the number of operations in the final round. Therefore, the programming intermediate result field 1005 provides an intermediate result instead of a final result, thereby allowing the programmer to check the intermediate steps of the algorithm implementation. For example, to obtain an increased intermediate value to check the implementation of the algorithm. Assume that one round of encryption is performed in a text block, then two rounds are performed in the same text block, and then three rounds are performed. Provides the function of programmable rounds and median results to allow users to check the secret 35 200536332 code execution, debug, and change the key structure and round count. Please refer to the eleventh figure, which is a table 1100 of example values of the data block size field 1002 of the control block 1QOO in the tenth figure. The value of 000 in the data block size field 1002 indicates that a computing device performs a cryptographic operation using a 128-bit block size input and output block according to the present invention, where these blocks are provided by the memory and are each provided by a Refers to the contents of the input indicator register and an output indicator register. The value 001 of the data block size field 1002 instructs the computing device to perform a cryptographic operation using an input and output block of a 192-bit block size. A value of 010 in the data block size field 1002 indicates that the computing device performs cryptographic operations using input and output blocks of a .256-bit block size. All other values in the block size field 1002 are reserved. Please refer to FIG. 12, which is a block diagram of a preferred embodiment of a cryptographic unit 1200 of the present invention. The crypto unit 1200 includes a micro instruction register 1203. The micro instruction register 1203 receives password micro instructions (for example, load and store ~ micro instructions) through a micro instruction bus 1214. The password unit 1200 also includes a control word register 1204, a first input (input-0) register 1205, a second input (input-1) register 1206, and a first_ A key (key-◦) register 1207 and a second key (key-1) register 1208. The data is provided to the register 1204-1208 through a load bus 1211, as specified by the contents of a micro instruction in the micro instruction register 1203. The crypto unit 1200 also includes a block crypto logic circuit 1201, which is coupled to all the registers 1203-1208 and also to a cryptographic key random access memory (RAM) 1202. The block code logic circuit 1201 provides a stall signal 1213 and also provides a block result to a first output (output-◦) register 1209 and a second output (output-1) register 1210. The output register 1209-1210 transmits the content to a successive stage in a symmetric microprocessor through a storage bus 1212 36 200536332 according to a specified path. In one embodiment, the micro-instruction register 1203 is a 32-bit size; the registers 1204, 1207, and 1208 are a 128-bit size; and the registers 1205-1206 and 1209-1210 are 256-bit sizes. In operation, the password microinstruction is continuously provided to the microinstruction register 1203 together with the data, wherein the data is assigned to the control block register 1204, or one of the input registers 1205-1206, or the key register 1207. One of -1208. In the embodiment discussed with reference to Figures 8 and 9, the control word is loaded into the control word register 1204 by a load microinstruction. Therefore, the password recording or key scheduling is performed by successive loading micro-instructions. When a 128-bit cipher key is loaded, a load microinstruction is therefore provided to the designated key-0 register 1207. When a larger than 128-bit cryptographic key is loaded, a load microinstruction is therefore provided to the designated key-0 register 1207, and the same load microinstruction is provided to the designated key-1 register 1208. When a user-generated key schedule is loaded, the continuous load microinstruction is provided to the designated key-0 register 1207. Each key in the key schedule is loaded and sequentially placed in the key random access memory 1202 for its corresponding password round. Following this, the input text data (if an initial vector is not required) is loaded into the input-1 register φ 1206, and if an initial vector is required, it is loaded into the input-1 register 1206 via a load microinstruction. A load micro-instruction of the input-0 register 1205 instructs the password unit to load the input text data to the input-register 1205, and starts a password round in the input text data in the input-0 register 1205 , Which uses the initial vector in input_1 or in the two input registers 1205-1206 (when the input data is processed by the pipeline) according to the parameters provided by the content of the control block register 1204. Upon receiving the load microinstruction of the designated input-zero register 1205, the block password logic circuit 1201 starts to perform the password operation specified by the content of the control block. When a single cryptographic key is requested to be expanded, the block cryptographic logic circuit 37 200536332 1201 generates a backup in the key shopping schedule — a, ⑯, ⑯ access note ㈣ H㈣ deposit key randomly generates a iron key schedule 1 2 0 or not; The key schedule of the first round of the block cipher logic circuit is loaded with a key schedule, so that the first block cipher logic 1201 is processed by the body 1202. -The value starts from the random access memory of Huayu Key and continues to execute the specified dense stone horse opcode logic circuit 1201. The operation is completed. Continue from #input μ material block until it must be retrieved from the twister access memory 1202. Claim. Cryptographic Unit · Execution

X二“日定的輸人文字區塊,而相繼的輸 =文:&塊透過相繼對應的載入及 :示暫停信號1213。 存器12〇9-1210時,暫存器12〇912/〇的子 内谷接者傳送到儲存匯流排1212。 A Μ Μ芩α弟十三圖,其為本發明執行有關進階加密標準 /貝异法岔碼運异之一區塊密碼邏輯電路13〇〇實施例的 方塊圖。區塊密碼邏輯電路1300包含一回合引擎(round engine) 1320,此回合弓丨擎U2〇透過匯流排 1311-1314及匯流排1316-1318|禺合到一回合引擎控 制器(round engine controller) 131〇。回合引擎控制器 13 10包含一區塊大小控制器(block size controller) 1330 ’並且存取〆微指令暫存器(micr〇 instructi〇n register) 1301、控制子組暫存器(control word register) 1302、第一鑰匙(鑰匙-〇)暫存器1303以及第二鑰匙(鑰 匙_1)暫存器1304以存取鑰匙資料、微指令以及所指示 费碼運异的參數。輸入暫存器13 0 5 - 13 0 6的内容提供給 回合引擎1320並且面合引擎1320提供相對應輸出文字 38 200536332 給輸岀暫存器1307-1308。輸出暫存器1307-1308透 過匯流排1316-1317也耦合到回合引擎控制器131〇, 以致能回合引擎控制器存取每一相繼密碼回合的結果,而 此結果係透過NEXTIN匯流排1318提供給回合引擎 1320下一密碼回合。鑰匙隨機存取記憶體(未繪出)中的 密碼錄匙係透過錄匙隨機存取記憶體匯流排1315存 取。加密/解密匯流排(ENC/DEC bus) 1311之信號指 示回合引擎利用次運算執行不是加密(例如S-Box)就是解 密(例如反向S-Box)。回合計算匯流排(rnDCON bus) 1312的内容指示回合引擎1320執行不是一第一進階加 密標準回合、一中間進階加密標準回合就是一最後進階加 密標準回合。回應指示一密碼输匙自動擴展之一控制字組 内一鑰匙產生攔位内容,此錄起排程控制器1330顯示鍮 匙產生匯流排(GENKEY bus) 13 14之信號以指示此回合 引擎1320根據餘匙匯流排1313所提供之錄匙產生一錄 匙排程。錄匙匯流排1313亦用以提供每一回合錄匙給回 合引擎1320在其對應的回合執行時。回應經由控制字組 暫存器1302提供給回合引擎控制器1310之一控制字組 内一資料區塊大小爛位内谷’此區塊大小控制器(block size controller) 1330設定區塊大小匯流排(BLKSIZE bus) 1319之值以指示加密以及解密運算期間所使用輸 入及輸出文字區塊大小。在一貫施例中,區塊大小匯流排 1319之值指示128位元區塊、192位元區塊或256位 元區塊。 回合引擎1320包含第一鑰匙互斥或(x〇r)邏輯電路 1321,此第一錄匙互斥或邏輯電路1321麵合到一第一 暫存器(暫存-0) 1322,此第一暫存器1322耦合到S-Box 邏輯電路1323,此S-Box邏輯電路1323耦合到移列 (Shift R〇w)邏輯電路1324 ’此移列邏輯電路1324耦合 39 200536332 1到、器(暫存1325 ’此第二暫存器1325柄 C〇1Um)邏輯電路1326,此混攔邏輯電路 輯:跋^ 一第三暫存器(暫存_2) 1327。第一输匙互斥 、1321' &Βοχ邏輯電路1323、移列邏輯電 HC) > ^以及混欄邏輯電路1326依據區塊大小匯流排 豆驊协春以係配置用以執行次運算於輸入文字資料,像是 ^ ΐίί可討論的進階加密標準FIpS標準。混欄邏輯電 讲担在中間回合期間於要求使用藉由錄匙匯流排 碑進提供的回合繪匙時,係附加配置以執行進階加密X 2 "day input text block, and successive input = text: & block through successive corresponding loading and: display pause signal 1213. Register 1209-1210, register 1201012 / 〇 的 内 内 谷 接 者 is transferred to the storage bus 1212. A ΜΜ 芩 α brother thirteen pictures, which is a block cipher logic circuit that implements one of the advanced encryption standard / different method of the present invention related to the encryption code The block diagram of the 13 00 embodiment. The block cipher logic circuit 1300 includes a round engine 1320, and this round of bows U20 through the buses 1311-1314 and the bus 1316-1318 | Round engine controller 131〇. Round engine controller 13 10 includes a block size controller 1330 'and accesses the microinstruction register 1301. Control sub-register (control word register) 1302, first key (key-〇) register 1303, and second key (key_1) register 1304 to access key data, micro-instructions and indicated fees Different code transport parameters. Enter the contents of register 13 0 5-13 0 6 The round engine 1320 is supplied and the face engine 1320 provides the corresponding output text 38 200536332 to the input register 1307-1308. The output register 1307-1308 is also coupled to the round engine controller 1310 through the bus 1316-1317, so that The round engine controller can access the result of each successive password round, and this result is provided to the next round of passwords by the round engine 1320 through the NEXTIN bus 1318. The password entry key in the key random access memory (not shown) It is accessed through the recording key random access memory bus 1315. The signal of the encryption / decryption bus (ENC / DEC bus) 1311 instructs the round engine to use the secondary operation to perform either encryption (such as S-Box) or decryption (such as reverse S-Box). The content of the round calculation bus (rnDCON bus) 1312 instructs the round engine 1320 to execute either a first advanced encryption standard round, an intermediate advanced encryption standard round or a last advanced encryption standard round. The response indicates a One of the password keys automatically expands the control block to generate the content of the block. The recording controller 1330 displays the key to generate the bus (GENKEY bus). The signal of 13 14 instructs the round engine 1320 to generate a recording key schedule based on the recording keys provided by the remaining key bus 1313. The recording key bus 1313 is also used to provide each round recording key to the round engine 1320 in its corresponding During round execution. The response is provided to one of the round engine controllers 1310 via the control block register 1302. A block size of data in the control block is bad. This block size controller 1330 sets the block size bus. (BLKSIZE bus) The value of 1319 indicates the size of the input and output text blocks used during encryption and decryption operations. In one embodiment, the value of the block size bus 1319 indicates a 128-bit block, a 192-bit block, or a 256-bit block. The round engine 1320 includes a first key mutex or (x〇r) logic circuit 1321, and this first recording key mutex or logic circuit 1321 is combined into a first register (temporary-0) 1322, this first The register 1322 is coupled to the S-Box logic circuit 1323, and the S-Box logic circuit 1323 is coupled to the shift logic circuit Shift 1324 'This shift logic circuit 1324 is coupled to 39 200536332 1325 'This second register 1325 handles C01Um) logic circuit 1326, this mixed logic circuit series: Post ^ a third register (temporary_2) 1327. The first key is mutually exclusive, 1321 '& Βχχ logic circuit 1323, shift logic circuit HC) > ^ and the mixed column logic circuit 1326 is configured based on block size. Enter textual information, such as the advanced encryption standard FIpS standard that can be discussed. Mixed logic logic is used to perform advanced encryption during the middle round when additional round keys provided by the recording bus and tablet are required.

Tin ^或功能於輸入資料。第一鑰匙互斥或邏輯電路 、、m:^B〇X邏輯電路1323、移列邏輯電路1324以及Tin ^ or function for entering data. First key mutually exclusive OR logic circuit, m: ^ BOX logic circuit 1323, shift logic circuit 1324, and

〔電路1326在藉由加密/解密匯流排(ENC/DEC +11的狀態指示時’也配置用以執行其相對之反向 白準次運算於解密期間。熟悉該項技藝者可察知 Μ 貝料係根據控制字組暫存器1302内容所指定 二二體區塊加密模式而回饋給回合引擎1320。初始向量 ^料(如果要求)透過ΝΕΧΤΙΝ匯流排1318提供給回合引 擎 1320 〇 斤在第十三圖所示的實施例中,回合引擎分為兩階段·· 一第一階段介於第一暫存器(暫存_0) U22與第二暫存器 (暫存-1) 1325以及一第二階段介於第二暫存器(暫存— 1325與第三暫存器(暫存_2) 1327。中間回合資料同步_ 時脈信號(未繪出)於階段間管線處理。當一區塊的輪=次 料完成密碼運算,其關聯的輸出資料放置於相對應輪出^ 存器1307-1308。一儲存微指令之執行使得所指定之 出暫存器1307-1308之内容提供至儲存匯流排(未^ 請參照第十四圖,其為本發明一實施例在一中斷事 期間保留密碼參數之狀態的方法流程圖。當一微處理哭^ 200536332 據本發明執行一指令流時,方法流程從步驟1402開始。 上述之指令流程並不須包含一像此描述之密碼指令。然後 方法流程處理至決定步驟1404。 在決定步驟1404,決定是否藉由一指令流(中斷處理 程式)處理一要求改變指令流之中斷事件(例如可遮罩式 中斷、非遮罩式中斷、分頁錯誤(page fault)、工作切換 (task switch)等)。若是,方法流程處理至步驟1406 ; 若否,方法流程跳至步驟1404,其指令執行繼續直到一 中斷事件產生。 在步驟1406,因為一中斷事件已經發生,在傳送控 制程式至一對應中斷處理程式之前,中斷邏輯電路依據本 發明指示清除一旗標暫存器中之X位元。X位元的清除確 保從中斷處理程式返回時,如果一區塊密碼運算進行中, 其指示排除至少一個中斷事件,並指示控制字組資料以及 鑰匙資料,必須在輸入指標暫存器之内容目前所指的輸入 資料區塊繼續區塊密碼運算之前重新載入。然後處理至步 驟 1408 〇 在步驟1408,所有架構暫存器包含本發明區塊密碼 運算執行之相關指標及計數均儲存於記憶體。熟悉該項技 藝者可知架構暫存器之儲存係在轉移控制權給中斷處例 程式之前完成於目前資料計算裝置。因此本發明一實施例 中探究目前資料架構,以提供中斷事件執行輸出量之透明 度。在暫存器儲存之後,方法流程處理至步驟1410。 在步驟1410,程式流程係轉移至中斷處理程式。因 此方法流程處理至步驟1412。 在步驟1412,此方法流程完成結束。熟悉該項技藝 者可察知第十四圖之方法依據中斷處理程式之返回係從 步驟1402再開始。 41 200536332 請參照第十五圖,其為本發明一較佳實施例中在至少 一個中斷事件時,在複數個輸入資料區塊執行一密碼運算 並使用一使用者指定區塊大小之方法流程圖1500。為求 圖示之簡潔,省略依據區塊密碼模式執行指定密碼運算之 流程,其中區塊密碼模式要求區塊間初始向量等效物之更 新以及儲存(例如輸出反饋模式、密碼反饋模式)。然而本 發明之方法係包含其他之區塊密碼模式。 方法流程從步驟1502開始,其中依據本發明之一密 碼指令指示一密碼運算開始執行。上述之密碼指令執行係 可以第一執行或由於一中斷事件之中斷執行而跟隨第一 > 執行之後執行,藉此在中斷處理程式執行完成後,將程式 控制權轉移回密碼指令。流程處理至步驟1504。 在步驟1504,載入記憶體中之一資料區塊並且開始 一指定密碼運算,其中上述之區塊資料係由本發明實施例 之一輸入指標暫存器之内容所指定。在一設定實施例中, 用以載入資料區塊之區塊大小係128位元。因此,當使 用區塊大小並非為128位元時,在發布密碼指令前,須 要求指令執行以清除X位元。在一 x86相容實施例中, 其利用一 x86旗標暫存器中之第30位元,此X位元可 _ 以藉由依序執行一 PUSHFD指令與一 POPFD指令而清 除。然而熟悉該項技藝者可得知在另一實施例中,其他用 以清除X位元之指令。在一實施例中,指定之密碼運算 係依據進階加密標準規則開始執行。然後方法流程處理至 決定步驟1506。 在決定步驟1506,決定是否設定一旗標暫存器中之 一 X位元。如果設定X位元,其指示目前依據本發明載 入一密碼單元之控制字組及鍮匙排程係有效(valid)。如果 清除X位元,其指示目前載入上述之密碼單元之控制字 42 200536332 組及鍮匙排程係無效(invalid)。如上述參照第十四圖之討 論,當一中斷事件產生時,X位元係清除。如果X位元係 設定,方法流程處理至步驟1524 ;如果X位元係清除, 方法流程處理至步驟1508。 在步驟1508,因為一清除之X位元係指示不是一中 斷事件產生就是一新的控制字組及/或鑰匙資料載入,因 此從記憶體載入一控制字組。在一實施例中,載入控制字 組停止密碼單元執行上述之步驟1504所提及之密碼運 算。在此實施例中之步驟1504開始一密碼運算,係考慮 到使用電子密碼本模式之多128位元區塊之最佳化,其 .係藉由假設使用目前載入之控制字組及鑰匙資料,以及假 設在12 8位元輸入區塊執行電子密碼本模式係最為普遍 使用之區塊密碼模式。根據上述,在決定步驟1506檢查 X位元之狀態重置前,載入目前輸入資料區塊並且開始密 碼運算。然後方法流程處理至決定步驟1514。 在決定步驟 1514,評估在步驟 1508所擷取 (retrieve)控制字組中之資料區塊大小攔位以決定在指定 密碼運算執行期間所使用之輸入及輸出文字區塊之大 小。如果資料區塊大小欄位之值指定192位元區塊,則 • 方法流程處理至步驟1510。如果貢料區塊大小棚位之值 指定128位元區塊,則方法流程處理至步驟1516。如果 貢料區塊大小搁位之值指定2 5 6位元區塊’則方法流程 處理至步驟1518。 在步驟1510 ^本發明之區塊密碼缝輯電路中之區塊 大小匯流排係設定用以指示其回合引擎執行192位元資 料區塊之密碼運算。然後方法流程處理至步驟1512。 在步驟1512,從記憶體載入密碼鑰匙資料。依據控 制字組中之餘匙產生欄位及鑰匙大小欄位之狀態,鑰匙資 43 200536332 〜佞、用者產生鑰匙排 —餘匙排程。然後方 ,不”部從記憶體载入(例亦: ,),就是載人一初始輸匙並擴展成 法k程處理至步驟1522。 在步驟1516,因為區塊密碼邏輯 匯流排係預設為128位元資料=路中之區塊大小 述之步驟1512 斗塊,因此必須參照如上 法流程至=2載入/擴展密购料。然後方 在步驟1518,本發明之區塊密碼邏輯電 、,小匯流排係設定用以指示其回合引擎執行256 ^二^ 料區塊之密碼運算。然後方法流程處理至步驟⑸〇。、 士步驟152〇,參照上述之步驟1S12所述之載入/ 擴展岔碼鑰匙資料。然後方法流程處理至步驟1522。 ^步驟1518,輸入區塊參照步驟15〇4依據控制 、、且中貢料區塊大小攔位之值所指定的區塊大小再次載 ^,且依據新載入之控制字組以及鑰匙排程開始密碼運 丹。然後方法濟程處理至步驟1524。 。在步驟1524,產生大小對應載入之輸入區塊的一輸 出區塊,對加密而言,輸入區塊係一明文區塊而輸出區塊 係一對應之密文區塊;對解密而言,輸入區塊係一密文區 塊而輪出區塊係一對應之明文區塊。然後方法流程處理至 步驟1526。 在步驟1526,將產生的輸出區塊儲存於記憶體。然 後方法流程處理至步驟1528。 在步驟1528,輸入及輸出區塊指標暫存器之内容依 據控制字組中資料區塊大小攔位之值而修改以指到下一 輸入及輪出資料區塊。另外,修改區塊計數暫存器之内容 以指示目前輸入資料區塊完成之密碼運算。在參照第十五 44 200536332 圖所討論之一實施例,區塊計數暫存器係遞減。然而,熟 悉該項技藝者可在另一實施例中,思量處理及測試區塊計 數暫存器之内容以考慮輸入文字區塊之管線執行。然後方 法流程處理至步驟1530。 在決定步驟1530,決定是否繼續運算一輸入資料區 塊。在用以說明具特徵之實施例中,評估區塊計數器是否 等於零而決定。如果沒有剩下之區塊可供運算,則方法流 程處理至步驟1534 ;如果剩下區塊可供運算,則方法流 程處理至步驟1532。 g 在步驟1532,載入下一輸入資料區塊,如輸入指標 暫存器之内容所指。然後方法流程處理至步驟1524。 在步驟1530,此方法流程完成結束。 雖然本發明及其目的、特徵與優點已詳細描述,但其 他實施例也應包含於本發明。例如:本發明曾根據相容 x86架構之實施例討論長度,然而這些討論已提供此類的 方式,因為x86架構容易理解且提供足夠的方式以教示 本發明。然而本發明包含相稱於其他指令集架構的實施 例,例如:PowerPC、MIPS及諸如此類等,此外還有全 φ 新的指令集架構。 本發明更包含電腦系統中微處理器外其他元件之密 碼運算的執行,例如,根據本發明的密碼指令可以容易地 被應用在一密碼單元的一實施例,此實施例並非如微處理 器部分相同的整合電路,其執行方式如部分電腦系統。本 發明之如此的實施例係為了併入圍繞在微處理器的晶片 組(如北橋、南僑),或當一處理器用於執行密碼運算時, 其密碼指令係由主要微處理器移轉(hand off)給此處理 器。本發明可應用於内嵌控制器、工業控制器、信號處理 器、陣列處理器以及任何相似處理資料之裝置。本發明也 45 200536332 包含一實施例僅含有執行密碼運算所必需的元件。如此的 内嵌裝置不僅執行密碼運算,也確實提供低成本、低電 源,例如通信系統中的加密/解密處理器。為求簡明,本 發明將這些替代的處理元件參照成上述之處理器。 此外,雖然本發明提及128位元區塊,但是許多不 同區塊的大小可以透過改變暫存器的大小而被應用,其中 暫存器傳送輸入資料、輸出資料、鑰匙以及控制字組。 並且,雖然本應用顯著以資料加密標準、三重資料加 密標準以及進階加密鰾準演算法為其特徵,但本發明也包 含較少人知的區塊密碼演算法,例如:MARS密碼、 Rijndael 密碼、Twofish 密碼、Blowfish 密碼、Serpent 密碼以及RC6密碼。足以理解的是,本發明提供在微處 理器中用於區塊密碼的裝置及支援的演算法,其基元區塊 密碼運算可透過單一指令的執行而引動。 並且,雖然本發明在此以區塊密碼演算及其相關技術 以執行區塊密碼功能為特徵,但是除了區塊密碼之外其他 形式的密碼也包含於本發明應用範圍之内。可足以觀察的 是,提供一單一指令,藉此,使用者可指示一相稱的微處 理器執行一密碼運算,例如:加密或解密,其中微處理器 包含一密碼單元,此密碼單元依指示完成指令所指定的密 碼功能。 並且,在此所討論的回合引擎提供一兩階裝置可管線 處理兩區塊的輸入資料,但其他實施例也可考慮多於兩階 段裝置。階段的分配對支援更多輸入資料區塊的管線處 理,將發展協調相稱微處理器中其他階没的分配。 最後,雖然本發明具體討論支援複數個演算法之一單 獨密碼單元,但是本發明也提供理解在一相稱微處理器中 與其他執行單元並列操作_合的多密碼單元,而每一多密 46 200536332 碼單元係配置用以執行一具體指定的密碼演算,例如:一 第一單元係配置用以執行進階加密標準演算法、一第二單 元係配置用以執行資料加密標準演算法等。 以上所述僅為本發明之較佳實施例而已,並非用以限 定本發明之申請專利範圍;凡其他為脫離本發明所揭示之 精神下所完成之等效改變或修飾,均應包含在下述之申請 專利範圍。 【圖式簡單說明】 第一圖係現今密碼應用的方塊圖; 第二圖係執行密碼運算技術的方塊圖; 第三圖係本發明實施例中執行密碼運算之微處理器裝置 的方塊圖; 第四圖係本發明實施例中之基元(atomic)密碼指令實施 例的方塊圖; 第五圖係第四圖之基元密碼指令區塊加密模式欄位值之 範例的表格; 第六圖係本發明在x86相容微處理器中之密碼單元的方 塊圖, 第七圖係第六圖之微處理器中指示密碼次運算之範例微 指令搁位的方塊圖, 第八圖係第七圖之載入微指令暫存欄位值格式的表格; 第九圖係第七圖之儲存微指令暫存欄位值格式的表格; 第十圖係本發明指定密碼運算參數之控制字組格式範例 的方塊圖, 47 200536332 弟十一圖係弟十圖之控制子組資料大小獨值值的表格; 第十二圖係本發明之一較佳實施密碼單元的方塊圖; 第十三圖係本發明執行有關進階加密標準(AES)演算法密 碼運异之一區塊加密邏輯電路實施例的方塊圖; 第十四圖係本發明在一中斷事件期間保留密碼參數狀態 之方法流程圖;以及 / u 第十五圖係本發明在一或多個中斷事件時,在複數個輸入 資料區塊執行一密碼運算使用一使用者指定區塊大小之 _ 方法流程圖。 【主要元件符號說明】 100 電腦密碼應用之方塊圖 101、 102、103 電腦工作站 104 筆記型電腦 105 區域網路 106 網路檔案儲存裝置 107、 111 路由器 108 無線網路路由器 109 無線網路 110 廣域網路 112 加密/解密應用程式 200 密碼運算執行技術之方塊圖 201 微處理器 202 操作系統 203 應用記憶體 204 密碼输匙產生應用程式 205 鑰匙排程 206 加密應用程式 207 解密應用程式 208 初始向量 209 密碼參數 210 明文 43 200536332 211 密文[Circuit 1326 is also configured to perform its relative inverse white-quasi-quadratic operation during decryption by using the encryption / decryption bus (ENC / DEC +11 status indication). Those skilled in the art may know the M material It is returned to the round engine 1320 according to the encryption mode specified by the control block register 1302. The initial vector data (if required) is provided to the round engine 1320 through the ΝΕΤΙΝ bus 1318. In the embodiment shown in the figure, the round engine is divided into two stages. A first stage is between the first register (temporary_0) U22 and the second register (temporary-1) 1325 and a first register The second stage is between the second register (temporary — 1325 and the third register (temporary_2) 1327). The data of the middle round is synchronized _ clock signals (not shown) are processed in the pipeline between the stages. The round of the block = the second time completes the cryptographic operation, and its associated output data is placed in the corresponding round-out register 1307-1308. The execution of a stored micro-instruction makes the contents of the designated output register 1307-1308 provided to the storage Bus bar (not ^ please refer to the fourteenth figure, which is an implementation of the present invention For example, a flowchart of a method for preserving the state of password parameters during an interruption. When a micro-processing cry ^ 200536332 according to the present invention, an instruction flow is executed, the method flow starts from step 1402. The above instruction flow does not need to include something like this The password instruction described. Then the method flow is processed to decision step 1404. At decision step 1404, it is determined whether to process an interrupt event (such as a maskable interrupt, non-maskable interrupt) that requires the instruction stream to be changed by an instruction stream (interrupt handler). Mask interrupts, page faults, task switches, etc.) If yes, the method flow proceeds to step 1406; if not, the method flow skips to step 1404, and its instruction execution continues until an interrupt event occurs. Step 1406, because an interrupt event has occurred, before transmitting the control program to a corresponding interrupt handler, the interrupt logic circuit clears the X bit in a flag register according to the instructions of the present invention. The X bit clearing ensures the interruption from the interrupt When the handler returns, if a block cipher operation is in progress, it instructs to exclude at least one interrupt event and indicates The display control block data and key data must be reloaded before the input data block currently pointed to by the input index register is continued with the block password calculation. Then the process proceeds to step 1408. At step 1408, all architectures are temporarily stored. The device includes the relevant indexes and counts of the block cryptographic operation of the present invention and are stored in the memory. Those skilled in the art can know that the storage of the structure register is completed on the current data computing device before transferring control to the interrupt routine. Therefore, in an embodiment of the present invention, the current data structure is explored to provide transparency of the execution output volume of the interrupt event. After the temporary register is stored, the method flow proceeds to step 1410. In step 1410, the program flow is transferred to an interrupt handler. Therefore, the method flow proceeds to step 1412. At step 1412, the method flow is completed. Those skilled in the art may know that the method of FIG. 14 starts from step 1402 according to the return of the interrupt handler. 41 200536332 Please refer to the fifteenth figure, which is a flowchart of a method for performing a cryptographic operation on a plurality of input data blocks and using a user-specified block size when there is at least one interrupt event in a preferred embodiment of the present invention. 1500. For the sake of brevity, the process of performing the specified cryptographic operation according to the block cipher mode is omitted. The block cipher mode requires the update and storage of the initial vector equivalent between blocks (such as output feedback mode and password feedback mode). However, the method of the present invention includes other block cipher modes. The method flow starts from step 1502, wherein a cryptographic instruction according to the present invention instructs a cryptographic operation to begin. The above-mentioned cryptographic instruction execution can be executed first or after the first > execution is executed due to the interrupted execution of an interrupt event, thereby transferring program control back to the cryptographic instruction after the execution of the interrupt processing program is completed. The process proceeds to step 1504. In step 1504, a data block in the memory is loaded and a specified cryptographic operation is started, wherein the above-mentioned block data is specified by the content of the input index register according to an embodiment of the present invention. In one embodiment, the block size used to load the data blocks is 128 bits. Therefore, when the block size used is not 128 bits, before issuing a password instruction, the instruction must be executed to clear the X bits. In an x86 compatible embodiment, it utilizes the 30th bit in an x86 flag register. This X bit can be cleared by sequentially executing a PUSHFD instruction and a POPFD instruction. However, those skilled in the art will know that in another embodiment, there are other instructions for clearing X bits. In one embodiment, the specified cryptographic operation is performed according to the advanced encryption standard rules. The method flow then proceeds to decision step 1506. In decision step 1506, it is determined whether to set an X bit in a flag register. If the X bit is set, it indicates that the control word group and key schedule currently loaded into a cryptographic unit according to the present invention are valid. If the X bit is cleared, it indicates that the control word of the above-mentioned cryptographic unit is currently loaded. 42 200536332 Group and key scheduling are invalid. As discussed above with reference to Figure 14, when an interrupt event occurs, the X bit is cleared. If the X-bit system is set, the method flow proceeds to step 1524; if the X-bit system is cleared, the method flow proceeds to step 1508. At step 1508, because a clear X bit indicates that either an interrupt event was generated or a new control word and / or key data was loaded, a control word is loaded from memory. In one embodiment, the loading control block stops the cryptographic unit from performing the cryptographic operations mentioned in step 1504 above. Step 1504 in this embodiment starts a cryptographic calculation, taking into account the optimization of multiple 128-bit blocks using the electronic codebook mode, which is based on the assumption that the currently loaded control word and key data are used , And assuming that the implementation of the electronic codebook mode in a 12-bit input block is the most commonly used block cipher mode. According to the above, before determining the reset of the X bit in the decision step 1506, the current input data block is loaded and the password operation is started. The method flow then proceeds to decision step 1514. In decision step 1514, the data block size block in the retrieved control block in step 1508 is evaluated to determine the size of the input and output text blocks used during the execution of the specified cryptographic operation. If the value of the data block size field specifies a 192-bit block, then the method flow proceeds to step 1510. If the value of the size of the tribute block specifies a 128-bit block, the method flow proceeds to step 1516. If the value of the size block of the tribute block specifies a 256-bit block ', the method flow proceeds to step 1518. In step 1510, the block size bus in the block password stitching circuit of the present invention is set to instruct its round engine to perform a cipher operation of a 192-bit data block. The method flow then proceeds to step 1512. At step 1512, the cryptographic key data is loaded from the memory. According to the status of the remaining key generation field and the key size field in the control word group, the key asset 43 200536332 ~ 佞, the user generates a key row—the remaining key schedule. Then, the “not” part is loaded from the memory (for example:,), which is to carry an initial key and expand it into the process of processing to step 1522. At step 1516, because the block password logic bus is preset For the 128-bit data = the block size in step 1512, the block is described, so you must load / expand the secret purchase material by referring to the above process to = 2. Then, in step 1518, the block cipher logic of the present invention is The small bus is set to instruct its turn engine to perform the cryptographic operation of the 256 ^^^ data block. Then the method flow is processed to step ⑸〇, step 152, refer to the loading described in step 1S12 above. / Extend the fork code key data. Then the method flow is processed to step 1522. ^ Step 1518, the input block is referenced in step 1504, and the block size specified by the control and the block size block value of the medium material is reloaded ^, And start the password operation according to the newly loaded control word group and key schedule. Then the method proceeds to step 1524. In step 1524, an output block corresponding to the loaded input block is generated. In terms of encryption, The input block is a plaintext block and the output block is a corresponding ciphertext block. For decryption, the input block is a ciphertext block and the rotation block is a corresponding plaintext block. Then the method The process is processed to step 1526. At step 1526, the generated output block is stored in the memory. Then the method process is processed to step 1528. At step 1528, the content of the input and output block index register is based on the data in the control block. The value of the block size block is modified to refer to the next input and rotation of the data block. In addition, the content of the block count register is modified to indicate the current cryptographic operation of the input data block. Refer to the fifteenth 44 200536332 In one embodiment discussed in the figure, the block count register is decremented. However, those skilled in the art can consider and process the content of the block count register to consider the input text in another embodiment. The pipeline of the block is executed. Then the method flow is processed to step 1530. At decision step 1530, it is decided whether to continue to calculate an input data block. In the embodiment for describing the characteristics, the evaluation area is evaluated. It is determined whether the block counter is equal to zero. If there are no remaining blocks available for operation, the method flow is processed to step 1534; if there are remaining blocks available for operation, the method flow is processed to step 1532. g In step 1532, load The next input data block is as indicated by the content of the input indicator register. Then the method flow is processed to step 1524. At step 1530, the method flow is completed. Although the present invention and its objects, features and advantages have been described in detail, However, other embodiments should also be included in the present invention. For example, the present invention has discussed length according to embodiments compatible with the x86 architecture, but these discussions have provided such a way because the x86 architecture is easy to understand and provides enough ways to teach this invention. However, the present invention includes embodiments commensurate with other instruction set architectures, such as: PowerPC, MIPS, and the like, as well as a new instruction set architecture with a full φ. The present invention further includes the execution of cryptographic operations of other components outside the microprocessor in the computer system. For example, the cryptographic instructions according to the present invention can be easily applied to an embodiment of a cryptographic unit. This embodiment is not as a microprocessor part. The same integrated circuit is implemented in some computer systems. Such an embodiment of the present invention is to incorporate a chipset (such as Northbridge, Nanqiao) surrounding a microprocessor, or when a processor is used to perform cryptographic operations, its cryptographic instructions are transferred by the main microprocessor ( hand off) to this processor. The invention can be applied to embedded controllers, industrial controllers, signal processors, array processors, and any similar devices that process data. The present invention also includes an embodiment that includes only components necessary for performing cryptographic operations. Such embedded devices not only perform cryptographic operations, but also provide low cost, low power, such as encryption / decryption processors in communication systems. For brevity, the present invention refers to these alternative processing elements as the aforementioned processors. In addition, although the present invention refers to 128-bit blocks, the size of many different blocks can be applied by changing the size of the register, where the register transmits input data, output data, keys, and control words. And, although this application is significantly characterized by data encryption standards, triple data encryption standards, and advanced encryption / quasi-algorithms, the present invention also includes less-known block cipher algorithms, such as MARS ciphers, Rijndael ciphers, Twofish password, Blowfish password, Serpent password, and RC6 password. It is well understood that the present invention provides a device and a supported algorithm for block ciphers in a microprocessor, and the primitive block cipher operations can be initiated by the execution of a single instruction. Moreover, although the present invention is characterized by the implementation of the block cipher algorithm and its related technology here, other forms of passwords besides the block cipher are also included in the scope of application of the present invention. It is sufficient to observe that a single instruction is provided, whereby the user can instruct a corresponding microprocessor to perform a cryptographic operation, such as encryption or decryption. The microprocessor includes a cryptographic unit, and the cryptographic unit is completed according to the instructions. The password function specified by the instruction. Moreover, the round engine discussed here provides a two-stage device that can pipeline input data of two blocks, but other embodiments may also consider more than two-stage devices. The allocation of phases to pipeline processing that supports more blocks of input data will develop and coordinate the allocation of other phases in a symmetric microprocessor. Finally, although the present invention specifically discusses supporting a single cryptographic unit of a plurality of algorithms, the present invention also provides multiple cryptographic units that are understood to operate side-by-side with other execution units in a symmetric microprocessor. The 200536332 code unit is configured to perform a specific cryptographic calculation, for example: a first unit is configured to perform an advanced encryption standard algorithm, a second unit is configured to perform a data encryption standard algorithm, and the like. The above is only a preferred embodiment of the present invention, and is not intended to limit the scope of patent application of the present invention; all other equivalent changes or modifications made without departing from the spirit disclosed by the present invention shall be included in the following The scope of patent application. [Schematic description] The first diagram is a block diagram of a current cryptographic application; the second diagram is a block diagram of a cryptographic operation technique; the third diagram is a block diagram of a microprocessor device that performs a cryptographic operation in the embodiment of the present invention; The fourth figure is a block diagram of an embodiment of an atomic cryptographic instruction in the embodiment of the present invention; the fifth figure is a table of an example of the field encryption mode block value of the primitive cryptographic instruction of the fourth figure; the sixth figure It is a block diagram of a cryptographic unit in an x86-compatible microprocessor of the present invention. The seventh diagram is a block diagram of an example microinstruction stall indicating a cryptographic operation in the microprocessor of FIG. 6. The eighth diagram is the seventh. Figure 9 is a table for loading the micro-instruction temporary field value format; Figure 9 is a table for storing the micro-instruction temporary field value format in Figure 7; Figure 10 is an example of a control block format for specifying a password operation parameter of the present invention. Block diagram, 47 200536332 The eleventh figure is a table of unique values of the control subgroup data size of the tenth figure; the twelfth figure is a block diagram of a preferred implementation of the cryptographic unit of the present invention; the thirteenth figure is the present invention Execute there A block diagram of an embodiment of the Advanced Encryption Standard (AES) algorithm cryptographic cryptographic block encryption logic circuit embodiment; the fourteenth figure is a flowchart of a method for preserving the state of cryptographic parameters during an interruption event of the present invention; and The fifteenth figure is a flowchart of a method for performing a cryptographic operation on a plurality of input data blocks using a user-specified block size during one or more interrupt events of the present invention. [Description of main component symbols] 100 Block diagram of computer password application 101, 102, 103 Computer workstation 104 Notebook computer 105 Local area network 106 Network file storage device 107, 111 Router 108 Wireless network router 109 Wireless network 110 Wide area network 112 Encryption / Decryption Application 200 Block Diagram of Cryptographic Operation Technology 201 Microprocessor 202 Operating System 203 Application Memory 204 Password Key Generation Application 205 Key Schedule 206 Encryption Application 207 Decryption Application 208 Initial Vector 209 Password Parameters 210 plaintext 43 200536332 211 ciphertext

300 301 303 305 307 309 311 313 315 317 319 321 323 324 325 327 400 402 404 執行密碼運算微處理器 微處理器 轉譯邏輯電路 儲存指令 暫存器組 餘起指標 輸入文字指標 區塊計數 資料快取 儲存邏輯電路 記憶體匯流排 系統記憶體 密碼控制字組 之方塊圖 302 掏取邏輯電路 304 微指令彳宁列 306 載入指令 308 控制字組指標 310 初始向量指標 312 輪出文字指標 314 載入邏輯電路 316 密碼單元 318 寫回邏輯電路 320 操作系統 322 密碼指令 初始密碼鑰匙或鑰匙排程 初始向量 輸出文字 密碼指令 重複前置攔位 區塊密碼模式攔位 326 328 401 輸入文字 執行邏輯電路 選項前置攔位 運算碼欄位 500 600 602 區塊密碼模式欄位值之表格 微處理器 轉譯邏輯電路 擷取邏輯電路 轉譯器 49 200536332 609、611、613、615 微佇列300 301 303 305 307 309 311 313 315 317 319 321 323 324 325 327 400 402 404 Execute cryptographic operation microprocessor microprocessor translation logic circuit storage instruction register group remaining index input text indicator block count data cache storage Logic circuit block diagram of the memory password control block of the memory bus system 302 Draw logic circuit 304 Microinstruction 彳 Column 306 Load instruction 308 Control block index 310 Initial vector index 312 Round-out text index 314 Load logic circuit 316 password unit 318 write back logic circuit 320 operating system 322 password instruction initial password key or key schedule initial vector output text password instruction repeat pre-block block block password mode block 326 328 401 enter text to execute logic circuit option pre-block Bit Opcode Field 500 600 602 Table of Block Password Mode Field Values Microprocessor Translation Logic Circuit Extraction Logic Circuit Translator 49 200536332 609, 611, 613, 615 micro-queue

載入微指令暫存器欄位值之表格 儲存微指令暫存器欄位值之表格 605 暫存階段 607 載入階段 612 浮點單元 616 串流延伸集單元 618 儲存階段 620 載入匯流排 622 儲存匯流排 625 X位元 627 中斷信號 629 E位元 631 D位元 634 匯流排 700 微指令 702 資料暫存器攔位 604 微碼唯讀記憶體 606 定址階段 608 執行階段 610 整數單元 614 多媒體延伸集單元 617 密碼單元 619 寫回階段 621 暫停信號匯流排 624 旗標暫存器 626 中斷邏輯電路 628 機器特殊暫存器 630 特徵控制暫存器 632 執行邏輯電路 640 鑰匙產生邏輯電路 7〇1 微運算碼攔位 703 暫存器欄位 800 900 1000控制字組格式 1002資料區塊大小欄位 1004加密/解密欄位 1006鑰匙產生欄位 1〇〇1保留欄位 1003鍮匙大小欄位 1005中間結果欄位 1007演算欄位 50 200536332 1008回合計算欄位 11〇〇資料區塊大小欄位值之表格Load the table of microinstruction register field values Store the table of microinstruction register field values 605 Staging stage 607 Loading stage 612 Floating point unit 616 Streaming extension unit 618 Storage stage 620 Loading bus 622 Storage bus 625 X-bit 627 Interrupt signal 629 E-bit 631 D-bit 634 Bus 700 Microinstruction 702 Data register block 604 Microcode read-only memory 606 Addressing phase 608 Execution phase 610 Integer unit 614 Multimedia extension Set unit 617 Password unit 619 Write back stage 621 Suspend signal bus 624 Flag register 626 Interrupt logic circuit 628 Machine special register 630 Feature control register 632 Execute logic circuit 640 Key generation logic circuit 701 Micro operation Code block 703 Register field 800 900 1000 Control block format 1002 Data block size field 1004 Encryption / decryption field 1006 Key generation field 1001 Reserved field 1003 Key size field 1005 Intermediate result Field 1007 Calculation field 50 200536332 1008 Round calculation field 1 100 Data block size field value table

1200密碼單元 1201 區塊密碼邏輯電路 1202鑰匙隨機存取記憶體 1203 微指令暫存為 1204控制字組暫存器 1205 、1206輸入暫存器 1207、1208 鑰匙暫存器 1209 、1210輸出暫存器 1211載入匯流排 1212 儲存匯流排 1213暫停信號 1214 微指令匯流排 1300區塊密碼邏輯電路之方塊圖 1301微指令暫存器 1302 控制字組暫存器 1303、1304 输匙暫存器 1305 、1306輸入暫存器 1307、1308 輸出暫存器 1310 回合引擎控制器 1311加密/解密匯流排 1312 回合計算匯流排 1313鑰匙匯流排 1314 鑰匙產生匯流排 1315鑰匙隨機存取記憶體匯流排 1316、1317 匯流排 1318 NEXTIN匯流排 1319區塊大小匯流排 1320 回合引擎 1321第一鑰匙互斥或邏輯電路 1322第一暫存器 1323 S-BOX邏輯電路 1324移列邏輯電路 1325 第二暫存器 1326混欄邏輯電路 1327 第三暫存器 1402開始 1404 中斷? 1406清除X位元 1408 儲存架構暫存器 51 200536332 1410 處理中斷 1412 結束 1502 開始 1504 載入輪入區塊(預設) 並開始 1506 X位元是否設定? 1508 載入控制字組並重置 1510 設定192位元區塊回合引擎 1512 載入/擴展餘匙排程 1514 資料區塊大小? 1516 載入/擴展鑰匙排程 1518 設定256位元區塊回合引擎 1520 載入/擴展鑰匙排程 1522 載入輸入區塊(再次) 並開始 1524 產生輸出區塊 1526 儲存輸出區塊至記憶體 1528 更新區塊計數及指標 1530 區塊計數是否為零? 1532 載入輸入區塊並開始 1534 結束 521200 password unit 1201 block password logic circuit 1202 key random access memory 1203 micro instructions are temporarily stored as 1204 control block register 1205, 1206 input register 1207, 1208 key register 1209, 1210 output register 1211 loading bus 1212 storage bus 1213 pause signal 1214 block diagram of the microinstruction bus 1300 block password logic circuit 1301 microinstruction register 1302 control block register 1303, 1304 key register 1305, 1306 Input register 1307, 1308 output register 1310 round engine controller 1311 encryption / decryption bus 1312 round calculation bus 1313 key bus 1314 key generation bus 1315 key random access memory bus 1316, 1317 bus 1318 NEXTIN bus 1319 block size bus 1320 round engine 1321 first key mutex or logic circuit 1322 first register 1323 S-BOX logic circuit 1324 shift logic circuit 1325 second register 1326 mixed column logic circuit 1327 Third register 1402 starts 1404 interrupt? 1406 Clear X bit 1408 Storage architecture register 51 200536332 1410 Processing interrupt 1412 End 1502 Start 1504 Load the rotation block (default) and start 1506 Is the X bit set? 1508 Load control word and reset 1510 Set 192-bit block round engine 1512 Load / extend spare key schedule 1514 Data block size? 1516 Load / Expand key schedule 1518 Set 256-bit block turn engine 1520 Load / Expand key schedule 1522 Load input block (again) and start 1524 Generate output block 1526 Save output block to memory 1528 Update block count and indicator 1530 Is the block count zero? 1532 Load input block and start 1534 End 52

Claims (1)

200536332 十、申請專利範圍·· 1·一種執行密碼運算之裝置,包含·· 一密碼指令電路,用以產生一资 算裝置接收並將其各忐劫馬扣令,該密碼指令係由一計 分,其中該密碼指令指定叶算裝々置之一指令流之-部 料區塊大小其中之一;以^进碼運算其中之-及複數個資 一執彳于邏輯電路,操作搞人 執行被指定之密碼運算,;df令電路,並且係配置用以 以使雜指定之資料iitr费碼運算執行期間,係配置用 1項所述之裝置,其中該密碼運算更包含: 文=密運算包含複數個明文區塊之加密以產生相 3·如2所述之妓,其中該密碼運算更包含: 山“解雄、運异包含複數個密文區塊之解密,以產生 相對複數個明文區塊。 兄颂山以屋生 4·1^ί8^财1項所述之妓,射被指定資料區塊大小係 5. 如包丨顿述之裝置,其巾翻_镜塊大小係 6. 如申細第〗項氣之妓,其巾被奴㈣區塊大小係 包含256位7〇。 7. 如申請專利範圍第〗項所述之裝置,其巾贿 加密標準之規則執行。 8·如柄狀妓,財麵獻倾制器係配 置用以轉澤由該岔碼指令所芩照之一控制字組中之一資料區塊 大小襴位。 、 9.如申請專利範圍第丨項所述之裝置,其中該密碼指令係依據χ86 53 200536332 指令格式指定。 裝置,射贿碼齡係隱含參 11.如申請專利範圍第1G項所述之裝置,其中該些暫 -第-暫存器’其中該第-暫存器之内容係包含指向°° 位,之-第-指標,該第—記憶體位址係依 被 指定之密碼運算指定記憶體内一第一位置以存取複數=入= 該些輸人文字區塊之大小係依據被敏之資料 小而&疋0 12·如申請專利範圍第10項所述之裝置,其中該些暫存 二第二暫存器:其中該第二暫存器之内容係包含指向一第二記 憶體位址之-第二指標,該第二記憶體位址指定記憶體内一^ 複數個輸出文字區塊,相對該些輸出文字區 塊係依據_個輸人文字區塊完成被指定之密碼運算 該些輸出文字區塊之大顯^ 131圍第1G項所述之裝置,其中該些暫存器包含: 個?:該第三暫存器之内容係指示複數健入文 :===設ί中該些輸入文字區塊之大小係依據被 14.如=請專繼_ 1G項所述之 其中該第四暫存器之内容係包一含指向°一第三記 ㊁第三記憶體位址指定記憶體内一第 !馬鑰畦貧料以用於完成被指定之密碼運算。 第酬叙駭,其找些料器包含: 憶L:i:第第=存器之内容係包含指向-第四記 ㈣☆番姑狄 知軚,該弟四記憶體位址指定記憶體内一第 勺入二弟包含一初始向量位置’該初始向量位置之 合匕3初口π里或一初始向量等效物以用於完成被指定之 200536332 密碼運算。 16 圍ί ΓΛ所述之裝置,其中該些暫存器包含: 情體位址之:知六暫存11之内容係包含指向一第五記 ^置以概ίϋ日ΐ ’該第五記憶體位址指定記憶體内一第 該控制字組包 辦制字妙—if字組以用於完成被指定之密碼運算,其中 人控制予、、且扣疋被指定之密碼運算之密碼參數, 3 ·200536332 10. Scope of patent application 1. A device for performing cryptographic operations, including a cryptographic instruction circuit, used to generate a computing device to receive and rob each of them. The cryptographic instruction is composed of The password instruction specifies one of the instruction block's one of the instruction stream's-part block size; calculates it with a ^ code-and a plurality of assets are executed on the logic circuit, and the operation is performed by a person. The specified cryptographic operation; df makes the circuit, and is configured to make the miscellaneous specified data iitr fee code operation during the implementation of the device described in item 1, wherein the cryptographic operation further includes: text = cryptographic operation Encryption of a plurality of plaintext blocks to generate a prostitute as described in phase 3, wherein the cryptographic operation further includes: "Unlocking the Heroes, Dissimilarity Contains Decryption of a plurality of ciphertext blocks to generate relatively plural plaintexts Block. Brother Songshan used the prostitute described in item 1 in the housing 4 · 1 ^ ί8 ^ Cai to shoot the designated data. The block size is 5. If the device described in the package is described, its towel is _ mirror block size is 6 . As a prostitute in item No. 〖, the quilt ㈣The block size is 256 bits 70. 7. As for the device described in the scope of the patent application, the rules for the encryption standard of bribes are implemented. 8. If a prostitute is used, it is used for configuration. The size of a data block in one of the control blocks is reflected by the translation code instruction. 9. The device according to item 丨 of the patent application scope, wherein the password instruction is based on the χ86 53 200536332 instruction The format is specified. The device and the bribe code age are implied. 11. The device as described in item 1G of the patent application scope, wherein the temporary-number-registers are included. °° bit, the -th-indicator, the first-memory address is calculated according to the specified cryptographic operation to specify a first position in the memory to access the plural = input = the size of the input text blocks is determined by Min's information is small and & 疋 0 12 · The device as described in item 10 of the scope of patent application, wherein the two temporary registers are stored in the second register: wherein the content of the second register includes a pointer to a second memory -The second index of the body address, the second memory address refers to ^ A plurality of output text blocks in the memory. Relative to these output text blocks, the specified password calculation is performed according to _ input text blocks. The device described above, wherein the registers include:?: The content of the third register is indicative of a plural number of entries: === Let the size of the input text blocks in the system be based on 14. = Please follow the _ 1G, where the content of the fourth register contains a pointer to a third record, the third memory address specifies the first memory in the memory! Completion of the specified cryptographic calculations. The first reward is narrative, and its finders include: Recall L: i: 第 = Register The content of the register contains the pointing-fourth note 番 Fangu Dizhi 軚, the brother's four memories The first and second brothers in the body address designation memory include an initial vector position 'the initial vector position, or the initial vector equivalent, which is used to complete the specified 200536332 cryptographic operation. 16 The device described in ΓΛΛ, where the registers include: The address of the emotional body: Knowing the content of temporary storage 11 refers to pointing to a fifth record ^ set to summarize the date ΐ 'the fifth memory address The first control word group in the designated memory organizes the word magic—if word group is used to complete the specified password operation, in which the person controls the password parameters of the specified password operation, and 3 · =區用以鳩翻定之細算執 17·ΐ·:= 1項所述之執行密碼運算之裝置’其中該執 二’配置用以在每—輸人文字區塊執行複數個密碼回 產生母—相對輪出文字區塊,其中被指定之資料區塊大小 18·—種執行密碼運算之裝置,包含·· 元件内之一密碼單元,該密碼單元係配置用以執行複數個 ,運算其中之一,回應接收一指令流内一密碼指令,該密碼指 々係,一密碼指令電路所提供,而該密碼指令指定被指定之密 碼運算,以及在執行被指定之密碼運算時指定欲使用之一區塊 大小;以及 一區塊大小邏輯電路,操作耦合於該密碼單元,用以在被指定 之您碼運异期間’指定該元件來使用該區塊大小。 19·如申請專利範圍第18項所述之裝置,其中被指定之區塊大小係 包含128位元。 2〇·如申請專利範圍第18項所述之裝置,其中被指定之區塊大小係 包含192位元。 21 ·如申請專利範圍第18項所述之裝置,其中被指定之區塊大小係 包含256位元。 55 200536332 22.如申請專利範圍第18項所述 a 依據進階加密標準之規則執彳_衣置、、T被扎疋之铪螞運算係 23·如申請專利範圍第18項所▲丁之 係配置用以轉譯該密碼指人^置、、中該^塊^小遷輯電路 塊大小欄位、 7 h、?'之一控制字組中之一咨封& 24·如申請專利範圍第18項 x86指令格式所指定。 衣置,/、中該始、碼私令係依據 25·-種在-裝置執補碼運算之方法,包含· 指定之密碼運算時,使馳指定之資料區塊大小。 第25項所述之方法,其中該接收包含’ 控制字組係由該密碼指令所參照。 、竹匕兄人】/、中該 27.如申請專概圍第26顧述之方法,其中該指定包含: 指定128位元為被指定之資料區塊大小。 28·如申請專利範圍第26項所述之方法,其中該指定包含: 指定192位元為被指定之資料區塊大小。 29·如申請專利範圍第26項所述之方法,其中該指定包含: 指定256位元為被指定之資料區塊大小。 30·如申請專利範圍第25項所述之方法,其中該使用包含: 執行被指定之密碼運算係依據進階加密標準之規則。 31·如申請專利範圍第25項所述之方法,其中該接收包含: 指定該密碼指令係依據χ86指令格式。 56= District used to do the calculation of the calculation 17 · 17 ·: = The device for performing cryptographic operations described in item 1 'where the execution two' is configured to execute multiple passwords in each input text block to generate a mother —Relative text block, in which the specified data block size is 18 · —A device for performing cryptographic operations, including one of the cryptographic units in the component, the cryptographic unit is configured to execute a plurality of First, in response to receiving a cryptographic instruction in a command stream, the cryptographic reference is provided by a cryptographic instruction circuit, and the cryptographic instruction specifies a designated cryptographic operation, and specifies one of the to-be-used when performing the designated cryptographic operation. Block size; and a block size logic circuit operatively coupled to the cryptographic unit to 'designate' the component to use the block size during the designated period during which your code is shipped. 19. The device according to item 18 of the scope of patent application, wherein the specified block size includes 128 bits. 20. The device described in item 18 of the scope of patent application, wherein the specified block size includes 192 bits. 21 • The device as described in item 18 of the scope of patent application, wherein the specified block size includes 256 bits. 55 200536332 22. As described in item 18 of the scope of patent application a. Implementation according to the rules of the advanced encryption standard It is configured to translate the password refers to the setting of the password, the size of the circuit block, the size of the circuit block, 7 h, and one of the control words in the control block. 24. If the scope of patent application Item 18 specifies the x86 instruction format. Clothing, / ,,,,,,,, and the code privacy order are based on 25 ·-a method of performing complement code calculations on the-device, including the specified data block size when the specified password operation is performed. The method according to item 25, wherein the reception contains a 'control block' which is referred to by the cryptographic command. [Bamboo dagger] /, the 27. If you apply for the method described in Section 26 Gu, the designation includes: Designating 128 bits as the specified data block size. 28. The method according to item 26 of the scope of patent application, wherein the designation includes: designating 192 bits as the designated data block size. 29. The method according to item 26 of the scope of patent application, wherein the designation includes: designating 256 bits as the designated data block size. 30. The method according to item 25 of the scope of patent application, wherein the use includes: performing a specified cryptographic operation in accordance with the rules of an advanced encryption standard. 31. The method according to item 25 of the scope of patent application, wherein the receiving includes: specifying that the password instruction is based on the x86 instruction format. 56
TW094107792A 2004-04-16 2005-03-15 Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine TWI264911B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US10/826,433 US7519833B2 (en) 2003-04-18 2004-04-16 Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine

Publications (2)

Publication Number Publication Date
TW200536332A true TW200536332A (en) 2005-11-01
TWI264911B TWI264911B (en) 2006-10-21

Family

ID=35007823

Family Applications (1)

Application Number Title Priority Date Filing Date
TW094107792A TWI264911B (en) 2004-04-16 2005-03-15 Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine

Country Status (2)

Country Link
CN (1) CN1658548B (en)
TW (1) TWI264911B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI406150B (en) * 2005-12-23 2013-08-21 Nagravision Sa Secure system-on-chip

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI409644B (en) * 2007-11-02 2013-09-21 Tatung Co Ltd Data encryption / decryption control method and its circuit

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10061998A1 (en) * 2000-12-13 2002-07-18 Infineon Technologies Ag The cryptographic processor

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI406150B (en) * 2005-12-23 2013-08-21 Nagravision Sa Secure system-on-chip

Also Published As

Publication number Publication date
TWI264911B (en) 2006-10-21
CN1658548B (en) 2010-09-15
CN1658548A (en) 2005-08-24

Similar Documents

Publication Publication Date Title
TWI303936B (en) Apparatus and method for generating a cryptographic key schedule in a microprocessor
US7321910B2 (en) Microprocessor apparatus and method for performing block cipher cryptographic functions
EP1596530B1 (en) Apparatus and method for employing cryptographic functions to generate a message digest
US7844053B2 (en) Microprocessor apparatus and method for performing block cipher cryptographic functions
US7532722B2 (en) Apparatus and method for performing transparent block cipher cryptographic functions
EP1519509B1 (en) Apparatus and method for providing user-generated key schedule in a microprocessor cryptographic engine
US7392400B2 (en) Microprocessor apparatus and method for optimizing block cipher cryptographic functions
US7502943B2 (en) Microprocessor apparatus and method for providing configurable cryptographic block cipher round results
US7529368B2 (en) Apparatus and method for performing transparent output feedback mode cryptographic functions
US7536560B2 (en) Microprocessor apparatus and method for providing configurable cryptographic key size
US7900055B2 (en) Microprocessor apparatus and method for employing configurable block cipher cryptographic algorithms
US7542566B2 (en) Apparatus and method for performing transparent cipher block chaining mode cryptographic functions
US7519833B2 (en) Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine
CN1661958B (en) Microprocessor apparatus of block cryptographic functions and method
TW200536332A (en) Microprocessor apparatus and method for enabling configurable data block size in a cryptographic engine
US7529367B2 (en) Apparatus and method for performing transparent cipher feedback mode cryptographic functions
TWI247241B (en) Microprocessor apparatus and method for performing block cipher cryptographic functions
TW200536335A (en) Apparatus and method for performing transparent cipher feedback mode cryptographic functions
CN100527664C (en) Microprocessor apparatus and method for optimizing block cipher cryptographic functions
TW200536330A (en) Apparatus and method for performing transparent output feedback mode cryptographic functions