Jonas Schnelli
<[email protected]> writes:
>> #include <openssl-1.0.0e/include/openssl/hmac.h>
>> #include <openssl-1.0.0e/include/openssl/evp.h>
>> #include <string.h>
>>
>> char key[20] = { 0 };
>>
>> int
>> main()
>> {
>> HMAC_CTX * context;
>>
>> context = (HMAC_CTX *) malloc(sizeof(*context));
>
> Do you need to malloc the context (a pointer) ?
> I don't think so.
> Remove the line?
That won't work, but you can do
HMAC_CTX context;
and use &context instead of context.
>> HMAC_CTX_init(context);
>> HMAC_Init_ex(context, key, sizeof(key), EVP_sha1(), NULL);
>> return 0;
>> }
The program runs fine under valgrind on my Fedora 14. Have you built
your openssl in a weird way (and why is it named libtestcrypto)?
(I had to add HMAC_CTX_cleanup(context) and free(context) to avoid
memory leak warnings from valgrind, though.)
--
Henrik Grindal Bakken <[email protected]>
PGP ID: 8D436E52
Fingerprint: 131D 9590 F0CF 47EF 7963 02AF 9236 D25A 8D43 6E52
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]