Modified version of NetServices. Fixes an issue where connections failed should the HTTP response status line be received in a packet on its own prior to any further headers. Changes are made to the HTTPClient.cpp file's readHeaders method.

Committer:
andrewbonney
Date:
Fri Apr 08 14:39:41 2011 +0000
Revision:
0:ec559500a63f

        

Who changed what in which revision?

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