TWI529736B - Test method and system for memory device - Google Patents

Test method and system for memory device Download PDF

Info

Publication number
TWI529736B
TWI529736B TW103129808A TW103129808A TWI529736B TW I529736 B TWI529736 B TW I529736B TW 103129808 A TW103129808 A TW 103129808A TW 103129808 A TW103129808 A TW 103129808A TW I529736 B TWI529736 B TW I529736B
Authority
TW
Taiwan
Prior art keywords
test
memory device
vector
character
memory
Prior art date
Application number
TW103129808A
Other languages
Chinese (zh)
Other versions
TW201608575A (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 華邦電子股份有限公司
Priority to TW103129808A priority Critical patent/TWI529736B/en
Publication of TW201608575A publication Critical patent/TW201608575A/en
Application granted granted Critical
Publication of TWI529736B publication Critical patent/TWI529736B/en

Links

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)
  • For Increasing The Reliability Of Semiconductor Memories (AREA)

Description

記憶裝置的測試方法及系統 Memory device test method and system

本發明係有關於一種具有安全保護功能的記憶體,特別是有關於一種在測試模式下具有安全保護功能的記憶體的系統及方法。 The present invention relates to a memory having a security protection function, and more particularly to a system and method for a memory having a security protection function in a test mode.

許多具有安全保護功能的記憶裝置係利用一秘密鍵對欲儲存的資料進行加密。這種具有安全保護功能的記憶裝置很有可能會遭受攻擊,使得原本儲存的重要資料被不正當存取或是更改及/或中斷記憶裝置的操作。 Many memory devices with security protection use a secret key to encrypt the data to be stored. Such a memory device with security protection is likely to be attacked, so that the originally stored important data is improperly accessed or changed and/or interrupted.

本發明所提供的方法係應用在操作於測試模式下的記憶裝置,包括接收欲寫入記憶裝置中之一向量。當向量屬於複數測試向量之一預設集合時,將向量寫入記憶裝置。當向量不屬於測試向量之預設集合時,將向量轉換成測試向量之一者,用以產生一轉換向量,並將轉換向量寫入記憶裝置中。 The method provided by the present invention is applied to a memory device operating in a test mode, comprising receiving a vector to be written into the memory device. When the vector belongs to a preset set of one of the complex test vectors, the vector is written to the memory device. When the vector does not belong to the preset set of test vectors, the vector is converted into one of the test vectors to generate a conversion vector, and the conversion vector is written into the memory device.

在一些實施例中,將向量轉換成測試向量之一者的步驟包括,選擇向量的一位元集合;以及週期性地以位元集合取代向量的其它位元。在其它實施例中,測試向量之每一者的所有偶數位元的數值均等於一第一位元數值,測試向量之每一者的所有奇數位元的數值均等於一第二位元數值,並且將向量轉換成測試向量之一者的步驟包括,在向量中,選擇一代表 性的偶數位元以及一代表性的奇數位元;利用代表性的偶數位元取代向量的偶數位元;以及利用代表性的奇數位元取代向量的奇數位元。 In some embodiments, the step of converting the vector to one of the test vectors includes selecting a one-bit set of vectors; and periodically replacing the other bits of the vector with the set of bits. In other embodiments, the values of all the even bits of each of the test vectors are equal to a first bit value, and the values of all odd bits of each of the test vectors are equal to a second bit value. And the step of converting the vector into one of the test vectors includes, in the vector, selecting a representative Singular even bits and a representative odd bit; replacing the even bits of the vector with representative even bits; and replacing the odd bits of the vector with representative odd bits.

在一可能實施例中,本發明之測試記憶裝置的方法包括,讀取一先前寫入測試向量的一資料字元;以及輸出記憶裝置的一編碼資料,編碼資料與讀取資料字元時所發生錯誤有關。在另一實施例中,輸出記憶裝置的該編碼資料包括:輸出一錯誤數量。在其它實施例中,輸出記憶裝置的一編碼資料包括:不輸出錯誤發生的實際位置。 In a possible embodiment, the method for testing a memory device of the present invention includes: reading a data character of a previously written test vector; and outputting an encoded data of the memory device, encoding the data and reading the data character It is related to the error. In another embodiment, the encoding of the output memory device includes outputting an error amount. In other embodiments, an encoded material of the output memory device includes: not outputting the actual location at which the error occurred.

在一些實施例中,不輸出錯誤發生的實際位置的步驟包括,位移偶數位元以及奇數位元,該等偶數位元以及該等奇數位元表示錯誤發生在相對應的偶數或奇數位元中。在其它實施例中,輸出記憶裝置的一編碼資料包括:輸出錯誤發生的實際位置。 In some embodiments, the step of not outputting the actual location at which the error occurred includes shifting the even bit and the odd bit, the even bits and the odd bits indicating that the error occurred in the corresponding even or odd bit . In other embodiments, an encoded material of the output memory device includes an actual location at which an output error occurs.

本發明另提供一種記憶裝置,包括一記憶體以及一記憶體控制器。在一測試模式下,記憶體控制器接收一向量。向量係欲寫入記憶體中。只有當向量屬於複數測試向量之一預設集合時,記憶體控制器將向量寫入記憶體中。當向量不屬於測試向量之該預設集合時,記憶體控制器將向量轉換成測試向量之一者,用以產生一轉換向量,並將該轉換向量寫入記憶體中。 The invention further provides a memory device comprising a memory and a memory controller. In a test mode, the memory controller receives a vector. The vector is intended to be written into the memory. The memory controller writes the vector into the memory only when the vector belongs to one of the preset sets of the complex test vectors. When the vector does not belong to the preset set of test vectors, the memory controller converts the vector into one of the test vectors to generate a conversion vector and writes the conversion vector into the memory.

本發明提供一種測試方法,包括在一測試模式下,讀取一記憶裝置的至少一字元。對字元進行單向函數運算,用以產生一運算結果,並且無法由運算結果重新獲得字元。根據 運算結果,輸出錯誤發生在字元的一編碼資訊。 The present invention provides a test method comprising reading at least one character of a memory device in a test mode. A one-way function operation is performed on the character to generate an operation result, and the character cannot be retrieved from the operation result. according to As a result of the operation, an output error occurs in a coded information of the character.

在一些實施例中,讀取字元的步驟包括,當記憶裝置儲存字元後,接收單向函數的一公開結果;以及對字元進行單向函數運算的步驟包括,在讀取到字元後,對字元的一次集合進行該單向函數運算。在其它實施例中,輸出編碼資訊的步驟包括,輸出公開結果與運算結果的一比較結果的一二進制結果。在另一實施例中,接收公開結果的步驟包括,多次接收公開結果,並且當接收公開結果的次數大於一預設臨界值時,啟動一保護機制。 In some embodiments, the step of reading a character comprises: receiving a public result of the one-way function after the memory device stores the character; and performing the one-way function operation on the character comprises: reading the character Then, the one-way function operation is performed on a set of characters. In other embodiments, the step of outputting the encoded information includes outputting a binary result of a comparison of the published result and the computed result. In another embodiment, the step of receiving the public result includes receiving the public result multiple times, and initiating a protection mechanism when the number of times the public result is received is greater than a predetermined threshold.

本發明另提供一種記憶裝置,包括一記憶體;以及一記憶體控制器。在一測試模式下,記憶體控制器從記憶體中讀取至少一字元,並對字元進行一單向函數運算,用以產生一運算結果,使得無法由運算結果重新得到該字元,並根據運算結果,輸出錯誤發生在字元的一編碼資訊。 The invention further provides a memory device comprising a memory; and a memory controller. In a test mode, the memory controller reads at least one character from the memory and performs a one-way function operation on the character to generate an operation result, so that the character cannot be retrieved from the operation result. And according to the operation result, the output error occurs in a coded information of the character.

本發明另提供一種測試方法,包括在一記憶裝置中,確認一秘密鍵是否已設定。當秘密鍵被設定時,禁能記憶裝置的一測試模式,直到至少記憶裝置中的秘密鍵被清除。 The present invention further provides a test method comprising confirming in a memory device whether a secret key has been set. When the secret key is set, a test mode of the memory device is disabled until at least the secret key in the memory device is cleared.

在一些實施例中,秘密鍵係設定在記憶裝置中,並且至少記憶裝置中的秘密鍵被清除的步驟包括,清除記憶裝置的所有記憶空間。 In some embodiments, the secret key is set in the memory device, and at least the step of clearing the secret key in the memory device includes clearing all memory spaces of the memory device.

