[openssl-users] SHA256() to EVP_* ?

jonetsu jonetsu at teksavvy.com
Tue Apr 28 17:53:01 UTC 2015


What would be the equivalent of the SHA256() function in the EVP
class of methods ?  EVP_sha256() could be it, although from the
short description in manual page it does not seemingly fit in,
returning a EVP_MD which is, if not mistaken, a env_md_st

The code I'm adapting to EVP has a first pass of shortening the
key if too long:

    /* Change key if longer than 64 bytes */
    if (klen > HMAC_INT_LEN) {
			SHA256(key, klen, nkey);
			key = nkey;
			klen = SHA256_DIGEST_LENGTH;

Before proceeding with the usual SHA256_Init(),
SHA256_Update() (twice), and SHA256_Final.  All of which I have
tested with the corresponding EVP_* methods.  For the use of
SHA256() above, though, I'm puzzled regarding its EVP_*

Suggestions, comments appreciated.


View this message in context: http://openssl.6102.n7.nabble.com/SHA256-to-EVP-tp57774.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.

More information about the openssl-users mailing list