Version of http://mbed.org/cookbook/NetServicesTribute with setting set the same for LPC2368

Dependents:   UDPSocketExample 24LCxx_I2CApp WeatherPlatform_pachube HvZServerLib ... more

Committer:
simon
Date:
Tue Nov 23 14:15:36 2010 +0000
Revision:
0:350011bf8be7
Experimental version for testing UDP

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:350011bf8be7 1 /*
simon 0:350011bf8be7 2 ***********************************************************************
simon 0:350011bf8be7 3 ** md5.c -- the source code for MD5 routines **
simon 0:350011bf8be7 4 ** RSA Data Security, Inc. MD5 Message-Digest Algorithm **
simon 0:350011bf8be7 5 ** Created: 2/17/90 RLR **
simon 0:350011bf8be7 6 ** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. **
simon 0:350011bf8be7 7 ***********************************************************************
simon 0:350011bf8be7 8 */
simon 0:350011bf8be7 9
simon 0:350011bf8be7 10 /*
simon 0:350011bf8be7 11 ***********************************************************************
simon 0:350011bf8be7 12 ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. **
simon 0:350011bf8be7 13 ** **
simon 0:350011bf8be7 14 ** License to copy and use this software is granted provided that **
simon 0:350011bf8be7 15 ** it is identified as the "RSA Data Security, Inc. MD5 Message- **
simon 0:350011bf8be7 16 ** Digest Algorithm" in all material mentioning or referencing this **
simon 0:350011bf8be7 17 ** software or this function. **
simon 0:350011bf8be7 18 ** **
simon 0:350011bf8be7 19 ** License is also granted to make and use derivative works **
simon 0:350011bf8be7 20 ** provided that such works are identified as "derived from the RSA **
simon 0:350011bf8be7 21 ** Data Security, Inc. MD5 Message-Digest Algorithm" in all **
simon 0:350011bf8be7 22 ** material mentioning or referencing the derived work. **
simon 0:350011bf8be7 23 ** **
simon 0:350011bf8be7 24 ** RSA Data Security, Inc. makes no representations concerning **
simon 0:350011bf8be7 25 ** either the merchantability of this software or the suitability **
simon 0:350011bf8be7 26 ** of this software for any particular purpose. It is provided "as **
simon 0:350011bf8be7 27 ** is" without express or implied warranty of any kind. **
simon 0:350011bf8be7 28 ** **
simon 0:350011bf8be7 29 ** These notices must be retained in any copies of any part of this **
simon 0:350011bf8be7 30 ** documentation and/or software. **
simon 0:350011bf8be7 31 ***********************************************************************
simon 0:350011bf8be7 32 */
simon 0:350011bf8be7 33
simon 0:350011bf8be7 34 #include "lwip/opt.h"
simon 0:350011bf8be7 35
simon 0:350011bf8be7 36 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
simon 0:350011bf8be7 37
simon 0:350011bf8be7 38 #if CHAP_SUPPORT || MD5_SUPPORT
simon 0:350011bf8be7 39
simon 0:350011bf8be7 40 #include "ppp.h"
simon 0:350011bf8be7 41 #include "pppdebug.h"
simon 0:350011bf8be7 42
simon 0:350011bf8be7 43 #include "md5.h"
simon 0:350011bf8be7 44
simon 0:350011bf8be7 45 #include <string.h>
simon 0:350011bf8be7 46
simon 0:350011bf8be7 47 /*
simon 0:350011bf8be7 48 ***********************************************************************
simon 0:350011bf8be7 49 ** Message-digest routines: **
simon 0:350011bf8be7 50 ** To form the message digest for a message M **
simon 0:350011bf8be7 51 ** (1) Initialize a context buffer mdContext using MD5Init **
simon 0:350011bf8be7 52 ** (2) Call MD5Update on mdContext and M **
simon 0:350011bf8be7 53 ** (3) Call MD5Final on mdContext **
simon 0:350011bf8be7 54 ** The message digest is now in mdContext->digest[0...15] **
simon 0:350011bf8be7 55 ***********************************************************************
simon 0:350011bf8be7 56 */
simon 0:350011bf8be7 57
simon 0:350011bf8be7 58 /* forward declaration */
simon 0:350011bf8be7 59 static void Transform (u32_t *buf, u32_t *in);
simon 0:350011bf8be7 60
simon 0:350011bf8be7 61 static unsigned char PADDING[64] = {
simon 0:350011bf8be7 62 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
simon 0:350011bf8be7 69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
simon 0:350011bf8be7 70 };
simon 0:350011bf8be7 71
simon 0:350011bf8be7 72 /* F, G, H and I are basic MD5 functions */
simon 0:350011bf8be7 73 #define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
simon 0:350011bf8be7 74 #define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
simon 0:350011bf8be7 75 #define H(x, y, z) ((x) ^ (y) ^ (z))
simon 0:350011bf8be7 76 #define I(x, y, z) ((y) ^ ((x) | (~z)))
simon 0:350011bf8be7 77
simon 0:350011bf8be7 78 /* ROTATE_LEFT rotates x left n bits */
simon 0:350011bf8be7 79 #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
simon 0:350011bf8be7 80
simon 0:350011bf8be7 81 /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */
simon 0:350011bf8be7 82 /* Rotation is separate from addition to prevent recomputation */
simon 0:350011bf8be7 83 #define FF(a, b, c, d, x, s, ac) \
simon 0:350011bf8be7 84 {(a) += F ((b), (c), (d)) + (x) + (u32_t)(ac); \
simon 0:350011bf8be7 85 (a) = ROTATE_LEFT ((a), (s)); \
simon 0:350011bf8be7 86 (a) += (b); \
simon 0:350011bf8be7 87 }
simon 0:350011bf8be7 88 #define GG(a, b, c, d, x, s, ac) \
simon 0:350011bf8be7 89 {(a) += G ((b), (c), (d)) + (x) + (u32_t)(ac); \
simon 0:350011bf8be7 90 (a) = ROTATE_LEFT ((a), (s)); \
simon 0:350011bf8be7 91 (a) += (b); \
simon 0:350011bf8be7 92 }
simon 0:350011bf8be7 93 #define HH(a, b, c, d, x, s, ac) \
simon 0:350011bf8be7 94 {(a) += H ((b), (c), (d)) + (x) + (u32_t)(ac); \
simon 0:350011bf8be7 95 (a) = ROTATE_LEFT ((a), (s)); \
simon 0:350011bf8be7 96 (a) += (b); \
simon 0:350011bf8be7 97 }
simon 0:350011bf8be7 98 #define II(a, b, c, d, x, s, ac) \
simon 0:350011bf8be7 99 {(a) += I ((b), (c), (d)) + (x) + (u32_t)(ac); \
simon 0:350011bf8be7 100 (a) = ROTATE_LEFT ((a), (s)); \
simon 0:350011bf8be7 101 (a) += (b); \
simon 0:350011bf8be7 102 }
simon 0:350011bf8be7 103
simon 0:350011bf8be7 104 #ifdef __STDC__
simon 0:350011bf8be7 105 #define UL(x) x##UL
simon 0:350011bf8be7 106 #else
simon 0:350011bf8be7 107 #ifdef WIN32
simon 0:350011bf8be7 108 #define UL(x) x##UL
simon 0:350011bf8be7 109 #else
simon 0:350011bf8be7 110 #define UL(x) x
simon 0:350011bf8be7 111 #endif
simon 0:350011bf8be7 112 #endif
simon 0:350011bf8be7 113
simon 0:350011bf8be7 114 /* The routine MD5Init initializes the message-digest context
simon 0:350011bf8be7 115 mdContext. All fields are set to zero.
simon 0:350011bf8be7 116 */
simon 0:350011bf8be7 117 void
simon 0:350011bf8be7 118 MD5Init (MD5_CTX *mdContext)
simon 0:350011bf8be7 119 {
simon 0:350011bf8be7 120 mdContext->i[0] = mdContext->i[1] = (u32_t)0;
simon 0:350011bf8be7 121
simon 0:350011bf8be7 122 /* Load magic initialization constants. */
simon 0:350011bf8be7 123 mdContext->buf[0] = (u32_t)0x67452301UL;
simon 0:350011bf8be7 124 mdContext->buf[1] = (u32_t)0xefcdab89UL;
simon 0:350011bf8be7 125 mdContext->buf[2] = (u32_t)0x98badcfeUL;
simon 0:350011bf8be7 126 mdContext->buf[3] = (u32_t)0x10325476UL;
simon 0:350011bf8be7 127 }
simon 0:350011bf8be7 128
simon 0:350011bf8be7 129 /* The routine MD5Update updates the message-digest context to
simon 0:350011bf8be7 130 account for the presence of each of the characters inBuf[0..inLen-1]
simon 0:350011bf8be7 131 in the message whose digest is being computed.
simon 0:350011bf8be7 132 */
simon 0:350011bf8be7 133 void
simon 0:350011bf8be7 134 MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen)
simon 0:350011bf8be7 135 {
simon 0:350011bf8be7 136 u32_t in[16];
simon 0:350011bf8be7 137 int mdi;
simon 0:350011bf8be7 138 unsigned int i, ii;
simon 0:350011bf8be7 139
simon 0:350011bf8be7 140 #if 0
simon 0:350011bf8be7 141 PPPDEBUG(LOG_INFO, ("MD5Update: %u:%.*H\n", inLen, LWIP_MIN(inLen, 20) * 2, inBuf));
simon 0:350011bf8be7 142 PPPDEBUG(LOG_INFO, ("MD5Update: %u:%s\n", inLen, inBuf));
simon 0:350011bf8be7 143 #endif
simon 0:350011bf8be7 144
simon 0:350011bf8be7 145 /* compute number of bytes mod 64 */
simon 0:350011bf8be7 146 mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
simon 0:350011bf8be7 147
simon 0:350011bf8be7 148 /* update number of bits */
simon 0:350011bf8be7 149 if ((mdContext->i[0] + ((u32_t)inLen << 3)) < mdContext->i[0]) {
simon 0:350011bf8be7 150 mdContext->i[1]++;
simon 0:350011bf8be7 151 }
simon 0:350011bf8be7 152 mdContext->i[0] += ((u32_t)inLen << 3);
simon 0:350011bf8be7 153 mdContext->i[1] += ((u32_t)inLen >> 29);
simon 0:350011bf8be7 154
simon 0:350011bf8be7 155 while (inLen--) {
simon 0:350011bf8be7 156 /* add new character to buffer, increment mdi */
simon 0:350011bf8be7 157 mdContext->in[mdi++] = *inBuf++;
simon 0:350011bf8be7 158
simon 0:350011bf8be7 159 /* transform if necessary */
simon 0:350011bf8be7 160 if (mdi == 0x40) {
simon 0:350011bf8be7 161 for (i = 0, ii = 0; i < 16; i++, ii += 4) {
simon 0:350011bf8be7 162 in[i] = (((u32_t)mdContext->in[ii+3]) << 24) |
simon 0:350011bf8be7 163 (((u32_t)mdContext->in[ii+2]) << 16) |
simon 0:350011bf8be7 164 (((u32_t)mdContext->in[ii+1]) << 8) |
simon 0:350011bf8be7 165 ((u32_t)mdContext->in[ii]);
simon 0:350011bf8be7 166 }
simon 0:350011bf8be7 167 Transform (mdContext->buf, in);
simon 0:350011bf8be7 168 mdi = 0;
simon 0:350011bf8be7 169 }
simon 0:350011bf8be7 170 }
simon 0:350011bf8be7 171 }
simon 0:350011bf8be7 172
simon 0:350011bf8be7 173 /* The routine MD5Final terminates the message-digest computation and
simon 0:350011bf8be7 174 ends with the desired message digest in mdContext->digest[0...15].
simon 0:350011bf8be7 175 */
simon 0:350011bf8be7 176 void
simon 0:350011bf8be7 177 MD5Final (unsigned char hash[], MD5_CTX *mdContext)
simon 0:350011bf8be7 178 {
simon 0:350011bf8be7 179 u32_t in[16];
simon 0:350011bf8be7 180 int mdi;
simon 0:350011bf8be7 181 unsigned int i, ii;
simon 0:350011bf8be7 182 unsigned int padLen;
simon 0:350011bf8be7 183
simon 0:350011bf8be7 184 /* save number of bits */
simon 0:350011bf8be7 185 in[14] = mdContext->i[0];
simon 0:350011bf8be7 186 in[15] = mdContext->i[1];
simon 0:350011bf8be7 187
simon 0:350011bf8be7 188 /* compute number of bytes mod 64 */
simon 0:350011bf8be7 189 mdi = (int)((mdContext->i[0] >> 3) & 0x3F);
simon 0:350011bf8be7 190
simon 0:350011bf8be7 191 /* pad out to 56 mod 64 */
simon 0:350011bf8be7 192 padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi);
simon 0:350011bf8be7 193 MD5Update (mdContext, PADDING, padLen);
simon 0:350011bf8be7 194
simon 0:350011bf8be7 195 /* append length in bits and transform */
simon 0:350011bf8be7 196 for (i = 0, ii = 0; i < 14; i++, ii += 4) {
simon 0:350011bf8be7 197 in[i] = (((u32_t)mdContext->in[ii+3]) << 24) |
simon 0:350011bf8be7 198 (((u32_t)mdContext->in[ii+2]) << 16) |
simon 0:350011bf8be7 199 (((u32_t)mdContext->in[ii+1]) << 8) |
simon 0:350011bf8be7 200 ((u32_t)mdContext->in[ii]);
simon 0:350011bf8be7 201 }
simon 0:350011bf8be7 202 Transform (mdContext->buf, in);
simon 0:350011bf8be7 203
simon 0:350011bf8be7 204 /* store buffer in digest */
simon 0:350011bf8be7 205 for (i = 0, ii = 0; i < 4; i++, ii += 4) {
simon 0:350011bf8be7 206 mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF);
simon 0:350011bf8be7 207 mdContext->digest[ii+1] =
simon 0:350011bf8be7 208 (unsigned char)((mdContext->buf[i] >> 8) & 0xFF);
simon 0:350011bf8be7 209 mdContext->digest[ii+2] =
simon 0:350011bf8be7 210 (unsigned char)((mdContext->buf[i] >> 16) & 0xFF);
simon 0:350011bf8be7 211 mdContext->digest[ii+3] =
simon 0:350011bf8be7 212 (unsigned char)((mdContext->buf[i] >> 24) & 0xFF);
simon 0:350011bf8be7 213 }
simon 0:350011bf8be7 214 SMEMCPY(hash, mdContext->digest, 16);
simon 0:350011bf8be7 215 }
simon 0:350011bf8be7 216
simon 0:350011bf8be7 217 /* Basic MD5 step. Transforms buf based on in.
simon 0:350011bf8be7 218 */
simon 0:350011bf8be7 219 static void
simon 0:350011bf8be7 220 Transform (u32_t *buf, u32_t *in)
simon 0:350011bf8be7 221 {
simon 0:350011bf8be7 222 u32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3];
simon 0:350011bf8be7 223
simon 0:350011bf8be7 224 /* Round 1 */
simon 0:350011bf8be7 225 #define S11 7
simon 0:350011bf8be7 226 #define S12 12
simon 0:350011bf8be7 227 #define S13 17
simon 0:350011bf8be7 228 #define S14 22
simon 0:350011bf8be7 229 FF ( a, b, c, d, in[ 0], S11, UL(3614090360)); /* 1 */
simon 0:350011bf8be7 230 FF ( d, a, b, c, in[ 1], S12, UL(3905402710)); /* 2 */
simon 0:350011bf8be7 231 FF ( c, d, a, b, in[ 2], S13, UL( 606105819)); /* 3 */
simon 0:350011bf8be7 232 FF ( b, c, d, a, in[ 3], S14, UL(3250441966)); /* 4 */
simon 0:350011bf8be7 233 FF ( a, b, c, d, in[ 4], S11, UL(4118548399)); /* 5 */
simon 0:350011bf8be7 234 FF ( d, a, b, c, in[ 5], S12, UL(1200080426)); /* 6 */
simon 0:350011bf8be7 235 FF ( c, d, a, b, in[ 6], S13, UL(2821735955)); /* 7 */
simon 0:350011bf8be7 236 FF ( b, c, d, a, in[ 7], S14, UL(4249261313)); /* 8 */
simon 0:350011bf8be7 237 FF ( a, b, c, d, in[ 8], S11, UL(1770035416)); /* 9 */
simon 0:350011bf8be7 238 FF ( d, a, b, c, in[ 9], S12, UL(2336552879)); /* 10 */
simon 0:350011bf8be7 239 FF ( c, d, a, b, in[10], S13, UL(4294925233)); /* 11 */
simon 0:350011bf8be7 240 FF ( b, c, d, a, in[11], S14, UL(2304563134)); /* 12 */
simon 0:350011bf8be7 241 FF ( a, b, c, d, in[12], S11, UL(1804603682)); /* 13 */
simon 0:350011bf8be7 242 FF ( d, a, b, c, in[13], S12, UL(4254626195)); /* 14 */
simon 0:350011bf8be7 243 FF ( c, d, a, b, in[14], S13, UL(2792965006)); /* 15 */
simon 0:350011bf8be7 244 FF ( b, c, d, a, in[15], S14, UL(1236535329)); /* 16 */
simon 0:350011bf8be7 245
simon 0:350011bf8be7 246 /* Round 2 */
simon 0:350011bf8be7 247 #define S21 5
simon 0:350011bf8be7 248 #define S22 9
simon 0:350011bf8be7 249 #define S23 14
simon 0:350011bf8be7 250 #define S24 20
simon 0:350011bf8be7 251 GG ( a, b, c, d, in[ 1], S21, UL(4129170786)); /* 17 */
simon 0:350011bf8be7 252 GG ( d, a, b, c, in[ 6], S22, UL(3225465664)); /* 18 */
simon 0:350011bf8be7 253 GG ( c, d, a, b, in[11], S23, UL( 643717713)); /* 19 */
simon 0:350011bf8be7 254 GG ( b, c, d, a, in[ 0], S24, UL(3921069994)); /* 20 */
simon 0:350011bf8be7 255 GG ( a, b, c, d, in[ 5], S21, UL(3593408605)); /* 21 */
simon 0:350011bf8be7 256 GG ( d, a, b, c, in[10], S22, UL( 38016083)); /* 22 */
simon 0:350011bf8be7 257 GG ( c, d, a, b, in[15], S23, UL(3634488961)); /* 23 */
simon 0:350011bf8be7 258 GG ( b, c, d, a, in[ 4], S24, UL(3889429448)); /* 24 */
simon 0:350011bf8be7 259 GG ( a, b, c, d, in[ 9], S21, UL( 568446438)); /* 25 */
simon 0:350011bf8be7 260 GG ( d, a, b, c, in[14], S22, UL(3275163606)); /* 26 */
simon 0:350011bf8be7 261 GG ( c, d, a, b, in[ 3], S23, UL(4107603335)); /* 27 */
simon 0:350011bf8be7 262 GG ( b, c, d, a, in[ 8], S24, UL(1163531501)); /* 28 */
simon 0:350011bf8be7 263 GG ( a, b, c, d, in[13], S21, UL(2850285829)); /* 29 */
simon 0:350011bf8be7 264 GG ( d, a, b, c, in[ 2], S22, UL(4243563512)); /* 30 */
simon 0:350011bf8be7 265 GG ( c, d, a, b, in[ 7], S23, UL(1735328473)); /* 31 */
simon 0:350011bf8be7 266 GG ( b, c, d, a, in[12], S24, UL(2368359562)); /* 32 */
simon 0:350011bf8be7 267
simon 0:350011bf8be7 268 /* Round 3 */
simon 0:350011bf8be7 269 #define S31 4
simon 0:350011bf8be7 270 #define S32 11
simon 0:350011bf8be7 271 #define S33 16
simon 0:350011bf8be7 272 #define S34 23
simon 0:350011bf8be7 273 HH ( a, b, c, d, in[ 5], S31, UL(4294588738)); /* 33 */
simon 0:350011bf8be7 274 HH ( d, a, b, c, in[ 8], S32, UL(2272392833)); /* 34 */
simon 0:350011bf8be7 275 HH ( c, d, a, b, in[11], S33, UL(1839030562)); /* 35 */
simon 0:350011bf8be7 276 HH ( b, c, d, a, in[14], S34, UL(4259657740)); /* 36 */
simon 0:350011bf8be7 277 HH ( a, b, c, d, in[ 1], S31, UL(2763975236)); /* 37 */
simon 0:350011bf8be7 278 HH ( d, a, b, c, in[ 4], S32, UL(1272893353)); /* 38 */
simon 0:350011bf8be7 279 HH ( c, d, a, b, in[ 7], S33, UL(4139469664)); /* 39 */
simon 0:350011bf8be7 280 HH ( b, c, d, a, in[10], S34, UL(3200236656)); /* 40 */
simon 0:350011bf8be7 281 HH ( a, b, c, d, in[13], S31, UL( 681279174)); /* 41 */
simon 0:350011bf8be7 282 HH ( d, a, b, c, in[ 0], S32, UL(3936430074)); /* 42 */
simon 0:350011bf8be7 283 HH ( c, d, a, b, in[ 3], S33, UL(3572445317)); /* 43 */
simon 0:350011bf8be7 284 HH ( b, c, d, a, in[ 6], S34, UL( 76029189)); /* 44 */
simon 0:350011bf8be7 285 HH ( a, b, c, d, in[ 9], S31, UL(3654602809)); /* 45 */
simon 0:350011bf8be7 286 HH ( d, a, b, c, in[12], S32, UL(3873151461)); /* 46 */
simon 0:350011bf8be7 287 HH ( c, d, a, b, in[15], S33, UL( 530742520)); /* 47 */
simon 0:350011bf8be7 288 HH ( b, c, d, a, in[ 2], S34, UL(3299628645)); /* 48 */
simon 0:350011bf8be7 289
simon 0:350011bf8be7 290 /* Round 4 */
simon 0:350011bf8be7 291 #define S41 6
simon 0:350011bf8be7 292 #define S42 10
simon 0:350011bf8be7 293 #define S43 15
simon 0:350011bf8be7 294 #define S44 21
simon 0:350011bf8be7 295 II ( a, b, c, d, in[ 0], S41, UL(4096336452)); /* 49 */
simon 0:350011bf8be7 296 II ( d, a, b, c, in[ 7], S42, UL(1126891415)); /* 50 */
simon 0:350011bf8be7 297 II ( c, d, a, b, in[14], S43, UL(2878612391)); /* 51 */
simon 0:350011bf8be7 298 II ( b, c, d, a, in[ 5], S44, UL(4237533241)); /* 52 */
simon 0:350011bf8be7 299 II ( a, b, c, d, in[12], S41, UL(1700485571)); /* 53 */
simon 0:350011bf8be7 300 II ( d, a, b, c, in[ 3], S42, UL(2399980690)); /* 54 */
simon 0:350011bf8be7 301 II ( c, d, a, b, in[10], S43, UL(4293915773)); /* 55 */
simon 0:350011bf8be7 302 II ( b, c, d, a, in[ 1], S44, UL(2240044497)); /* 56 */
simon 0:350011bf8be7 303 II ( a, b, c, d, in[ 8], S41, UL(1873313359)); /* 57 */
simon 0:350011bf8be7 304 II ( d, a, b, c, in[15], S42, UL(4264355552)); /* 58 */
simon 0:350011bf8be7 305 II ( c, d, a, b, in[ 6], S43, UL(2734768916)); /* 59 */
simon 0:350011bf8be7 306 II ( b, c, d, a, in[13], S44, UL(1309151649)); /* 60 */
simon 0:350011bf8be7 307 II ( a, b, c, d, in[ 4], S41, UL(4149444226)); /* 61 */
simon 0:350011bf8be7 308 II ( d, a, b, c, in[11], S42, UL(3174756917)); /* 62 */
simon 0:350011bf8be7 309 II ( c, d, a, b, in[ 2], S43, UL( 718787259)); /* 63 */
simon 0:350011bf8be7 310 II ( b, c, d, a, in[ 9], S44, UL(3951481745)); /* 64 */
simon 0:350011bf8be7 311
simon 0:350011bf8be7 312 buf[0] += a;
simon 0:350011bf8be7 313 buf[1] += b;
simon 0:350011bf8be7 314 buf[2] += c;
simon 0:350011bf8be7 315 buf[3] += d;
simon 0:350011bf8be7 316 }
simon 0:350011bf8be7 317
simon 0:350011bf8be7 318 #endif /* CHAP_SUPPORT || MD5_SUPPORT */
simon 0:350011bf8be7 319
simon 0:350011bf8be7 320 #endif /* PPP_SUPPORT */