本發明更提供一種記憶裝置,包括一記憶體;以及一記憶體控制器。記憶體控制器確認是否一秘密鍵已被設定,並在秘密鍵被設定時,禁能該記憶裝置的一測試模式,直到至少記憶體的秘密鍵被清除。 The invention further provides a memory device comprising a memory; and a memory controller. The memory controller confirms whether a secret key has been set, and when the secret key is set, disables a test mode of the memory device until at least the secret key of the memory is cleared.

為讓本發明之特徵和優點能更明顯易懂,下文特舉出較佳實施例,並配合所附圖式,作詳細說明如下: In order to make the features and advantages of the present invention more comprehensible, the preferred embodiments are described below, and are described in detail with reference to the accompanying drawings.

20‧‧‧測試系統 20‧‧‧Test system

24‧‧‧記憶裝置 24‧‧‧ memory device

28‧‧‧主機 28‧‧‧Host

32‧‧‧記憶體控制器 32‧‧‧ memory controller

34‧‧‧記憶體介面 34‧‧‧Memory interface

38‧‧‧不安全連結 38‧‧‧Unsafe links

40‧‧‧非揮發記憶體 40‧‧‧ Non-volatile memory

44‧‧‧模式配置單元 44‧‧‧Mode configuration unit

48‧‧‧選擇器 48‧‧‧Selector

52‧‧‧加密引擎 52‧‧‧Encryption Engine

56‧‧‧秘密鍵單元 56‧‧‧secret key unit

60‧‧‧測試讀/寫單元 60‧‧‧Test read/write unit

64‧‧‧測試圖案 64‧‧‧ test pattern

260、268‧‧‧記憶區域 260, 268‧‧‧ memory area

100、104、108、112、200、204、208、212、216、220、224、228‧‧‧步驟 100, 104, 108, 112, 200, 204, 208, 212, 216, 220, 224, 228 ‧ ‧ steps

第1圖係為本發明一實施例之測試系統之示意圖。 Figure 1 is a schematic illustration of a test system in accordance with an embodiment of the present invention.

第2圖係為本發明一實施例之秘密寫入測試圖案方法的流程示意圖。 2 is a flow chart showing a method of secretly writing a test pattern according to an embodiment of the present invention.

第3圖係為本發明一實施例之記憶體裝置的測試方法的流程示意圖。 3 is a flow chart showing a test method of a memory device according to an embodiment of the present invention.

第4圖係為本發明一實施例之利用單向函數對記憶裝置進行測試方法的示意圖。 4 is a schematic diagram of a method for testing a memory device using a one-way function according to an embodiment of the present invention.

本發明所提供的方法及系統係用以預防記憶裝置受到攻擊,以避免不正常使用記憶裝置的測試模式。在測試模式中,測試圖案會被儲存並被讀取,但在儲存或讀取測試圖案時,並不會對測試圖案進行加密,因此,很容易得知測試結果。雖然只有經過授權的測試人員才能夠測試記憶裝置,但由於記憶裝置在測試模式下較為危弱,故未經授權的人員可能嘗試存取或更改儲存的資料或對記憶裝置進行其它攻擊,因而中斷記憶裝置的運作。在以下的說明中,係假設記憶裝置透過一不安全的連結,而與一外部主機(如測試人員)進行溝通。 The method and system provided by the present invention are for preventing a memory device from being attacked to avoid a test mode in which the memory device is not normally used. In the test mode, the test pattern is stored and read, but the test pattern is not encrypted when the test pattern is stored or read, so it is easy to know the test result. Although only authorized testers can test the memory device, because the memory device is weak in the test mode, unauthorized personnel may attempt to access or change the stored data or perform other attacks on the memory device, thus interrupting The operation of the memory device. In the following description, it is assumed that the memory device communicates with an external host (such as a tester) through an unsecure connection.

在一些實施例中,測試模式與預設測試圖案的一小集合(以下也稱為測試向量)有關。當記憶裝置操作在測試模式下時,記憶裝置只將符合預設有效圖案的集合的資料字元寫 入記憶陣列中。另外,若接收到不屬於測試圖案的集合的資料字元時,記憶裝置在儲存字元前,先將該資料字元轉換成預設測試圖案之一者,再儲存該轉換後的字元。藉由限定寫入記憶裝置的圖案,而不是限定有意義的資訊,因而提高記憶裝置的安全性。 In some embodiments, the test mode is related to a small set of preset test patterns (hereinafter also referred to as test vectors). When the memory device operates in the test mode, the memory device only writes data characters that match the set of preset active patterns. Into the memory array. In addition, if a data character that does not belong to the set of test patterns is received, the memory device converts the data character into one of the preset test patterns before storing the character, and then stores the converted character. The security of the memory device is improved by defining a pattern of writes to the memory device rather than defining meaningful information.

在一些實施例中,記憶裝置讀取先前存入的測試圖案,讀取結果可能具有至少一錯誤。記憶裝置將讀取圖案轉換成有效圖案之一者,再比較轉換結果與讀取圖案,用以產生具有錯誤位元的字元。此字元隱藏錯誤發生的實際位置,但記憶裝置仍可處理此字元,讓測試人員進行測試及除錯。舉例而言,上述的處理可能係將錯誤位元位移到其它位元位置。換句話說,記憶裝置判斷錯誤的數量,但不告知錯誤發生的位置。在一可能實施例中,記憶裝置更對錯誤數量及最高有效錯誤位元進行編碼。 In some embodiments, the memory device reads the previously deposited test pattern and the read result may have at least one error. The memory device converts the read pattern into one of the active patterns, and compares the conversion result with the read pattern to generate a character having an erroneous bit. This character hides the actual location where the error occurred, but the memory device can still process the character for the tester to test and debug. For example, the above process may shift the wrong bit to other bit positions. In other words, the memory device determines the number of errors, but does not tell where the error occurred. In a possible embodiment, the memory device encodes the number of errors and the most significant error bits.

在一些實施例中,主機寫入測試資料到一特定記憶區域(並不需要是鄰近的區域)。主機更告知記憶裝置一公開結果,該公開結果係為儲存在特定記憶區域的測試資料經一單向函數運算後的結果。單向函數的特性係無法回推記憶區域所儲存的測試資料。為了測試記憶區域的測試資料的準確性,記憶裝置再次計算單向函數的結果,並將再次計算的結果與公開結果相比較。 In some embodiments, the host writes test data to a particular memory area (and does not need to be a neighboring area). The host further informs the memory device of a public result, which is the result of the test data stored in the specific memory region being subjected to a one-way function operation. The characteristics of the one-way function cannot push back the test data stored in the memory area. In order to test the accuracy of the test data in the memory region, the memory device again calculates the result of the one-way function and compares the recalculated result with the public result.

若再次計算的結果不同於公開結果時,則表示從記憶區域所讀取的資料具有至少一錯誤。記憶裝置只會輸出比較結果的二進制,因此,只會公開必要的資訊。此測試機制可 測試寫入資料的正確性,但無法猜出資料。 If the result of the recalculation is different from the public result, it means that the data read from the memory area has at least one error. The memory device will only output the binary of the comparison result, so only the necessary information will be disclosed. This test mechanism can Test the correctness of the written data, but can not guess the data.

在一些實施例中,當一攻擊發生時,將會提供許多不同的單向函數結果,用以研判所儲存的資料,此時,記憶裝置提供一保護機制。記憶裝置計算所接收到的單向函數結果的次數,並在次數大於一預設臨界值時,記憶裝置禁能測試模式或啟動一保護機制。 In some embodiments, when an attack occurs, a number of different one-way function results are provided to investigate the stored data, at which point the memory device provides a protection mechanism. The memory device counts the number of received one-way function results, and when the number of times is greater than a predetermined threshold, the memory device disables the test mode or initiates a protection mechanism.

在一可能實施例中,記憶裝置係判斷是否已設定至少一秘密鍵,並根據判斷結果禁能測試模式。舉例而言,秘密鍵可能係用以加密及/或辨識。在其它實施例中,當秘密鍵尚未被設定時,記憶裝置無法進行加密及/或辨識操作。因此,在設定一秘密鍵後,在測試模式下,記憶裝置不寫入未加密資料及/或不讀取所儲存的資料。在此例中,為了開始測試,記憶裝置先清除所有的資料,包括任何已設定的秘密鍵以及其它已儲存的秘密資訊。當然,記憶體裝置也可以是選擇性只清除已設定的秘密鍵或只清除已儲存的秘密資訊。 In a possible embodiment, the memory device determines whether at least one secret key has been set, and disables the test mode according to the determination result. For example, a secret key may be used for encryption and/or identification. In other embodiments, the memory device is unable to perform encryption and/or identification operations when the secret key has not been set. Therefore, after setting a secret key, in the test mode, the memory device does not write unencrypted data and/or does not read the stored data. In this example, in order to start the test, the memory device first clears all the data, including any set secret keys and other stored secret information. Of course, the memory device can also selectively clear only the set secret key or only the stored secret information.

