1. Reduce the size of the heap memory 2. Change the TCP segment size 3. Disable UDP + DHCP + DNS 4. Change the configuration of the TCP/IP thread

Dependents:   EthernetInterface

Fork of lwip by mbed official

Committer:
mbed_official
Date:
Fri Jun 22 09:25:39 2012 +0000
Revision:
0:51ac1d130fd4
Initial import from lwip-1.4.0: http://download.savannah.gnu.org/releases/lwip/lwip-1.4.0.zip

Who changed what in which revision?

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