1
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
3
* LibTomCrypt is a library that provides various cryptographic
4
* algorithms in a highly modular and flexible manner.
6
* The library is free for all purposes without any express
9
* Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org
11
/* Submited by Dobes Vandermeer (dobes@smartt.com) */
17
int hmac_memory(int hash, const unsigned char *key, unsigned long keylen,
18
const unsigned char *data, unsigned long len,
19
unsigned char *dst, unsigned long *dstlen)
25
_ARGCHK(data != NULL);
27
_ARGCHK(dstlen != NULL);
29
/* allocate ram for hmac state */
30
hmac = XMALLOC(sizeof(hmac_state));
35
if ((err = hmac_init(hmac, hash, key, keylen)) != CRYPT_OK) {
39
if ((err = hmac_process(hmac, data, len)) != CRYPT_OK) {
43
if ((err = hmac_done(hmac, dst, dstlen)) != CRYPT_OK) {
50
zeromem(hmac, sizeof(hmac_state));