comparison src/mac/pmac/pmac_done.c @ 380:d5faf4814ddb libtomcrypt-orig libtomcrypt-1.16

Update to LibTomCrypt 1.16
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:22:00 +0000
parents 59400faa4b44
children
comparison
equal deleted inserted replaced
280:59400faa4b44 380:d5faf4814ddb
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 $ */