1 // SPDX-License-Identifier: BSD-2-Clause 2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis 3 * 4 * LibTomCrypt is a library that provides various cryptographic 5 * algorithms in a highly modular and flexible manner. 6 * 7 * The library is free for all purposes without any express 8 * guarantee it works. 9 */ 10 #include "tomcrypt_private.h" 11 12 /** 13 @file hmac_process.c 14 HMAC support, process data, Tom St Denis/Dobes Vandermeer 15 */ 16 17 #ifdef LTC_HMAC 18 19 /** 20 Process data through HMAC 21 @param hmac The hmac state 22 @param in The data to send through HMAC 23 @param inlen The length of the data to HMAC (octets) 24 @return CRYPT_OK if successful 25 */ hmac_process(hmac_state * hmac,const unsigned char * in,unsigned long inlen)26int hmac_process(hmac_state *hmac, const unsigned char *in, unsigned long inlen) 27 { 28 int err; 29 LTC_ARGCHK(hmac != NULL); 30 LTC_ARGCHK(in != NULL); 31 if ((err = hash_is_valid(hmac->hash)) != CRYPT_OK) { 32 return err; 33 } 34 return hash_descriptor[hmac->hash]->process(&hmac->md, in, inlen); 35 } 36 37 #endif 38 39 40 /* ref: $Format:%D$ */ 41 /* git commit: $Format:%H$ */ 42 /* commit time: $Format:%ai$ */ 43