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 pelican_memory.c
13    Pelican MAC, MAC a block of memory, by Tom St Denis
14 */
15 
16 #ifdef LTC_PELICAN
17 
18 /**
19   Pelican block of memory
20   @param key      The key for the MAC
21   @param keylen   The length of the key (octets)
22   @param in       The input to MAC
23   @param inlen    The length of the input (octets)
24   @param out      [out] The output TAG
25   @return CRYPT_OK on success
26 */
27 int pelican_memory(const unsigned char *key, unsigned long keylen,
28                    const unsigned char *in,  unsigned long inlen,
29                          unsigned char *out)
pelican_init(pelican_state * pelmac,const unsigned char * key,unsigned long keylen)30 {
31    pelican_state *pel;
32    int err;
33 
34    pel = XMALLOC(sizeof(*pel));
35    if (pel == NULL) {
36       return CRYPT_MEM;
37    }
38 
39    if ((err = pelican_init(pel, key, keylen)) != CRYPT_OK) {
40       XFREE(pel);
41       return err;
42    }
43    if ((err = pelican_process(pel, in ,inlen)) != CRYPT_OK) {
44       XFREE(pel);
45       return err;
46    }
47    err = pelican_done(pel, out);
48    XFREE(pel);
49    return err;
50 }
51 
52 
53 #endif
_four_rounds(pelican_state * pelmac)54 
55 /* ref:         HEAD -> master, tag: v1.18.2 */
56 /* git commit:  7e7eb695d581782f04b24dc444cbfde86af59853 */
57 /* commit time: 2018-07-01 22:49:01 +0200 */
58