TWI804439B - Apparatus and method for detecting errors during data encryption - Google Patents

Apparatus and method for detecting errors during data encryption Download PDF

Info

Publication number
TWI804439B
TWI804439B TW111137123A TW111137123A TWI804439B TW I804439 B TWI804439 B TW I804439B TW 111137123 A TW111137123 A TW 111137123A TW 111137123 A TW111137123 A TW 111137123A TW I804439 B TWI804439 B TW I804439B
Authority
TW
Taiwan
Prior art keywords
key
parity
circuit
bit
small
Prior art date
Application number
TW111137123A
Other languages
Chinese (zh)
Other versions
TW202326433A (en
Inventor
吳溫哲
陳柏宏
鄭巧雯
余俊宏
劉志尉
Original Assignee
慧榮科技股份有限公司
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
Application filed by 慧榮科技股份有限公司 filed Critical 慧榮科技股份有限公司
Application granted granted Critical
Publication of TWI804439B publication Critical patent/TWI804439B/en
Publication of TW202326433A publication Critical patent/TW202326433A/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0816Key establishment, i.e. cryptographic processes or cryptographic protocols whereby a shared secret becomes available to two or more parties, for subsequent use
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0863Generation of secret information including derivation or calculation of cryptographic keys or passwords involving passwords or one-time passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/088Usage controlling of secret information, e.g. techniques for restricting cryptographic keys to pre-authorized uses, different access levels, validity of crypto-period, different key- or password length, or different strong and weak cryptographic algorithms
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Storage Device Security (AREA)
  • Detection And Correction Of Errors (AREA)
  • Error Detection And Correction (AREA)

Abstract

The invention relates to an apparatus and a method for detecting errors during data encryption. The apparatus includes: key generation circuitry; and key error-detection circuitry. The key generation circuitry is arranged operably to realize a expand-key operation in an encryption algorithm, which uses a root key to generate multiple round keys, where the encryption algorithm uses one round key to encode plaintext or encryption intermediate in each corresponding round. The key error-detection circuitry is arranged operably to predict redundant data corresponding to each round key, and issue an error signal when detecting that any round key does not match corresponding redundant data. With the arrangement of key error-detection circuitry, the error detection can be achieved by circuitry smaller than the key generation circuitry.

Description

資料加密的錯誤偵測裝置及方法 Error detection device and method for data encryption

本發明涉及資料加密,尤指一種資料加密的錯誤偵測裝置及方法。 The present invention relates to data encryption, in particular to an error detection device and method for data encryption.

由於現在的儲存裝置(例如,NAND閃存)常用來儲存系統程式碼、應用程式碼、驅動程式和使用者的隱私資料等,因此資料安全性是重要議題。高級加密標準(Advanced Encryption Standard,AES)是目前由美國聯邦政府採用的一種區塊加密標準,並且已經被多方驗證且廣為採用。然而,AES運作的過程中可能遭到惡意的攻擊,而讓AES編碼器錯誤的產生運算結果。或者是,晶片製作過程中有些暇疵,使得AES編碼器在運行一段時間後會產生不預期的運算結果。或者是,儲存裝置處在惡劣的環境下,讓AES編碼器中的部分元件失能而產生不預期的運算結果。錯誤的加密過程將使原始的使用者資料無法回復,造成巨大的損失。因此,本發明提出一種資料加密的錯誤偵測裝置及方法,避免寫入錯誤的加密後資料到儲存裝置。 Since current storage devices (eg, NAND flash memory) are commonly used to store system codes, application codes, drivers, and user privacy data, etc., data security is an important issue. Advanced Encryption Standard (AES) is a block encryption standard currently adopted by the US federal government, and has been verified by multiple parties and widely adopted. However, malicious attacks may occur during the operation of AES, and the AES encoder may generate incorrect calculation results. Or, there are some defects in the chip manufacturing process, so that the AES encoder will produce unexpected calculation results after running for a period of time. Or, the storage device is in a harsh environment, which causes some components in the AES encoder to fail and produce unexpected calculation results. Wrong encryption process will make the original user data irrecoverable, resulting in huge losses. Therefore, the present invention proposes a data encryption error detection device and method to avoid writing wrong encrypted data to the storage device.

有鑑於此,如何減輕或消除上述相關領域的缺失,實為有待解決的問題。 In view of this, how to alleviate or eliminate the deficiencies in the above-mentioned related fields is a problem to be solved.

本說明書涉及一種資料加密的錯誤偵測裝置,包含:密鑰產生電路;和密鑰錯誤檢查電路。密鑰產生電路,設置以實現加密演算法中的擴展密鑰操作,用於使用基礎密鑰產生多個回合密鑰,其中,所述加密演算法使用一個所述回合密鑰在相應回合中對明文或者中間加密結果進行編碼。密鑰錯誤檢查電路設置以預測出相應於每個回合 密鑰的冗餘資料;並且在擴展密鑰過程中的指定中間點發現任何回合密鑰和相應冗餘資料不匹配時,發出錯誤訊號給處理單元。 This specification relates to an error detection device for data encryption, including: a key generating circuit; and a key error checking circuit. a key generation circuit configured to implement extended key operations in an encryption algorithm for generating a plurality of round keys using a base key, wherein the encryption algorithm uses one of the round keys in a corresponding round to Encode plaintext or intermediate encrypted results. The key error checking circuit is set to predict the corresponding Redundant data of the key; and sending an error signal to the processing unit when any round key and corresponding redundant data are found not to match at a specified intermediate point in the process of expanding the key.

本說明書另涉及一種資料加密的錯誤偵測裝置,包含:搜索電路;和替代校驗電路。搜索電路設置以依據查找表將輸入的相應於回合密鑰的1個位元組的第一值轉換為第二值。替代校驗電路設置以使用相應於查找表的公式判斷第一值轉換為第二值的過程中是否發生錯誤,以及當發現錯誤時,發出錯誤訊號。 This specification also relates to an error detection device for data encryption, which includes: a search circuit; and a replacement verification circuit. The search circuit is configured to convert the input first value corresponding to 1 byte of the round key into a second value according to the look-up table. The replacement verification circuit is configured to use a formula corresponding to the look-up table to determine whether an error occurs during the process of converting the first value into the second value, and when an error is found, an error signal is sent.

上述實施例的優點之一,通過以上所述密鑰錯誤檢查電路的設置,可利用比密鑰產生電路較少面積的電路來完成錯誤偵測。 One of the advantages of the above-mentioned embodiment is that by setting the above-mentioned key error checking circuit, the error detection can be completed with a circuit with a smaller area than the key generation circuit.

本發明的其他優點將搭配以下的說明和圖式進行更詳細的解說。 Other advantages of the present invention will be explained in more detail with the following description and drawings.

10:電子裝置 10: Electronic device

110:主機端 110: Host side

130:閃存控制器 130: Flash memory controller

131:主機介面 131: host interface

132:匯流排 132: busbar

134:處理單元 134: processing unit

136:隨機存取記憶體 136: random access memory

137:高級加密標準編碼器 137: Advanced Encryption Standard Encoder

138:直接記憶體存取控制器 138: Direct memory access controller

139:閃存介面 139: Flash interface

150:閃存模組 150: Flash memory module

151:介面 151: interface

153#0~153#15:NAND閃存單元 153#0~153#15: NAND flash memory unit

CH#0~CH#3:通道 CH#0~CH#3: channel

CE#0~CE#3:致能訊號 CE#0~CE#3: enable signal

R#0:初始回合 R#0: Initial round

R#1~R#9:中間回合 R#1~R#9: Middle round

R#10:最終回合 R#10: Final Round

S310#1~S310#10:替代位元組步驟 S310#1~S310#10: Substitute byte step

S320#1~S320#10:位移列步驟 S320#1~S320#10: shift sequence steps

S330#1~S330#9:混合行步驟 S330#1~S330#9: mixed line steps

S340#1~S340#10:加上回合密鑰步驟 S340#1~S340#10: Steps of adding round key

S350:擴展密鑰步驟 S350: Extended key steps

w[0,3]:基礎密鑰 w[0,3]: basic key

w[4,7],w[36,39],w[40,43]:擴展後的密鑰 w[4,7],w[36,39],w[40,43]: the expanded key

400:AES編碼器 400:AES Encoder

410,430:AES編碼電路 410,430: AES encoding circuit

450:比較器 450: Comparator

500:AES編碼器 500: AES encoder

510:AES編碼電路 510: AES encoding circuit

530:錯誤偵測電路 530: Error detection circuit

550:冗餘資料產生電路 550: redundant data generation circuit

570:冗餘密鑰產生電路 570: redundant key generation circuit

S0~S15:體 S 0 ~S 15 : Body

P0~P15:體內奇偶校驗位元 P 0 ~P 15 : Internal parity bits

Q0~Q3:跨體奇偶校驗9位元 Q 0 ~Q 3 : 9 bits of cross-body parity check

k0~k31:小鑰 k 0 ~k 31 : small key

R0~R31:小鑰內奇偶校驗位元 R 0 ~R 31 : parity bits in the small key

V0~V7:跨小鑰奇偶校驗9位元 V 0 ~V 7 : 9-bit cross-key parity check

810:AES資料處理電路 810: AES data processing circuit

813:編碼電路 813: encoding circuit

815:編碼錯誤檢查電路 815: Coding error checking circuit

830:AES密鑰排程電路 830: AES key scheduling circuit

833:密鑰產生電路 833: key generation circuit

835:密鑰錯誤檢查電路 835: key error check circuit

850:或閘 850: OR gate

870:控制器 870:Controller

912:資料寄存器 912: data register

914:奇偶校驗碼寄存器 914: parity check code register

920:增強型替代位元組電路 920: Enhanced Alternative Byte Circuits

930:位移列電路 930: shift column circuit

940:混合行電路 940: mixed row circuit

950:加上回合密鑰電路 950: add round key circuit

960:奇偶校驗檢查電路 960: parity check circuit

970:奇偶校驗預測電路 970: Parity prediction circuit

980:多工器 980: multiplexer

1010:體內奇偶校驗位元預測電路 1010: Internal parity bit prediction circuit

1030:跨體奇偶校驗9位元預測電路 1030: Cross-body parity 9-bit prediction circuit

1110:體內奇偶校驗位元產生電路 1110: Internal parity bit generating circuit

1120:位移列預測電路 1120: displacement column prediction circuit

1130:混合行預測電路 1130: Hybrid row prediction circuit

1140:多工器 1140: multiplexer

1150:加上回合密鑰預測電路 1150: Add round key prediction circuit

1160:位移列電路 1160: shift column circuit

1210:多工器 1210: multiplexer

1230:體內互斥或閘 1230: internal mutex or gate

1310:跨體奇偶校驗位元組產生電路 1310: cross-body parity byte generation circuit

1330:跨小鑰奇偶校驗位元組分割電路 1330: Inter-small key parity byte segmentation circuit

1350:跨體奇偶校驗位元組預測電路 1350: Span parity byte prediction circuit

1370:跨體奇偶校驗1位元預測電路 1370: Cross-body parity 1-bit prediction circuit

1390:跨體奇偶校驗9位元合併電路 1390: 9-bit merging circuit for cross-body parity

1410:跨體奇偶校驗位元組分割電路 1410: Cross-body parity byte segmentation circuit

1430#0~1430#15:增強型查表電路 1430#0~1430#15: enhanced look-up table circuit

1450:跨體奇偶校驗位元組合併電路 1450: Cross-body parity bit combination combination circuit

1510:搜索電路 1510: search circuit

1530:替代校驗電路 1530: Alternative calibration circuit

1610:計算電路 1610: Calculation Circuit

1630:乘法器 1630: multiplier

1650:比較器 1650: Comparator

1710,1750:密鑰分割電路 1710,1750: key splitting circuit

1712,1714:寄存器 1712, 1714: Register

1720,1730:鑰字處理電路 1720,1730: key word processing circuit

1725,1727,1729:互斥或閘 1725, 1727, 1729: mutex or gate

1742,1744:密鑰奇偶校驗碼產生電路 1742, 1744: key parity code generation circuit

1752,1754,1782,1784:寄存器 1752, 1754, 1782, 1784: registers

1762,1764:密鑰奇偶校驗檢查電路 1762, 1764: Key parity check circuit

1772,1774:密鑰奇偶校驗預測電路 1772, 1774: key parity prediction circuit

1810:鑰字分割電路 1810: key word segmentation circuit

1820:旋轉鑰字電路 1820: Rotary key word circuit

1830:替代鑰字電路 1830: Alternative key circuit

1840:捨去常數電路 1840: Rounding off the constant circuit

1850:鑰字合併電路 1850: key word combination circuit

1860:鑰字奇偶校驗產生電路 1860: Key word parity check generation circuit

1870:鑰字奇偶校驗預測電路 1870: Key Word Parity Prediction Circuit

1880:鑰字跨奇偶校驗預測電路 1880: Key word cross parity prediction circuit

1890:鑰字奇偶校驗9位元合併電路 1890: Key word parity check 9-bit merge circuit

1930#0~1930#3:增強型查表電路 1930#0~1930#3: enhanced look-up table circuit

2010:互斥或閘 2010: Mutual exclusion or gate

2110:鑰字分割電路 2110: key word segmentation circuit

2130:替代鑰字電路 2130: Alternative key word circuit

2150:鑰字合併電路 2150: key combination circuit

2160:鑰字奇偶校驗產生電路 2160: key word parity check generation circuit

2180:鑰字跨奇偶校驗預測電路 2180: key word cross parity prediction circuit

2190:鑰字奇偶校驗9位元合併電路 2190: keyword parity check 9-bit merge circuit

圖1為依據本發明實施例的電子裝置的系統架構圖。 FIG. 1 is a system architecture diagram of an electronic device according to an embodiment of the invention.

圖2為依據本發明實施例的閃存模組的示意圖。 FIG. 2 is a schematic diagram of a flash memory module according to an embodiment of the invention.

圖3為以128位元密鑰使用10個回合的演算法的高階示意圖。 FIG. 3 is a high-level schematic diagram of an algorithm using 10 rounds with a 128-bit key.

圖4為依據一些實施方式的高級加密標準(Advanced EncryptionStandard,AES)編碼器的方塊圖。 FIG. 4 is a block diagram of an Advanced Encryption Standard (AES) encoder in accordance with some implementations.

圖5為依據本發明實施例的AES編碼器的方塊圖。 FIG. 5 is a block diagram of an AES encoder according to an embodiment of the present invention.

圖6為依據本發明實施例的體、體內奇偶校驗位元和跨體奇偶校驗9位元的示意圖。 FIG. 6 is a schematic diagram of a body, body parity bits, and cross-body parity 9 bits according to an embodiment of the present invention.

圖7為依據本發明實施例的小鑰、小鑰內奇偶校驗位元和跨小鑰奇偶校驗9位元的示意圖。 Fig. 7 is a schematic diagram of a small key, parity bits within a small key, and 9 bits of parity across small keys according to an embodiment of the present invention.

圖8為依據本發明實施例的AES編碼器的方塊圖。 FIG. 8 is a block diagram of an AES encoder according to an embodiment of the present invention.

圖9為依據本發明實施例的AES資料處理電路的方塊圖。 FIG. 9 is a block diagram of an AES data processing circuit according to an embodiment of the present invention.

圖10為依據本發明實施例的奇偶校驗預測電路的方塊圖。 FIG. 10 is a block diagram of a parity prediction circuit according to an embodiment of the present invention.

圖11為依據本發明實施例的體內奇偶校驗位元預測電路的方塊圖。 FIG. 11 is a block diagram of an in-body parity bit prediction circuit according to an embodiment of the present invention.

圖12為依據本發明實施例的體內奇偶校驗位元產生電路的方塊圖。 FIG. 12 is a block diagram of an internal parity bit generating circuit according to an embodiment of the present invention.

圖13為依據本發明實施例的跨體奇偶校驗9位元預測電路的方塊圖。 FIG. 13 is a block diagram of a 9-bit prediction circuit for cross-body parity according to an embodiment of the present invention.

圖14為依據本發明實施例的增強型替代位元組電路的方塊圖。 FIG. 14 is a block diagram of an enhanced replacement byte circuit according to an embodiment of the present invention.

圖15為依據本發明實施例的增強型查表電路的方塊圖。 FIG. 15 is a block diagram of an enhanced look-up table circuit according to an embodiment of the present invention.

圖16為依據本發明實施例的替代校驗電路的方塊圖。 FIG. 16 is a block diagram of an alternative verification circuit according to an embodiment of the present invention.

圖17為依據本發明實施例的AES密鑰排程電路的方塊圖。 FIG. 17 is a block diagram of an AES key scheduling circuit according to an embodiment of the present invention.

圖18為依據本發明實施例的鑰字處理電路的方塊圖。 FIG. 18 is a block diagram of a key word processing circuit according to an embodiment of the present invention.

圖19為依據本發明實施例的替代鑰字電路的方塊圖。 FIG. 19 is a block diagram of an alternative key circuit according to an embodiment of the present invention.

圖20為依據本發明實施例的捨去常數電路的示意圖。 FIG. 20 is a schematic diagram of a rounding constant circuit according to an embodiment of the present invention.

圖21為依據本發明實施例的鑰字處理電路的方塊圖。 FIG. 21 is a block diagram of a key word processing circuit according to an embodiment of the present invention.

以下說明為完成發明的較佳實現方式,其目的在於描述本發明的基本精神,但並不用以限定本發明。實際的發明內容必須參考之後的權利要求範圍。 The following description is a preferred implementation mode of the invention, and its purpose is to describe the basic spirit of the invention, but not to limit the invention. For the actual content of the invention, reference must be made to the scope of the claims that follow.

必須了解的是,使用於本說明書中的「包含」、「包括」等詞,用以表示存在特定的技術特徵、數值、方法步驟、作業處理、元件以及/或組件,但並不排除可加上更多的技術特徵、數值、方法步驟、作業處理、元件、組件,或以上的任意組合。 It must be understood that words such as "comprising" and "including" used in this specification are used to indicate the existence of specific technical features, values, method steps, operations, components and/or components, but do not exclude the possibility of adding More technical characteristics, numerical values, method steps, operation processes, components, components, or any combination of the above.

於權利要求中使用如「第一」、「第二」、「第三」等詞是用來修飾權利要求中的元件,並非用來表示之間具有優先順序,前置關係,或者是一個元件先於另一個元件,或者是執行方法步驟時的時間先後順序,僅用來區別具有相同名字的元件。 Words such as "first", "second", and "third" used in the claims are used to modify the elements in the claims, and are not used to indicate that there is a priority order, a pre-relationship, or an element An element preceding another element, or a chronological order in performing method steps, is only used to distinguish elements with the same name.

必須了解的是,當元件描述為「連接」或「耦接」至另一元件時,可以是直接連結、或耦接至其他元件,可能出現中間元件。相反地,當元件描述為「直接連接」或「直接耦接」至另一元件時,其中不存在任何中間元件。使用來描述元件之間關係的其他語詞也可類似方式解讀,例如「介於」相對於「直接介於」,或者是「鄰接」相對於「直接鄰接」等等。 It should be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, intervening elements may be present. In contrast, when an element is described as being "directly connected" or "directly coupled" to another element, there are no intervening elements present. Other words used to describe the relationship between elements may be interpreted in a similar manner, such as "between" versus "directly between," or "adjacent" versus "directly adjacent," and so on.

參考圖1。電子裝置10包含主機端(Host Side)110、閃存控制器130 及閃存模組150,並且閃存控制器130及閃存模組150可合稱為裝置端(Device Side)。電子裝置10可實施於個人電腦、筆記型電腦(Laptop PC)、平板電腦、手機、數位相機、數位攝影機、智慧型電視、智慧型電冰箱、車用電子系統(Automotive Electronics System)等電子產品之中。主機端110與閃存控制器130的主機介面(Host Interface)137可以通用序列匯流排(Universal Serial Bus,USB)、先進技術附著(advanced technology attachment,ATA)、序列先進技術附著(serial advanced technology attachment,SATA)、快速周邊元件互聯(peripheral component interconnect express,PCI-E)、通用快閃記憶儲存(Universal Flash Storage UFS)、嵌入式多媒體卡(Embedded Multi-Media Card eMMC)等通訊協定彼此溝通。閃存控制器130的閃存介面(Flash Interface)139與閃存模組150可以雙倍資料率(Double Data Rate DDR)通訊協定彼此溝通,例如,開放NAND快閃(Open NAND Flash Interface ONFI)、雙倍資料率開關(DDR Toggle)或其他通訊協定。閃存控制器130包含處理單元134,可使用多種方式實施,如使用通用硬體(例如,單一處理器、具平行處理能力的多處理器、圖形處理器或其他具運算能力的處理器),並且在執行軟體以及/或韌體指令時,提供之後描述的功能。處理單元134通過主機介面131接收主機命令,例如讀取命令(Read Command)、寫入命令(Write Command)、抹除命令(Erase Command)等,排程並執行這些命令。閃存控制器130另包含隨機存取記憶體(Random Access Memory,RAM)136,可實施為動態隨機存取記憶體(Dynamic Random Access Memory,DRAM)、靜態隨機存取記憶體(Static Random Access Memory,SRAM)或上述兩者的結合,用於配置空間作為資料緩衝區,儲存從主機端110讀取並即將寫入閃存模組150的主機資料,以及從閃存模組150讀取並即將輸出給主機端110的主機資料。隨機存取記憶體 136另可儲存執行過程中需要的資料,例如,變數、資料表、主機-閃存對照表(Host-to-Flash H2F Table)、閃存-主機對照表(Flash-to-Host F2H Table)等。閃存介面139包含NAND閃存控制器(NAND Flash Controller NFC),提供存取閃存模組150時需要的功能,例如命令序列器(Command Sequencer)、低密度奇偶校驗(Low Density Parity Check LDPC)等。 Refer to Figure 1. The electronic device 10 includes a host side (Host Side) 110, a flash memory controller 130 and the flash memory module 150, and the flash memory controller 130 and the flash memory module 150 may be collectively referred to as a device side (Device Side). The electronic device 10 can be implemented in electronic products such as personal computers, notebook computers (Laptop PC), tablet computers, mobile phones, digital cameras, digital video cameras, smart TVs, smart refrigerators, and automotive electronic systems (Automotive Electronics System). middle. The host interface (Host Interface) 137 between the host terminal 110 and the flash memory controller 130 can be a Universal Serial Bus (USB), an advanced technology attachment (ATA), a serial advanced technology attachment, SATA), peripheral component interconnect express (PCI-E), universal flash storage (Universal Flash Storage UFS), embedded multimedia card (Embedded Multi-Media Card eMMC) and other communication protocols communicate with each other. The flash memory interface (Flash Interface) 139 of the flash memory controller 130 and the flash memory module 150 can communicate with each other with a double data rate (Double Data Rate DDR) communication protocol, for example, open NAND flash (Open NAND Flash Interface ONFI), double data rate DDR rate switch (DDR Toggle) or other communication protocols. The flash memory controller 130 includes a processing unit 134, which can be implemented in various ways, such as using general-purpose hardware (for example, a single processor, multiple processors with parallel processing capabilities, graphics processing units, or other processors with computing capabilities), and The functions described later are provided when the software and/or firmware instructions are executed. The processing unit 134 receives host commands, such as read commands (Read Command), write commands (Write Command), erase commands (Erase Command), etc., through the host interface 131, and schedules and executes these commands. The flash controller 130 further includes a random access memory (Random Access Memory, RAM) 136, which can be implemented as a dynamic random access memory (Dynamic Random Access Memory, DRAM), a static random access memory (Static Random Access Memory, SRAM) or a combination of the above two, used to configure the space as a data buffer, store the host data that is read from the host end 110 and is about to be written into the flash memory module 150, and is read from the flash memory module 150 and is about to be output to the host computer The host information of terminal 110. random access memory 136 can also store data needed during execution, such as variables, data tables, Host-to-Flash H2F Table, Flash-to-Host F2H Table, etc. The flash interface 139 includes a NAND flash controller (NAND Flash Controller NFC), which provides functions required for accessing the flash memory module 150, such as command sequencer (Command Sequencer), low density parity check (Low Density Parity Check LDPC) and so on.

