Hello,
I have a doubt about how to use the HMAC() function. I developed this
code in C
language: (abridged)
...
unsigned char *auth = NULL;
unsigned char *session_auth_key;
unsigned char *auth_tag;
.
.
auth = HMAC(EVP_sha1(), session_auth_key, auth_key_length, length,
auth_tag, auth_tag_length);
.
.
Is the first argument in HMAC correct?
When i run my program with GDB (GNU Project Debugger ) i get the string
EVP_DigestFinal_ex () from /usr/lib/i686/cmov/libcrypto.so.0.9.8 as
result.
I think that the problem deals with the HMAC function.
I use also the AES_ctr128_encrypt in my program. Can it have an
influence?
Code like this:
HMAC(EVP_md5(), pass, strlen(pass),
(u_char *) ctx-chal, strlen(ctx-chal), buff, len);
works (pass and chal are normal strings)
As a result you will get hmac (here of MD5 size = 16bytes) but as binary
buffer.
You may convert this buffer to hex with code:
for (i = 0; i len; i++) {
sprintf((digest[i * 2]), %02x, buff[i]);
}
digest[2 * len] = 0;
and use for example for ascii compare or so.
(from performance point of view sprintf() should be replaced
with simple function which covert byte to hex form).
Best regards,
--
Marek Marcola [EMAIL PROTECTED]
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]