可利用許多方式達到上述用以提高記憶裝置測試的安全性,如限定寫入的資料必須符合測試圖案之一小集合、只提供測試結果的編碼及特定的資訊、以及只有在清除所有秘密鍵及/或秘密資料時,才執行測試動作。 There are many ways to achieve the above-mentioned security for improving the memory device test, such as limiting the written data must conform to a small set of test patterns, only provide the code of the test results and specific information, and only clear all secret keys and The test action is performed only when the secret data is available.

第1圖係為本發明一實施例之測試系統之示意圖。測試系統20用以測試記憶裝置24。測試系統20包括一主機28。主機28寫入資料及/或命令至記憶裝置24中,並從記憶裝置24中,讀取資料及/或測試結果。記憶裝置24包括一記憶體控制器32。記憶體控制器32利用一記憶體介面34透過一不安全連結 38與主機28進行溝通。 Figure 1 is a schematic illustration of a test system in accordance with an embodiment of the present invention. Test system 20 is used to test memory device 24. Test system 20 includes a host 28. The host 28 writes data and/or commands to the memory device 24 and reads data and/or test results from the memory device 24. Memory device 24 includes a memory controller 32. The memory controller 32 utilizes a memory interface 34 through an insecure link 38 communicates with the host 28.

記憶裝置24更包括一非揮發記憶體40。非揮發記憶體40儲存記憶體控制器32所提供的資料,並根據要求,將所儲存的資料提供予記憶體控制器32。在本實施例中,非揮發記憶體40包括快閃記憶體(flash memory)。在另一可能實施例中,非揮發記憶體40可包括其它任何合適的技術所產生的非揮發記憶體,如固態硬碟(SSD)、電子抹除式可複寫唯讀記憶體(EEPROM)、一次可程式化唯讀記憶體(OTP ROM)、可變電阻式記憶體(Resistive-RAM;RRAM)、磁性儲存器(magnetic storage),如硬性磁碟機(Hard Disk Drive;HDD)、光學儲存器……等等。在以下的說明中,假設非揮發記憶體40具有一快閃記憶體,但並非用以限制本發明。在其它實施例中,可利用其它合適的記憶體取代快閃記憶體。 The memory device 24 further includes a non-volatile memory 40. The non-volatile memory 40 stores the data provided by the memory controller 32 and provides the stored data to the memory controller 32 as required. In the present embodiment, the non-volatile memory 40 includes a flash memory. In another possible embodiment, the non-volatile memory 40 can include non-volatile memory generated by any other suitable technique, such as solid state hard disk (SSD), electronic erasable rewritable read only memory (EEPROM), One Programmable Read Only Memory (OTP ROM), Variable Resistive Memory (RRAM), Magnetic Storage, such as Hard Disk Drive (HDD), Optical Storage And so on. In the following description, it is assumed that the non-volatile memory 40 has a flash memory, but is not intended to limit the present invention. In other embodiments, other suitable memory may be utilized in place of the flash memory.

一模式配置單元44令記憶裝置24操作在兩執行模式之一者中,如一操作模式或一測試模式。雖然測試模式一般係受限於經過授權的使用者,但其它未經授權的使用者也可使記憶裝置進入測試模式。 A mode configuration unit 44 causes the memory device 24 to operate in one of two modes of execution, such as an operational mode or a test mode. Although the test mode is generally limited to authorized users, other unauthorized users can also put the memory device into test mode.

在操作模式下,記憶體控制器32對欲儲存在非揮發記憶體40內的資料進行加密操作,並利用一加密引擎52擷取非揮發記憶體40所儲存的資料。在操作模式下,一選擇器48連接於加密引擎52與非揮發記憶體40之間。在其它實施例中,在儲存資料前,加密引擎52先對資料進行加密,並在讀取非揮發記憶體時,對資料進行解密。 In the operation mode, the memory controller 32 encrypts the data to be stored in the non-volatile memory 40, and uses an encryption engine 52 to retrieve the data stored in the non-volatile memory 40. In the operational mode, a selector 48 is coupled between the encryption engine 52 and the non-volatile memory 40. In other embodiments, prior to storing the data, the encryption engine 52 first encrypts the data and decrypts the data when the non-volatile memory is read.

在另一實施例中,加密引擎52計算資料的一加密 簽章(cryptographic signature),並將簽章連同資料一起儲存在非揮發記憶體40中。在擷取資料時,加密引擎52藉由計算讀取資料的簽章並比較被儲存的簽章,用以恢復資料的正確性。一秘密鍵單元56具有至少一秘密鍵,用以供加密引擎52使用。 In another embodiment, the encryption engine 52 calculates an encryption of the data. A cryptographic signature is stored and the signature is stored in non-volatile memory 40 along with the data. When the data is retrieved, the encryption engine 52 restores the correctness of the data by calculating the signature of the read data and comparing the stored signatures. A secret key unit 56 has at least one secret key for use by the encryption engine 52.

在測試模式下,記憶體控制器32令選擇器48由原本透過加密引擎52,改成透過一測試讀/寫單元60與非揮發記憶體40連結。因此,在測試模式下,測試讀/寫單元60便可控制非揮發記憶體與主機間的交換資訊。 In the test mode, the memory controller 32 causes the selector 48 to be passed through the encryption engine 52 to be coupled to the non-volatile memory 40 via a test read/write unit 60. Therefore, in the test mode, the test read/write unit 60 can control the exchange of information between the non-volatile memory and the host.

在一些實施例中,在測試模式下,若欲將資料寫入非揮發記憶體時,測試讀/寫單元60只將符合預設測試圖案64的一小集合的資料字元寫入非揮發記憶體。另外,測試讀/寫單元60接收並將來自記憶體介面34的資料轉換成合法的測試圖案,其中未轉換前的資料不符合測試圖案64的任何部分。在一可能實施例中,一未經授權的使用者無法寫入有意義的資訊至非揮發記憶體,因此,無法更改非揮發記憶體內重要的資訊。 In some embodiments, in the test mode, if the data is to be written to the non-volatile memory, the test read/write unit 60 writes only a small set of data characters that conform to the preset test pattern 64 to the non-volatile memory. body. Additionally, test read/write unit 60 receives and converts data from memory interface 34 into a legal test pattern, wherein the unconverted material does not conform to any portion of test pattern 64. In a possible embodiment, an unauthorized user cannot write meaningful information to the non-volatile memory, and therefore cannot change important information in the non-volatile memory.

在測試模式下,當記憶裝置24讀取非揮發記憶體40所儲存的資料時,測試讀/寫單元60確認讀取的資料是否發生錯誤。測試讀/寫單元60編碼錯誤的資訊,因此,只有必要的錯誤資訊會被公開,並透過記憶體介面34將編碼資訊提供予主機28。因此,不安全連結38只會傳送最少的必要資訊。 In the test mode, when the memory device 24 reads the data stored in the non-volatile memory 40, the test read/write unit 60 confirms whether the read data has an error. The test read/write unit 60 encodes the wrong information, so that only the necessary error information is disclosed and the encoded information is provided to the host 28 via the memory interface 34. Therefore, the insecure link 38 will only transmit the minimum necessary information.

在其它實施例中,記憶裝置24的測試係對儲存在非揮發記憶體的資料進行單向函數(one-way function)運算。單向函數係符合兩標準,第一是資料的改變很有可能會造成函數 的結果改變,第二是無法從結果中恢復資料。 In other embodiments, the test of memory device 24 performs a one-way function operation on data stored in non-volatile memory. The one-way function conforms to two standards. The first is that the change of data is likely to cause a function. The result is changed, and the second is that the data cannot be recovered from the results.

