Stephen, Thanks for your solution. >Well I'd add the BIG disclaimer that will NOT work in future when OpenSSL >structures are made opaque and almost certainly will fail if you have an >ENGINE.
Understood. I am new to openssl and I am reading up about 'ENGINE's in openssl. When you say it will fail when there is an 'ENGINE', do you mean if I use EVP_DIGEST functions (from the example on openssl.org), your solution will not work? If yes, is the solution as simple as using SHA1_Init, SHA1_Update, SHA1_Final functions instead? >What you need to do is copy the md_ctx->data (which will be a flat buffer for >the software SHA1 implementation) for md_ctx->digest->md_size bytes. Save that >somewhere and after calling init the second time copy it back. Do NOT try >restoring the context with different versions of OpenSSL or different >architectures. Will this work with plain old SHA also? I will try to find the answers for some of the questions on my own by writing some code. But any help from your side will be much appreciated. Subra