I have some code what was originally doing:
HMAC_CTX ctx;
HMAC_Init(&ctx, key, keylen, EVP_md5());
HHAC_Update(&ctx, data, datalen);
HHAC_Update(&ctx, moredata, moredatalen);
HMAC_Final(&ctx, digest, &digestlen);
This seems to work fine and valgrind indicates there are no memory
leaks, i.e. that I don't need to call HMAC_CTX_cleanup(). But the man
page indicates my usage of HMAC_Init() is depreciated so I'm trying to
convert to HMAC_Init_ex() but I'm finding my stack is getting destroyed.
Now I am trying to understand the HMAC_CTX_init() and HMAC_Init_ex() API
calls but I can't get them to work.
{
char digest[MD5_DIGEST_LENGTH];
unsigned int digestlen;
HMAC_CTX ctx;
HMAC_CTX_init(&ctx);
HMAC_Init_ex(&ctx, key, keylen, EVP_md5(), NULL); // NULL needed even
through man page it out of date
// At this point my stack is destroyed, "gdb backtrace" returns "???",
but the program doesn't crash until return from this function....
HHAC_Update(&ctx, data, datalen);
HHAC_Update(&ctx, moredata, moredatalen);
HMAC_Final(&ctx, digest, &digestlen);
HMAC_CTX_cleanup(&ctx);
// ...the function return here is where the program crashes
}
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [EMAIL PROTECTED]