comparison eax_encrypt_authenticate_memory.c @ 0:d7da3b1e1540 libtomcrypt

put back the 0.95 makefile which was inadvertently merged over
author Matt Johnston <matt@ucc.asn.au>
date Mon, 31 May 2004 18:21:40 +0000
parents
children 5d99163f7e32
comparison
equal deleted inserted replaced
-1:000000000000 0:d7da3b1e1540
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
12 /* EAX Implementation by Tom St Denis */
13 #include "mycrypt.h"
14
15 #ifdef EAX_MODE
16
17 int eax_encrypt_authenticate_memory(int cipher,
18 const unsigned char *key, unsigned long keylen,
19 const unsigned char *nonce, unsigned long noncelen,
20 const unsigned char *header, unsigned long headerlen,
21 const unsigned char *pt, unsigned long ptlen,
22 unsigned char *ct,
23 unsigned char *tag, unsigned long *taglen)
24 {
25 int err;
26 eax_state eax;
27
28 if ((err = eax_init(&eax, cipher, key, keylen, nonce, noncelen, header, headerlen)) != CRYPT_OK) {
29 return err;
30 }
31
32 if ((err = eax_encrypt(&eax, pt, ct, ptlen)) != CRYPT_OK) {
33 return err;
34 }
35
36 if ((err = eax_done(&eax, tag, taglen)) != CRYPT_OK) {
37 return err;
38 }
39
40 return CRYPT_OK;
41 }
42
43 #endif