一般而言,單向函數運算係由測試讀/寫單元60所完成,但也可能是加密引擎52的一部分或是被切分在測試讀/寫單元60與加密引擎52中。當主機欲儲存資料在記憶裝置中時,測試讀/寫單元60對資料進行單向函數運算,並儲存資料與運算結果,並將資料及運算結果回傳予主機。在另一可能實施例中,主機具有一裝置,用以進行單向函數結果的運算,用以產生相對應的公開結果,並將公開結果儲存在主機的一本地記憶體中。 In general, the one-way function operation is performed by the test read/write unit 60, but may also be part of the encryption engine 52 or split into the test read/write unit 60 and the encryption engine 52. When the host wants to store the data in the memory device, the test read/write unit 60 performs a one-way function operation on the data, stores the data and the operation result, and returns the data and the operation result to the host. In another possible embodiment, the host has a means for performing a one-way function result operation to generate a corresponding public result and storing the public result in a local memory of the host.

在測試模式下,主機將單向函數運算的公開結果提供予測試讀/寫單元60,用以讀回資料,測試讀/寫單元60讀取記憶體所儲存的資料,再對讀取資料進行單向函數運算,再將運算結果與主機所提供的公開結果進行比較。若兩結果相符,可以假設很有可能讀取到正確的資料。測試讀/寫單元60可以只將比較結果或是單向函數的再次計算結果提供予主機28。 In the test mode, the host provides the public result of the one-way function operation to the test read/write unit 60 for reading back the data, and the test read/write unit 60 reads the data stored in the memory, and then performs the read data. A one-way function operation, and then compare the result of the operation with the public result provided by the host. If the two results match, it can be assumed that it is very possible to read the correct data. The test read/write unit 60 may provide only the result of the comparison or the result of the recalculation of the one-way function to the host 28.

在一些實施例中,測試讀/寫單元60更維持追踪接收到單向函數的公開結果的次數,公開結果係用以與再次計算結果進行比較。當追踪到的次數大於一預設臨界值時,表示受到暴力功擊(brute force attack),並且記憶裝置可能會藉由離開測試模式,以達到保護的功能,或是使用其它合適的保護機制。 In some embodiments, the test read/write unit 60 further maintains tracking the number of times the public result of the one-way function is received, and the published result is used to compare with the recalculated result. When the number of times of tracking is greater than a predetermined threshold, it indicates that a brute force attack is performed, and the memory device may pass the test mode to achieve the protection function or use other suitable protection mechanisms.

在一些實施例中,測試讀/寫單元60包括一裝置,用以偵測秘密鍵單元56是否已就緒,並可禁能記憶裝置,直到秘密鍵及/或其它重要資訊已被清除,稍後將舉例說明。 In some embodiments, test read/write unit 60 includes a means for detecting if secret key unit 56 is ready and can disable the memory device until the secret key and/or other important information has been cleared, later. An example will be given.

第1圖所示之記憶裝置24的架構只是一示範架構,純粹用以說明。在其它實施例中,也可使用其它合適的記憶裝置的架構。藉由其它合適的硬體架構,如特殊應用積體電路(Application-Specific Integrated Circuit;ASIC)或現場可程式閘陣列(Field-Programmable Gate Array;FPGA),便可實現記憶裝置24裡的不同元件,如測試讀/寫單元60與加密引擎52。在一些實施例中,可利用軟體或軟體與硬體的組合,實現記憶裝置24裡的一些元件。 The architecture of the memory device 24 shown in Figure 1 is merely an exemplary architecture and is purely illustrative. In other embodiments, other suitable memory device architectures may be used. Different components in the memory device 24 can be realized by other suitable hardware architectures, such as an Application-Specific Integrated Circuit (ASIC) or a Field-Programmable Gate Array (FPGA). For example, the test read/write unit 60 and the encryption engine 52 are tested. In some embodiments, some of the components in memory device 24 may be implemented using a combination of software or software and hardware.

在一些實施例中,測試系統20的某些元件,如主機28或記憶體控制器32的元件,可能包括一中央處理器(general-purpose processor),其可利用軟體完成上述功能。可利用電子格式,如網路,將軟體下載至處理器,或是提供及/或儲存至非暫能有形媒體(non-transitory tangible media),如磁性、光學或電子記憶體。 In some embodiments, certain components of test system 20, such as components of host 28 or memory controller 32, may include a general-purpose processor that can perform the functions described above using software. The software can be downloaded to the processor in an electronic format, such as a network, or provided and/or stored in non-transitory tangible media, such as magnetic, optical or electronic memory.

第2圖係為本發明之秘密寫入測試圖案的流程示意圖。在本實施例中,步驟100、104、108及112係在記憶裝置上進行。假設,記憶裝置操作在測試模式下。另外,假設,非揮發記憶體40儲存32位元的資料,並且測試圖案64具有四個32位元的圖案,如下列的表格1所示。在表格1中,偶數位元具有第一位元值,而奇數位元具有第二位元值。 Figure 2 is a flow chart showing the secret writing test pattern of the present invention. In the present embodiment, steps 100, 104, 108, and 112 are performed on a memory device. Assume that the memory device operates in test mode. In addition, it is assumed that the non-volatile memory 40 stores 32-bit data, and the test pattern 64 has four 32-bit patterns as shown in Table 1 below. In Table 1, even bits have a first bit value and odd bits have a second bit value.

首先,在接收步驟100中,利用測試讀/寫單元60接收來自主機28的一欲寫入的資料字元。在測試模式下,資料字元一般係屬於測試圖案64之一者,例如資料字元等於上述表格1的一圖案。在另一實施例中,接收步驟100係利用測試讀/寫單元60接收來自主機的一命令,該命令包括一欲寫入的資料字元。 First, in the receiving step 100, a test word to be written from the host 28 is received by the test read/write unit 60. In the test mode, the data characters are generally one of the test patterns 64, for example, the data characters are equal to a pattern of Table 1 above. In another embodiment, the receiving step 100 utilizes the test read/write unit 60 to receive a command from the host that includes a data character to be written.

在確認步驟104中,測試讀/寫單元60判斷接收到的資料字元是否符合測試圖案64的任一者。若資料字元不同於所有有效測試圖案時,在轉換步驟108中,測試讀/寫單元將資料字元轉換成一有效測試圖案,否則測試讀/寫單元不理會資料字元,因此資料字元未被改變。在上述兩例中,測試讀/寫單元輸出一有效測試圖案。在一些實施例中,當接收到的資料字元不符合所有測試圖案時,記憶裝置忽略該資料字元或具有該資料字元的命令。 In a confirmation step 104, the test read/write unit 60 determines whether the received data character matches any of the test patterns 64. If the data character is different from all valid test patterns, in the conversion step 108, the test read/write unit converts the data character into a valid test pattern, otherwise the test read/write unit ignores the data character, so the data character is not Was changed. In the above two examples, the test read/write unit outputs an effective test pattern. In some embodiments, when the received data character does not conform to all of the test patterns, the memory device ignores the data character or the command with the data character.

測試讀/寫單元60可利用任何適合的方法將接收到的資料字元轉換成一有效圖案。在一些實施例中,為了執行轉換動作,測試讀/寫單元先從接收到的資料字元的32位元中,選擇一代表性的偶數位元以及一代表性的奇數位元。測試讀/寫單元可選擇任何合適的偶數及奇數代表位元,舉例而言,測試讀/寫單元從接收到的資料字元中,選擇最高有效位元(MSB)及其相鄰的位元,或是選擇最低有效位元(LSB)及其相鄰的位 元。測試讀/寫單元60接著利用上述選擇到的代表性的偶數位元的數值取代資料字元中偶數位元的數值,以及利用上述選擇到的代表性的奇數位元的數值取代資料字元中奇數位元的數值,用以將接收到資料字元轉換成一有效測試圖案。一般而言,測試讀/寫單元可能從接收到的資料字元的位元中,選擇合適的位元,再利用所選擇的合適位元的數值週期性地取代接收到的資料字元的其它剩餘位元,用以將接收到的資料字元轉換成一有效圖案。 Test read/write unit 60 may convert the received data characters into a valid pattern using any suitable method. In some embodiments, to perform the conversion action, the test read/write unit first selects a representative even bit and a representative odd bit from the 32 bits of the received data character. The test read/write unit may select any suitable even and odd representative bit. For example, the test read/write unit selects the most significant bit (MSB) and its adjacent bit from the received data word. Or select the least significant bit (LSB) and its adjacent bits yuan. The test read/write unit 60 then replaces the value of the even bit in the data character with the value of the selected representative even bit selected above, and replaces the data word with the value of the selected representative odd bit selected above. The value of the odd bit is used to convert the received data character into a valid test pattern. In general, the test read/write unit may select the appropriate bit from the bits of the received data character and then periodically replace the received data character with the value of the selected appropriate bit. The remaining bits are used to convert the received data characters into a valid pattern.

