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