Mercurial > dropbear
comparison libtomcrypt/src/mac/omac/omac_done.c @ 382:0cbe8f6dbf9e
propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f)
to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a)
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 11 Jan 2007 02:41:05 +0000 |
parents | 1b9e69c058d2 |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
379:b66a00272a90 | 382:0cbe8f6dbf9e |
---|---|
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 $ */ |