2024
words, if either of these reset signals is true, the registers will be cleared. However, in cases where
there is not a reset condition these registers retain their values until the next hash operation. It is
during the time between an old hash operation and a new hash operation that that data is open to
unauthorized disclosure.
To correct the issue of data persisting between hash operations, the memory mapped I/O registers
need to be cleared once the values written in these registers are propagated to the SHA256
module. This could be done for example by adding a new condition to zeroize the memory mapped
I/O registers once the hash value is computed, i.e., hashValid signal asserted, as shown in the
good code example below [REF-1380]. This fix will clear the memory-mapped I/O registers after
the data has been provided as input to the SHA engine.
Example Language: Verilog (Good)
...
// Implement SHA256 I/O memory map interface
// Write side
always @(posedge clk_i)
begin
if(~(rst_ni && ~rst_3))
begin
startHash <= 0;
newMessage <= 0;
data[0] <= 0;
data[1] <= 0;
data[2] <= 0;
...
data[14] <= 0;
data[15] <= 0;
end
else if(hashValid && ~hashValid_r)
begin
data[0] <= 0;
data[1] <= 0;
data[2] <= 0;
...
data[14] <= 0;
data[15] <= 0;
end
...
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 1416 Comprehensive Categorization: Resource Lifecycle
Management
1400 2545
Related Attack Patterns
CAPEC-ID Attack Pattern Name
37 Retrieve Embedded Sensitive Data
150 Collect Data from Common Resource Locations
204 Lifting Sensitive Data Embedded in Cache
545 Pull Data from System Resources
References
[REF-267]Information Technology Laboratory, National Institute of Standards and Technology.
"SECURITY REQUIREMENTS FOR CRYPTOGRAPHIC MODULES". 2001 May 5. < https://
csrc.nist.gov/csrc/media/publications/fips/140/2/final/documents/fips1402.pdf >.2023-04-07.
CWE Version 4.14
CWE-1240: Use of a Cryptographic Primitive with a Risky Implementation
CWE-1240: Use of a Cryptographic Primitive with a Risky Implementation