在一實施例中,在步驟108中,測試讀/寫單元60係將最高有效位元及其相鄰位元的數值複製15次,用以將接收到的資料字元轉換成一有效圖案。舉例而言,測試讀/寫單元將32位元的資料字元00XX…XXXX轉換成圖案0x00000000,其中x係表示二進制數值,其可能是0或1,以及將字元01XX…XXXX轉換成圖案0x55555555(二進制數值為”0101…01010101”)。 In one embodiment, in step 108, test read/write unit 60 copies the value of the most significant bit and its neighboring bits 15 times to convert the received data word into a valid pattern. For example, the test read/write unit converts the 32-bit data character 00XX...XXXX into a pattern 0x00000000, where x represents a binary value, which may be 0 or 1, and converts the characters 01XX...XXXX into a pattern 0x55555555 (The binary value is "0101...01010101").

在儲存步驟112中,測試讀/寫單元60將步驟108所產生的圖案寫入非揮發記憶體40中,並結束寫入動作,如上所述,步驟108所產生的圖案係為一有效測試圖案。 In the storing step 112, the test read/write unit 60 writes the pattern generated in step 108 into the non-volatile memory 40, and ends the writing operation. As described above, the pattern generated in step 108 is an effective test pattern. .

第2圖所呈現的寫入流程可預防一未經授權的使用者寫入有意義的資訊至記憶體中,而試圖讀取或竄改秘密資料,或是造成記憶裝置的其它損害。 The write flow presented in Figure 2 prevents an unauthorized user from writing meaningful information into the memory while attempting to read or tamper with the secret data or cause other damage to the memory device.

第3圖係為本發明之記憶體裝置的測試方法的流程示意圖。第3圖的測試方法可在完成第2圖的寫入動作後開始進行或是與第2圖的寫入動作各自獨立進行。在本實施例中, 步驟200、204、208、212、216及220係在記憶裝置上進行,而步驟224及228係在主機上進行。在第3圖中,係假設圖案0x55555555(二進制數值為”0101…01010101”)已事先寫入非揮發記憶體中。其它數值的寫入結果揭露於以下的表格2中。 Figure 3 is a flow chart showing the test method of the memory device of the present invention. The test method of Fig. 3 can be started after the completion of the write operation of Fig. 2 or independently of the write operation of Fig. 2. In this embodiment, Steps 200, 204, 208, 212, 216, and 220 are performed on the memory device, and steps 224 and 228 are performed on the host. In Fig. 3, it is assumed that the pattern 0x55555555 (the binary value is "0101...01010101") has been previously written into the non-volatile memory. The results of writing other values are disclosed in Table 2 below.

一開始,在讀取步驟200中,測試讀/寫單元60讀取儲存在非揮發記憶體40內的一字元。在一些實施例中,測試讀/寫單元根據主機所提供的一命令(未顯示)執行步驟200,用以讀取記憶體內的至少一字元。步驟200所讀取到的32位元的字元可能是正確或是錯誤的。在表格2中,假設讀取字元具有21個錯誤,並且取代了先前所寫入的圖案0x55555555,故測試讀/寫單元60讀取到的字元R_WORD為0x93209A6A。 Initially, in a read step 200, the test read/write unit 60 reads a character stored in the non-volatile memory 40. In some embodiments, the test read/write unit performs step 200 for reading at least one character in the memory according to a command (not shown) provided by the host. The 32-bit characters read in step 200 may be correct or incorrect. In Table 2, assuming that the read character has 21 errors and replaces the previously written pattern 0x55555555, the character R_WORD read by the test read/write unit 60 is 0x93209A6A.

在讀取轉換步驟204中,測試讀/寫單元60將字元R_WORD轉換成測試圖案64之一者。在一可能實施例中,步驟204的轉換方法相同於上述步驟104及108的確認及轉換方法。在表格2中,字元R_WORD的最高有效位元及其相鄰位元的數值為10,故字元R_WORD會被轉換成圖案R_PATTERN,其十六進制數值為0xAAAAAAAA。 In the read conversion step 204, the test read/write unit 60 converts the character R_WORD into one of the test patterns 64. In a possible embodiment, the conversion method of step 204 is the same as the confirmation and conversion method of steps 104 and 108 above. In Table 2, the most significant bit of the character R_WORD and its neighboring bit have a value of 10, so the character R_WORD is converted into a pattern R_PATTERN having a hexadecimal value of 0xAAAAAAAA.

在一錯誤擷取步驟208中,測試讀/寫單元60利用32位元XOR運算,比較字元R_WORD與圖案R_PATTERN,其可產32位元的數值,以符號R_ERRORS表示。當字元R_WORD沒有錯誤時,字元R_ERRORS的所有位元數值應等於0。 In an error capture step 208, the test read/write unit 60 compares the character R_WORD with the pattern R_PATTERN using a 32-bit XOR operation, which yields a 32-bit value, represented by the symbol R_ERRORS. When the character R_WORD has no errors, all the bit values of the character R_ERRORS should be equal to zero.

在最高有效錯誤位元擷取步驟212中,測試讀/寫單元擷取一32位元的字元,以符號MS_ERROR_BIT表示,字元MS_ERROR_BIT只有一個位元的數值為1,也就是字元 R_ERRORS的最高有效錯誤位元的發生位置。舉例而言,當R_ERRORS的所有位元數值不為0時,測試讀/寫單元60可清除字元MS_ERROR_BIT的所有位元,並根據字元R_ERRORS的最左側的數值為非0的位元,令字元MS_ERROR_BIT的相對應位元為數值1。在表格2中,字元MS_ERROR_BIT為0x20000000。在一些實施例中,測試讀/寫單元60並不提供最高有效錯誤位元的實際資訊,故可省略步驟212。 In the most significant error bit extraction step 212, the test read/write unit retrieves a 32-bit character, represented by the symbol MS_ERROR_BIT, and the character MS_ERROR_BIT has only one bit having a value of 1, which is a character. The location of the most significant error bit of R_ERRORS. For example, when all the bit values of R_ERRORS are not 0, the test read/write unit 60 can clear all the bits of the character MS_ERROR_BIT, and the non-zero bit according to the leftmost value of the character R_ERRORS, The corresponding bit of the character MS_ERROR_BIT is the value 1. In Table 2, the character MS_ERROR_BIT is 0x20000000. In some embodiments, test read/write unit 60 does not provide actual information on the most significant error bit, so step 212 can be omitted.

在步驟212中,測試讀/寫單元60擷取32位元的字元,其包括最低有效錯誤位元,以符號LS_ERROR_BITS表示。除了最高有效錯誤位元外,字元LS_ERROR_BITS等於R_ERRORS,(如對字元R_ERRORS及MS_ERROR_BIT進行XOR運算)。在表格2中,字元LS_ERROR_BITS為0x198A30C0。 In step 212, test read/write unit 60 retrieves a 32-bit character that includes the least significant error bit, represented by the symbol LS_ERROR_BITS. In addition to the most significant error bit, the character LS_ERROR_BITS is equal to R_ERRORS (eg XOR operations on the characters R_ERRORS and MS_ERROR_BIT). In Table 2, the character LS_ERROR_BITS is 0x198A30C0.

在錯誤編碼步驟216中,測試讀/寫單元60將字元LS_ERROR_BITS的錯誤編碼成32位元的字元,用以找出錯誤的數量,但還不知道錯誤係發生在哪些位元。測試讀/寫單元60各自地處理字元LS_ERROR_BITS的偶數與奇數位元的數值。在本實施例中,在字元LS_ERROR_BITS的偶數與奇數位元中,數值為1的位元稱為”1”位元。 In error encoding step 216, test read/write unit 60 encodes the error of character LS_ERROR_BITS into a 32-bit character to find the number of errors, but it is not known which bits the error occurred in. The test read/write unit 60 processes the values of the even and odd bits of the character LS_ERROR_BITS, respectively. In the present embodiment, among the even and odd bits of the character LS_ERROR_BITS, a bit having a value of 1 is referred to as a "1" bit.