閃存控制器130中可配置匯流排架構(Bus Architecture)132,用於讓元件之間彼此耦接以傳遞資料、位址、控制訊號等,這些元件包含主機介面131、處理單元134、RAM 136、高級加密標準(Advanced Encryption Standard,AES)編碼器137、直接記憶體存取(Direct Memory Access,DMA)控制器138、閃存介面139等。DMA控制器138可依據處理單元134的指令,通過匯流排架構132在元件間遷移資料,例如,將RAM 136的特定資料緩存器中的資料搬到AES編碼器137的特定寄存器(Register),將AES編碼器137的特定寄存器中的資料搬到RAM 136的特定資料緩存器等。 A bus architecture (Bus Architecture) 132 can be configured in the flash memory controller 130, which is used to couple components to each other to transmit data, addresses, control signals, etc. These components include a host interface 131, a processing unit 134, a RAM 136, An advanced encryption standard (Advanced Encryption Standard, AES) encoder 137, a direct memory access (Direct Memory Access, DMA) controller 138, a flash memory interface 139, and the like. The DMA controller 138 can transfer data between components through the bus architecture 132 according to the instructions of the processing unit 134, for example, move the data in the specific data buffer of the RAM 136 to a specific register (Register) of the AES encoder 137, and transfer The data in the specific register of the AES encoder 137 is moved to the specific data register of the RAM 136 and the like.

閃存模組150提供大量的儲存空間,通常是數百個千兆位元組(Gigabytes,GB),甚至是數個萬億位元組(Terabytes,TB),用於儲存大量的主機資料,例如高解析度圖片、影片等。閃存模組150中包含控制電路以及記憶體陣列,記憶體陣列中的記憶單元可在抹除後組態為單層式單元(Single Level Cells,SLCs)、多層式單元(Multiple Level Cells,MLCs)三層式單元(Triple Level Cells,TLCs)、四層式單元(Quad-Level Cells,QLCs)或上述的任意組合。處理單元134通過閃存介面139寫入主機資料到閃存模組150中的指定位址(目的位址),以及從閃存模組150中的指定位址(來源位址)讀取主機資料。閃存介面139使用數個電子訊號來協調閃存控制器130與閃存模組150間的資料與命令傳遞,包含資料線(Data Line)、時脈訊號(Clock Signal)與控制訊號(Control Signal)。資料線可用於傳遞命令、位址、讀出及寫入的資料;控制訊號線可用於傳遞晶片致能(Chip Enable,CE)、位址提取致能(Address Latch Enable,ALE)、命令提取致能(Command Latch Enable,CLE)、寫入致能(Write Enable,WE)等控制訊號。 The flash memory module 150 provides a large amount of storage space, usually hundreds of gigabytes (Gigabytes, GB), or even several trillion bytes (Terabytes, TB), for storing a large amount of host data, such as High-resolution pictures, videos, and more. The flash memory module 150 includes a control circuit and a memory array. The memory cells in the memory array can be configured as Single Level Cells (SLCs) or Multiple Level Cells (MLCs) after erasing. Three-level cells (Triple Level Cells, TLCs), four-level cells (Quad-Level Cells, QLCs), or any combination of the above. The processing unit 134 writes host data to a specified address (destination address) in the flash memory module 150 through the flash memory interface 139 and reads host data from a specified address (source address) in the flash memory module 150 . The flash memory interface 139 uses several electronic signals to coordinate the data and command transmission between the flash memory controller 130 and the flash memory module 150, including the data line (Data Line), clock signal (Clock Signal) and control signal (Control Signal). Signal). Data lines can be used to transmit commands, addresses, read and write data; control signal lines can be used to transmit chip enable (Chip Enable, CE), address extraction enable (Address Latch Enable, ALE), command extraction enable Control signals such as Command Latch Enable (CLE) and Write Enable (WE).

參考圖2,閃存模組150中的介面151可包含四個輸出入通道(I/O channels,以下簡稱通道)CH#0至CH#3,每個通道連接四個NAND閃存單元,例如,通道CH#0連接NAND閃存單元153#0、153#4、153#8及153#12。每個NAND閃存單元可封裝為獨立的芯片(Die)。閃存介面139可通過介面151發出致能訊號CE#0至CE#3中的一個來致能NAND閃存單元153#0至153#3、153#4至153#7、153#8至153#11、或153#12至153#15,接著以並行的方式從致能的NAND閃存單元讀取主機資料,或者寫入主機資料至致能的NAND閃存單元。 Referring to FIG. 2, the interface 151 in the flash memory module 150 may include four input/output channels (I/O channels, hereinafter referred to as channels) CH#0 to CH#3, and each channel is connected to four NAND flash memory units, for example, the channel CH#0 is connected to NAND flash memory units 153#0, 153#4, 153#8 and 153#12. Each NAND flash memory unit can be packaged as an independent chip (Die). The flash memory interface 139 can send one of the enable signals CE#0 to CE#3 through the interface 151 to enable the NAND flash memory units 153#0 to 153#3, 153#4 to 153#7, 153#8 to 153#11 , or 153#12 to 153#15, and then read the host data from the enabled NAND flash memory unit in parallel, or write the host data to the enabled NAND flash memory unit.

AES編碼器137實施一種Rijndael的變形演算法,其中使用固定的128位元大小的塊和128、192或256位元大小的基礎密鑰。AES編碼器137針對4x4以行為主的有序陣列(4x4 Column-major Order Array)的位元組進行操作,每個位元組稱為體(State)。大部分的AES計算都是在特定有限域(Finite Field)中完成的。例如,16個體S0、S1到S15可用以下二維陣列(Two-dimensional Array)表示:

Figure 111137123-A0305-02-0008-1
AES加密中使用的密鑰大小決定了轉換回合的數目,此加密用以將輸入訊息(稱為明文)轉換成為最後輸出(稱為密文)。例如,128位元密鑰使用10個回合(n=10)加密,192位元密鑰使用12個回合(n=12)加密,256位元密鑰使用14個回合(n=14)加密。每個回合包含數個處理步驟(或者稱為操作),其中包含一個取決於加 密密鑰本身的步驟。參考圖3所示的以128位元密鑰使用10個回合的演算法的高階示意圖。演算法使用擴展密鑰的步驟S350(也稱為AES密鑰排程),根據128位元基礎密鑰(Root Key)w[0,3]來擴展出多個回合所需要的密鑰。初始回合包含加上回合密鑰(Add-Round-Key)的步驟S340#0,用於加上回合密鑰,每個體使用逐位元的XOR運算合併上基礎密鑰w[0,3]中的相應位元組。接下來的9個回合,每個回合包含替代位元組(Substitute-Bytes)的步驟S310#i、位移列(Shift-Rows)的步驟S320#i、混合行(Mix-Columns)的步驟S330#i、加上回合密鑰的步驟S340#i,其中i為1到9之間的任意正整數。步驟S310#i是一個非線性替代的步驟,根據查找表(又可稱為Rijndael S-box)將每個體的值替換為另一個值,其中的查找表使用以下公式建立:SBi=Affine((i)-1)SBi代表i的輸出結果,Affine()代表Affine轉換函數,i為從0到127的正整數。步驟S320#i是一個調換位置的步驟,將下面三列的每一者向左或向右循環位移指定步數。步驟S330#i執行線性混合操作,作用於行,用於將每一行的四個體進行合併。步驟S340#i用於加上回合密鑰,每個體使用逐位元的XOR運算合併上基礎密鑰w[i*4,i*4+3]中的相應位元組。最後回合(也就是第10回合)包含步驟S310#10、S320#10、S340#10,其功能分別類似於步驟S310#i、S320#i、S340#i。雖然圖3只介紹了128位元密鑰使用10個回合的演算法,所屬技術領域人員理解192位元密鑰使用12個回合及256位元密鑰使用14個回合的演算法的技術細節,可從美國國家標準與技術研究院(National Institute of Standard and Technology,NIST)發表的標準文件中獲取。 The AES encoder 137 implements a variant of Rijndael using a fixed 128-bit size block and a base key size of 128, 192 or 256 bits. The AES encoder 137 operates on a 4x4 column-major order array (4x4 Column-major Order Array) of bytes, and each byte is called a body (State). Most of the AES calculations are done in a specific finite field (Finite Field). For example, 16 individuals S 0 , S 1 to S 15 can be represented by the following two-dimensional array (Two-dimensional Array):
Figure 111137123-A0305-02-0008-1
The key size used in AES encryption determines the number of conversion rounds used to convert an input message (called plaintext) into a final output (called ciphertext). For example, a 128-bit key is encrypted using 10 rounds (n=10), a 192-bit key is encrypted using 12 rounds (n=12), and a 256-bit key is encrypted using 14 rounds (n=14). Each round consists of several processing steps (or operations), including one that depends on the encryption key itself. Refer to Figure 3 for a high-level schematic diagram of the algorithm using 10 rounds with a 128-bit key. The algorithm uses the step S350 of expanding the key (also called AES key scheduling) to expand the keys needed for multiple rounds according to the 128-bit root key (Root Key) w[0,3]. The initial round includes the step S340#0 of adding a round key (Add-Round-Key), which is used to add a round key, and each body uses a bitwise XOR operation to combine the basic key w[0,3] corresponding bytes of the . Next 9 rounds, each round includes step S310#i of Substitute-Bytes, step S320#i of Shift-Rows, step S330# of Mix-Columns i. Step S340#i of adding a round key, wherein i is any positive integer between 1 and 9. Step S310#i is a non-linear substitution step, replacing the value of each volume with another value according to a lookup table (also called Rijndael S-box), wherein the lookup table is established using the following formula: SB i =Affine( (i) -1 )SB i represents the output of i, Affine() represents the Affine conversion function, and i is a positive integer from 0 to 127. Step S320#i is a step of exchanging positions, cyclically shifting each of the following three columns to the left or right by a specified number of steps. Step S330#i executes a linear blending operation, acting on rows, for merging four volumes in each row. Step S340#i is used to add the round key, each body uses the bitwise XOR operation to combine the corresponding bytes in the basic key w[i*4, i*4+3]. The last round (that is, the tenth round) includes steps S310#10, S320#10, and S340#10, the functions of which are similar to steps S310#i, S320#i, and S340#i respectively. Although Fig. 3 only introduces the algorithm using 10 rounds for the 128-bit key, those skilled in the art understand the technical details of the algorithm using 12 rounds for the 192-bit key and 14 rounds for the 256-bit key, Available from standards documents published by the National Institute of Standards and Technology (NIST).

由於在遭遇惡意攻擊、晶片瑕疵、惡劣環境等情況時,AES加密的過程中會發生錯誤而造成使用者資料無法回復的重大傷害。參考圖 4,在一些實施方式的AES編碼器400中,包含兩套相同的用於實現如上所示演算法的AES編碼電路410和430。AES編碼器400另設置比較器450,用於從AES編碼電路410接收每個體的密文C#1,從AES編碼電路430接收每個體的密文C#2,並且比較兩者是否相同。如果相同,則比較器450輸出密文C#1和加密成功的訊息。如果不同,則比較器450輸出加密失敗的訊息,用於通知處理單元中運行的韌體,需要執行錯誤管理程序。然而,以上實施方式的AES編碼器400的面積大於兩套AES編碼電路的面積,造成製造成本上升。 Due to malicious attacks, chip defects, harsh environments, etc., errors will occur during the AES encryption process, which will cause major damage to user data that cannot be recovered. reference image 4. In some implementations, the AES encoder 400 includes two sets of identical AES encoding circuits 410 and 430 for implementing the algorithm shown above. The AES encoder 400 is further provided with a comparator 450 for receiving the ciphertext C#1 of each body from the AES encoding circuit 410 and the ciphertext C#2 of each body from the AES encoding circuit 430, and comparing whether they are the same. If they are the same, the comparator 450 outputs the ciphertext C#1 and the message that the encryption is successful. If not, the comparator 450 outputs an encryption failure message, which is used to notify the firmware running in the processing unit that an error management program needs to be executed. However, the area of the AES encoder 400 in the above embodiment is larger than the area of the two sets of AES encoding circuits, resulting in increased manufacturing costs.

為了讓AES編碼器的面積小於兩套AES編碼電路的面積,從一個方面來說,參考圖5,本發明實施例提出在AES編碼器500中除了設置用於實現如上所示演算法的AES編碼電路510之外,還設置面積較一套完整的AES編碼電路510更小的錯誤偵測電路530來完成加密過程是否發生錯誤的偵測。在每個體的加密過程中,錯誤偵測電路530使用比16個體及其所屬的回合密鑰更少的資訊來判斷整個加密過程中是否發生錯誤。如果判定沒有任何錯誤,則錯誤偵測電路530可輸出加密成功訊息。如果判定發生錯誤,則錯誤偵測電路530輸出加密失敗的訊息,用於通知處理單元中運行的韌體,需要執行錯誤管理程序。 In order to make the area of the AES encoder smaller than the area of the two sets of AES encoding circuits, from one aspect, referring to FIG. In addition to the circuit 510, an error detection circuit 530 with a smaller area than a complete set of AES encoding circuit 510 is also provided to detect whether an error occurs during the encryption process. During the encryption process of each block, the error detection circuit 530 uses less information than 16 blocks and their associated round keys to determine whether an error occurs during the entire encryption process. If it is determined that there is no error, the error detection circuit 530 may output an encryption success message. If it is determined that an error occurs, the error detection circuit 530 outputs an encryption failure message for notifying the firmware running in the processing unit that an error management program needs to be executed.

冗餘資料產生電路550可在16個體附加上用於讓錯誤偵測電路530判斷加密過程中是否發生錯誤的冗餘資料,而冗餘資料是一種根據16個體中的值或者中間加密結果和AES加密演算法的預測結果。參考圖6,在一些實施例中,冗餘資料產生電路(Redundant-data Generation Circuitry)550可預測一個體內奇偶校驗位元(In-state Parity Bit),並且將體內奇偶校驗位元(當作第8個位元)附加在體(第0~7個位元)之後。需要注意的是,所屬技術領域人員不應依據上述的附加操作解讀為8位元的體和1位元的體內奇偶校驗位元實際儲存於9位元的連續空間,不同但等同的資料結構都是允許的。 例如,冗餘資料產生電路550可預測體S0的體內奇偶校驗位元P0,預測體S1的體內奇偶校驗位元P1,依此類推。體和相應體內奇偶校驗位元之間的匹配可使用以下範例公式表示:

