Hi,

In crypto/sha/sha.h the SHA256_CTX struct is defined as:

typedef struct SHA256state_st
{
        SHA_LONG h[8];
        SHA_LONG Nl,Nh;
        SHA_LONG data[SHA_LBLOCK];
        unsigned int num,md_len;
} SHA256_CTX;

I am trying to start a SHA256 computation defined by the intermediate
state. I tried a few proof of concept programs to bootstrap the SHA256_CTX
with intermediate values and alter call SHA256_{Update,Final} functions.

When I specify intermediate values I only set the h[8], Nl, Nh values.
The num is set to 0, and md_len to SHA256_DIGEST_LENGTH. It is unclear
to me what the Nl and Nh values represent. Without them, I was unable
to compute the correct digests for certain test vectors in my proof of
concept. I tried to follow the md32_common.h which computes the
merkle-damgard construction using SHA. However, it's unclear what Nl,Nh
represent and why they are necessary. The SHA256 spec only discusses
values in h[8].

Thanks,
Naveen
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to