在步驟216中,為了處理偶數的”1”位元,測試讀/寫單元60將字元LS_ERROR_BITS的偶數的”1”位元依序移到有效的最右側的偶數位元。移動後的結果如符號EVN_SHIFT_ERRORS所示,其數值為000…01010101,在符號EVN_SHIFT_ERRORS的所有位元中,數值為1的位元數量即為字元LS_ERROR_BITS的偶數的”1”位元的數量。在表格2中, 字元LS_ERROR_BITS具有四個偶數”1”位元,因此,字元EVE_SHIFT_ERRORS為0x00000055。 In step 216, to process the even "1" bits, the test read/write unit 60 sequentially shifts the even "1" bits of the character LS_ERROR_BITS to the active rightmost even bit. The result of the movement is as shown by the symbol EVN_SHIFT_ERRORS, and its value is 000...01010101. Among all the bits of the symbol EVN_SHIFT_ERRORS, the number of bits having a value of 1 is the number of even "1" bits of the character LS_ERROR_BITS. In Table 2, The character LS_ERROR_BITS has four even "1" bits, so the character EVE_SHIFT_ERRORS is 0x00000055.

同樣地,為了處理奇數”1”位元,測試讀/寫單元60將字元LS_ERROR_BITS的奇數”1”位元依序移到有效的最右側的奇數位元。移動後的結果如符號ODD_SHIFT_ERRORS所示,其數值為000…101010,在符號ODD_SHIFT_ERRORS中,數值為1的位元數量係表示字元LS_ERROR_BITS的奇數”1”位元的數量。在表格2中,字元LS_ERROR_BITS具有六個奇數”1”位元,因此,字元ODD_SHIFT_ERRORS為0x00000AAA。 Similarly, to process odd "1" bits, test read/write unit 60 sequentially shifts the odd "1" bits of character LS_ERROR_BITS to the active rightmost odd bit. The result of the movement is as shown by the symbol ODD_SHIFT_ERRORS, and its value is 000...101010. In the symbol ODD_SHIFT_ERRORS, the number of bits having a value of 1 represents the number of odd "1" bits of the character LS_ERROR_BITS. In Table 2, the character LS_ERROR_BITS has six odd "1" bits, so the character ODD_SHIFT_ERRORS is 0x00000AAA.

字元EVE_SHIFT_ERRORS與ODD_SHIFT_ERRORS告知錯誤的數量,但還不知道錯誤的實際位置。 The characters EVE_SHIFT_ERRORS and ODD_SHIFT_ERRORS tell the number of errors, but do not know the actual location of the error.

在錯誤編碼步驟220中,測試讀/寫單元60整合步驟212的最高有效錯誤位元MS_ERROR_BIT、步驟216的偶數位移錯誤字元EVN_SHIFT_ERRORS與奇數位移錯誤字元ODD_SHIFT_ERRORS以及步驟204的圖案R_PATTERN,用以產生字元ENCODED_ERRORS。在一些實施例中,步驟220的整合運算係對字元R_PATTERN、MS_BIT_ERROR、EVEN_SHIFTED_ERRORS與ODD_SHIFTED_ERRORS進行XOR運算。在表格2中,字元ENCODED_ERRORS為0x8AAAA055。接著,記憶裝置將步驟220所得到的字元ENCODED_ERRORS提供予主機28。 In the error encoding step 220, the test read/write unit 60 integrates the most significant error bit MS_ERROR_BIT of step 212, the even-numbered displacement error character EVN_SHIFT_ERRORS of step 216 and the odd-numbered displacement error character ODD_SHIFT_ERRORS, and the pattern R_PATTERN of step 204, Generate the character ENCODED_ERRORS. In some embodiments, the integration operation of step 220 performs an XOR operation on the characters R_PATTERN, MS_BIT_ERROR, EVEN_SHIFTED_ERRORS, and ODD_SHIFTED_ERRORS. In Table 2, the character ENCODED_ERRORS is 0x8AAAA055. Next, the memory device provides the character ENCODED_ERRORS obtained in step 220 to the host 28.

在本實施例中,測試讀/寫單元60對字元R_PATTERN進行兩次的XOR運算,第一次係在步驟208中,用 以擷取錯誤,第二次是在步驟220中,用以編碼錯誤。另外,在兩次的XOR運算之間,偶數的”1”位元與奇數的”1”位元被放在其它的偶數與奇數位置。若在字元R_WORD的最高有效位元及其相鄰位元具有錯誤時,字元R_PATTERN的數值將不同於所儲存的真正圖案數值。在此例中,在字元R_ERRORS的錯誤及正確位元會被切換(即數值0表示錯誤位元,而數值1表示正確位元),但步驟220的XOR運算將錯誤位元的位置按順序往後移。 In the present embodiment, the test read/write unit 60 performs an XOR operation on the character R_PATTERN twice, the first time in step 208, To capture the error, the second is in step 220 to encode the error. In addition, between the two XOR operations, the even "1" bit and the odd "1" bit are placed at other even and odd positions. If the most significant bit of the character R_WORD and its neighboring bits have an error, the value of the character R_PATTERN will be different from the stored true pattern value. In this example, the error and the correct bit in the character R_ERRORS will be switched (ie, the value 0 indicates the error bit and the value 1 indicates the correct bit), but the XOR operation in step 220 will position the error bit in order. Move back.

如上所述,測試讀/寫單元維持最高有效錯誤位元的位置,並將最低有效錯誤位元的位置往有效的最右側位移,因此,維持最高有效錯誤位元的位置,但不維持最低有效錯誤位元,測試讀/寫單元輸出錯誤的數量,但並不知道錯誤發生的位置。 As described above, the test read/write unit maintains the position of the most significant error bit and shifts the position of the least significant error bit to the active rightmost side, thus maintaining the position of the most significant error bit, but not maintaining the minimum effective position. The error bit, the number of test read/write unit output errors, but does not know where the error occurred.

接下說明主機28在接收到上述步驟220所產生的字元ENCODED_ERRORS後所進行的動作。在比較步驟224中,主機比較字元ENCODED_ERRORS與公開測試圖案(W_PATTERN)。主機對字元ENCODED_ERRORS與圖案W_PATTERN進行XOR運算,運算結果以符號EST_ERRORS表示。如表格2所示,字元EST_ERRORS為0xDFFFF500。 Next, the operation performed by the host 28 after receiving the character ENCODED_ERRORS generated in the above step 220 will be described. In a comparison step 224, the host compares the character ENCODED_ERRORS with the public test pattern (W_PATTERN). The host performs an XOR operation on the character ENCODED_ERRORS and the pattern W_PATTERN, and the operation result is represented by the symbol EST_ERRORS. As shown in Table 2, the character EST_ERRORS is 0xDFFFF500.

在錯誤解碼步驟228中,主機從字元EST_ERRORS中擷取各自的讀取錯誤。在本實施例中,主機擷取準確的最高有效錯誤的位置及錯誤數量。如表格2所示,最高有效錯誤係位於最左邊的位置,並且共有21個錯誤。 In error decoding step 228, the host retrieves a respective read error from the character EST_ERRORS. In this embodiment, the host retrieves the exact location of the most significant error and the number of errors. As shown in Table 2, the most significant error is located at the leftmost position and there are 21 errors.

表格2 Form 2

第3圖的測試架構只是一實施方式,亦可利用其它的測試架構。舉例而言,在一些實施例中,主機提供公開圖案予記憶裝置,其將公開圖案與儲存的數值進行比較,並在發生讀取錯誤時,將編碼資訊回傳予主機。 The test architecture of Figure 3 is just an implementation and other test architectures can be utilized. For example, in some embodiments, the host provides a public pattern to the memory device that compares the public pattern to the stored value and returns the encoded information back to the host in the event of a read error.

在上述實施例中,讀取錯誤的編碼資訊包括最高有效錯誤的準確位置以及錯誤數量。在另一實施例中,編碼資訊只包括最高有效錯誤的準確位置或錯誤數量。在其它實施例中,編碼資訊可能包括其它不同於最高有效錯誤的位置(如最低有效錯誤的位置)及/或許多錯誤的位置。 In the above embodiment, the erroneous coded information is read including the exact position of the most significant error and the number of errors. In another embodiment, the encoded information includes only the exact location or number of errors of the most significant error. In other embodiments, the encoded information may include other locations that are different from the most significant error (such as the location of the least significant error) and/or a number of erroneous locations.

在本實施例中,係利用表格1所示的四種測試圖案。然而,在另一可能實施例中,亦可利用其它任何適合的有效圖案進行測試。舉例而言,測試圖案的數量可能大於四。在其它實施例中,測試圖案的數值可能不同於表格1的測試圖案。 In the present embodiment, the four test patterns shown in Table 1 are utilized. However, in another possible embodiment, any other suitable effective pattern can also be used for testing. For example, the number of test patterns may be greater than four. In other embodiments, the value of the test pattern may differ from the test pattern of Table 1.