Figure 111137123-A0305-02-0011-3
Pi代表第i個體的體內奇偶校驗位元的值,Si,j代表第i個體中的第j個位元的值,i為從0到15的正整數。當公式的兩邊相等時,代表第i個體和第i個體內奇偶校驗位元是匹配的。否則,代表兩者間不匹配。冗餘資料產生電路550可預測相應於每行的體的值及其體內奇偶校驗位元的一個跨體奇偶校驗9位元(Across-state Parity 9-bit)。例如,冗餘資料產生電路550可預測相應於體S0及其體內奇偶校驗位元P0、體S1及其體內奇偶校驗位元P1、體S2及其體內奇偶校驗位元P2和體S3及其體內奇偶校驗位元P3的跨體奇偶校驗9位元Q0,依此類推。每個行的多個體及其體內奇偶校驗位元和相應跨體奇偶校驗9位元之間的匹配可使用以下範例公式表示:
Figure 111137123-A0305-02-0011-7
,for j=0~8 Redundant data generating circuit 550 can add redundant data for allowing error detection circuit 530 to judge whether an error occurs in the encryption process in 16 units, and redundant data is a kind of value based on 16 units or intermediate encryption result and AES The predicted result of the encryption algorithm. Referring to FIG. 6 , in some embodiments, a redundant-data generation circuit (Redundant-data Generation Circuitry) 550 can predict an internal parity bit (In-state Parity Bit), and convert the internal parity bit (when as the 8th bit) is appended after the body (0~7 bits). It should be noted that those skilled in the art should not interpret the 8-bit body and 1-bit body parity bits to be actually stored in a 9-bit continuous space based on the above additional operations, different but equivalent data structures are allowed. For example, the redundant data generating circuit 550 can predict the internal parity bit P 0 of the bank S 0 , predict the internal parity bit P 1 of the bank S 1 , and so on. A match between a body and the corresponding body parity bits can be expressed using the following example formula:
Figure 111137123-A0305-02-0011-3
P i represents the value of the internal parity bit of the i-th individual, S i,j represents the value of the j-th bit in the i-th individual, and i is a positive integer from 0 to 15. When both sides of the formula are equal, it means that the i-th individual and the parity bits in the i-th individual match. Otherwise, there is a mismatch between the two. The redundant data generation circuit 550 can predict an Across-state Parity 9-bit corresponding to the bank value of each row and its bank parity bit. For example, the redundant data generating circuit 550 may predict the corresponding Element P 2 and bank S 3 and its body parity bit P 3 's cross-body parity 9-bit Q 0 , and so on. The matching between multiple banks of each row and its internal parity bits and the corresponding straddle parity 9 bits can be expressed using the following example formula:
Figure 111137123-A0305-02-0011-7
, for j =0~8

Figure 111137123-A0305-02-0011-8
,for j=0~8
Figure 111137123-A0305-02-0011-8
, for j =0~8

Figure 111137123-A0305-02-0011-9
,for j=0~8
Figure 111137123-A0305-02-0011-9
, for j =0~8

Figure 111137123-A0305-02-0011-10
,for j=0~8 Q0,j代表第0個跨體奇偶校驗9位元的第j個位元的值,Q1,j代表第1個跨體奇偶校驗9位元的第j個位元的值,Q2,j代表第2個跨體奇偶校驗9位元的第j個位元的值,Q3,j代表第3個跨體奇偶校驗9位元的第j個位元的值,Si,j代表第i個體中的第j個位元的值,j為從0至8的任意整數。當第i個跨體奇偶校驗9位元中的每個位元等於第i行中的相應位元的加總(或者互斥或運算的結果)時,代表第i行的體及體內奇偶校驗位元和第i個跨體奇偶校驗9位元之間是匹配的。否則,代表兩者間不匹配。
Figure 111137123-A0305-02-0011-10
,for j =0~8 Q 0,j represents the value of the jth bit of the 0th straddle parity 9-bit, Q 1,j represents the value of the 1st straddle parity 9-bit The value of j bits, Q 2,j represents the value of the jth bit of the second spanning parity 9-bit, Q 3,j represents the value of the third spanning parity 9-bit The value of j bits, S i, j represents the value of the jth bit in the i-th individual, and j is any integer from 0 to 8. When each of the 9 bits of the i-th cross-body parity check is equal to the sum of the corresponding bits in the i-th row (or the result of a mutually exclusive OR operation), it represents the body and body parity of the i-th row There is a match between the parity bit and the i-th span parity 9 bits. Otherwise, there is a mismatch between the two.

從一個方面來說,AES編碼電路510和冗餘資料產生電路550是獨立 且並行運行的,兩者之間不會進行資料和訊息交換。冗餘資料產生電路550使用冗餘資料更新演算法來產生預測冗餘資料,而冗餘資料更新演算法是從AES加密演算法推導出來的,使得AES編碼電路510產生的中間加密結果和冗餘資料產生電路550預測的冗餘資料能夠在加密明文過程中的每個特定中間點,在沒有發生錯誤的情況下,都能維持指定的數學關係。 From one aspect, the AES encoding circuit 510 and the redundant data generating circuit 550 are independent And running in parallel, there will be no data and message exchange between the two. The redundant data generation circuit 550 generates predicted redundant data using a redundant data update algorithm, and the redundant data update algorithm is derived from the AES encryption algorithm, so that the intermediate encryption result and redundant data generated by the AES encoding circuit 510 The redundant data predicted by the data generation circuit 550 can maintain the specified mathematical relationship at each specific intermediate point in the process of encrypting plaintext without errors.

冗餘密鑰產生電路(Redundant-key Generation Circuitry)570在每個基礎密鑰或者回合密鑰附加上用於讓錯誤偵測電路530判斷密鑰產生過程中是否發生錯誤的冗餘資料,而冗餘資料是一種根據基礎密鑰或者回合密鑰中的值和AES密鑰排程演算法的預測結果。參考圖7,以256位元基礎密鑰為例,冗餘密鑰產生電路570可先將基礎密鑰依序切分為32個位元組(每個位元組可稱為小鑰,Subkey),並組織為8行4列的矩陣。冗餘密鑰產生電路570可預測一個小鑰內奇偶校驗位元(In-subkey Parity Bit),並且將小鑰內奇偶校驗位元(當作第8個位元)附加在小鑰(第0~7個位元)之後。需要注意的是,所屬技術領域人員不能夠依據上述的附加操作解讀為8位元的小鑰和1位元的小鑰內奇偶校驗位元實際儲存於9位元的連續空間,不同但等同的資料結構都是允許的。例如,冗餘密鑰產生電路570可預測小鑰k0的小鑰內奇偶校驗位元R0,預測小鑰k1的小鑰內奇偶校驗位元R1,依此類推。小鑰和小鑰內奇偶校驗位元之間的匹配可使用以下範例公式表示:

Figure 111137123-A0305-02-0012-6
Ri代表第i個小鑰的小鑰內奇偶校驗位元的值,ki,j代表第i個小鑰中的第j個位元的值,i為從0到15的正整數。當公式的兩邊相等時,代表第i個小鑰和第i個小鑰內奇偶校驗位元是匹配的。否則,代表兩者間不匹配。冗餘密鑰產生電路570可預測相應於每行的小鑰的值 及其小鑰內奇偶校驗位元的一個跨小鑰奇偶校驗9位元(Across-subkey Parity 9-bit)。例如,冗餘密鑰產生電路570可預測相應於小鑰k0及其小鑰內奇偶校驗位元R0、小鑰k1及其體內奇偶校驗位元R1、小鑰k2及其小鑰內奇偶校驗位元R2和小鑰k3及其小鑰內奇偶校驗位元R3的跨小鑰奇偶校驗9位元V0,依此類推。每個行的多個小鑰及其小鑰內奇偶校驗位元和相應跨小鑰奇偶校驗9位元之間的匹配可使用以下範例公式表示:
Figure 111137123-A0305-02-0013-13
,for j=0~8 Redundant-key Generation Circuitry (Redundant-key Generation Circuitry) 570 adds redundant data for allowing error detection circuit 530 to determine whether an error occurs in the key generation process to each basic key or round key, and redundant The remaining data is a prediction based on the value in the base key or round key and the AES key scheduling algorithm. Referring to FIG. 7, taking the 256-bit basic key as an example, the redundant key generation circuit 570 can first divide the basic key into 32 bytes in sequence (each byte can be called a small key, Subkey ), and organized as a matrix of 8 rows and 4 columns. Redundant key generating circuit 570 can predict the parity check bit (In-subkey Parity Bit) in a small key, and attach the parity check bit (as the 8th bit) in the small key to the small key ( After the 0~7 bits). It should be noted that those skilled in the art cannot interpret the parity bits in the 8-bit small key and the 1-bit small key to be actually stored in a 9-bit continuous space based on the above additional operations, which are different but equivalent data structures are allowed. For example, the redundant key generation circuit 570 can predict the parity bit R 0 of the small key k 0 , predict the parity bit R 1 of the small key k 1 , and so on. The match between the keylet and the parity bits within the keylet can be expressed using the following example formula:
Figure 111137123-A0305-02-0012-6
R i represents the value of the parity bit in the i-th small key, ki ,j represents the value of the j-th bit in the i-th small key, and i is a positive integer from 0 to 15. When both sides of the formula are equal, it means that the i-th small key matches the parity bits in the i-th small key. Otherwise, there is a mismatch between the two. The redundant key generation circuit 570 can predict an Across-subkey Parity 9-bit (Across-subkey Parity 9-bit) corresponding to the value of the subkey of each row and the parity bits within the subkey. For example, the redundant key generation circuit 570 can predict that corresponding to the small key k 0 and its internal parity bit R 0 , small key k 1 and its internal parity bit R 1 , small key k 2 and The parity check bit R 2 in the small key and the parity check bit R 3 in the small key k 3 and the parity check bit R 3 in the small key 9-bit V 0 , and so on. Multiple keys per row and the matching between their intra-keylet parity bits and the corresponding cross-keylet parity 9 bits can be expressed using the following example formula:
Figure 111137123-A0305-02-0013-13
, for j =0~8

Figure 111137123-A0305-02-0013-14
,for j=0~8
Figure 111137123-A0305-02-0013-14
, for j =0~8

Figure 111137123-A0305-02-0013-15
,for j=0~8
Figure 111137123-A0305-02-0013-15
, for j =0~8

Figure 111137123-A0305-02-0013-16
,for j=0~8
Figure 111137123-A0305-02-0013-16
, for j =0~8

Figure 111137123-A0305-02-0013-17
,for j=0~8
Figure 111137123-A0305-02-0013-17
, for j =0~8

Figure 111137123-A0305-02-0013-18
,for j=0~8
Figure 111137123-A0305-02-0013-18
, for j =0~8

Figure 111137123-A0305-02-0013-20
,for j=0~8
Figure 111137123-A0305-02-0013-20
, for j =0~8

Figure 111137123-A0305-02-0013-22
,for j=0~8 V0,j代表第0個跨小鑰奇偶校驗9位元的第j個位元的值,V1,j代表第1個跨小鑰奇偶校驗9位元的第j個位元的值,V2,j代表第2個跨小鑰奇偶校驗9位元的第j個位元的值,V3,j代表第3個跨小鑰奇偶校驗9位元的第j個位元的值,V4,j代表第4個跨小鑰奇偶校驗9位元的第j個位元的值,V5,j代表第5個跨小鑰奇偶校驗9位元的第j個位元的值,V6,j代表第6個跨小鑰奇偶校驗9位元的第j個位元的值,V7,j代表第7個跨小鑰奇偶校驗9位元的第j個位元的值,ki,j代表第i個小鑰中的第j個位元的值,j為從0至8的任意整數。當第i個跨小鑰奇偶校驗9位元中的每個位元等於第i行中的相應位元的加總(或者互斥或運算的結果)時,代表第i行的小鑰及小鑰內奇偶校驗位元和第i個跨小鑰奇偶校驗9位元之間是匹配的。否則,代表兩者間不匹配。
Figure 111137123-A0305-02-0013-22
,for j =0~8 V 0,j represents the value of the jth bit of the 0th 9-bit cross-key parity check, V 1,j represents the first 9-bit cross-key parity check V 2,j represents the value of the jth bit of the second cross-key parity 9-bit, V 3,j represents the third cross-key parity 9 The value of the jth bit of the bit, V 4,j represents the value of the jth bit of the 4th cross-key parity check 9 bits, V 5,j represents the fifth cross-key parity Check the value of the jth bit of the 9-bit, V 6,j represents the value of the jth bit of the 6th cross-key parity check 9-bit, V 7,j represents the 7th cross-key The value of the j-th bit of the 9-bit parity check, ki ,j represents the value of the j-th bit in the i-th small key, and j is any integer from 0 to 8. When each bit in the 9-bit parity check across the i-th small key is equal to the sum of the corresponding bits in the i-th row (or the result of a mutually exclusive OR operation), it represents the i-th row's small key and There is a match between the parity bit in the small key and the i-th 9-bit parity across the small key. Otherwise, there is a mismatch between the two.

從一個方面來說,AES編碼電路510和冗餘密鑰產生電路570是獨立 且並行運行的,兩者之間不會進行資料和訊息交換。冗餘密鑰產生電路570使用冗餘密鑰更新演算法來產生預測冗餘資料,而冗餘密鑰更新演算法是從AES加密演算法中的AES密鑰排程推導出來的,使得AES編碼電路510產生的回合密鑰和冗餘密鑰產生電路570預測的冗餘資料能夠在產生回合密鑰過程中的每個特定中間點,在沒有發生錯誤的情況下,都能維持指定的數學關係。 From one aspect, the AES encoding circuit 510 and the redundant key generation circuit 570 are independent And running in parallel, there will be no data and message exchange between the two. The redundant key generating circuit 570 generates predicted redundant data using a redundant key update algorithm, and the redundant key update algorithm is derived from the AES key schedule in the AES encryption algorithm, so that the AES encoding The round key generated by the circuit 510 and the redundant data predicted by the redundant key generation circuit 570 can maintain the specified mathematical relationship at each specific intermediate point in the process of generating the round key without errors .

雖然圖5將AES編碼電路510、錯誤偵測電路530、冗餘資料產生電路550和冗餘密鑰產生電路570以不同方塊表示,但這只是為了讓讀者容易理解,所屬技術領域人員可在實際實現時,將AES編碼電路510、錯誤偵測電路530、冗餘資料產生電路550和冗餘密鑰產生電路570以適當的方式整合在一起,本發明並不因此局限。 Although FIG. 5 shows the AES encoding circuit 510, the error detection circuit 530, the redundant data generation circuit 550 and the redundant key generation circuit 570 in different blocks, this is only for the sake of easy understanding by readers, and those skilled in the art can use them in practice During implementation, the AES encoding circuit 510 , the error detection circuit 530 , the redundant data generating circuit 550 and the redundant key generating circuit 570 are integrated together in an appropriate manner, and the present invention is not limited thereto.

從另一個方面來說,參考圖8,本發明實施例提出在AES編碼器137中設置AES資料處理電路(AES Data Processing Circuitry)810和AES密鑰排程電路(AES Key Schedule Circuitry)830。AES密鑰排程電路830包含密鑰產生電路833,用於完成如圖3所示的擴展密鑰步驟S350。控制器870發出控制訊號給AES密鑰排程電路830,用於驅動AES密鑰排程電路830根據基礎密鑰K0或者之前的回合密鑰Ki-2產生新的回合密鑰,並且輸出指定回合的回合密鑰Ki及其相應的冗餘資料(例如,小鑰內奇偶校驗位元R和跨小鑰奇偶校驗9位元V)給AES資料處理電路810。AES密鑰排程電路830包含密鑰錯誤檢查電路835,設置以計算出相應於每個回合密鑰的冗餘資料;並且在擴展密鑰過程中的指定中間點發現任何回合密鑰和相應冗餘資料不匹配時,發出錯誤訊號ERR_KEY=1。回合密鑰可切分為16個小鑰且組織為4x4位元組陣列,每個小鑰為1位元組;冗餘資料包含相應於每個小鑰的小鑰內奇偶校驗位元,和相應於每個行的跨小鑰奇偶校驗9位元。密鑰錯誤檢查電路835在擴展密鑰過程中的指定中間點發現任何小鑰不匹配於相應小鑰內奇偶校驗位元時,或者發現相應 於任何行的小鑰加上4個相應小鑰內奇偶校驗位元,不匹配於相應跨小鑰奇偶校驗9位元時,發出錯誤訊號ERR_KEY=1。 From another aspect, referring to FIG. 8 , the embodiment of the present invention proposes setting an AES Data Processing Circuit (AES Data Processing Circuit) 810 and an AES Key Schedule Circuit (AES Key Schedule Circuit) 830 in the AES encoder 137 . The AES key scheduling circuit 830 includes a key generation circuit 833 for completing the key expansion step S350 shown in FIG. 3 . The controller 870 sends a control signal to the AES key scheduling circuit 830, which is used to drive the AES key scheduling circuit 830 to generate a new round key according to the basic key K 0 or the previous round key K i-2 , and output The round key K i of the designated round and its corresponding redundant data (for example, the parity bit R within the small key and the 9-bit parity V across small keys) are sent to the AES data processing circuit 810 . The AES key scheduling circuit 830 includes a key error checking circuit 835 arranged to calculate redundant information corresponding to each round key; When the remaining data do not match, an error signal ERR_KEY=1 is issued. The round key can be divided into 16 small keys and organized as a 4x4 byte array, each small key is 1 byte; redundant data includes parity bits in the small key corresponding to each small key, and 9 bits of parity across keylets corresponding to each row. When key error checking circuit 835 finds any keylet that does not match a parity bit in the corresponding keylet at a specified intermediate point in the keying process, or finds a keylet corresponding to any row plus 4 corresponding keylets When the inner parity bit does not match the corresponding 9-bit parity across the small key, an error signal ERR_KEY=1 is sent.

AES資料處理電路810包含編碼電路813,設置以實現如圖3所示的AES演算法中的替代位元組步驟S310、位移列步驟S320、混合行步驟S330和加上回合密鑰步驟S340。AES演算法包含多個回合,並且在每個回合中用於使用回合密鑰對明文或者中間加密結果進行編碼。控制器870發出控制訊號給AES資料處理電路810,用於驅動AES資料處理電路810來安排上述步驟的執行順序,以符合AES演算法的回合設置。AES資料處理電路810包含編碼錯誤檢查電路815,設置以計算出相應於明文或者中間加密結果的冗餘資料;在加密過程中的指定中間點發現中間加密結果和冗餘資料之間不匹配時,發出編碼錯誤訊號ERR_ENC=1。明文可切分為16個體且組織為4x4陣列,每個體為1位元組,冗餘資料包含相應於每個體的體內奇偶校驗位元,和相應於明文中的每個行的跨體奇偶校驗9位元。編碼錯誤檢查電路815在加密過程中的指定時間點發現任何所述體的中間加密結果不匹配於相應體內奇偶校驗位元時,或者發現相應於明文中的任何行的中間加密結果加上4個相應體內奇偶校驗位元,不匹配於相應跨體奇偶校驗9位元時,發出編碼錯誤訊號ERR_ENC=1。 The AES data processing circuit 810 includes an encoding circuit 813, which is configured to implement the byte replacement step S310, column displacement step S320, row mixing step S330 and round key addition step S340 in the AES algorithm shown in FIG. The AES algorithm consists of multiple rounds, and in each round is used to encode plaintext or intermediate encryption results using the round key. The controller 870 sends a control signal to the AES data processing circuit 810 for driving the AES data processing circuit 810 to arrange the execution sequence of the above steps to meet the round setting of the AES algorithm. The AES data processing circuit 810 includes an encoding error checking circuit 815, which is configured to calculate redundant data corresponding to plaintext or intermediate encryption results; when a specified intermediate point in the encryption process finds a mismatch between the intermediate encryption results and the redundant data, Issue encoding error signal ERR_ENC=1. The plaintext can be divided into 16 individuals and organized as a 4x4 array, each body is 1 byte, and the redundant data includes the body parity bits corresponding to each body, and the cross-body parity corresponding to each row in the plaintext Check 9 bits. Encoding error checking circuit 815 at a specified point in the encryption process when it finds that the intermediate encrypted result of any of the bodies does not match the corresponding body parity bit, or finds that the intermediate encrypted result corresponds to any line in the plaintext plus 4 When a corresponding internal parity bit does not match the corresponding spanning parity 9 bits, an encoding error signal ERR_ENC=1 is sent.

