comparison libtomcrypt/src/mac/pmac/pmac_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 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 $ */