在第3圖的測試方法中,錯誤位元會被位移到最右邊的偶數或奇數有效位置。在另一實施例中,錯誤位元被位移到不同於最右邊的偶數或奇數有效位置的位置。舉例而言,若單一錯誤發生在最低有效位元的位置時,此錯誤位元可能會被位移到其它奇數位元的位置。 In the test method of Figure 3, the error bit is shifted to the rightmost even or odd effective position. In another embodiment, the error bit is shifted to a position other than the rightmost even or odd effective position. For example, if a single error occurs at the location of the least significant bit, the error bit may be shifted to the position of the other odd bit.

雖然第3圖的測試方法係用以測試32位元的字元,但也可測試其它位元數量的字元中。 Although the test method in Figure 3 is used to test 32-bit characters, it can also be tested in other bits.

第4圖係為本發明之利用單向函數對記憶裝置進行測試的示意圖。第4圖包括一寫入期間以及一讀取期間。在 寫入期間,主機寫入測試資料至記憶裝置的一記憶區域260。假設,主機係傳送一公開結果,該公開結果係為一測試資料的單向函數運算結果,並且測試讀/寫單元60具有一裝置,用以對寫入資料進行相同的單向函數運算。 Figure 4 is a schematic diagram of the invention for testing a memory device using a one-way function. Figure 4 includes a write period and a read period. in During writing, the host writes test data to a memory area 260 of the memory device. It is assumed that the host system transmits a public result, which is a one-way function operation result of a test data, and the test read/write unit 60 has a means for performing the same one-way function operation on the written data.

