Mercurial > dropbear
comparison libtomcrypt/src/mac/pmac/pmac_done.c @ 398:59c7938af2bd
merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c'
and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 03 Feb 2007 08:20:30 +0000 |
parents | 0cbe8f6dbf9e |
children | f849a5ca2efc |
comparison
equal
deleted
inserted
replaced
396:e7c1a77d2921 | 398:59c7938af2bd |
---|---|
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 pmac_done.c | 14 @file pmac_done.c |
15 PMAC implementation, terminate a session, by Tom St Denis | 15 PMAC implementation, terminate a session, by Tom St Denis |
16 */ | 16 */ |
17 | 17 |
18 #ifdef PMAC | 18 #ifdef LTC_PMAC |
19 | 19 |
20 int pmac_done(pmac_state *state, unsigned char *out, unsigned long *outlen) | 20 int pmac_done(pmac_state *state, unsigned char *out, unsigned long *outlen) |
21 { | 21 { |
22 int err, x; | 22 int err, x; |
23 | 23 |
47 } | 47 } |
48 state->checksum[x] ^= 0x80; | 48 state->checksum[x] ^= 0x80; |
49 } | 49 } |
50 | 50 |
51 /* encrypt it */ | 51 /* encrypt it */ |
52 cipher_descriptor[state->cipher_idx].ecb_encrypt(state->checksum, state->checksum, &state->key); | 52 if ((err = cipher_descriptor[state->cipher_idx].ecb_encrypt(state->checksum, state->checksum, &state->key)) != CRYPT_OK) { |
53 return err; | |
54 } | |
53 cipher_descriptor[state->cipher_idx].done(&state->key); | 55 cipher_descriptor[state->cipher_idx].done(&state->key); |
54 | 56 |
55 /* store it */ | 57 /* store it */ |
56 for (x = 0; x < state->block_len && x <= (int)*outlen; x++) { | 58 for (x = 0; x < state->block_len && x < (int)*outlen; x++) { |
57 out[x] = state->checksum[x]; | 59 out[x] = state->checksum[x]; |
58 } | 60 } |
59 *outlen = x; | 61 *outlen = x; |
60 | 62 |
61 #ifdef LTC_CLEAN_STACK | 63 #ifdef LTC_CLEAN_STACK |
66 | 68 |
67 #endif | 69 #endif |
68 | 70 |
69 | 71 |
70 /* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_done.c,v $ */ | 72 /* $Source: /cvs/libtom/libtomcrypt/src/mac/pmac/pmac_done.c,v $ */ |
71 /* $Revision: 1.4 $ */ | 73 /* $Revision: 1.8 $ */ |
72 /* $Date: 2005/05/05 14:35:59 $ */ | 74 /* $Date: 2006/11/03 00:39:49 $ */ |