This application is based upon and claims the benefit of priority from Japanese Patent Application No. 2021-047658, filed Mar. 22, 2021, the entire contents of which are incorporated herein by reference.
Embodiments described herein relate generally to an operation device, a method for executing a hash function, and a memory system.
In the related art, a hash function has been used in digital signature processing.
Embodiments provide an operation device for improving computer systems and the like by including a hash function circuit of a smaller circuit size for executing a plurality of hash functions.
In general, according to one embodiment, an operation device for executing a first hash function and a second hash function having a larger input data width than that of the first hash function, includes a first conversion circuit configured to, upon receipt of a selection signal indicating the first hash function, convert input data according to the input data width of the second hash function. The operation device further includes a hash operation circuit configured to perform, based on the selection signal, either the first hash function or the second hash function on the input data and generate output data. The operation device further includes a second conversion circuit configured to, when the selection signal indicates the first hash function, convert the output data according to an output data width of the first hash function. The operation device further includes an output buffer that stores the output data.
In the following, memory systems according to certain example embodiments will be described as examples of an operation device incorporating a hash function circuit. It is noted that the disclosure is applicable not only memory systems but any other systems incorporating or including a hash function circuit or the functions thereof. This disclosure may be applied to any system or device including a memory for storing a computer program and a processor for executing the computer program. Such memory systems will be described with reference to the accompanying drawings. It is noted that the present disclosure is not limited to the particular example embodiments described below.
The memory system 1 is configured to be connectable to a host 2. For example, the host 2 is a central processing unit (CPU), a personal computer, a portable information device, a server, or the like. Any interface standard may be adopted as an interface standard for communication between the memory system 1 and the host 2. Two or more hosts 2 may be simultaneously connected to the memory system 1. The host 2 and the memory system 1 may be connected via a network.
The memory system 1 transmits and receive data to and from the host 2 in response to access commands issued by the host 2.
The memory system 1 includes a NAND memory 12 and a memory controller 10. The memory controller 10 includes, for example, a host interface unit 11, a NAND controller 13, a random access memory (RAM) 14, and a processor 15. The memory controller 10 may include a plurality of processors 15.
The processor 15 controls the memory system 1 by executing one or more programs stored in the memory system 1. For example, the programs are stored in the NAND memory 12 and loaded into the RAM 14 at startup. The processor 15 executes the programs that have been loaded into the RAM 14. The control of the memory system 1 includes a plurality of pieces of processing executed by the processor 15. A part or all of the plurality of pieces of processing may be performed by one or more hardware circuits. Each piece of processing executed by the processor 15 will be described later.
The host interface unit 11 is an interface circuit for the memory system 1 to communicate with the host 2. For example, the host interface unit 11 transfers user data between the host 2 and the RAM 14 under the control of the processor 15.
The NAND controller 13 is an interface circuit for accessing the NAND memory 12. The NAND controller 13 transfers the user data or management information between the RAM 14 and the NAND memory 12 under the control of the processor 15. The NAND controller 13 can perform any known error correction processing.
The NAND memory 12 is a non-volatile storage medium. For example, the NAND memory 12 is a non-volatile semiconductor memory. The NAND memory 12 includes one or more memory chips.
The RAM 14 is a memory for temporarily storing data. The RAM 14 may be embedded in the memory controller 10 or may be installed outside the memory controller 10. As the RAM 14, for example, a type of memory faster than the NAND memory 12 may be adopted. As the RAM 14, for example, a volatile or non-volatile memory may be adopted. As the RAM 14, for example, a dynamic RAM (DRAM), static RAM (SRAM), ferroelectric RAM (FeRAM), magnetoresistive RAM (MRAM), phase change RAM (PRAM), and the like may be adopted.
The storing unit 30 stores various types of information. The storing unit 30 stores, for example, a private key, a public key, a message, and signature information. The storing unit 30 is implemented in the RAM 14 and/or the NAND memory 12.
The signature processing unit 31 performs signature processing. The signature processing unit 31 is implemented by the processor 15. The signature processing unit 31 generates a signature and verifies the signature based on a hash value.
The hash value calculation unit 32 is a circuit configured to calculate a hash value (hereinafter also referred to as “hash operation circuit”. The hash value calculation unit 32 is in, for example, the memory controller 10.
The public key encryption processing unit 33 performs public key encryption processing. The public key encryption processing unit 33 is in, for example, the memory controller 10.
Hash Value Calculation Method by Operation Device According to Comparative Example
Before particularly describing a hash value calculation unit 32, a hash value calculation procedure by an operation device according to a comparative example will be described with reference to
Subsequently, the operation device performs compression processing for compressing the expanded data (step S4). For example, the operation device compresses the data expanded by the expansion processing to 2048 bits to data of 256 bits.
Subsequently, the operation device adds the compressed data to the result of previous processing (step S5). It is then determined whether the operation has been completed for all the blocks (step S6). When the operation has not been completed for all blocks (No in step S6), the procedure returns to step S2. When the operation has been completed for all blocks (Yes in step S6), the operation device outputs a hash value (step S7).
As described above, the operation device includes a circuit that executes the expansion processing and a circuit that executes the compression processing. Here, an example of the circuit that executes the expansion processing is illustrated in
It is noted that processing performed by the logic function operation unit 51 and the logic function operation unit 52 is different depending on a type of hash function. That is, the processing performed by the logic function operation unit is different depending on whether the hash function of SHA-256 is executed or the hash function of SHA-512 is executed.
An example of a circuit that executes compression processing is illustrated in
It is noted that the processing performed by the logic function operation unit 72 and the logic function operation unit 74 is different depending on the type of hash function. That is, the processing performed by the logic function operation unit is different depending on whether the hash function of SHA-256 is executed or the hash function of SHA-512 is executed.
Here, execution contents in the case of SHA-256 in the logic function operation unit 72 are illustrated by the following expression 1:
Σ0(a)=(a>>>2)⊕(a>>>13)⊕(a>>>22) (1)
Here, “>>>” indicates a right shift operation, and “⊕” indicates an XOR operation. The execution contents in the logic function operation unit 73 are illustrated in the following expression 2:
Ma(a,b,c)=(aΛb)⊕(aΛc)⊕(bΛc) (2)
Here, “Λ” indicates an AND operation. The processing performed by the logic function operation unit 74 is illustrated by the following expression 3:
Σ1(e)=(e>>>6)⊕(e>>>11)⊕(e>>>25) (3)
Here, the processing performed by the logic function operation unit 75 in the case of SHA-256 is illustrated by the following expression 4:
Ch(e,f,g)=(eΛf)⊕(¬eΛg) (4)
Here, “¬” indicates a NOT operation. In the compression processing circuit, compression processing is executed with input data after expansion and a constant being input to the addition operation unit 76 as a trigger.
In this example, it is examined to execute the hash function of SHA-256 and the hash function of SHA-512.
As illustrated in
If the circuit that executes the hash function of SHA-256 and the circuit that executes the hash function of SHA-512 are simply combined, its circuit size becomes large. Therefore, in the first embodiment, the memory system 1 that includes a hash function circuit having a smaller circuit size will be described.
First, a circuit illustrating the hash value calculation unit 32 will be described with reference to
The input buffer 321 stores input data from the signature processing unit 31 (see
Block data obtained by dividing the input data based on the selection signal is output from the input buffer 321. For example, when the selection signal indicates that the hash function of SHA-256 is to be executed, the block data is output from the input buffer 321 to the conversion circuit 322. When the selection signal indicates that the hash function of SHA-512 is to be executed, block data is output from the input buffer 321 to the selector 323.
The conversion circuit 322 converts the block data acquired from the input buffer 321.
The conversion circuit 322 outputs the converted block data to the selector 323. The selector 323 outputs the block data to the expansion and compression circuit 324 based on the selection signal. When the selection signal indicates that the hash function of SHA-256 is to be executed, the selector 323 outputs the block data output from the conversion circuit 322 to the expansion and compression circuit 324. When the selection signal indicates that the hash function of SHA-512 is to be executed, the selector 323 outputs the block data output from the input buffer 321 to the expansion and compression circuit 324.
The expansion and compression circuit 324 is configured to perform expansion processing and compression processing. The expansion and compression circuit 324 has a register size of 64 bits. Here, an expansion processing circuit part of the expansion and compression circuit 324 is illustrated in
The logic function operation unit 51a is an operation unit corresponding to SHA-256, and the logic function operation unit 51b is an operation unit corresponding to SHA-512. The logic function operation unit 51a and the logic function operation unit 51b output an operation result to the selector 57.
The logic function operation unit 52a is an operation unit corresponding to SHA-256 and the logic function operation unit 52b is an operation unit corresponding to SHA-512. The logic function operation unit 52a and the logic function operation unit 52b output the operation result to the selector 58.
When the selection signal indicates that the hash function of SHA-256 is to be executed, the selector 57 outputs the operation result output from the logic function operation unit 51a to the addition operation unit 53. When the selection signal indicates that the hash function of SHA-512 is to be executed, the selector 57 outputs the operation result output from the logic function operation unit 51b to the addition operation unit 53.
When the selection signal indicates that the hash function of SHA-256 is to be executed, the selector 58 outputs the operation result output from the logic function operation unit 52a to the addition operation unit 55. When the selection signal indicates that the hash function of SHA-512 is to be executed, the selector 58 outputs the operation result output from the logic function operation unit 52b to the addition operation unit 55.
As described above, the expansion processing circuit 41, which is a part of the expansion and compression circuit 324, can reduce the circuit area as compared with the case where a plurality of expansion processing circuits are provided by sharing the register part and the addition operation units and including only the logic function operation unit 51 and the logic function operation unit 52 whose processing contents are different between SHA-256 and SHA-512.
The compression processing circuit part of the expansion and compression circuit 324 is illustrated in
The logic function operation unit 72a is an operation unit corresponding to SHA-256, and the logic function operation unit 72b is an operation unit corresponding to SHA-512. The logic function operation unit 72a and the logic function operation unit 72b output an operation result to the selector 81.
The logic function operation unit 74a is an operation unit corresponding to SHA-256 and the logic function operation unit 74b is an operation unit corresponding to SHA-512. The logic function operation unit 74a and the logic function operation unit 74b output the operation result to the selector 82.
When the selection signal indicates that the hash function of SHA-256 is to be executed, the selector 81 outputs the operation result output from the logic function operation unit 72a to the addition operation unit 80. When the selection signal indicates that the hash function of SHA-512 is to be executed, the selector 81 outputs the operation result output from the logic function operation unit 72b to the addition operation unit 80.
When the selection signal indicates that the hash function of SHA-256 is to be executed, the selector 82 outputs the operation result output from the logic function operation unit 74a to the addition operation unit 78. When the selection signal indicates that the hash function of SHA-512 is to be executed, the selector 82 outputs the operation result output from the logic function operation unit 74b to the addition operation unit 78.
As described above, the compression processing circuit 42, which is a part of the expansion and compression circuit 324, can reduce the circuit area as compared with the case where a plurality of compression processing circuits are provided by sharing the register part and the addition operation units and including only the logic function operation unit 72 and the logic function operation unit 74 whose processing contents are different between SHA-256 and SHA-512.
Referring back to
The output buffer 326 stores the hash value that is output from the conversion circuit 325 and the expansion and compression circuit 324. When the selection signal indicates that the hash function of SHA-256 is to be executed, the hash value acquired from the conversion circuit 325 is output to the signature processing unit 31. When the selection signal indicates that the hash function of SHA-512 is to be executed, the hash value acquired from the expansion and compression circuit 324 is output to the signature processing unit 31.
A hash value calculation processing procedure executed by the hash value calculation unit 32 will be described with reference to
When the selection signal does not indicate that the hash function of SHA-512 is to be executed (No in step S12), block data of 512 bits is output from the input buffer 321 to the conversion circuit 322 (step S13). Then, the conversion circuit 322 generates block data of 1024 bits and outputs the block data of 1024 bits to the expansion and compression circuit 324 (step S14).
The expansion and compression circuit 324 executes the expansion processing based on the selection signal (step S16), and executes the compression processing (step S17).
When the selection signal indicates that the hash function of SHA-512 is to be executed (Yes in step S18), a hash value of 512 bits is output to the output buffer 326 (step S21). In step S18, when the selection signal does not indicate that the hash function of SHA-512 is to be executed (No in step S18), the conversion circuit 325 generates converted data of 32-bit×8 (step S19) and outputs the converted data of 32-bit×8 to the output buffer 326 (step S20).
Explanation of Signature Generation Process
A procedure of the signature generation process will be described with reference to
First, the signature processing unit 31 reads a message from the storing unit 30 (step S31). The message refers to a signature processing target, for example, a computer program code.
The signature processing unit 31 inputs the message to the hash value calculation unit 32. The hash value calculation unit 32 outputs a hash value using the message as input data (step S32).
Subsequently, the signature processing unit 31 reads a private key from the storing unit 30 (step S33).
The signature processing unit 31 inputs the hash value and the private key into the public key encryption processing unit 33, and applies a known technique to generate signature data based on data output by the public key encryption processing unit 33 (step S34), and outputs the signature data to the storing unit 30 (step S35).
Explanation of Signature Verification
A procedure of signature verification will be described with reference to
First, the signature processing unit 31 reads a message from the storing unit 30 (step S41).
Subsequently, the signature processing unit 31 inputs the message to the hash value calculation unit 32. The hash value calculation unit 32 outputs a hash value using the message as input data (step S42).
The signature processing unit 31 then reads the signature data and the public key from the storing unit 30 (step S43).
The signature processing unit 31 then verifies the signature. For example, the signature processing unit 31 inputs the signature data and the public key into the public key encryption processing unit 33, and applies a known technique to verify the signature based on the data and the hash value output by the public key encryption processing unit 33 (step S44). The signature processing unit 31 outputs a result indicating whether the signatures match (step S45).
In the example embodiments described above, the hash value calculation unit 32 includes: (1) the conversion circuit 322 configured to convert input data according to the input data width of SHA-512 when executing the hash function of SHA-256, (2) the expansion and compression circuit 324 configured to select the logic function of SHA-256 and the logic function of SHA-512, (3) the conversion circuit 325 configured to convert the output value according to the output data width of SHA-256 when the output value output from the expansion and compression circuit 324 is obtained by the hash function of SHA-256.
In such a case, the hash value calculation unit 32 converts input data according to the input data width of SHA-512 when executing the hash function of SHA-256 and selects and processes the logic function of SHA-256 and the logic function of SHA-512 in the expansion and compression circuit 324. Thus, the register part and the addition operation unit in the expansion and compression circuit 324 can be shared, and as a result, the circuit area can be reduced.
The expansion and compression circuit 324 in the first embodiment has a register size of 64 bits. An expansion and compression circuit 324 in a second embodiment has two modules each having a register size of 32 bits. Here, an expansion processing circuit of the expansion and compression circuit 324 according to the second embodiment is illustrated in
As illustrated in
As illustrated in
A compression processing circuit of the expansion and compression circuit 324 in the second embodiment is illustrated in
As illustrated in
As described above, in the expansion and compression circuit 324 of the second embodiment, not only the hash function having the register size of 32 bits but also the hash function having a register size of 64 bits can be executed by including a plurality of circuits having the register size of 32 bits and including the interfaces for sharing information and transmitting the addition result.
The expansion and compression circuit 324 in the second embodiment may further include, as a selection signal, a signal indicating that the hash functions of SHA-256 are to be executed in parallel. As described above, the expansion and compression circuit 324 in the second embodiment includes a plurality of circuits for executing the hash function of 32 bits, and thus the hash functions of SHA-256 can be executed in parallel.
The compression processing circuit in the second embodiment includes the interface L11 and the interface L14 for transmitting the addition result. As illustrated in
As described above, the interface L21 and the interface L22 transmit the addition result via the storing mechanism 85 and the storing mechanism 83, and thus the timing of transmitting the addition result can be delayed by one cycle, and the critical path can be shortened.
In the compression processing circuit according to a fourth embodiment, a plurality of pieces of round processing are collectively executed. Here, the compression processing circuit according to the fourth embodiment is illustrated in
Here, each of the first round processing circuit 90 and the second round processing circuit 91 includes the logic function operation unit 72a, the logic function operation unit 72b, the logic function operation unit 73, the logic function operation unit 74a, the logic function operation unit 74b, the logic function operation unit 75, the addition operation units 76 to 80, the selector 81, the selector 82, and the addition operation unit 88 illustrated in
As described above, the compression processing circuit in the fourth embodiment includes the first round processing circuit 90 and the second round processing circuit 91, and thus the logical operations and additions for a plurality of rounds can be collectively executed and processing efficiency can be improved.
It is noted that the expansion processing circuit may also execute a plurality of pieces of round processing at once. For example, the expansion processing circuit may also include the registers w1 to w15 illustrated in
It is noted that, in the example embodiments described above, description has been made of a case where, in the circuit of the expansion processing part of the expansion compression circuit 324, only the logic function operation unit 51 and the logic function operation unit 52, whose processing are different in SHA-256 and SHA-512, include the logic function operation units of SHA-256 and SHA-512, respectively, by sharing the register part and the addition operation units. But the circuit of the expansion processing part of the expansion compression circuit 324 may be configured to simply connect the expansion circuit for SHA-256 or the expansion circuit for SHA-512 of the operation device according to the comparative example as illustrated in
In the example embodiments described above, although the case where the hash value calculation unit 32 executes the hash function of SHA-256 and the hash function of SHA-512 has been described, the hash value calculation unit 32 in other examples may also or instead execute the hash function of SHA-256 and the hash function of SHA-384.
While certain embodiments have been described, these embodiments have been presented by way of example only, and are not intended to limit the scope of the disclosure. Indeed, the novel embodiments described herein may be embodied in a variety of other forms; furthermore, various omissions, substitutions and changes in the form of the embodiments described herein may be made without departing from the spirit of the disclosure. The accompanying claims and their equivalents are intended to cover such forms or modifications as would fall within the scope and spirit of the disclosure.
Number | Date | Country | Kind |
---|---|---|---|
2021-047658 | Mar 2021 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
6829335 | Colemon | Dec 2004 | B2 |
11303429 | Ghosh | Apr 2022 | B2 |
20180183577 | Suresh | Jun 2018 | A1 |
20190042765 | Chung et al. | Feb 2019 | A1 |
20190319782 | Ghosh | Oct 2019 | A1 |
20190379547 | Durham | Dec 2019 | A1 |
20200349866 | Ghosh et al. | Nov 2020 | A1 |
20200403802 | Hars | Dec 2020 | A1 |
Number | Date | Country |
---|---|---|
2011-133916 | Jul 2011 | JP |
Entry |
---|
“FIPS PUB 180-4 Federal Information Processing Standards Publication: Secure Hash Standard (SHS)” (pp. 1-31) https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf (Year: 2015). |
Wikipedia article for “SHA-2”, dated Dec. 20, 2017 (8 pages) https://en.wikipedia.org/w/index.php?title=SHA-2&oldid=816269108 (Year: 2017). |
L. Dadda, M. Macchetti and J. Owen, “The design of a high speed ASIC unit for the hash function SHA-256 (384, 512),” (6 pages) (Year: 2004). |
Number | Date | Country | |
---|---|---|---|
20220303140 A1 | Sep 2022 | US |