或閘850耦接編碼錯誤檢查電路815和密鑰錯誤檢查電路835的輸出端。當編碼錯誤檢查電路815輸出編碼錯誤訊號ERR_ENC=1和/或密鑰錯誤檢查電路835輸出密鑰錯誤訊號ERR_KEY=1時,或閘850輸出AES錯誤訊號ERR_AES=1給處理單元134。 The OR gate 850 is coupled to the output terminals of the encoding error checking circuit 815 and the key error checking circuit 835 . When the encoding error checking circuit 815 outputs the encoding error signal ERR_ENC=1 and/or the key error checking circuit 835 outputs the key error signal ERR_KEY=1, the OR gate 850 outputs the AES error signal ERR_AES=1 to the processing unit 134 .

參考圖9所示的AES資料處理電路810的方塊圖。資料寄存器912用於儲存在AES加密過程中產生的16位元組(也就是128比特)的中間或者最終結果,而奇偶校驗碼寄存器(Parity Registers)914用於儲存在AES加密過程中產生的相應於16位元組的中間或者最終結果的體內奇偶校驗位元和跨體奇偶校驗9位元。位移列電路(Shift-row Circuitry)930用於執行如如圖3所示的位移列的步驟S320,並且其結構為所屬技術領域人員所公知,為求簡明不再贅述。混合行電路(Mix-column Circuitry)940用於執行如如圖3所示的混合行的步驟S330,並且其結構為所屬技術領域人員所公知,為求簡明不再贅述。加上回合密鑰電路(Add-round-key Circuitry)950用於執行如如圖3所示的加上回合密鑰的步驟S340,並且其結構為所屬技術領域人員所公知,為求簡明不再贅述。 Refer to the block diagram of the AES data processing circuit 810 shown in FIG. 9 . The data register 912 is used to store the intermediate or final result of the 16-byte group (that is, 128 bits) generated in the AES encryption process, and the parity register (Parity Registers) 914 is used to store the generated data in the AES encryption process. The body parity bits and the span parity 9 bits corresponding to the intermediate or final result of the 16-byte group. Shift column circuit (Shift-row Circuitry) 930 is used to execute the step S320 of shifting the sequence as shown in FIG. 3 , and its structure is well known to those skilled in the art, and will not be repeated for simplicity. A Mix-column Circuitry (Mix-column Circuitry) 940 is used to execute the step S330 of mixing columns as shown in FIG. 3 , and its structure is well known to those skilled in the art, and will not be repeated for brevity. Adding a round key circuit (Add-round-key Circuit) 950 is used to perform the step S340 of adding a round key as shown in FIG. 3 , and its structure is well known to those skilled in the art. repeat.

控制器870可在每個回合發出選擇訊號R_sel給多工器980和奇偶校驗預測電路(Parity Prediction Circuitry)970,用於控制流經指定電路的資料流。多工器980包含三個輸入端I0、I1及I2和一個輸出端O。輸入端I0耦接AES編碼器137的輸入腳位以接收16位元組的明文,輸入端I1耦接混合行電路940的輸出以接收16位元組的運算結果,輸入端I2耦接位移列電路930的輸出以接收16位元組的運算結果,輸出端O耦接加上回合密鑰電路950的輸入。詳細來說,在初始回合,控制器870可使用控制訊號R_sel控制多工器980將輸入端I0連接上輸出端O,使得從AES編碼器137的輸入腳位接收到的16位元組的明文S能夠饋入加上回合密鑰電路950。在中間回合(例如使用256位元密鑰的第1至第13回合),控制器870可使用控制訊號R_sel控制多工器980將輸入端I1連接上輸出端O,使得混合行電路940的輸出能夠饋入加上回合密鑰電路950。在最終回合(例如使用256位元密鑰的第14回合),控制器870可使用控制訊號R_sel控制多工器980將輸入端I2連接上輸出端O,使得位移列電路930的輸出能夠饋入加上回合密鑰電路950。此外,在初始回合,控制器870可使用控制訊號R_sel控制奇偶校驗預測電路970,讓從AES編碼器137的輸入腳位接收到的16位元組的明文S能夠饋入奇偶校驗預測電路970,用於產生相應於明文的體內奇偶校驗位元P和跨體奇偶校驗9位元Q。在中間和最終回合,控制器870可使用控制訊號R_sel控制奇偶校驗預測電路970, 讓增強型替代位元組電路920的輸出能夠饋入奇偶校驗預測電路970,用於產生相應於中間加密結果的體內奇偶校驗位元P和跨體奇偶校驗9位元Q。 The controller 870 can send a selection signal R_sel to the multiplexer 980 and the parity prediction circuit (Parity Prediction Circuit) 970 in each round for controlling the data flow through the designated circuit. The multiplexer 980 includes three input terminals I 0 , I 1 and I 2 and one output terminal O. The input terminal I 0 is coupled to the input pin of the AES encoder 137 to receive the 16-byte plain text, the input terminal I 1 is coupled to the output of the mixing row circuit 940 to receive the 16-byte operation result, and the input terminal I 2 is coupled to The output of the column shift circuit 930 is connected to receive the 16-byte operation result, and the output terminal O is coupled to the input of the adding round key circuit 950 . In detail, in the initial round, the controller 870 can use the control signal R_sel to control the multiplexer 980 to connect the input terminal I0 to the output terminal O, so that the 16-byte received from the input pin of the AES encoder 137 The plaintext S can be fed into the adding round key circuit 950 . In the middle round (for example, the 1st to 13th rounds using a 256-bit key), the controller 870 can use the control signal R_sel to control the multiplexer 980 to connect the input terminal I1 to the output terminal O, so that the hybrid row circuit 940 The output can be fed into plus round key circuit 950 . In the final round (for example, the 14th round using a 256-bit key), the controller 870 can use the control signal R_sel to control the multiplexer 980 to connect the input terminal I2 to the output terminal O, so that the output of the column shift circuit 930 can be fed to Add the round key circuit 950. In addition, in the initial round, the controller 870 can use the control signal R_sel to control the parity prediction circuit 970, so that the 16-byte plaintext S received from the input pin of the AES encoder 137 can be fed into the parity prediction circuit 970, used to generate body parity bit P and straddle body parity bit Q corresponding to the plaintext. In the intermediate and final rounds, the controller 870 can use the control signal R_sel to control the parity prediction circuit 970, so that the output of the enhanced surrogate byte circuit 920 can be fed into the parity prediction circuit 970 for generating the corresponding intermediate encryption The body parity bit P and the cross body parity 9 bits Q of the result.

參考圖10所示的奇偶校驗預測電路970的方塊圖。奇偶校驗預測電路970包含體內奇偶校驗位元預測電路(In-state Parity-bit Prediction Circuitry)1010和跨體奇偶校驗9位元預測電路(Across-state Parity-9-bit Prediction Circuitry)1030。體內奇偶校驗位元預測電路1010依據控制訊號R_sel選擇輸入明文S(相應於初始回合)或者中間加密結果S’(相應於中間或者最終回合),並且根據明文S/中間加密結果S’和小鑰內奇偶校驗位元R產生體內奇偶校驗位元P。跨體奇偶校驗9位元預測電路1030依據控制訊號R_sel選擇輸入明文S(相應於初始回合)或者中間加密結果S’(相應於中間或者最終回合),並且根據明文S/中間加密結果S’和跨小鑰奇偶校驗9位元V產生跨體奇偶校驗9位元Q。 Refer to the block diagram of the parity prediction circuit 970 shown in FIG. 10 . The parity prediction circuit 970 includes an In-state Parity-bit Prediction Circuitry 1010 and an Across-state Parity-9-bit Prediction Circuitry 1030 . The internal parity bit prediction circuit 1010 selects the input plaintext S (corresponding to the initial round) or the intermediate encrypted result S' (corresponding to the intermediate or final round) according to the control signal R_sel, and according to the plaintext S/intermediate encrypted result S' and small The parity bits R in the key generate the parity bits P in the key. The cross-body parity 9-bit prediction circuit 1030 selects the input plaintext S (corresponding to the initial round) or the intermediate encryption result S' (corresponding to the intermediate or final round) according to the control signal R_sel, and according to the plaintext S/intermediate encryption result S' And cross-key parity 9-bit V produces cross-body parity 9-bit Q.

參考圖11所示的體內奇偶校驗位元預測電路1010的方塊圖。控制器870可在每個回合發出選擇訊號R_sel給多工器1140和體內奇偶校驗位元產生電路1110,用於控制流經指定電路的資料流。多工器1140包含三個輸入端I0、I1及I2和一個輸出端O。輸入端I0耦接體內奇偶校驗位元產生電路1110的輸出以接收相應於明文的16位元的體內奇偶校驗碼,輸入端I1耦接混合行預測電路1130的輸出以接收16位元的運算結果,輸入端I2耦接位移列預測電路1120的輸出以接收16位元的運算結果,輸出端O耦接加上回合密鑰預測電路1150的輸入。詳細來說,在初始回合,控制器870可使用控制訊號R_sel驅動體內奇偶校驗位元產生電路1110從AES編碼器137的輸入腳位接收16位元組的明文,並且控制多工器1140將輸入端I0連接上輸出端O,使得從體內奇偶校驗位元產生電路1110的輸出所接收到的相應於明文S的16位元的體內奇偶校驗碼能夠饋入加上回合密鑰預測電路1150。 在中間回合(例如使用256位元密鑰的第1至第13回合),控制器870可使用控制訊號R_sel驅動體內奇偶校驗位元產生電路1110從資料寄存器912獲取16位元組的中間加密結果S’,並且控制多工器1140將輸入端I1連接上輸出端O,使得從混合行預測電路1130的輸出所接收到的相應於中間加密結果S’的16位元的體內奇偶校驗碼能夠饋入加上回合密鑰預測電路1150。在最終回合(例如使用256位元密鑰的第14回合),控制器870可使用控制訊號R_sel驅動體內奇偶校驗位元產生電路1110從資料寄存器912獲取16位元組的中間加密結果S’,並且控制多工器1140將輸入端I2連接上輸出端O,使得從位移列預測電路1120的輸出所接收到的相應於中間加密結果S’的16位元的體內奇偶校驗碼能夠饋入加上回合密鑰預測電路1150。 Refer to the block diagram of the internal parity bit prediction circuit 1010 shown in FIG. 11 . The controller 870 can send a selection signal R_sel to the multiplexer 1140 and the internal parity bit generating circuit 1110 in each round to control the data flow through the designated circuit. The multiplexer 1140 includes three input terminals I 0 , I 1 and I 2 and one output terminal O. The input terminal I0 is coupled to the output of the internal parity bit generation circuit 1110 to receive the 16-bit internal parity code corresponding to the plaintext, and the input terminal I1 is coupled to the output of the hybrid row prediction circuit 1130 to receive the 16-bit internal parity code. The input terminal I2 is coupled to the output of the shift column prediction circuit 1120 to receive the 16-bit calculation result, and the output terminal O is coupled to the input of the plus round key prediction circuit 1150 . In detail, in the initial round, the controller 870 can use the control signal R_sel to drive the internal parity bit generation circuit 1110 to receive 16-byte plaintext from the input pin of the AES encoder 137, and control the multiplexer 1140 to The input terminal I0 is connected to the output terminal O, so that the 16-bit internal parity code corresponding to the plaintext S received from the output of the internal parity check bit generation circuit 1110 can be fed into plus the round key prediction circuit 1150. In the middle round (for example, the 1st to 13th rounds using a 256-bit key), the controller 870 can use the control signal R_sel to drive the internal parity bit generation circuit 1110 to obtain the 16-byte intermediate encryption from the data register 912 result S', and the multiplexer 1140 is controlled to connect the input terminal I1 to the output terminal O, so that the 16-bit body parity received from the output of the hybrid row prediction circuit 1130 corresponding to the intermediate encryption result S' The code can be fed into plus round key prediction circuit 1150 . In the final round (for example, the 14th round using a 256-bit key), the controller 870 can use the control signal R_sel to drive the internal parity bit generation circuit 1110 to obtain the 16-byte intermediate encryption result S' from the data register 912 , and control the multiplexer 1140 to connect the input terminal I2 to the output terminal O, so that the 16-bit internal parity code corresponding to the intermediate encryption result S' received from the output of the shift column prediction circuit 1120 can be fed to Add the round key prediction circuit 1150.

參考圖12所示的體內奇偶校驗位元產生電路1110的方塊圖。控制器870可在每個回合發出選擇訊號R_sel給多工器1210,用於控制流經指定電路的資料流。多工器1210包含兩個輸入端I0及I1和一個輸出端O。詳細來說,在初始回合,控制器870可使用控制訊號R_sel控制多工器1210將輸入端I0連接上輸出端O,使得從AES編碼器137的輸入腳位所接收到的16位元組的明文S能夠饋入體內互斥或閘1230。在中間和最終回合(例如使用256位元密鑰的第1至第14回合),控制器870可使用控制訊號R_sel控制多工器1210將輸入端I1連接上輸出端O,使得從資料寄存器912獲取16位元組的中間加密結果S’能夠饋入體內互斥或閘1230。體內互斥或閘1230包含多個互斥或閘,安排以依據接收到的16位元組的明文S或者中間加密結果S’,產生如圖6所示的體內奇偶校驗位元P0至P15Refer to the block diagram of the internal parity bit generation circuit 1110 shown in FIG. 12 . The controller 870 can send a selection signal R_sel to the multiplexer 1210 in each round to control the data flow through the designated circuit. The multiplexer 1210 includes two input terminals I 0 and I 1 and one output terminal O. In detail, in the initial round, the controller 870 can use the control signal R_sel to control the multiplexer 1210 to connect the input terminal I0 to the output terminal O, so that the 16 bytes received from the input pin of the AES encoder 137 The plaintext S can be fed into the mutex OR gate 1230 in the body. In the middle and final rounds (such as the 1st to 14th rounds using a 256-bit key), the controller 870 can use the control signal R_sel to control the multiplexer 1210 to connect the input terminal I1 to the output terminal O, so that the slave data register 912 obtains the 16-byte intermediate encryption result S′ that can be fed into the internal exclusive OR gate 1230 . The internal exclusive OR gate 1230 comprises a plurality of exclusive OR gates arranged to generate the internal parity bits P 0 to P15 .

參考回圖11,明文S或中間加密結果S’組織為4x4個體的陣列。位移列電路1160用於將下面三列的每一者向左循環位移指定步數。舉例來說,明文S表示如下:

Figure 111137123-A0305-02-0019-23
位移列電路1160用於將第一列向左循環位移一個體,將第二列向左循環位移兩個體,以及將第三列向左循環位移三個體。位移結果如下所示:
Figure 111137123-A0305-02-0019-24
Referring back to Fig. 11, the plaintext S or the intermediate encryption result S' is organized as an array of 4x4 entities. The column shift circuit 1160 is used to cyclically shift each of the lower three columns to the left by a specified number of steps. For example, the plaintext S is expressed as follows:
Figure 111137123-A0305-02-0019-23
The column shift circuit 1160 is used to cyclically shift the first column to the left by one bank, the second column to the left by two banks, and the third column to the left by three banks. The displacement results are as follows:
Figure 111137123-A0305-02-0019-24

相應於明文S或中間加密結果S’的體內奇偶校驗位元組織為4x4個位元的陣列。位移列預測電路1120用於將下面三列的每一者向左循環位移指定步數。舉例來說,相應於明文S的體內奇偶校驗位元表示如下:

Figure 111137123-A0305-02-0019-25
位移列預測電路1120用於將第一列向左循環位移一個位元,將第二列向左循環位移兩個位元,以及將第三列向左循環位移三個位元。位移結果如下所示:
Figure 111137123-A0305-02-0019-26
The body parity bits corresponding to the plaintext S or the intermediate encrypted result S' are organized as an array of 4x4 bits. The shift column prediction circuit 1120 is used to cyclically shift each of the lower three columns to the left by a specified number of steps. For example, the body parity bits corresponding to the plaintext S are expressed as follows:
Figure 111137123-A0305-02-0019-25
The column shift prediction circuit 1120 is used to cyclically shift the first column to the left by one bit, the second column to the left by two bits, and the third column to the left by three bits. The displacement results are as follows:
Figure 111137123-A0305-02-0019-26

混合行預測電路1130耦接位移列預測電路1120和位移列電路1160的輸出,使用所屬技術領域人員所習知的16個公式,每個公式加總位移後的明文S或中間加密結果S’的4x4位元組陣列以及位移後的體內奇偶校驗位元的4x4位元陣列中指定部分的值,產生混合後的體內奇偶校驗位元的矩陣中的指定的值。 The hybrid row prediction circuit 1130 is coupled to the output of the displacement column prediction circuit 1120 and the displacement column circuit 1160, using 16 formulas known to those skilled in the art, and each formula sums the shifted plaintext S or the intermediate encrypted result S' The 4x4 array of bytes and the values of the specified portion of the 4x4 array of shifted internal parity bits yield the specified values of the mixed matrix of internal parity bits.

加上回合密鑰預測電路1150使用以下公式計算體內奇偶校驗位元的加密後結果:P(out) i=P(in) i+Ri P(out) i代表輸出的第i個體的體內奇偶校驗位元,P(in) i代表輸入的第i個體的體內奇偶校驗位元,Ri代表第i個小鑰內奇偶校驗位元,i為從0至15的任意整數。需要注意的是,此時P(in) i和P(out) i所對應到的矩陣中的位置指的是混合行預測電路1130所輸出矩陣中的位置,不是對應到體內奇偶校驗位元產生電路1110所輸出矩陣中的位置。 In addition, the round key prediction circuit 1150 uses the following formula to calculate the encrypted result of the parity check bit in the body: P (out) i =P (in) i +R i P (out) i represents the body of the output i individual Parity bit, P (in) i represents the internal parity bit of the i-th individual input, R i represents the parity bit in the i-th small key, and i is any integer from 0 to 15. It should be noted that at this time, the positions in the matrix corresponding to P (in) i and P (out) i refer to the positions in the matrix output by the hybrid row prediction circuit 1130, not corresponding to the parity bits in the body The positions in the matrix output by the generation circuit 1110 are generated.

