> > > > #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? > > HMAC_CTX_init(context); > HMAC_Init_ex(context, key, sizeof(key), EVP_sha1(), NULL); > return 0; > } > > > I used ./config for setup on RedHat, and got linux-elf as my configuration. > > To compile the test program: > > g++ -o ot -ggdb -I/home/bertoni/src/ ot.c -L. -ltestcrypto -ldl > > after installing libcrypto.a as libtestcrypto.a > > When I run it under valgrind, I get errors: > > > ==30797== Invalid write of size 1 > ==30797== at 0x400655C: memset (mc_replace_strmem.c:479) > ==30797== by 0x804959D: HMAC_Init_ex (hmac.c:100) > ==30797== Address 0x40160E0 is 0 bytes after a block of size 184 alloc'd > ==30797== at 0x40053C0: malloc (vg_replace_malloc.c:149) > ==30797== by 0x80491F0: main (ot.c:12) > > and so on. > > The hmactest program run is clean, so I'm not sure what I'm doing > incorrectly.. Any pointers would be appreciated. > > Jon Bertoni > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager majord...@openssl.org