split up sha256 hash and compare indiv block results

We have a h/w accelerator in our SoC and it can do sha256. The restrictions are it's input descriptors (which defines the input packet and len) must not straddle 64K boundary. When it does we can split the descriptors into two. However the total number of descriptors can be max of 64. This means 64K * 64 = 4MB seems to be max sha256 input block.

However i want to calculate sha256sum of a 12MB block

So is it possible to split sha256sum hash into multiple operations and somehow verify it back (i.e.)

hash(12MB) = x;
hash(4MB) = a; hash(4-8MB) = b; hash(8-12MB) = c;


Is there any way to compare

x = "some method of" (a,b,c)

-

No, if the crypto accelerator can do a straight SHA256 computation of up to 4MB messages, and nothing else, well, you're rather stuck; there's no way to combine independent sha256 hashes into a larger hash.

On the other hand, perhaps the designer of the accelerator provided some additional hooks. One thing that they might have provided is an 'incremental' hash; where you give the messages in pieces (and they save the intermediate state between requests).

Alternatively, if they have a mode where:

• You provide the IV (rather than using the fixed IV that SHA256 uses)

• They don't do the final SHA256 padding; instead, they take an integral number of blocks, and output the intermediate state.

If so, then you can do the incremental processing yourself. You would start with the SHA256 starting IV, and send the first 4MB (or smaller, as long as it is a multiple of 64 bytes), ask to do hashing with this mode, and give you the intermediate state. Then, you use the intermediate state as the IV, and send it the next 4MB, and get that intermediate state. For the final block, you would apply the SHA256 padding yourself (unless the hardware will do that for you; it's not the standard padding of the final block, because the message length will need to include the entire message) and the 'intermediate state' of that is the SHA256 of the combined message.

-
@pocho: Looks like incremental hash is not supported by the h/w block. Suggestion given by the vendor is to go for custom hash like do hash of hashes during creation and verification. But that's no good for my solution. Thanks and thought of updating the status. – Telex Jul 31 '13 at 7:49