comparison src/mac/pelican/pelican.c @ 210:4768b55c5240 libtomcrypt

propagate from branch 'au.asn.ucc.matt.ltc-orig' (head 33c416b902f1a44913d825bae7ad9a160f703ed3) to branch 'au.asn.ucc.matt.dropbear.ltc' (head 4d6aec6e6121e13f68c11c149b6579c41cb63e74)
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jul 2005 12:10:23 +0000
parents 39d5d58461d6
children
comparison
equal deleted inserted replaced
199:8be64e2c86f4 210:4768b55c5240
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 $ */