Mercurial > dropbear
comparison src/mac/omac/omac_process.c @ 209:39d5d58461d6 libtomcrypt-orig LTC_1.05
Import of libtomcrypt 1.05
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 06 Jul 2005 03:53:40 +0000 |
parents | 1c15b283127b |
children |
comparison
equal
deleted
inserted
replaced
191:1c15b283127b | 209:39d5d58461d6 |
---|---|
25 @param inlen The length of the input (octets) | 25 @param inlen The length of the input (octets) |
26 @return CRYPT_OK if successful | 26 @return CRYPT_OK if successful |
27 */ | 27 */ |
28 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) | 28 int omac_process(omac_state *omac, const unsigned char *in, unsigned long inlen) |
29 { | 29 { |
30 int err, n, x; | 30 unsigned long n, x; |
31 int err; | |
31 | 32 |
32 LTC_ARGCHK(omac != NULL); | 33 LTC_ARGCHK(omac != NULL); |
33 LTC_ARGCHK(in != NULL); | 34 LTC_ARGCHK(in != NULL); |
34 if ((err = cipher_is_valid(omac->cipher_idx)) != CRYPT_OK) { | 35 if ((err = cipher_is_valid(omac->cipher_idx)) != CRYPT_OK) { |
35 return err; | 36 return err; |
55 #endif | 56 #endif |
56 | 57 |
57 while (inlen != 0) { | 58 while (inlen != 0) { |
58 /* ok if the block is full we xor in prev, encrypt and replace prev */ | 59 /* ok if the block is full we xor in prev, encrypt and replace prev */ |
59 if (omac->buflen == omac->blklen) { | 60 if (omac->buflen == omac->blklen) { |
60 for (x = 0; x < omac->blklen; x++) { | 61 for (x = 0; x < (unsigned long)omac->blklen; x++) { |
61 omac->block[x] ^= omac->prev[x]; | 62 omac->block[x] ^= omac->prev[x]; |
62 } | 63 } |
63 cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->prev, &omac->key); | 64 cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->prev, &omac->key); |
64 omac->buflen = 0; | 65 omac->buflen = 0; |
65 } | 66 } |
75 return CRYPT_OK; | 76 return CRYPT_OK; |
76 } | 77 } |
77 | 78 |
78 #endif | 79 #endif |
79 | 80 |
81 | |
82 /* $Source: /cvs/libtom/libtomcrypt/src/mac/omac/omac_process.c,v $ */ | |
83 /* $Revision: 1.6 $ */ | |
84 /* $Date: 2005/05/05 14:35:58 $ */ |