參考圖13所示的跨體奇偶校驗9位元預測電路1030的方塊圖。控制器870可在每個回合發出選擇訊號R_sel給跨體奇偶校驗位元組產生電路1310,用於控制跨體奇偶校驗位元組產生電路1310輸入的資料流。詳細來說,在初始回合,控制器870可使用控制訊號R_sel驅動跨體奇偶校驗位元組產生電路1310從AES編碼器137的輸入腳位接收16位元組的明文,使得跨體奇偶校驗位元組產生電路1310依據明文S的16位元組產生跨體奇偶校驗位元組。在中間回合(例如使用256位元密鑰的第1至第13回合)或者最終回合(例如使用256位元密鑰的第14回合),控制器870可使用控制訊號R_sel驅動跨體奇偶校驗位元組產生電路1310從資料寄存器912獲取16位元組的中間加密結果S’,使得跨體奇偶校驗位元組產生電路1310依據中間加密結果S’的16位元組產生跨體奇偶校驗位元組。 Refer to the block diagram of the 9-bit prediction circuit 1030 for cross-body parity shown in FIG. 13 . The controller 870 can send a selection signal R_sel to the span parity generating circuit 1310 in each round for controlling the input data flow of the span parity generating circuit 1310 . Specifically, in the initial round, the controller 870 can use the control signal R_sel to drive the straddle parity generating circuit 1310 to receive 16-byte plaintext from the input pin of the AES encoder 137, so that the straddle parity The parity byte generation circuit 1310 generates a cross-body parity byte according to the 16-byte group of the plaintext S. During intermediate rounds (e.g., rounds 1 to 13 using a 256-bit key) or final rounds (e.g., round 14 using a 256-bit key), the controller 870 can drive cross-body parity using the control signal R_sel The byte group generation circuit 1310 obtains the intermediate encryption result S' of 16 bytes from the data register 912, so that the straddle parity check byte group generation circuit 1310 generates a span parity check according to the 16 bytes of the intermediate encryption result S' Parity group.

跨體奇偶校驗位元組產生電路1310包含多個互斥或閘,在初始回合安排以依據接收到的16位元組的明文S,完成如圖6所示的跨體奇偶校驗位元組(不包含相應於體內奇偶校驗位元的第8位元)Q0,0..7至Q3,0..7。在中間回合或者最終回合安排以依據接收到的16位元組的中間加密結果S’,並且使用以下公式計算跨體奇偶校驗位元組(不包含相應於體內奇偶校驗位元的第8位元)Q0,0..7至Q3,0..7Q 0,j =S' 0,j +S' 5,j +S' 10,j +S' 15,j ,for j=0~7 The straddle parity check byte generation circuit 1310 comprises a plurality of exclusive OR gates, arranged in the initial round to complete the straddle parity check bit as shown in Figure 6 according to the plaintext S of the 16-byte group received Groups (excluding the 8th bit corresponding to the parity bit in the body) Q 0,0..7 to Q 3,0..7 . In the middle round or the final round, the arrangement is based on the received intermediate encryption result S' of the 16-byte group, and the following formula is used to calculate the cross-body parity bit (excluding the 8th bit corresponding to the body parity bit) bits) Q 0,0..7 to Q 3,0..7 : Q 0 ,j = S' 0 ,j + S' 5 ,j + S' 10 ,j + S' 15 ,j ,for j =0~7

Q 1,j =S' 4,j +S' 9,j +S' 14,j +S' 3,j ,for j=0~7 Q 1 ,j = S' 4 ,j + S' 9 ,j + S' 14 ,j + S' 3 ,j ,for j =0~7

Q 2,j =S' 8,j +S' 13,j +S' 2,j +S' 7,j ,for j=0~7 Q 2 ,j = S' 8 ,j + S' 13 ,j + S' 2 ,j + S' 7 ,j ,for j =0~7

Q 3,j =S' 12,j +S' 1,j +S' 6,j +S' 11,j ,for j=0~7 Q0,j到Q3,j分別代表第0個到第3個跨體奇偶校驗位元組的第j個位元的值,S’0,j到S’15,j分別代表相應於第0個到第15個中間加密結果中的第j個位元的值。 Q 3 ,j = S' 12 ,j + S' 1 ,j + S' 6 ,j + S' 11 ,j ,for j =0~7 Q 0,j to Q 3,j represent the 0th to The value of the jth bit of the third spanning parity byte group, S' 0, j to S' 15, j respectively represent the jth corresponding to the 0th to the 15th intermediate encryption results bit value.

跨小鑰奇偶校驗位元組分割電路(Across-subkey Parity-byte Split Circuitry)1330移除每個跨小鑰奇偶校驗9位元的第8個位元,成為跨小鑰奇偶校驗位元組,並且將跨小鑰奇偶校驗位元組饋入跨體奇偶校驗位元組預測電路1350。 Across-subkey Parity-byte Split Circuitry (Across-subkey Parity-byte Split Circuitry) 1330 removes the 8th bit of each 9-bit cross-subkey parity to become a cross-subkey parity bit and feed the cross-key parity bytes into the cross-body parity prediction circuit 1350.

跨體奇偶校驗位元組預測電路1350使用以下公式計算每個跨體奇偶校驗位元組的預測結果:

Figure 111137123-A0305-02-0021-27
,for j=0~7 The span parity byte prediction circuit 1350 calculates the prediction result for each span parity byte using the following formula:
Figure 111137123-A0305-02-0021-27
, for j =0~7

Figure 111137123-A0305-02-0021-28
,for j=0~7
Figure 111137123-A0305-02-0021-28
, for j =0~7

Figure 111137123-A0305-02-0021-29
,for j=0~7
Figure 111137123-A0305-02-0021-29
, for j =0~7

Figure 111137123-A0305-02-0021-30
,for j=0~7 Q(out) 0,j代表輸出的第0個跨體奇偶校驗位元組的第j個位元的值,Q(out) 1,j代表輸出的第1個跨體奇偶校驗位元組的第j個位元的值,Q(out) 2,j代表輸出的第2個跨體奇偶校驗位元組的第j個位元的值,Q(out) 3,j代表輸出的第3個跨體奇偶校驗位元組的第j個位元的值,Q(in) i,j代表輸入的第i個跨體奇偶校驗位元組的第j個位元的值,Vi,j代表第i個跨小鑰奇偶校驗位元組中的第j個位元的值。
Figure 111137123-A0305-02-0021-30
,for j =0~7 Q (out) 0, j represents the value of the jth bit of the 0th straddle parity bit group output, Q (out) 1, j represents the first output The value of the jth bit of the straddle body parity check byte, Q (out) 2, j represents the value of the jth bit of the 2nd straddle body parity check byte of output, Q (out ) 3,j represents the value of the jth bit of the 3rd straddle parity byte group output, Q (in) i,j represents the value of the ith straddle parity byte group input The value of j bits, V i,j represents the value of the jth bit in the ith inter-key parity byte group.

跨體奇偶校驗1位元預測電路1370使用以下公式計算每個跨體奇偶校驗9位元的第8個位元的預測結果:

Figure 111137123-A0305-02-0021-31
The straddle parity 1 bit prediction circuit 1370 calculates the prediction result of the 8th bit of each span parity 9 bits using the following formula:
Figure 111137123-A0305-02-0021-31

Figure 111137123-A0305-02-0022-32
Q0,8代表第0個行的跨體奇偶校驗9位元的第8個位元的值,Q1,8代表第1個行的跨體奇偶校驗9位元的第8個位元的值,Q2,8代表第2個行的跨體奇偶校驗9位元的第8個位元的值,Q3,8代表第3個行的跨體奇偶校驗9位元的第8個位元的值,Pi,8代表相應於第i個體的體內奇偶校驗位元(也就是第8個位元)的值。
Figure 111137123-A0305-02-0022-32
Q 0,8 represents the value of the 8th bit of the 9-bit straddle parity of the 0th row, and Q 1,8 represents the 8th bit of the 9-bit straddle parity of the 1st row The value of the element, Q 2, 8 represents the value of the 8th bit of the 9-bit straddle parity check of the second row, and Q 3, 8 represents the 9-bit straddle parity check of the 3rd row The value of the 8th bit, Pi ,8 represents the value of the internal parity bit (that is, the 8th bit) corresponding to the i-th individual.

跨體奇偶校驗9位元合併電路(Across-state Parity-9-bit Concatenation Circuitry)1390將每個從跨體奇偶校驗位元組預測電路1350輸出的跨體奇偶校驗位元組,附加上從跨體奇偶校驗1位元預測電路1370輸出的相應第8個位元,成為完整的跨體奇偶校驗9位元。 Across-state Parity-9-bit Concatenation Circuitry (Across-state Parity-9-bit Concatenation Circuitry) 1390 adds each of the Across-state Parity-check bytes output from the Across-state Parity-9-bit prediction circuit 1350 The corresponding 8th bit output from the straddle parity 1 bit prediction circuit 1370 becomes the complete straddle parity 9 bits.

參考回圖9,奇偶校驗檢查電路(Parity Check Circuitry)960檢查上一回合的執行結果是否發生錯誤。奇偶校驗檢查電路960從資料寄存器912獲取中間加密結果S’,以及從奇偶校驗碼寄存器914獲取相應於中間加密結果S’的體內奇偶校驗位元P和跨體奇偶校驗9位元Q。奇偶校驗檢查電路960判斷中間的加密結果S’和體內奇偶校驗位元P之間是否匹配,如果不匹配,則發出線性錯誤訊號err_L=1給處理單元134,使得處理單元134執行任何因應AES加密錯誤的管理程序。奇偶校驗檢查電路960還判斷中間的加密結果S’、中間的體內奇偶校驗位元P和跨體奇偶校驗9位元Q之間是否匹配,如果不匹配,則發出線性錯誤訊號err_L=1給處理單元134。 Referring back to FIG. 9 , a parity check circuit (Parity Check Circuitry) 960 checks whether an error occurs in the execution result of the previous round. The parity check circuit 960 obtains the intermediate encrypted result S' from the data register 912, and obtains the internal parity bit P and the cross-body parity 9 bits corresponding to the intermediate encrypted result S' from the parity register 914 Q. The parity check circuit 960 judges whether the intermediate encryption result S' matches the internal parity bit P, and if not, sends a linear error signal err_L=1 to the processing unit 134, so that the processing unit 134 performs any response A hypervisor for AES encryption errors. The parity check circuit 960 also judges whether the middle encryption result S', the middle body parity bit P, and the straddle parity 9-bit Q match, and if they do not match, a linear error signal err_L= is issued. 1 to the processing unit 134.

增強型替代位元組電路(Enhanced Substitute-byte Circuitry)920除了完成演算法中的替代位元組步驟S310之外,也要檢查此步驟的執行結果是否正確。參考圖14所示的增強型替代位元組電路920的方塊圖。跨體奇偶校驗位元組分割電路1410從資料寄存器912獲取128位元的中間結果S’,切分為16個位元組,並且將這16個位元組分別饋入增強型查表電路1430#0至1430#15。增強型查表電路1430#0至 1430#15中的每一個完成替代位元組步驟S310,並且判斷此操作是否正確。如果增強型查表電路1430#0至1430#15中的任何一個發現此操作錯誤,則輸出非線性錯誤訊號err_nl_i=1,i為0到15的正整數。只要任何一個增強型查表電路輸出非線性錯誤訊號err_nl_i,則增強型替代位元組電路920輸出非線性錯誤訊號err_nL=1給處理單元134,使得處理單元134執行任何因應AES加密錯誤的管理程序。跨體奇偶校驗位元組合併電路1450搜集增強型查表電路1430#0至1430#15的查表結果,並且將轉換後的128位元輸出到位移列電路930。 The Enhanced Substitute-byte Circuit (Enhanced Substitute-byte Circuit) 920, in addition to completing the byte-substitute step S310 in the algorithm, also checks whether the execution result of this step is correct. Refer to the block diagram of the enhanced replacement byte circuit 920 shown in FIG. 14 . The cross-body parity byte segmentation circuit 1410 obtains the 128-bit intermediate result S' from the data register 912, divides it into 16 byte groups, and feeds these 16 byte groups into the enhanced look-up table circuit respectively 1430#0 to 1430#15. Enhanced look-up table circuit 1430#0 to Each of 1430#15 completes the byte replacement step S310, and judges whether the operation is correct. If any one of the enhanced look-up table circuits 1430#0 to 1430#15 finds the operation error, it outputs a non-linear error signal err_nl_i=1, where i is a positive integer from 0 to 15. As long as any enhanced look-up circuit outputs the non-linear error signal err_nl_i, the enhanced substituting byte circuit 920 outputs the non-linear error signal err_nL=1 to the processing unit 134, so that the processing unit 134 executes any management procedures in response to AES encryption errors . The cross-body parity bit combining circuit 1450 collects the table look-up results of the enhanced look-up table circuits 1430 #0 to 1430 #15, and outputs the converted 128 bits to the shift column circuit 930 .

參考圖15所示的增強型查表電路1430#i的方塊圖,i為0到15的正整數。搜索電路1510依據如上所述的查找表將輸入的1個位元組S’(in)轉換出1個位元組S’(out)。替代校驗電路(Substitution Check Circuitry)1530從搜索電路1510接收轉換後的1個位元組S’(out),並且使用相應於查找表的公式判斷S’(in)轉換到S’(out)的過程中是否發生錯誤。如果發現錯誤,則替代校驗電路1530輸出非線性錯誤訊號err_nl_i=1。 Referring to the block diagram of the enhanced look-up table circuit 1430 #i shown in FIG. 15 , i is a positive integer ranging from 0 to 15. The search circuit 1510 converts the input byte S' (in) into a byte S' (out) according to the above-mentioned lookup table. Substitution Check Circuitry (Substitution Check Circuitry) 1530 receives converted 1 byte S' (out) from search circuit 1510, and uses the formula corresponding to the look-up table to judge that S' (in) is converted to S' (out) whether an error occurred during the process. If an error is found, the substitution check circuit 1530 outputs a non-linear error signal err_nl_i=1.

參考圖16所示的替代校驗電路1530的方塊圖。計算電路1610從搜索電路1510獲取轉換後的位元組S’(out) i,計算Affine(S’(out) i)-1,Affine()-1代表Affine轉換的反函數,並且將計算結果輸出到乘法器1630和比較器1650。乘法器1630將S’(in)乘上Affine(S’(out) i)-1以產生S’(mul) i。比較器1650實施以下邏輯運算式來產生判斷結果:err_nl_i=0,if(S’(mul) i==1)&&(S’(in) i!=0)&&(Affine(S’(out) i)-1!=0) Refer to the block diagram of the alternative verification circuit 1530 shown in FIG. 16 . Calculation circuit 1610 obtains converted bytes S' (out) i from search circuit 1510, calculates Affine(S' (out) i ) -1 , Affine () -1 represents the inverse function of Affine conversion, and calculates the result Output to multiplier 1630 and comparator 1650. The multiplier 1630 multiplies S' (in) by Affine(S' (out) i ) -1 to generate S' (mul) i . The comparator 1650 implements the following logical operation formula to generate a judgment result: err_nl_i=0, if(S' (mul) i ==1)&&(S' (in) i !=0)&&(Affine(S' (out) i ) -1 !=0)

