comparison omac_memory.c @ 3:7faae8f46238 libtomcrypt-orig

Branch renaming
author Matt Johnston <matt@ucc.asn.au>
date Mon, 31 May 2004 18:25:41 +0000
parents
children 5d99163f7e32
comparison
equal deleted inserted replaced
-1:000000000000 3:7faae8f46238
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 * Tom St Denis, [email protected], http://libtomcrypt.org
10 */
11 /* OMAC1 Support by Tom St Denis (for 64 and 128 bit block ciphers only) */
12 #include "mycrypt.h"
13
14 #ifdef OMAC
15
16 int omac_memory(int cipher,
17 const unsigned char *key, unsigned long keylen,
18 const unsigned char *msg, unsigned long msglen,
19 unsigned char *out, unsigned long *outlen)
20 {
21 int err;
22 omac_state omac;
23
24 _ARGCHK(key != NULL);
25 _ARGCHK(msg != NULL);
26 _ARGCHK(out != NULL);
27 _ARGCHK(outlen != NULL);
28
29 if ((err = omac_init(&omac, cipher, key, keylen)) != CRYPT_OK) {
30 return err;
31 }
32 if ((err = omac_process(&omac, msg, msglen)) != CRYPT_OK) {
33 return err;
34 }
35 if ((err = omac_done(&omac, out, outlen)) != CRYPT_OK) {
36 return err;
37 }
38
39 return CRYPT_OK;
40 }
41
42 #endif