1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4 
5 /**
6   @file hmac_process.c
7   HMAC support, process data, Tom St Denis/Dobes Vandermeer
8 */
9 
10 #ifdef LTC_HMAC
11 
12 /**
13   Process data through HMAC
14   @param hmac    The hmac state
15   @param in      The data to send through HMAC
16   @param inlen   The length of the data to HMAC (octets)
17   @return CRYPT_OK if successful
18 */
hmac_process(hmac_state * hmac,const unsigned char * in,unsigned long inlen)19 int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen)
20 {
21     int err;
22     LTC_ARGCHK(hmac != NULL);
23     LTC_ARGCHK(in != NULL);
24     if ((err = hash_is_valid(hmac->hash)) != CRYPT_OK) {
25         return err;
26     }
27     return hash_descriptor[hmac->hash]->process(&hmac->md, in, inlen);
28 }
29 
30 #endif
31 
32