Mercurial > dropbear
comparison libtomcrypt/src/mac/omac/omac_done.c @ 435:337c45621e81
merge of 'a9b0496634cdd25647b65e585cc3240f3fa699ee'
and 'c22be8b8f570b48e9662dac32c7b3e7148a42206'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 22 Feb 2007 14:53:49 +0000 |
parents | 0cbe8f6dbf9e |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
434:0aaaf68e97dc | 435:337c45621e81 |
---|---|
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | 8 * |
9 * Tom St Denis, [email protected], http://libtomcrypt.org | 9 * Tom St Denis, [email protected], http://libtomcrypt.com |
10 */ | 10 */ |
11 #include "tomcrypt.h" | 11 #include "tomcrypt.h" |
12 | 12 |
13 /** | 13 /** |
14 @file omac_done.c | 14 @file omac_done.c |
15 OMAC1 support, terminate a stream, Tom St Denis | 15 OMAC1 support, terminate a stream, Tom St Denis |
16 */ | 16 */ |
17 | 17 |
18 #ifdef OMAC | 18 #ifdef LTC_OMAC |
19 | 19 |
20 /** | 20 /** |
21 Terminate an OMAC stream | 21 Terminate an OMAC stream |
22 @param omac The OMAC state | 22 @param omac The OMAC state |
23 @param out [out] Destination for the authentication tag | 23 @param out [out] Destination for the authentication tag |
59 for (x = 0; x < (unsigned)omac->blklen; x++) { | 59 for (x = 0; x < (unsigned)omac->blklen; x++) { |
60 omac->block[x] ^= omac->prev[x] ^ omac->Lu[mode][x]; | 60 omac->block[x] ^= omac->prev[x] ^ omac->Lu[mode][x]; |
61 } | 61 } |
62 | 62 |
63 /* encrypt it */ | 63 /* encrypt it */ |
64 cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->block, &omac->key); | 64 if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->block, &omac->key)) != CRYPT_OK) { |
65 return err; | |
66 } | |
65 cipher_descriptor[omac->cipher_idx].done(&omac->key); | 67 cipher_descriptor[omac->cipher_idx].done(&omac->key); |
66 | 68 |
67 /* output it */ | 69 /* output it */ |
68 for (x = 0; x < (unsigned)omac->blklen && x < *outlen; x++) { | 70 for (x = 0; x < (unsigned)omac->blklen && x < *outlen; x++) { |
69 out[x] = omac->block[x]; | 71 out[x] = omac->block[x]; |
78 | 80 |
79 #endif | 81 #endif |
80 | 82 |
81 | 83 |
82 /* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_done.c,v $ */ | 84 /* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_done.c,v $ */ |
83 /* $Revision: 1.4 $ */ | 85 /* $Revision: 1.7 $ */ |
84 /* $Date: 2005/05/05 14:35:58 $ */ | 86 /* $Date: 2006/11/03 00:39:49 $ */ |