err_nl_i=0,if(S’(mul) i==0)&&(S’(in) i==0)&&(Affine(S’(out) i)-1==0) err_nl_i=0,if(S' (mul) i ==0)&&(S' (in) i ==0)&&(Affine(S' (out) i ) -1 ==0)

err_nl_i=1,otherwise當err_nl_i等於1時,代表發生非線性錯誤訊號。 err_nl_i=1, otherwise when err_nl_i is equal to 1, it means a non-linear error signal occurs.

資料寄存器912、搜索電路1510、位移列電路930、混合行電路940、多工器980和加上回合密鑰電路950可視為AES編碼電路。奇偶校驗碼寄存器914、替代校驗電路1530、奇偶校驗檢查電路960和奇偶校驗預測電路970可視為錯誤檢查電路。 The data register 912, the search circuit 1510, the column shift circuit 930, the mixed row circuit 940, the multiplexer 980 and the adding round key circuit 950 can be regarded as an AES encoding circuit. The parity code register 914, the substitution check circuit 1530, the parity check circuit 960, and the parity prediction circuit 970 may be considered as error checking circuits.

參考圖17所示的AES密鑰排程電路830的方塊圖。密鑰分割電路1750將256位元的基礎密鑰K0切分為2個密鑰K#0和K#1,每個鑰字的長度為128位元,相同於一個體的長度。密鑰奇偶校驗碼產生電路(Key Parity Generation Circuitry)1742包含多個互斥或閘,安排以依據接收到的密鑰K#0,產生如圖7所示的小鑰內奇偶校驗位元R0至R15(可統稱為R#0),以及跨小鑰奇偶校驗9位元V0至V3(可統稱為V#0),並且將小鑰內奇偶校驗位元R#0和跨小鑰奇偶校驗9位元V#0儲存到寄存器1752。密鑰奇偶校驗碼產生電路1744包含多個互斥或閘,安排以依據接收到的密鑰K#1,產生如圖7所示的小鑰內奇偶校驗位元R16至R31(可統稱為R#1),以及跨小鑰奇偶校驗9位元V4至V7(可統稱為V#1),並且將小鑰內奇偶校驗位元R#1和跨小鑰奇偶校驗9位元V#1儲存到寄存器1754。寄存器1752和1754又可稱為目前周期奇偶校驗寄存器(Current Cycle Parity Registers)。 Refer to the block diagram of the AES key scheduling circuit 830 shown in FIG. 17 . The key division circuit 1750 divides the 256-bit basic key K 0 into two keys K#0 and K#1, and the length of each key word is 128 bits, which is the same as the length of an individual. The Key Parity Generation Circuit (Key Parity Generation Circuitry) 1742 includes a plurality of exclusive OR gates, arranged to generate parity bits in the small key as shown in Figure 7 according to the received key K#0 R 0 to R 15 (collectively referred to as R#0), and the 9-bit parity across the small key V 0 to V 3 (collectively referred to as V#0), and the parity bit R# in the small key 0 and cross key parity 9 bits V#0 are stored to register 1752. The key parity code generating circuit 1744 includes a plurality of exclusive OR gates, arranged to generate parity bits R 16 to R 31 ( can be collectively referred to as R#1), and the 9-bit parity across small keys V 4 to V 7 (collectively referred to as V#1), and the parity bit R#1 in the small key and the parity across small keys The parity 9-bit V#1 is stored in register 1754. The registers 1752 and 1754 can also be called current cycle parity registers (Current Cycle Parity Registers).

密鑰奇偶校驗檢查電路(Key Parity Check Circuitry)1762和1764分別檢查密鑰K#0和K#1的產生是否發生錯誤。密鑰奇偶校驗檢查電路1762從密鑰分割電路1750獲取密鑰K#0,以及從寄存器1752獲取相應於密鑰K#0的小鑰內奇偶校驗位元R#0和跨小鑰奇偶校驗9位元V#0。密鑰奇偶校驗檢查電路1762判斷密鑰K#0和小鑰內奇偶校驗位元R#0之間是否匹配,如果不匹配,則發出密鑰錯誤訊號err_kc=1。密鑰奇偶校驗檢查電路1762還判斷密鑰K#0、小鑰內奇偶校驗位元R#0和跨小鑰奇偶校驗9位元V#0之間是否匹配,如果不匹配,則發出密鑰錯誤訊號err_kc=1。密鑰奇偶校驗檢查電路1764從密鑰分割電路1750獲取密鑰K#1,以及從寄存器1754獲取相應於密鑰K#1的小鑰內奇偶校驗位元R#1和跨小鑰奇偶校驗9位元V#1。密鑰奇偶校驗檢查電路1764判斷密鑰K#1和小鑰內奇偶校驗位元R#1之間是否匹配,如果不匹配,則發出密鑰錯誤訊號err_kd=1。密鑰奇偶校驗檢查電路1764還判斷密鑰K#1、小鑰內奇偶校驗位元R#1和跨小鑰 奇偶校驗9位元V#1之間是否匹配,如果不匹配,則發出密鑰錯誤訊號err_kd=1。密鑰錯誤訊號err_kc=1或者err_kd=1可觸發處理單元134執行任何因應AES密鑰錯誤的管理程序。 Key parity check circuits (Key Parity Check Circuitry) 1762 and 1764 respectively check whether an error occurs in the generation of keys K#0 and K#1. The key parity check circuit 1762 obtains the key K#0 from the key split circuit 1750, and obtains the parity bit R#0 within the small key corresponding to the key K#0 and the parity across small keys from the register 1752. Check 9 bits V#0. The key parity check circuit 1762 judges whether the key K#0 matches the parity bit R#0 in the small key, and if not, sends a key error signal err_kc=1. The key parity check circuit 1762 also judges whether the key K#0, the parity bit R#0 in the small key and the 9-bit parity V#0 across the small key match, if not, then Issue key error signal err_kc=1. The key parity check circuit 1764 obtains the key K#1 from the key split circuit 1750, and obtains the parity bit R#1 within the small key corresponding to the key K#1 and the parity across small keys from the register 1754. Check 9 bits V#1. The key parity check circuit 1764 judges whether the key K#1 matches the parity bit R#1 in the small key, and if not, sends a key error signal err_kd=1. The key parity check circuit 1764 also judges the key K#1, the parity bit R#1 within the small key and the cross small key Whether the 9-bit V#1 of the parity check matches, if not, a key error signal err_kd=1 is issued. The key error signal err_kc=1 or err_kd=1 can trigger the processing unit 134 to execute any management procedures in response to AES key errors.

密鑰分割電路1710將256位元的基礎密鑰K0切分為8個鑰字(Word)W0,0至W0,3和W1,0至W1,3,每個鑰字的長度為4個位元組,並且將8個鑰字儲存在寄存器1712。鑰字處理電路1720根據最後一個鑰字W1,3產生一個鑰字的中間運算結果,此運算結果被用來和第一個鑰字W0,0進行逐位元邏輯互斥或運算(Bitwise Logical XOR Operation),以產生密鑰K#2的第一個鑰字W2,0。除了產生中間運算結果以外,鑰字處理電路1720還可以檢查中間運算結果的產生過程是否發生錯誤。如果是,則鑰字處理電路1720輸出密鑰錯誤訊號err_ka=1。密鑰錯誤訊號err_ka=1可觸發處理單元134執行任何因應AES密鑰錯誤的管理程序。 The key division circuit 1710 divides the 256-bit basic key K 0 into 8 key words (Word) W 0,0 to W 0,3 and W 1,0 to W 1,3 , each key word The length is 4 bytes, and 8 keys are stored in register 1712. The key word processing circuit 1720 generates an intermediate operation result of a key word according to the last key word W 1,3 , and this operation result is used to perform bit-by - bit logical exclusive OR operation (Bitwise Logical XOR Operation) to generate the first key word W 2,0 of key K#2. In addition to generating the intermediate operation result, the key word processing circuit 1720 can also check whether an error occurs in the generation process of the intermediate operation result. If yes, the key word processing circuit 1720 outputs a key error signal err_ka=1. The key error signal err_ka=1 can trigger the processing unit 134 to execute any management procedures in response to AES key errors.

參考圖18所示的鑰字處理電路1720的方塊圖。鑰字分割電路1810從寄存器1712讀取最後一個鑰字W1,3,並且切分為4個小鑰,每個小鑰為1位元組。旋轉鑰字電路(Rotate-Word Circuitry)1820將這4個小鑰向左循環位移1個小鑰。替代鑰字電路(Substitute-Word Circuitry)1830根據查找表(又可稱為Rijndael S-box)將每個位移後小鑰的值替換為另一個值,其中的查找表使用以下公式建立:SBi=Affine((i)-1),for i=0~127 SBi代表i的輸出結果,Affine()代表Affine轉換函數,i為從0到127的正整數。替代鑰字電路1830除了完成每個輸入位元組的值的轉換之外,也要檢查轉換的執行結果是否正確。 Refer to the block diagram of the key word processing circuit 1720 shown in FIG. 18 . The key word segmentation circuit 1810 reads the last key word W 1,3 from the register 1712 and divides it into 4 small keys, each of which is 1 byte. Rotate-Word Circuit (Rotate-Word Circuitry) 1820 cyclically shifts the 4 small keys to the left by 1 small key. Substitute-Word Circuitry (Substitute-Word Circuitry) 1830 replaces the value of each shifted small key with another value according to a lookup table (also called Rijndael S-box), wherein the lookup table is established using the following formula: SB i =Affine((i) -1 ), for i=0~127 SB i represents the output result of i, Affine() represents the Affine conversion function, and i is a positive integer from 0 to 127. In addition to converting the value of each input byte, the substitution key circuit 1830 also checks whether the conversion result is correct.

參考圖19所示的替代鑰字電路1830的方塊圖。增強型查表電路1930#0至1930#3中的每一個完成相應位元組的值的替換操作,並且判斷此操作是否正確。如果增強型查表電路1930#0至1930#3中的任何一個發現此操作錯誤,則輸出查表錯誤訊號err_w_i=1,i為0到3 的正整數。只要任何一個增強型查表電路輸出查表錯誤訊號err_w_i,則替代鑰字電路1830輸出密鑰錯誤訊號err_ka=1給處理單元134,使得處理單元134執行任何因應AES加密錯誤的管理程序。由於增強型查表電路1930#0至1930#3中的任一個的電路結構、功能和操作細節類似於增強型查表電路1430#i,所以讀者可參考圖15和圖16的描述,為求簡明不再贅述。 Referring to the block diagram of the replacement key circuit 1830 shown in FIG. 19 . Each of the enhanced look-up table circuits 1930#0 to 1930#3 completes the replacement operation of the value of the corresponding byte group, and judges whether the operation is correct. If any one of the enhanced look-up table circuits 1930#0 to 1930#3 finds this operation error, then output the look-up table error signal err_w_i=1, i is 0 to 3 positive integer of . As long as any enhanced table look-up circuit outputs the table look-up error signal err_w_i, the substitute key circuit 1830 outputs the key error signal err_ka=1 to the processing unit 134, so that the processing unit 134 executes any management procedures for AES encryption errors. Since the enhanced look-up table circuit 1930#0 to 1930#3 has any circuit structure, function and operation details similar to the enhanced look-up table circuit 1430#i, so the reader can refer to the description of Fig. 15 and Fig. 16, for seeking Concise and no more details.

參考回圖18,捨去常數電路(Round-Constant Circuitry)1840將鑰字w#0(in)和常數C執行逐位元互斥或(XOR)操作。參考圖20所示的捨去常數電路1840的示意圖。XOR閘2010設置將鑰字w#0(in)的每個位元和常數C的相應位元執行邏輯互斥或操作。 Referring back to FIG. 18 , the round-constant circuit (Round-Constant Circuitry) 1840 performs a bitwise exclusive OR (XOR) operation on the key word w#0 (in) and the constant C. Refer to the schematic diagram of the truncation constant circuit 1840 shown in FIG. 20 . The XOR gate 2010 is set to perform a logical exclusive OR operation between each bit of the key word w#0 (in) and the corresponding bit of the constant C.

鑰字合併電路(Word Concatenation Circuitry)1850從捨去常數電路1840獲取4個小鑰w#0至w#3,合併小鑰w#0至w#3為完整的鑰字W(out),並且輸出鑰字W(out)至互斥或閘1725。 The word concatenation circuit (Word Concatenation Circuitry) 1850 obtains 4 small keys w#0 to w#3 from the rounding constant circuit 1840, merges the small keys w#0 to w#3 into a complete key word W (out) , and Output key word W (out) to exclusive OR gate 1725 .

鑰字奇偶校驗產生電路(Word Parity Generation Circuitry)1860包含小鑰內奇偶校驗產生電路和跨小鑰奇偶校驗產生電路。小鑰內奇偶校驗產生電路包含多個互斥或閘,安排以依據從替代鑰字電路1830接收到的小鑰w#0至w#3,產生4個小鑰內奇偶校驗位元rt10至rt13。跨小鑰奇偶校驗產生電路包含多個互斥或閘,安排以依據從替代鑰字電路1830接收到的小鑰w#0至w#3,產生1個跨小鑰奇偶校驗位元組vt10..7The key word parity generation circuit (Word Parity Generation Circuitry) 1860 includes a small-key intra-key parity generation circuit and an inter-small-key parity generation circuit. The parity generation circuit in the keylet includes a plurality of exclusive OR gates arranged to generate 4 parity bits rt1 in the keylet according to the keylets w#0 to w#3 received from the substitute key word circuit 1830 0 to rt1 3 . The cross-keylet parity generation circuit comprises a plurality of exclusive OR gates arranged to generate 1 cross-keylet parity byte according to the keylets w#0 to w#3 received from the substitute key word circuit 1830 vt1 0..7 .

鑰字奇偶校驗預測電路(Word Parity Prediction Circuitry)1870包含小鑰內奇偶校驗預測電路和跨小鑰奇偶校驗預測電路。小鑰內奇偶校驗預測電路使用以下公式預測小鑰內奇偶校驗位元rt10 (out),並且輸出到鑰字跨奇偶校驗預測電路(Word Cross-parity Prediction Circuit)1880和密鑰奇偶校驗預測電路(Key Parity Prediction Circuit)1772:

Figure 111137123-A0305-02-0027-34
rt10 (out)代表計算後的第0個小鑰內奇偶校驗位元,rt10 (in)代表從鑰字奇偶校驗產生電路1860接收到的第0個小鑰內奇偶校驗位元,Ci代表捨去常數電路1840中使用的常數C中的第i個位元。此外,小鑰內奇偶校驗預測電路直接輸出從鑰字奇偶校驗產生電路1860接收到的小鑰內奇偶校驗位元rt11至rt13到鑰字跨奇偶校驗預測電路1880和密鑰奇偶校驗預測電路1772。跨小鑰奇偶校驗預測電路使用以下公式預測跨小鑰奇偶校驗位元組,並且輸出到鑰字奇偶校驗9位元合併電路(Word Parity 9-bit Concatenation Circuit)1890:vt10..7 (out)=vt10..7 (in)+C vt10..7 (out)代表輸出的跨小鑰奇偶校驗位元組,vt10..7 (in)代表從鑰字奇偶校驗產生電路1860接收到的跨小鑰奇偶校驗位元組,C代表捨去常數電路1840中使用的常數。 The key word parity prediction circuit (Word Parity Prediction Circuit) 1870 includes a parity prediction circuit within a small key and a parity prediction circuit across small keys. The parity prediction circuit in the small key uses the following formula to predict the parity bit rt1 0 (out) in the small key, and outputs to the word cross-parity prediction circuit (Word Cross-parity Prediction Circuit) 1880 and the key parity Check prediction circuit (Key Parity Prediction Circuit) 1772:
Figure 111137123-A0305-02-0027-34
rt1 0 (out) represents the calculated parity bit in the 0th small key, and rt1 0 (in) represents the parity bit in the 0th small key received from the key word parity generation circuit 1860 , C i represents the ith bit of the constant C used in the rounding constant circuit 1840 . In addition, the parity prediction circuit in the small key directly outputs the parity bits rt1 1 to rt1 3 in the small key received from the parity generation circuit 1860 to the inter-key parity prediction circuit 1880 and the key Parity prediction circuit 1772. The cross-small-key parity prediction circuit uses the following formula to predict cross-small-key parity bytes, and outputs to the word parity 9-bit merging circuit (Word Parity 9-bit Concatenation Circuit) 1890: vt1 0.. 7 (out) =vt1 0..7 (in) +C vt1 0..7 (out) represents the output cross-key parity bytes, vt1 0..7 (in) represents the slave key parity C represents the constant used in the truncation constant circuit 1840.

鑰字跨奇偶校驗預測電路1880使用以下公式計算跨小鑰奇偶校驗9位元vt的最後一個位元:

Figure 111137123-A0305-02-0027-35
vt18代表跨小鑰奇偶校驗9位元vt的最後一個位元,rt1i代表第i個小鑰內奇偶校驗位元。 The key word cross-parity prediction circuit 1880 uses the following formula to calculate the last bit of the cross-small key parity 9-bit vt:
Figure 111137123-A0305-02-0027-35
vt1 8 represents the last bit of the 9-bit parity across the small key vt, and rt1 i represents the parity bit in the ith small key.

鑰字奇偶校驗9位元合併電路1890將鑰字奇偶校驗預測電路1870的計算結果vt10..7合併上鑰字跨奇偶校驗預測電路1880的計算結果vt18,成為跨鑰字奇偶校驗9位元vt10..8,並且輸出到密鑰奇偶校驗電路1772。 The key word parity check 9-bit merging circuit 1890 combines the calculation result vt1 0..7 of the key word parity check prediction circuit 1870 with the calculation result vt1 8 of the key word cross parity check prediction circuit 1880 to become the cross key word parity The 9 bits vt1 0..8 are checked and output to the key parity circuit 1772.

參考回圖17,鑰字處理電路1730根據互斥或閘1727的運算結果(也就是鑰字W2,3)產生一個鑰字的中間運算結果,此運算結果被用來和鑰字W1,0進行逐位元邏輯互斥或運算,以產生密鑰K#3的第一個鑰字W3,0。除了產生中間運算結果以外,鑰字處理電路1730還可以檢查中間運算結果的產生過程是否發生錯誤。如果是,則鑰字處理 電路1730輸出密鑰錯誤訊號err_kb=1。密鑰錯誤訊號err_kb=1可觸發處理單元134執行任何因應AES密鑰錯誤的管理程序。 Referring back to FIG. 17, the key word processing circuit 1730 generates an intermediate operation result of a key word according to the operation result of the exclusive OR gate 1727 (that is, the key word W 2,3 ), and this operation result is used to combine the key word W 1, 0 to perform a bit-by-bit logical exclusive OR operation to generate the first key word W 3,0 of the key K#3. In addition to generating the intermediate operation result, the key word processing circuit 1730 can also check whether an error occurs in the generation process of the intermediate operation result. If yes, the key word processing circuit 1730 outputs a key error signal err_kb=1. The key error signal err_kb=1 can trigger the processing unit 134 to execute any management procedures in response to AES key errors.

參考圖21所示的鑰字處理電路1730的方塊圖。鑰字分割電路2110從互斥或閘1727讀取運算結果(也就是鑰字W2,3),並且切分為4個位元組。替代鑰字電路2130根據查找表將每個位元組的值替換為另一個值,其中的查找表使用以下公式建立:SBi=Affine((i)-1),for i=0~127 SBi代表i的輸出結果,Affine()代表Affine轉換函數,i為從0到127的正整數。替代鑰字電路2130除了完成每個輸入位元組的值的轉換之外,也要檢查轉換的執行結果是否正確。由於替代鑰字電路2130的電路結構、功能和運算結果類似於替代鑰字電路1830,所以讀者可參考圖15、圖16和圖19的描述,為求簡明不再贅述。只要替代鑰字電路2130中的任何一個增強型查表電路輸出查表錯誤訊號err_w_i,則替代鑰字電路2130輸出密鑰錯誤訊號err_kb=1給處理單元134,使得處理單元134執行任何因應AES加密錯誤的管理程序。 Refer to the block diagram of the key word processing circuit 1730 shown in FIG. 21 . The key word segmentation circuit 2110 reads the operation result (that is, the key word W 2,3 ) from the exclusive OR gate 1727 and divides it into 4 bytes. The substitution key word circuit 2130 replaces the value of each byte with another value according to a look-up table, wherein the look-up table is established using the following formula: SB i =Affine((i) -1 ), for i=0~127 SB i represents the output result of i, Affine() represents the Affine conversion function, and i is a positive integer from 0 to 127. In addition to converting the value of each input byte, the substitution key circuit 2130 also checks whether the conversion result is correct. Since the circuit structure, function and operation results of the substitution key circuit 2130 are similar to those of the substitution key circuit 1830, readers may refer to the descriptions in FIG. 15, FIG. 16 and FIG. 19, and will not repeat them for simplicity. As long as any enhanced look-up table circuit in the replacement key circuit 2130 outputs the table look-up error signal err_w_i, the replacement key circuit 2130 outputs the key error signal err_kb=1 to the processing unit 134, so that the processing unit 134 executes any corresponding AES encryption Faulty hypervisor.

鑰字合併電路2150從替代鑰字電路2130獲取替代後的4個小鑰w#0至w#3,合併小鑰w#0至w#3為完整的鑰字W(out),並且輸出鑰字W(out)至互斥或閘1729。 The key combination circuit 2150 obtains the substituted four small keys w#0 to w#3 from the replacement key circuit 2130, merges the small keys w#0 to w#3 into a complete key W (out) , and outputs the key Word W (out) to exclusive OR gate 1729.

鑰字奇偶校驗產生電路2160包含小鑰內奇偶校驗產生電路和跨小鑰奇偶校驗產生電路。小鑰內奇偶校驗產生電路包含多個互斥或閘,安排以依據從替代鑰字電路2130接收到的小鑰w#0至w#3,產生相應於小鑰w#0至w#3的四個小鑰內奇偶校驗位元rt20至rt23。這四個小鑰內奇偶校驗位元rt20至rt23輸出至鑰字跨奇偶校驗預測電路2180和密鑰奇偶校驗預測電路1774。跨小鑰奇偶校驗產生電路包含多個互斥或閘,安排以依據從替代鑰字電路2130接收到的小鑰w#0至w#3,產生相應於小鑰w#0至w#3的一個跨小鑰奇偶校驗位元組vt20..7(也就是缺少跨小鑰奇偶校驗9位元vt2中的第8個位元)。這個跨小鑰奇 偶校驗位元組vt20..7輸出至鑰字奇偶校驗9位元合併電路2190。 The key word parity generation circuit 2160 includes an intra-key parity generation circuit and an inter-small-key parity generation circuit. The parity generation circuit in the small key comprises a plurality of exclusive OR gates, arranged to generate the corresponding small keys w#0 to w#3 according to the small keys w#0 to w#3 received from the substitute key word circuit 2130 The parity bits rt2 0 to rt2 3 in the four keylets. The parity bits rt2 0 to rt2 3 in the four small keys are output to the key cross parity prediction circuit 2180 and the key parity prediction circuit 1774 . The cross-key parity generation circuit comprises a plurality of exclusive OR gates arranged to generate corresponding keylets w#0 to w#3 according to the keylets w#0 to w#3 received from the substitute key word circuit 2130 A cross-key parity byte vt2 0..7 (that is, the 8th bit of the cross-key parity 9-bit vt2 is missing). This cross-key parity byte vt2 0..7 is output to the key word parity 9-bit merge circuit 2190 .

鑰字跨奇偶校驗預測電路2180使用以下公式計算相應於小鑰w#0至w#3的跨小鑰奇偶校驗9位元的最後一個位元:

Figure 111137123-A0305-02-0029-36
vt28代表相應於小鑰w#0至w#3的一個跨小鑰奇偶校驗9位元的最後一個位元,rt2i代表相應於小鑰w#i的小鑰內奇偶校驗位元。 The key word cross-parity prediction circuit 2180 uses the following formula to calculate the last bit of the 9 bits of parity across small keys corresponding to small keys w#0 to w#3:
Figure 111137123-A0305-02-0029-36
vt2 8 represents the last bit of a 9-bit cross-key parity corresponding to key w#0 to w#3, and rt2 i represents the parity bit within the key corresponding to key w#i .

鑰字奇偶校驗9位元合併電路2190將鑰字奇偶校驗產生電路2160的計算結果vt20..7合併上鑰字跨奇偶校驗預測電路2180的計算結果vt28,作為跨鑰字奇偶校驗9位元vt20..8,並且輸出到密鑰奇偶校驗預測電路1774。 The key word parity 9-bit merging circuit 2190 combines the calculation result vt2 0..7 of the key word parity generation circuit 2160 with the calculation result vt2 8 of the key word cross parity prediction circuit 2180, as the cross key word parity Check 9 bits vt2 0..8 and output to key parity prediction circuit 1774.

參考回圖17,密鑰奇偶校驗預測電路(Key Parity Prediction Circuitry)1772包含多個加法器,安排以使用以下公式計算出相應於密鑰K#2的小鑰內奇偶校驗位元R#20至R#215:R#2i=rt1i+R#0i,for i=0~3 Referring back to FIG. 17, the Key Parity Prediction Circuit (Key Parity Prediction Circuit) 1772 includes a plurality of adders, arranged to use the following formula to calculate the parity bit R# in the small key corresponding to the key K#2 2 0 to R#2 15 : R#2 i =rt1 i +R#0 i , for i=0~3

R#2i=R#2i-4+R#0i,for i=4~15 R#2i代表相應於密鑰K#2的第i個小鑰內奇偶校驗位元,rt1i代表從鑰字處理電路1720獲取的第i個小鑰內奇偶校驗位元,R#0i代表從寄存器1752讀取的相應於密鑰K#0的第i個小鑰內奇偶校驗位元,R#2i-4代表從寄存器1752讀取的相應於密鑰K#2的第i-4個小鑰內奇偶校驗位元。密鑰奇偶校驗預測電路1772另包含多個加法器,安排以使用以下公式計算出相應於密鑰K#2的跨小鑰奇偶校驗9位元V#20至V#23:V#2i=vt1+V#0i,for i=0 R#2 i =R#2 i-4 +R#0 i , for i=4~15 R#2 i represents the parity bit in the i-th small key corresponding to the key K#2, rt1 i Represents the parity bit in the i-th small key obtained from the key word processing circuit 1720, R#0 i represents the parity bit in the i-th small key corresponding to the key K#0 read from the register 1752 R#2 i-4 represents the parity bit in the i-4th small key corresponding to the key K#2 read from the register 1752. The key parity prediction circuit 1772 further includes a plurality of adders arranged to calculate the 9-bit parity across small keys V#2 0 to V#2 3 corresponding to the key K#2 using the following formula: V #2 i =vt1+V#0 i , for i=0

V#2i=V#2i-1+V#0i,for i=1~3 V#2i代表相應於密鑰K#2的第i個跨小鑰奇偶校驗9位元,vt1代表從鑰字處理電路1720獲取的跨小鑰奇偶校驗9位元,V#0i代表從寄存器1752讀取的相應於密鑰K#0的第i個跨小鑰奇偶校驗9位元,V#2i-1代表從寄存器1752讀取的相應於密鑰K#2的第i-1個跨小鑰奇偶校驗9 位元。密鑰奇偶校驗預測電路1772將預測結果R#2、V#2儲存到寄存器1782,用於在下一個迭代中讓密鑰奇偶校驗檢查電路1762進行檢查。 V#2 i =V#2 i-1 +V#0 i , for i=1~3 V#2 i represents the 9-bit cross-key parity corresponding to key K#2, vt1 Represent the 9-bit cross-key parity obtained from the key word processing circuit 1720, and V#0 i represents the i-th cross-key parity 9-bit corresponding to the key K#0 read from the register 1752 , V#2 i-1 represents the i-1 th cross-key parity 9 bits read from the register 1752 corresponding to the key K#2. The key parity prediction circuit 1772 stores the prediction results R#2, V#2 into the register 1782 for checking by the key parity check circuit 1762 in the next iteration.

密鑰奇偶校驗預測電路1774包含多個加法器,安排以使用以下公式計算出相應於密鑰K#3的小鑰內奇偶校驗位元R#30至R#315:R#3i=rt2i+R#1i,for i=0~3 The key parity prediction circuit 1774 comprises a plurality of adders arranged to calculate the parity bits R#3 0 to R#3 15 within the keylet corresponding to the key K#3 using the following formula: R#3 i =rt2 i +R#1 i ,for i=0~3

R#3i=R#3i-4+R#1i,for i=4~15 R#3i代表相應於密鑰K#3的第i個小鑰內奇偶校驗位元,rt2i代表從鑰字處理電路1730獲取的第i個小鑰內奇偶校驗位元,R#1i代表從寄存器1754讀取的相應於密鑰K#1的第i個小鑰內奇偶校驗位元,R#3i-4代表從寄存器1754讀取的相應於密鑰K#3的第i-4個小鑰內奇偶校驗位元。密鑰奇偶校驗預測電路1774另包含多個加法器,安排以使用以下公式計算出相應於密鑰K#3的跨小鑰奇偶校驗9位元V#30至V#33:V#3i=vt2+V#1i,for i=0 R#3 i =R#3 i-4 +R#1 i , for i=4~15 R#3 i represents the parity bit in the i-th small key corresponding to the key K#3, rt2 i Represent the parity bit in the i-th small key obtained from the key word processing circuit 1730, R#1 i represents the parity bit in the i-th small key corresponding to the key K#1 read from the register 1754 R#3 i-4 represents the parity bit in the i-4th small key corresponding to the key K#3 read from the register 1754. The key parity prediction circuit 1774 further includes a plurality of adders arranged to calculate the 9-bit cross-small-key parity V#3 0 to V#3 3 corresponding to the key K#3 using the following formula: V #3 i =vt2+V#1 i , for i=0

V#3i=V#3i-1+V#1i,for i=1~3 V#3i代表相應於密鑰K#3的第i個跨小鑰奇偶校驗9位元,vt2代表從鑰字處理電路1730獲取的跨小鑰奇偶校驗9位元,V#1i代表從寄存器1754讀取的相應於密鑰K#1的第i個跨小鑰奇偶校驗9位元,V#3i-1代表從寄存器1754讀取的相應於密鑰K#3的第i-1個跨小鑰奇偶校驗9位元。密鑰奇偶校驗預測電路1774將預測結果R#3、V#3儲存到寄存器1784,用於在下一個迭代中讓密鑰奇偶校驗檢查電路1764進行檢查。 V#3 i =V#3 i-1 +V#1 i , for i=1~3 V#3 i represents the 9-bit cross-key parity corresponding to key K#3, vt2 Represent the 9-bit cross-key parity obtained from the key word processing circuit 1730, and V#1 i represents the i-th cross-key parity 9-bit corresponding to the key K#1 read from the register 1754 , V#3 i-1 represents the i-1 th cross-key parity 9 bits read from the register 1754 corresponding to the key K#3. The key parity prediction circuit 1774 stores the prediction results R#3, V#3 into the register 1784 for checking by the key parity check circuit 1764 in the next iteration.

雖然圖17只描述了密鑰K#2和K#3的產生及其產生過程的錯誤偵測,但是因為密鑰K#2和K#3就是產生密鑰K#4和K#5時所使用的密鑰(也就是下一個迭代所使用的密鑰),依此類推,所屬技術領域人員可參考以上的技術內容推導出其他回合密鑰的產生及其產生過程的錯誤偵測。 Although Fig. 17 only describes the generation of keys K#2 and K#3 and the error detection of the generation process, but because keys K#2 and K#3 are the keys K#4 and K#5 are generated The key used (that is, the key used in the next iteration), and so on, those skilled in the art can refer to the above technical content to deduce the generation of other round keys and the error detection of the generation process.

在一些實施例中,寄存器1712和1714可為實體上不同的寄存器。在另一些實施例中,寄存器1712和1714可指相同寄存器,但在指定的時間順序上依序儲存基礎密鑰和後續產生的回合密鑰。 In some embodiments, registers 1712 and 1714 may be physically distinct registers. In other embodiments, the registers 1712 and 1714 may refer to the same register, but store the base key and the subsequently generated round key sequentially in a specified time sequence.

在一些實施例中,寄存器1752和1782可為實體上不同的寄存器。在另一些實施例中,寄存器1752和1782可指相同寄存器,但在指定的時間順序上依序儲存第一個小鑰內奇偶校驗位元R#0和跨小鑰奇偶校驗9位元V#0,以及後續產生的小鑰內奇偶校驗位元和跨小鑰奇偶校驗9位元。 In some embodiments, registers 1752 and 1782 may be physically distinct registers. In other embodiments, registers 1752 and 1782 may refer to the same register, but sequentially store the first intra-keylet parity bit R#0 and the cross-keylet parity 9 bits sequentially in a specified time order V#0, as well as the parity bits within the small key and the 9 bits of parity across small keys generated subsequently.

在一些實施例中,寄存器1754和1784可為實體上不同的寄存器。在另一些實施例中,寄存器1754和1784可指相同寄存器,但在指定的時間順序上依序儲存第二個小鑰內奇偶校驗位元R#1和跨小鑰奇偶校驗9位元V#1,以及後續產生的小鑰內奇偶校驗位元和跨小鑰奇偶校驗9位元。 In some embodiments, registers 1754 and 1784 may be physically distinct registers. In other embodiments, registers 1754 and 1784 may refer to the same register, but store the second intra-key parity bit R#1 and the cross-key parity 9 bits sequentially in a specified time order V#1, as well as the parity bits within the small key and the 9 bits of parity across small keys generated subsequently.

雖然圖1至圖2、圖5、圖8至圖21中包含了以上描述的元件,但不排除在不違反發明的精神下,使用更多其他的附加元件,以達成更佳的技術效果。 Although the elements described above are included in FIGS. 1 to 2 , 5 , and 8 to 21 , it is not excluded to use more other additional elements to achieve better technical effects without violating the spirit of the invention.

雖然本發明使用以上實施例進行說明,但需要注意的是,這些描述並非用以限縮本發明。相反地,此發明涵蓋了熟習此技藝人士顯而易見的修改與相似設置。所以,申請權利要求範圍須以最寬廣的方式解釋來包含所有顯而易見的修改與相似設置。 Although the present invention is described using the above examples, it should be noted that these descriptions are not intended to limit the present invention. On the contrary, the invention covers modifications and similar arrangements obvious to those skilled in the art. Therefore, the claims of the application must be interpreted in the broadest manner to include all obvious modifications and similar arrangements.

810:AES資料處理電路 810: AES data processing circuit

813:編碼電路 813: encoding circuit

815:編碼錯誤檢查電路 815: Coding error checking circuit

830:AES密鑰排程電路 830: AES key scheduling circuit

833:密鑰產生電路 833: key generation circuit

835:密鑰錯誤檢查電路 835: key error check circuit

850:或閘 850: OR gate

870:控制器 870:Controller

Claims (13)

一種資料加密的錯誤偵測裝置,包含:密鑰產生電路,設置以實現加密演算法中的擴展密鑰操作,用於使用基礎密鑰產生多個回合密鑰,其中,所述加密演算法使用一個所述回合密鑰在相應回合中對明文或者中間加密結果進行編碼;以及密鑰錯誤檢查電路,耦接所述密鑰產生電路,設置以預測出相應於每個所述回合密鑰的冗餘資料;並且在擴展密鑰過程中的指定中間點發現任何所述回合密鑰和相應冗餘資料不匹配時,發出錯誤訊號給處理單元。 An error detection device for data encryption, comprising: a key generation circuit, configured to implement an extended key operation in an encryption algorithm, for generating a plurality of round keys using a basic key, wherein the encryption algorithm uses one of said round keys encodes plaintext or an intermediate encryption result in a corresponding round; and a key error checking circuit, coupled to said key generation circuit, arranged to predict the redundancy corresponding to each of said round keys and sending an error signal to the processing unit when any mismatch between the round key and the corresponding redundant data is found at a specified intermediate point in the process of expanding the key. 如請求項1所述的資料加密的錯誤偵測裝置,其中,所述加密演算法包含初始回合、多個中間回合和最後回合;所述初始回合執行加上回合密鑰操作;每個所述中間回合依序執行替代位元組操作、位移列操作、混合行操作和所述加上回合密鑰操作;以及所述最後回合執行所述替代位元組操作、所述位移列操作和所述加上回合密鑰操作。 The error detection device for data encryption according to claim 1, wherein the encryption algorithm includes an initial round, a plurality of intermediate rounds, and a final round; the initial round performs a round key operation; each of the an intermediate round sequentially performs the substitution byte operation, the shift column operation, the mixed row operation, and the add round key operation; and the final round performs the substitution byte operation, the shift column operation, and the Plus round key operations. 如請求項2所述的資料加密的錯誤偵測裝置,其中,所述基礎密鑰為256位元。 The error detection device for data encryption according to claim 2, wherein the basic key is 256 bits. 如請求項1所述的資料加密的錯誤偵測裝置,其中,所述回合密鑰切分為16個小鑰且組織為4x4位元組陣列,每個所述小鑰為1位元組;所述冗餘資料包含相應於每個所述小鑰的小鑰內奇偶校驗位元,和相應於每個行的跨小鑰奇偶校驗9位元; 其中,所述錯誤檢查電路在所述擴展密鑰過程中的指定中間點發現任何所述小鑰不匹配於相應小鑰內奇偶校驗位元時,或者發現相應於任何行的小鑰加上4個相應小鑰內奇偶校驗位元,不匹配於相應跨小鑰奇偶校驗9位元時,發出所述錯誤訊號給所述處理單元。 The error detection device for data encryption according to claim 1, wherein the round key is divided into 16 small keys and organized as a 4x4 byte array, and each small key is 1 byte; said redundant data includes intra-keylet parity bits corresponding to each of said keylets, and 9 bits of cross-keylet parity corresponding to each row; Wherein, when said error checking circuit finds at a specified intermediate point in said key extension process that any of said keylets does not match a parity bit in the corresponding keylet, or finds a keylet corresponding to any row plus When the parity bits within the corresponding four small keys do not match the corresponding nine parity bits across small keys, the error signal is sent to the processing unit. 如請求項4所述的資料加密的錯誤偵測裝置,其中,每個所述小鑰和所述相應小鑰內奇偶校驗位元之間的匹配可使用以下公式表示:
Figure 111137123-A0305-02-0037-37
Ri代表第i個小鑰的小鑰內奇偶校驗位元的值,ki,j代表第i個小鑰中的第j個位元的值,i為從0到15的正整數,其中,每個所述行的所述小鑰及其小鑰內奇偶校驗位元和所述相應跨小鑰奇偶校驗9位元之間的匹配可使用以下公式表示:
Figure 111137123-A0305-02-0037-38
,for j=0~8
Figure 111137123-A0305-02-0037-39
,for j=0~8
Figure 111137123-A0305-02-0037-40
,for j=0~8
Figure 111137123-A0305-02-0037-41
,for j=0~8 V0,j代表第0個跨小鑰奇偶校驗9位元的第j個位元的值,V1,j代表第1個跨小鑰奇偶校驗9位元的第j個位元的值,V2,j代表第2個跨小鑰奇偶校驗9位元的第j個位元的值,V3,j代表第3個跨小鑰奇偶校驗9位元的第j個位元的值,ki,j代表第i個小鑰中的第j個位元的值,j為從0至8的任意整數。
The error detection device for data encryption according to claim 4, wherein the matching between each of the small keys and the parity bits in the corresponding small keys can be expressed by the following formula:
Figure 111137123-A0305-02-0037-37
R i represents the value of the parity bit in the i-th small key, ki ,j represents the value of the j-th bit in the i-th small key, i is a positive integer from 0 to 15, Wherein, the matching between the small key and the parity bit in the small key of each row and the corresponding parity 9 bits across the small key can be expressed by the following formula:
Figure 111137123-A0305-02-0037-38
, for j =0~8
Figure 111137123-A0305-02-0037-39
, for j =0~8
Figure 111137123-A0305-02-0037-40
, for j =0~8
Figure 111137123-A0305-02-0037-41
,for j =0~8 V 0,j represents the value of the jth bit of the 0th 9-bit cross-key parity check, V 1,j represents the first 9-bit cross-key parity check V 2,j represents the value of the jth bit of the second cross-key parity 9-bit, V 3,j represents the third cross-key parity 9 The value of the j-th bit of the bit, ki ,j represents the value of the j-th bit in the i-th small key, and j is any integer from 0 to 8.
如請求項4所述的資料加密的錯誤偵測裝置,其中,所述回合密鑰切分為4個鑰字,每個所述鑰字包含4個小鑰,每個所述小鑰為1位元組, 其中,所述密鑰錯誤檢查電路,包含:鑰字處理電路,設置以產生相應於最後一個鑰字的4個中間小鑰內奇偶校驗位元和中間跨小鑰奇偶校驗9位元;密鑰奇偶校驗預測電路,設置以使用以下公式計算出相應於所述回合密鑰的小鑰內奇偶校驗位元:R#ji=rt1i+R#(j-2)i,for i=0~3 R#ji=R#ji-4+R#(j-2)i,for i=4~15 R#ji代表相應於第j個回合密鑰的第i個小鑰內奇偶校驗位元,rt1i代表從所述鑰字處理電路獲取的第i個中間小鑰內奇偶校驗位元,R#(j-2)i代表相應於第j-2個回合密鑰的第i個小鑰內奇偶校驗位元,R#ji-4代表相應於所述第j個回合密鑰的第i-4個小鑰內奇偶校驗位元,j為大於或者等於2的偶數;並且使用以下公式計算出相應於所述回合密鑰的4個跨小鑰奇偶校驗9位元:V#ji=vt1+V#(j-2)i,for i=0 V#ji=V#ji-1+V#(j-2)i,for i=1~3 V#ji代表相應於第j個回合密鑰的第i個跨小鑰奇偶校驗9位元,vt1代表從所述鑰字處理電路獲取的所述中間跨小鑰奇偶校驗9位元,V#(j-2)i代表相應於第j-2個回合密鑰的第i個跨小鑰奇偶校驗9位元,V#ji-1代表相應於所述第j個回合密鑰的第i-1個跨小鑰奇偶校驗9位元,j為大於或者等於2的偶數;密鑰奇偶校驗檢查電路,耦接所述密鑰奇偶校驗預測電路,設置以發現所述回合密鑰的任何所述小鑰不匹配於相應體內奇偶校驗位元時,或者發現相應於任何行的所述小鑰加上所述4個相應小鑰內奇偶校驗位元,不匹配於所述相應跨小鑰奇偶校驗9位元時,發出所述錯誤訊號給所述處理單元。 The error detection device for data encryption according to claim 4, wherein the round key is divided into 4 key words, each of which contains 4 small keys, and each of the small keys is 1 Bytes, wherein, the key error checking circuit includes: a key word processing circuit configured to generate 4 intermediate small key inner parity bits and intermediate cross small key parity bits corresponding to the last key word 9 bits; the key parity prediction circuit is set to use the following formula to calculate the parity bit corresponding to the small key in the round key: R#j i =rt1 i +R#(j-2 ) i , for i=0~3 R#j i =R#j i-4 +R#(j-2) i , for i=4~15 R#j i represents the key corresponding to the jth round key The parity check bit in the i-th small key, rt1 i represents the parity check bit in the i-th intermediate small key obtained from the key word processing circuit, and R#(j-2) i represents the parity bit corresponding to the jth - The parity check bit in the i-th small key of the 2 round keys, R#j i-4 represents the parity check bit in the i-4th small key corresponding to the j-th round key , j is an even number greater than or equal to 2; and use the following formula to calculate the 9-bit parity check corresponding to the round key: V#j i =vt1+V#(j-2) i , for i=0 V#j i =V#j i-1 +V#(j-2) i , for i=1~3 V#j i represents the i-th key corresponding to the j-th round key 9 bits of parity across small keys, vt1 represents the 9 bits of parity across small keys obtained from the key word processing circuit in the middle, and V#(j-2) i represents the corresponding j-2th The i-th cross-small-key parity check 9-bit of the round key, V#j i-1 represents the i-1-th cross-small-key parity check 9-bit corresponding to the j-th round key, j is an even number greater than or equal to 2; a key parity check circuit, coupled to the key parity prediction circuit, is configured to find that any of the small keys of the round key do not match the corresponding internal parity When checking bits, or when it is found that the small key corresponding to any row plus the parity bits in the 4 corresponding small keys do not match the 9 bits of parity in the corresponding cross small key, send The error signal is sent to the processing unit. 如請求項6所述的資料加密的錯誤偵測裝置,其中,所述鑰字處 理電路,包含:旋轉鑰字電路,設置以將所述最後一個鑰字的所述4個小鑰向左循環位移1個小鑰;替代鑰字電路,耦接所述旋轉鑰字電路,設置以依據查找表將每個位移後小鑰的第一值替換為第二值;鑰字奇偶校驗產生電路,耦接所述替代鑰字電路,設置以分別根據4個位移後小鑰的所述第二值產生4個小鑰內奇偶校驗位元,以及根據所述4個位移後小鑰的所述第二值產生1個跨小鑰奇偶校驗位元組;鑰字奇偶校驗預測電路,耦接所述鑰字奇偶校驗產生電路,設置以使用以下公式預測第0個中間小鑰內奇偶校驗碼:
Figure 111137123-A0305-02-0039-42
rt10 (out)代表所述第0個中間小鑰內奇偶校驗碼,rt10 (in)代表從所述鑰字奇偶校驗產生電路接收到的第0個小鑰內奇偶校驗碼,Ci代表捨去常數電路中使用的常數中的第i個位元;將從所述鑰字奇偶校驗產生電路接收到的第1個至第3個小鑰內奇偶校驗碼當作第1個至第3個中間小鑰內奇偶校驗碼;使用以下公式預測中間跨小鑰奇偶校驗位元組:vt10..7 (out)=vt10..7 (in)+C vt10..7 (out)代表所述中間跨小鑰奇偶校驗位元組,vt10..7 (in)代表從所述鑰字奇偶校驗產生電路接收到的所述跨小鑰奇偶校驗位元組,C代表所述捨去常數電路中使用的所述常數;鑰字跨奇偶校驗預測電路,耦接所述鑰字奇偶校驗預測電路,設置以使用以下公式計算所述中間跨小鑰奇偶校驗9位元的最後一個位元:
Figure 111137123-A0305-02-0039-43
vt18代表所述中間跨小鑰奇偶校驗9位元的所述最後一個位元, rt1i代表第i個中間小鑰內奇偶校驗位元;以及鑰字奇偶校驗9位元合併電路,耦接所述鑰字奇偶校驗預測電路和所述鑰字跨奇偶校驗預測電路,設置以合併所述中間跨小鑰奇偶校驗位元組和所述中間跨小鑰奇偶校驗9位元的所述最後一個位元,成為所述中間跨小鑰奇偶校驗9位元。
The error detection device for data encryption according to claim 6, wherein the key word processing circuit includes: a rotating key word circuit configured to rotate the four small keys of the last key word to the left Displacing 1 small key; replacing the key word circuit, coupled to the rotating key word circuit, and setting to replace the first value of each shifted small key with the second value according to the look-up table; key word parity check generation circuit, Coupled to the replacement key word circuit, set to generate 4 parity bits in the small key according to the second values of the 4 shifted small keys, and according to the second values of the 4 shifted small keys, The second value generates 1 inter-small key parity byte group; the key word parity prediction circuit, coupled to the key word parity generation circuit, is configured to predict the parity within the 0th intermediate small key using the following formula Check code:
Figure 111137123-A0305-02-0039-42
rt1 0 (out) represents the parity code in the 0th intermediate small key, and rt1 0 (in) represents the parity code in the 0th small key received from the key word parity generation circuit, C i represents the i-th bit in the constant used in the constant circuit; the parity code in the first to the third small key received from the key word parity generation circuit is regarded as the first 1st to 3rd inter-keylet intra-parity code; use the following formula to predict inter-keylet parity bits: vt1 0..7 (out) =vt1 0..7 (in) +C vt1 0..7 (out) represents the middle cross small key parity byte group, vt1 0..7 (in) represents the cross small key parity received from the key word parity generating circuit A check bit group, C represents the constant used in the rounding constant circuit; the key word cross parity prediction circuit, coupled to the key word parity prediction circuit, is set to use the following formula to calculate the intermediate The last bit of the 9-bit parity across the small key:
Figure 111137123-A0305-02-0039-43
vt1 8 represents the last bit of the 9-bit parity check in the intermediate key, rt1 i represents the parity check bit in the ith intermediate key; and the 9-bit parity merging circuit of the key word , coupled to the key word parity prediction circuit and the key word cross parity prediction circuit, configured to merge the intermediate cross small key parity bits and the intermediate cross small key parity 9 The last bit of the bits becomes the 9 bits of parity in the middle span keylet.
如請求項4所述的資料加密的錯誤偵測裝置,其中,所述回合密鑰切分為4個鑰字,每個所述鑰字包含4個小鑰,每個所述小鑰為1位元組,其中,所述密鑰錯誤檢查電路,包含:鑰字處理電路,設置以產生相應於最後一個鑰字的中間運算結果的4個中間小鑰內奇偶校驗位元和中間跨小鑰奇偶校驗9位元;密鑰奇偶校驗預測電路,設置以使用以下公式計算出相應於所述回合密鑰的小鑰內奇偶校驗位元:R#ji=rt2i+R#(j-2)i,for i=0~3 R#ji=R#ji-4+R#(j-2)i,for i=4~15 R#ji代表相應於第j個回合密鑰的第i個小鑰內奇偶校驗位元,rt2i代表從所述鑰字處理電路獲取的第i個中間小鑰內奇偶校驗位元,R#(j-2)i代表相應於第j-2個回合密鑰的第i個小鑰內奇偶校驗位元,R#ji-4代表相應於所述第j個回合密鑰的第i-4個小鑰內奇偶校驗位元,j為大於或者等於3的奇數;並且使用以下公式計算出相應於所述回合密鑰的4個跨小鑰奇偶校驗9位元:V#ji=vt2+V#(j-2)i,for i=0 V#ji=V#ji-1+V#(j-2)i,for i=1~3 V#ji代表相應於第j個回合密鑰的第i個跨小鑰奇偶校驗9位元,vt2代表從所述鑰字處理電路獲取的所述中間跨小鑰奇偶校驗9位元,V#(j-2)i代表相應於第j-2個回合密鑰的第i個跨小鑰奇偶 校驗9位元,V#ji-1代表相應於所述第j個回合密鑰的第i-1個跨小鑰奇偶校驗9位元,j為大於或者等於3的奇數;密鑰奇偶校驗檢查電路,耦接所述密鑰奇偶校驗預測電路,設置以發現所述回合密鑰的任何所述小鑰不匹配於相應體內奇偶校驗位元時,或者發現相應於任何行的所述小鑰加上所述4個相應小鑰內奇偶校驗位元,不匹配於所述相應跨小鑰奇偶校驗9位元時,發出所述錯誤訊號給所述處理單元。 The error detection device for data encryption according to claim 4, wherein the round key is divided into 4 key words, each of which contains 4 small keys, and each of the small keys is 1 Bytes, wherein the key error checking circuit includes: a key word processing circuit, configured to generate 4 intermediate small key internal parity bits and intermediate span small bits corresponding to the intermediate operation result of the last key word Key parity 9 bits; key parity prediction circuit, set to use the following formula to calculate the parity bit corresponding to the small key in the round key: R#j i =rt2 i +R# (j-2) i , for i=0~3 R#j i =R#j i-4 +R#(j-2) i , for i=4~15 R#j i represents the jth The parity bit in the ith small key of the round key, rt2 i represents the parity bit in the ith intermediate small key obtained from the key word processing circuit, and R#(j-2) i represents The parity bit in the i-th small key corresponding to the j-2th round key, R#j i-4 represents the parity in the i-4th small key corresponding to the j-th round key Check bits, j is an odd number greater than or equal to 3; and use the following formula to calculate the 9 bits of parity check corresponding to the round key: V#j i =vt2+V#( j-2) i , for i=0 V#j i =V#j i-1 +V#(j-2) i , for i=1~3 V#j i represents the key corresponding to the jth round The i-th small-key parity check 9-bit, vt2 represents the 9-bit parity check in the middle of the small key obtained from the key word processing circuit, and V#(j-2) i represents the 9-bit parity corresponding to the first The i-th cross-key parity of j-2 round keys is 9 bits, and V#j i-1 represents the i-1-th cross-key parity corresponding to the j-th round key 9 bits, j is an odd number greater than or equal to 3; the key parity check circuit, coupled to the key parity prediction circuit, is configured to find that any of the small keys of the round key do not match the When the parity bit in the corresponding body is found, or it is found that the keylet plus the 4 corresponding parity bits in the keylet corresponding to any row does not match the 9 bits of parity in the corresponding cross keylet sending the error signal to the processing unit. 如請求項6和8中任一項所述的資料加密的錯誤偵測裝置,其中,所述鑰字處理電路,包含:替代鑰字電路,設置以依據查找表將相應於所述最後一個鑰字的每個小鑰的第一值替換為第二值;鑰字奇偶校驗產生電路,耦接所述替代鑰字電路,設置以分別根據4個小鑰的所述第二值產生4個中間小鑰內奇偶校驗位元,以及根據所述4個小鑰的所述第二值產生1個中間跨小鑰奇偶校驗位元組;鑰字跨奇偶校驗預測電路,耦接所述鑰字奇偶校驗產生電路,設置以使用以下公式計算所述中間跨小鑰奇偶校驗9位元的最後一個位元:
Figure 111137123-A0305-02-0041-48
vt28代表所述中間跨小鑰奇偶校驗9位元的所述最後一個位元,rt2i代表第i個中間小鑰內奇偶校驗位元;以及鑰字奇偶校驗9位元合併電路,耦接所述鑰字奇偶校驗產生電路和所述鑰字跨奇偶校驗預測電路,設置以合併所述中間跨小鑰奇偶校驗位元組和所述中間跨小鑰奇偶校驗9位元的所述最後一個位元,成為所述中間跨小鑰奇偶校驗9位元。
The error detection device for data encryption as described in any one of claims 6 and 8, wherein the key word processing circuit includes: a substitute key word circuit, configured to replace the key corresponding to the last key according to the look-up table The first value of each small key of the word is replaced by the second value; the key word parity check generation circuit, coupled to the replacement key word circuit, is set to generate 4 according to the second value of the 4 small keys respectively The parity check bits in the middle small key, and according to the second value of the 4 small keys, generate 1 middle cross small key parity check bit group; the key word cross parity check prediction circuit is coupled to the The key word parity check generation circuit is configured to use the following formula to calculate the last bit of the 9-bit parity check in the middle of the small key:
Figure 111137123-A0305-02-0041-48
vt2 8 represents the last bit of the 9-bit parity check in the intermediate key, rt2 i represents the parity check bit in the ith intermediate key; and the 9-bit parity merging circuit of the key word , coupled to the key word parity generation circuit and the key word cross parity prediction circuit, configured to merge the intermediate cross small key parity bits and the intermediate cross small key parity 9 The last bit of the bits becomes the 9 bits of parity in the middle span keylet.
一種資料加密的錯誤偵測裝置,包含:搜索電路,設置以依據查找表將輸入的相應於回合密鑰的1個位元組的第一值轉換為第二值;以及替代校驗電路,耦接所述搜索電路,設置以使用相應於所述查找表的公式判斷所述第一值轉換為所述第二值的過程中是否發生錯誤,以及當發現錯誤時,發出錯誤訊號。 An error detection device for data encryption, comprising: a search circuit, configured to convert an input first value of 1 byte corresponding to a round key into a second value according to a look-up table; and a replacement check circuit, coupled Connected to the search circuit, configured to use a formula corresponding to the look-up table to determine whether an error occurs during the conversion of the first value into the second value, and to send an error signal when an error is found. 如請求項10所述的資料加密的錯誤偵測裝置,其中,所述查找表使用以下公式建立:SBi=Affine((i)-1) SBi代表i的輸出結果,Affine()代表Affine轉換函數,i為從0到127的正整數。 The error detection device for data encryption as described in claim item 10, wherein, the look-up table is established using the following formula: SB i =Affine((i) -1 ) SB i represents the output result of i, and Affine() represents Affine Conversion function, i is a positive integer from 0 to 127. 如請求項11所述的資料加密的錯誤偵測裝置,其中,所述替代校驗電路,包含:計算電路,耦接所述搜索電路,設置以獲取所述第二值,並且計算Affine(S’(out))-1而產生第三值,其中,S’(out)代表所述第二值,Affine()-1代表Affine轉換的反函數;乘法器,耦接所述搜索電路和所述計算電路,設置以將所述第二值乘上所述第三值以產生第四值;以及比較器,耦接所述搜索電路和所述乘法器,設置以實施以下邏輯運算式來產生判斷結果:err_nl=0,if(S’(mul)==1)&&(S’(in)!=0)&&(Affine(S’(out))-1!=0) err_nl=0,if(S’(mul)==0)&&(S’(in)==0)&&(Affine(S’(out))-1==0) err_nl=1,otherwise當err_nl等於1時,代表發現錯誤,S’(mul)代表所述第四值,S’(in)代表所述第一值,S’(out)代表所述第二值。 The error detection device for data encryption according to claim 11, wherein the substitution check circuit includes: a calculation circuit, coupled to the search circuit, configured to obtain the second value, and calculate Affine(S ' (out) ) -1 to generate a third value, wherein, S' (out) represents the second value, Affine () -1 represents the inverse function of Affine conversion; a multiplier, coupled to the search circuit and the The calculation circuit is configured to multiply the second value by the third value to generate a fourth value; and a comparator, coupled to the search circuit and the multiplier, is configured to implement the following logical operation formula to generate Judgment result: err_nl=0,if(S' (mul) ==1)&&(S' (in) !=0)&&(Affine(S' (out) ) -1 !=0) err_nl=0,if (S' (mul) ==0)&&(S' (in) ==0)&&(Affine(S' (out) ) -1 ==0) err_nl=1, otherwise when err_nl is equal to 1, it means discovery Error, S' (mul) represents the fourth value, S' (in) represents the first value, and S' (out) represents the second value. 如請求項10所述的資料加密的錯誤偵測裝置,其中,所述搜索電路設置以完成高級加密標準演算法中的替代鑰字操作。 The device for detecting errors in data encryption according to claim 10, wherein the search circuit is configured to perform a key substitution operation in the Advanced Encryption Standard algorithm.
TW111137123A 2021-12-21 2022-09-30 Apparatus and method for detecting errors during data encryption TWI804439B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US202163292038P 2021-12-21 2021-12-21
US63/292,038 2021-12-21

Publications (2)

Publication Number Publication Date
TWI804439B true TWI804439B (en) 2023-06-01
TW202326433A TW202326433A (en) 2023-07-01

Family

ID=86778519

Family Applications (2)

Application Number Title Priority Date Filing Date
TW111137123A TWI804439B (en) 2021-12-21 2022-09-30 Apparatus and method for detecting errors during data encryption
TW111137122A TWI808902B (en) 2021-12-21 2022-09-30 Apparatus for detecting errors during data encryption

Family Applications After (1)

Application Number Title Priority Date Filing Date
TW111137122A TWI808902B (en) 2021-12-21 2022-09-30 Apparatus for detecting errors during data encryption

Country Status (2)

Country Link
CN (2) CN116318622A (en)
TW (2) TWI804439B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108141358A (en) * 2015-10-15 2018-06-08 罗伯特·博世有限公司 For generating the method for key in the circuit arrangement
TWI673992B (en) * 2017-07-14 2019-10-01 美商雷神公司 Entwined encryption and error correction
CN111756541A (en) * 2019-03-26 2020-10-09 北京普安信科技有限公司 Method, server, terminal and system for transmitting secret key

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9646175B2 (en) * 2014-11-26 2017-05-09 Synopsys, Inc. Two-way parity error detection for advanced encryption standard engines
KR20200079134A (en) * 2018-12-24 2020-07-02 에스케이하이닉스 주식회사 Controller and memory system having the same
US11487908B2 (en) * 2019-08-16 2022-11-01 Macronix International Co., Ltd. Secure memory
CN113556332A (en) * 2021-07-09 2021-10-26 深圳市高德信通信股份有限公司 Data encryption transmission method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108141358A (en) * 2015-10-15 2018-06-08 罗伯特·博世有限公司 For generating the method for key in the circuit arrangement
TWI673992B (en) * 2017-07-14 2019-10-01 美商雷神公司 Entwined encryption and error correction
CN111756541A (en) * 2019-03-26 2020-10-09 北京普安信科技有限公司 Method, server, terminal and system for transmitting secret key

Also Published As

Publication number Publication date
TW202326491A (en) 2023-07-01
TWI808902B (en) 2023-07-11
CN116318622A (en) 2023-06-23
CN116318644A (en) 2023-06-23
TW202326433A (en) 2023-07-01

Similar Documents

Publication Publication Date Title
US9407286B2 (en) Data compression apparatus, data compression method, and memory system including the data compression apparatus
CN101149709B (en) Encryption processor of memory card and method for writing and reading data using the same
US8666064B2 (en) Endecryptor capable of performing parallel processing and encryption/decryption method thereof
US9348693B2 (en) Data accessing method for flash memory module
TWI432964B (en) Key transport method, memory controller and memory storage apparatus
CN105229592A (en) For generating the apparatus and method in order to again to access the descriptor of the nonvolatile semiconductor memory of memory driver due to mistake
US9672105B2 (en) Device and method for processing data using logical information and physical information
TWI804439B (en) Apparatus and method for detecting errors during data encryption
TWI835381B (en) Apparatus for detecting errors during data encryption
TWI835601B (en) Apparatus and method for expanding round keys during data encryption
CN110633225B (en) Apparatus and method for generating entity storage comparison table
TWI776351B (en) Data accessing method using data protection with aid of advanced encryption standard processing circuit, memory controller of memory device, and advanced encryption standard processing circuit of memory controller of memory device
US20240143791A1 (en) Apparatus and method for detecting errors during data encryption
US20230198754A1 (en) Apparatus and method for detecting errors during data encryption
CN118677599A (en) Round key expansion device for data encryption
US20230198755A1 (en) Apparatus and method for detecting errors during data encryption
TWI823436B (en) Apparatus and method for generating low-density parity-check (ldpc) code
US20230068302A1 (en) Memory device and method for data encryption/decryption of memory device
US20240356726A1 (en) Encryption device and operating method of encryption device
CN117331742A (en) Apparatus and method for generating low density parity check code
CN114969850A (en) Data transmission method and storage system