主機和測試讀/寫單元60可利用任何適當的單向函數F(.),其特性係提供一輸入A,B=F(A)是很容易計算得知,但無法根據B回推A。另外,針對兩不同的輸入A與A’,F(A)=F(A’)的可能性是很低的。示範性的單向函數的運算包括加密散列函数(cryptographic hash functions)SHA-1及SHA-2。 The host and test read/write unit 60 may utilize any suitable one-way function F(.) whose characteristics provide an input A, B=F(A) which is easily calculated, but cannot be pushed back against B. In addition, the probability of F(A) = F(A') for two different inputs A and A' is very low. The operations of the exemplary one-way function include cryptographic hash functions SHA-1 and SHA-2.

在讀取期間,記憶裝置判斷儲存在記憶區域MEM_A的資料是否被改變。記憶區域268(以符號MEM_A’表示)與記憶區域MEM_A相同(即具有相同的記憶位址),但由於錯誤的發生,故在記憶區域268的資料可能不同於原本儲存在記憶區域260的資料。 During the reading, the memory device judges whether or not the material stored in the memory area MEM_A is changed. The memory area 268 (indicated by the symbol MEM_A') is the same as the memory area MEM_A (i.e., has the same memory address), but the data in the memory area 268 may be different from the data originally stored in the memory area 260 due to an error.

在一些實施例中,為了測試區域MEM_A的資料準確性,測試讀/寫單元計算F(MEM_A’),並將計算結果與公開結果F(MEM_A)相比較,其中公開結果F(MEM_A)係由主機所提供。主機可能在寫入測試資料後,或是在任何適合的時間下,初始化讀取期間。若F(MEM_A’)等於F(MEM_A)時,表示資料很有可能是正確的。測試讀/寫單元60只會將測試後的二進制通過/失敗結果提供予主機28。在只有公開一二進制通過/失敗結果時,測試機制藉由比較資料本身,而不是資料的簽章,用以確認是否測試資料已正確地寫入。另外,未經授權的使用者係無法由一加密儲存單向函數而得知儲存的資料。 In some embodiments, in order to test the data accuracy of the region MEM_A, the test read/write unit calculates F(MEM_A') and compares the calculated result with the public result F(MEM_A), wherein the public result F(MEM_A) is Provided by the host. The host may initialize the read period after writing the test data or at any suitable time. If F(MEM_A') is equal to F(MEM_A), it means that the data is likely to be correct. Test read/write unit 60 will only provide the tested binary pass/fail results to host 28. When only a binary pass/fail result is exposed, the test mechanism confirms whether the test data has been correctly written by comparing the data itself, rather than the signature of the data. In addition, an unauthorized user cannot know the stored data by an encrypted storage one-way function.

未經授權的使用者可能送出許多不同版本的公開單向函數結果,用以猜出正確的公開結果。在一可能實施例中,測試讀/寫單元60記錄企圖修改資料的次數,並在修改次數大於一預設臨界時,測試讀/寫單元60啟動適當地保護措施,如禁能裝置的測試模式。 Unauthorized users may send out many different versions of the public one-way function results to guess the correct public results. In a possible embodiment, the test read/write unit 60 records the number of attempts to modify the data, and when the number of modifications is greater than a predetermined threshold, the test read/write unit 60 initiates appropriate protection measures, such as the test mode of the disable device. .

在一些實施例中,只有秘密鍵沒有被設定時,記憶裝置24才會執行記憶體測試。在此例中,若記憶裝置操作在測試模式時(如利用模式配置單元44),並判斷出一秘密鍵已被設定時,將禁能測試動作,直到記憶體的整體(包括秘密鍵)均被清除。在另一可能實施例中,當秘密鍵及儲存重要資料的記憶區域正好被清除時,記憶裝置才會允許執行測試動作。 In some embodiments, memory device 24 performs a memory test only if the secret key is not set. In this example, if the memory device is operating in the test mode (eg, using the mode configuration unit 44) and determines that a secret key has been set, the test action will be disabled until the memory (including the secret key) is Cleared. In another possible embodiment, the memory device allows the test action to be performed when the secret key and the memory area in which the important material is stored are just cleared.

測試系統20的實施方式已揭露如上,並且只是用以說明本發明。在其它實施例中,測試系統可以其它合適的方式據以實施。舉例而言,雖然上述的說明各別地揭露了許多實施方式,但可同時利用上述至少二實施方式,以構成其它的測試系統。 Embodiments of test system 20 have been disclosed above and are merely illustrative of the invention. In other embodiments, the test system can be implemented in other suitable ways. For example, while the above description separately discloses many embodiments, the at least two embodiments described above may be utilized simultaneously to form other test systems.

雖然上述的實施方式大部分是揭露如何安全地測試非揮發記憶體,但上述的實施方式亦可應用在其它的技術領域,如用以安全地測試任何尺寸及任何種類的儲存系統。 While most of the above embodiments disclose how to safely test non-volatile memory, the above-described embodiments can also be applied to other technical fields, such as to safely test any size and any kind of storage system.

雖然本發明已以較佳實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明之精神和範圍內,當可作些許之更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。 Although the present invention has been disclosed in the above preferred embodiments, it is not intended to limit the invention, and any one of ordinary skill in the art can make some modifications and refinements without departing from the spirit and scope of the invention. Therefore, the scope of the invention is defined by the scope of the appended claims.

100、104、108、112‧‧‧步驟 Steps 100, 104, 108, 112‧‧

Claims (16)

一種測試方法,包括:令一記憶裝置操作在一測試模式,並接收一向量,該向量係欲寫入該記憶裝置中;當該向量屬於複數測試向量之一預設集合時,將該向量寫入該記憶裝置;以及當該向量不屬於該等測試向量之該預設集合時,將該向量轉換成該等測試向量之一者,用以產生一轉換向量,並將該轉換向量寫入該記憶裝置中。 A test method includes: operating a memory device in a test mode and receiving a vector to be written into the memory device; writing the vector when the vector belongs to a preset set of a plurality of test vectors Entering the memory device; and when the vector does not belong to the preset set of the test vectors, converting the vector to one of the test vectors to generate a conversion vector and writing the conversion vector In the memory device. 如申請專利範圍第1項所述之測試方法,其中將該向量轉換成該等測試向量之一者的步驟包括:選擇該向量的一位元集合;以及週期性地以該位元集合取代該向量的其它位元。 The test method of claim 1, wherein the converting the vector into one of the test vectors comprises: selecting a one-bit set of the vector; and periodically replacing the set of bits with the set of bits Other bits of the vector. 如申請專利範圍第1項所述之測試方法,更包括:讀取一先前寫入測試向量的一資料字元,用以測試該記憶裝置;以及輸出該記憶裝置的一編碼資料,該編碼資料與讀取該資料字元時所發生錯誤有關。 The test method of claim 1, further comprising: reading a data character previously written to the test vector for testing the memory device; and outputting an encoded data of the memory device, the encoded data It is related to the error that occurred when reading the data character. 如申請專利範圍第3項所述之測試方法,其中輸出該記憶裝置的該編碼資料包括:輸出一錯誤數量,不輸出該錯誤發生的實際位置;其中該不輸出錯誤發生的實際位置的步驟包括,位移偶數位元以及奇數位元,該等偶數位元以及該等奇數位元表示錯誤發生在相對應的偶數或奇數位元中。 The test method of claim 3, wherein outputting the encoded data of the memory device comprises: outputting an error quantity, and not outputting an actual position where the error occurs; wherein the step of not outputting the actual position where the error occurs includes , shifting even bits and odd bits, the even bits and the odd bits indicate that an error occurred in the corresponding even or odd bit. 如申請專利範圍第3項所述之測試方法,其中輸出該記憶裝 置的一編碼資料包括:輸出錯誤發生的實際位置。 The test method described in claim 3, wherein the memory device is output The set of encoded data includes: the actual location where the output error occurred. 一種記憶裝置,包括:一記憶體;以及一記憶體控制器,在一測試模式下,接收一向量,該向量係欲寫入該記憶體中,只有當該向量屬於複數測試向量之一預設集合時,將該向量寫入該記憶體中,並且當該向量不屬於該等測試向量之該預設集合時,將該向量轉換成該等測試向量之一者,用以產生一轉換向量,並將該轉換向量寫入該記憶體中。 A memory device comprising: a memory; and a memory controller, in a test mode, receiving a vector to be written into the memory, only when the vector belongs to one of a plurality of test vectors When merging, the vector is written into the memory, and when the vector does not belong to the preset set of the test vectors, the vector is converted into one of the test vectors to generate a conversion vector. And the conversion vector is written into the memory. 如申請專利範圍第6項所述之記憶裝置,其中該記憶體控制器選擇該向量之一位元集合,以及週期性地以該位元集合取代該向量的其它位元。 The memory device of claim 6, wherein the memory controller selects one of the bit sets of the vector and periodically replaces the other bits of the vector with the set of bits. 如申請專利範圍第6項所述之記憶裝置,其中該記憶體控制器讀取一事先寫入測試向量的一資料字元並根據發生在該資料字元的錯誤輸出一編碼資訊予該記憶裝置。 The memory device of claim 6, wherein the memory controller reads a data character previously written into the test vector and outputs a coded information to the memory device according to an error occurring in the data character. . 如申請專利範圍第8項所述之記憶裝置,其中該記憶體控制器輸出一錯誤數量,不輸出該錯誤發生的實際位置;其中該記憶體控制器藉由位移複數偶數位元與複數奇數位元,用以不輸出該錯誤發生的位置,該等偶數及奇數位元係表示錯誤發生的位置。 The memory device of claim 8, wherein the memory controller outputs an error quantity, and does not output an actual position where the error occurs; wherein the memory controller shifts the complex even bit and the complex odd bit by The element is used to not output the location where the error occurred, and the even and odd bits represent the location where the error occurred. 如申請專利範圍第8項所述之記憶裝置,其中該記憶體控制器輸出該錯誤發生的位置。 The memory device of claim 8, wherein the memory controller outputs the location where the error occurred. 一種測試方法,包括:在一測試模式下,讀取一記憶裝置的至少一字元; 對該字元進行單向函數運算,用以產生一運算結果,並且無法由該運算結果重新獲得該字元;以及根據該運算結果,輸出錯誤發生在該字元的一編碼資訊,其中該編碼資料包括:輸出一錯誤數量,不輸出該錯誤發生的實際位置。 A test method includes: reading at least one character of a memory device in a test mode; Performing a one-way function operation on the character to generate an operation result, and the character cannot be re-acquired by the operation result; and outputting an error occurrence in the coded information of the character according to the operation result, wherein the code The data includes: outputting an error quantity and not outputting the actual position where the error occurred. 如申請專利範圍第11項所述之測試方法,其中輸出該編碼資訊的步驟包括,輸出該公開結果與該運算結果的一比較結果的一二進制結果。 The test method of claim 11, wherein the step of outputting the encoded information comprises outputting a binary result of a comparison result between the public result and the operation result. 如申請專利範圍第11項所述之測試方法,其中接收該公開結果的步驟包括,多次接收該公開結果,並且當接收該公開結果的數量大於一預設臨界值時,啟動一保護機制。 The test method of claim 11, wherein the step of receiving the public result comprises receiving the public result multiple times, and initiating a protection mechanism when the number of the received public results is greater than a predetermined threshold. 一種記憶裝置,包括:一記憶體;以及一記憶體控制器,在一測試模式下,從該記憶體中讀取至少一字元,並對該字元進行一單向函數運算,用以產生一運算結果,使得無法由該運算結果重新得到該字元,並根據該運算結果,輸出錯誤發生在該字元的一編碼資訊,其中該編碼資料包括:輸出一錯誤數量,不輸出該錯誤發生的實際位置。 A memory device comprising: a memory; and a memory controller, in a test mode, reading at least one character from the memory, and performing a one-way function operation on the character to generate An operation result is such that the character cannot be retrieved from the operation result, and according to the operation result, the output error occurs in an encoded information of the character, wherein the encoded data includes: outputting an error quantity, and not outputting the error occurrence The actual location. 如申請專利範圍第14項所述之記憶裝置,其中該記憶體控制器輸出該公開結果與該運算結果的一比較結果的一二進制結果。 The memory device of claim 14, wherein the memory controller outputs a binary result of a comparison result between the public result and the operation result. 如申請專利範圍第14項所述之記憶裝置,其中該記憶體控制器多次接收該公開結果,並且當接收該公開結果的數量 大於一預設臨界值時,該記憶體控制器啟動一保護機制。 The memory device of claim 14, wherein the memory controller receives the publicity result multiple times, and when receiving the publicly disclosed result When greater than a predetermined threshold, the memory controller initiates a protection mechanism.
TW103129808A 2014-08-29 2014-08-29 Test method and system for memory device TWI529736B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW103129808A TWI529736B (en) 2014-08-29 2014-08-29 Test method and system for memory device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW103129808A TWI529736B (en) 2014-08-29 2014-08-29 Test method and system for memory device

Publications (2)

Publication Number Publication Date
TW201608575A TW201608575A (en) 2016-03-01
TWI529736B true TWI529736B (en) 2016-04-11

Family

ID=56084821

Family Applications (1)

Application Number Title Priority Date Filing Date
TW103129808A TWI529736B (en) 2014-08-29 2014-08-29 Test method and system for memory device

Country Status (1)

Country Link
TW (1) TWI529736B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10276259B2 (en) 2017-07-05 2019-04-30 Winbond Electronics Corp. Memory testing method and memory apparatus therefor

Also Published As

Publication number Publication date
TW201608575A (en) 2016-03-01

Similar Documents

Publication Publication Date Title
Delvaux et al. Helper data algorithms for PUF-based key generation: Overview and analysis
EP2359520B1 (en) Distributed puf
WO2016113886A1 (en) Random number expanding device, random number expanding method, and random number expanding program
RU2696425C1 (en) Method of two-dimensional control and data integrity assurance
KR20150112893A (en) Method for protecting data from algebraic manipulation
RU2680739C1 (en) Data integrity monitoring and ensuring method
JP6134375B2 (en) Memory device having secure test mode and method thereof
CN113632066A (en) Error identification in executed code
US8199914B2 (en) Detection of a change of the data of a dataset
CN102971984A (en) Method for authenticating a storage device, machine-readable storage medium, and host device
TWI529736B (en) Test method and system for memory device
CN111143904B (en) Data decryption method, device and computer readable storage medium
US20150249467A1 (en) Storage device, controller, and data writing method
CN105469835B (en) Storage device and its test method
JP2007174024A (en) Encryption processing apparatus
US11829231B2 (en) Methods and systems for generating core dump in a user equipment
US20220179567A1 (en) Memory system and method of managing encryption key
CN110096909B (en) Method and system for ensuring stability of EFUSE key
CN105245325B (en) Method and apparatus for processing data
US11323265B2 (en) Storage device providing high security and electronic device including the storage device
US20190243789A1 (en) Method of sending data, method of receiving data, master, slave, and master-slave-system
JP2007325219A (en) Encryption processing system and encryption processing apparatus
ES2683998T3 (en) Memory device with safe test mode
WO2023162151A1 (en) Data storage device, data storage method, and program
KR101052600B1 (en) Apparatus for storing encoded data and method thereof