Lines Matching refs:hmac
15 HMAC support, initialize state, Tom St Denis/Dobes Vandermeer
23 Initialize an HMAC context.
24 @param hmac The HMAC state
30 int hmac_init(hmac_state *hmac, int hash, const unsigned char *key, unsigned long keylen)
37 LTC_ARGCHK(hmac != NULL);
44 hmac->hash = hash;
59 hmac->key = XMALLOC(HMAC_BLOCKSIZE);
60 if (hmac->key == NULL) {
68 if ((err = hash_memory(hash, key, keylen, hmac->key, &z)) != CRYPT_OK) {
72 zeromem((hmac->key) + hashsize, (size_t)(HMAC_BLOCKSIZE - hashsize));
76 XMEMCPY(hmac->key, key, (size_t)keylen);
78 zeromem((hmac->key) + keylen, (size_t)(HMAC_BLOCKSIZE - keylen));
84 buf[i] = hmac->key[i] ^ 0x36;
88 if ((err = hash_descriptor[hash].init(&hmac->md)) != CRYPT_OK) {
92 if ((err = hash_descriptor[hash].process(&hmac->md, buf, HMAC_BLOCKSIZE)) != CRYPT_OK) {
98 XFREE(hmac->key);
110 /* $Source: /cvs/libtom/libtomcrypt/src/mac/hmac/hmac_init.c,v $ */