comparison src/mac/pelican/pelican.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
100 int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned long inlen) 100 int pelican_process(pelican_state *pelmac, const unsigned char *in, unsigned long inlen)
101 { 101 {
102 102
103 LTC_ARGCHK(pelmac != NULL); 103 LTC_ARGCHK(pelmac != NULL);
104 LTC_ARGCHK(in != NULL); 104 LTC_ARGCHK(in != NULL);
105
106 /* check range */
107 if (pelmac->buflen < 0 || pelmac->buflen > 15) {
108 return CRYPT_INVALID_ARG;
109 }
110
105 #ifdef LTC_FAST 111 #ifdef LTC_FAST
106 if (pelmac->buflen == 0) { 112 if (pelmac->buflen == 0) {
107 while (inlen & ~15) { 113 while (inlen & ~15) {
108 int x; 114 int x;
109 for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) { 115 for (x = 0; x < 16; x += sizeof(LTC_FAST_TYPE)) {
134 */ 140 */
135 int pelican_done(pelican_state *pelmac, unsigned char *out) 141 int pelican_done(pelican_state *pelmac, unsigned char *out)
136 { 142 {
137 LTC_ARGCHK(pelmac != NULL); 143 LTC_ARGCHK(pelmac != NULL);
138 LTC_ARGCHK(out != NULL); 144 LTC_ARGCHK(out != NULL);
145
146 /* check range */
147 if (pelmac->buflen < 0 || pelmac->buflen > 16) {
148 return CRYPT_INVALID_ARG;
149 }
150
139 if (pelmac->buflen == 16) { 151 if (pelmac->buflen == 16) {
140 four_rounds(pelmac); 152 four_rounds(pelmac);
141 pelmac->buflen = 0; 153 pelmac->buflen = 0;
142 } 154 }
143 pelmac->state[pelmac->buflen++] ^= 0x80; 155 pelmac->state[pelmac->buflen++] ^= 0x80;
145 aes_done(&pelmac->K); 157 aes_done(&pelmac->K);
146 return CRYPT_OK; 158 return CRYPT_OK;
147 } 159 }
148 160
149 #endif 161 #endif
162
163 /* $Source: /cvs/libtom/libtomcrypt/src/mac/pelican/pelican.c,v $ */
164 /* $Revision: 1.16 $ */
165 /* $Date: 2005/05/05 14:35:59 $ */