#include <string.h>
Include dependency graph for md4.c:

Go to the source code of this file.
Data Structures | |
| struct | MD4_CTX |
Defines | |
| #define | F(x, y, z) (((x) & (y)) | ((~x) & (z))) |
| #define | FF(a, b, c, d, x, s) {(a) += F ((b), (c), (d)) + (x); (a) = ROTATE_LEFT ((a), (s));} |
| #define | G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) |
| #define | GG(a, b, c, d, x, s) {(a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; (a) = ROTATE_LEFT ((a), (s));} |
| #define | H(x, y, z) ((x) ^ (y) ^ (z)) |
| #define | HH(a, b, c, d, x, s) {(a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; (a) = ROTATE_LEFT ((a), (s));} |
| #define | ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) |
| #define | S11 3 |
| #define | S12 7 |
| #define | S13 11 |
| #define | S14 19 |
| #define | S21 3 |
| #define | S22 5 |
| #define | S23 9 |
| #define | S24 13 |
| #define | S31 3 |
| #define | S32 9 |
| #define | S33 11 |
| #define | S34 15 |
Typedefs | |
| typedef unsigned char * | POINTER |
| typedef unsigned short int | UINT2 |
| typedef unsigned long int | UINT4 |
Functions | |
| unsigned | Com_BlockChecksum (void *buffer, int length) |
| unsigned | Com_BlockChecksumKey (void *buffer, int length, int key) |
| void | Com_Memcpy (void *dest, const void *src, const size_t count) |
| void | Com_Memset (void *dest, const int val, const size_t count) |
| void | Decode (UINT4 *, const unsigned char *, unsigned int) |
| void | Encode (unsigned char *, UINT4 *, unsigned int) |
| void | MD4Final (unsigned char[16], MD4_CTX *) |
| void | MD4Init (MD4_CTX *) |
| void | MD4Transform (UINT4[4], const unsigned char[64]) |
| void | MD4Update (MD4_CTX *, const unsigned char *, unsigned int) |
Variables | |
| unsigned char | PADDING [64] |
|
|
Definition at line 86 of file md4.c. Referenced by asdl_defconst(), btot(), CG_DrawAmmoWarning(), CG_DrawDisconnect(), CG_DrawFollow(), CG_DrawFPS(), CG_DrawScores(), CG_DrawSnapshot(), CG_DrawSpectator(), CG_DrawTeamVote(), CG_DrawTimer(), CG_DrawVote(), CG_DrawWarmup(), main(), Pointfile_Draw(), prelabel(), simplify(), and visit(). |
|
|
Definition at line 95 of file md4.c. Referenced by MD4Transform(). |
|
|
|
|
|
Definition at line 97 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 88 of file md4.c. Referenced by main(). |
|
|
Definition at line 99 of file md4.c. Referenced by MD4Transform(). |
|
|
|
|
|
Definition at line 64 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 65 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 66 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 67 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 68 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 69 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 70 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 71 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 72 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 73 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 74 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 75 of file md4.c. Referenced by MD4Transform(). |
|
|
Definition at line 9 of file md4.c. Referenced by asgncode(), compose(), constant(), dclr(), dclr1(), do_type(), emittype(), eqtype(), hasproto(), MD4Final(), MD4Transform(), MD4Update(), outtype(), postfix(), primary(), prtype(), ptr(), tracevalue(), ttob(), typestring(), typeuid(), and vtoa(). |
|
|
|
|
|
Definition at line 15 of file md4.c. Referenced by MD4Transform(). |
|
||||||||||||
|
Definition at line 270 of file md4.c. References buffer, length(), MD4Final(), MD4Init(), and MD4Update(). Referenced by CM_LoadMap(), and CM_LumpChecksum(). 00271 {
00272 int digest[4];
00273 unsigned val;
00274 MD4_CTX ctx;
00275
00276 MD4Init (&ctx);
00277 MD4Update (&ctx, (unsigned char *)buffer, length);
00278 MD4Final ( (unsigned char *)digest, &ctx);
00279
00280 val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3];
00281
00282 return val;
00283 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 285 of file md4.c. References buffer, length(), MD4Final(), MD4Init(), and MD4Update(). Referenced by FS_LoadZipFile(). 00286 {
00287 int digest[4];
00288 unsigned val;
00289 MD4_CTX ctx;
00290
00291 MD4Init (&ctx);
00292 MD4Update (&ctx, (unsigned char *)&key, 4);
00293 MD4Update (&ctx, (unsigned char *)buffer, length);
00294 MD4Final ( (unsigned char *)digest, &ctx);
00295
00296 val = digest[0] ^ digest[1] ^ digest[2] ^ digest[3];
00297
00298 return val;
00299 }
|
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 260 of file md4.c. References i, input, j, and output. 00261 {
00262 unsigned int i, j;
00263
00264 for (i = 0, j = 0; j < len; i++, j += 4)
00265 output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
00266 }
|
|
||||||||||||||||
|
Definition at line 246 of file md4.c. References i, input, j, and output. 00247 {
00248 unsigned int i, j;
00249
00250 for (i = 0, j = 0; j < len; i++, j += 4) {
00251 output[j] = (unsigned char)(input[i] & 0xff);
00252 output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
00253 output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
00254 output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
00255 }
00256 }
|
|
||||||||||||
|
Definition at line 150 of file md4.c. References bits, Com_Memset(), MD4_CTX::count, Encode(), MD4Update(), PADDING, POINTER, and MD4_CTX::state. 00151 {
00152 unsigned char bits[8];
00153 unsigned int index, padLen;
00154
00155 /* Save number of bits */
00156 Encode (bits, context->count, 8);
00157
00158 /* Pad out to 56 mod 64.*/
00159 index = (unsigned int)((context->count[0] >> 3) & 0x3f);
00160 padLen = (index < 56) ? (56 - index) : (120 - index);
00161 MD4Update (context, PADDING, padLen);
00162
00163 /* Append length (before padding) */
00164 MD4Update (context, bits, 8);
00165
00166 /* Store state in digest */
00167 Encode (digest, context->state, 16);
00168
00169 /* Zeroize sensitive information.*/
00170 Com_Memset ((POINTER)context, 0, sizeof (*context));
00171 }
|
Here is the call graph for this function:

|
|
Definition at line 103 of file md4.c. References MD4_CTX::count, and MD4_CTX::state. 00104 {
00105 context->count[0] = context->count[1] = 0;
00106
00107 /* Load magic initialization constants.*/
00108 context->state[0] = 0x67452301;
00109 context->state[1] = 0xefcdab89;
00110 context->state[2] = 0x98badcfe;
00111 context->state[3] = 0x10325476;
00112 }
|
|
||||||||||||
|
Definition at line 175 of file md4.c. References a, b, c, Com_Memset(), d, Decode(), FF, GG, HH, POINTER, S11, S12, S13, S14, S21, S22, S23, S24, S31, S32, S33, S34, state, UINT4, and x. 00176 {
00177 UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
00178
00179 Decode (x, block, 64);
00180
00181 /* Round 1 */
00182 FF (a, b, c, d, x[ 0], S11); /* 1 */
00183 FF (d, a, b, c, x[ 1], S12); /* 2 */
00184 FF (c, d, a, b, x[ 2], S13); /* 3 */
00185 FF (b, c, d, a, x[ 3], S14); /* 4 */
00186 FF (a, b, c, d, x[ 4], S11); /* 5 */
00187 FF (d, a, b, c, x[ 5], S12); /* 6 */
00188 FF (c, d, a, b, x[ 6], S13); /* 7 */
00189 FF (b, c, d, a, x[ 7], S14); /* 8 */
00190 FF (a, b, c, d, x[ 8], S11); /* 9 */
00191 FF (d, a, b, c, x[ 9], S12); /* 10 */
00192 FF (c, d, a, b, x[10], S13); /* 11 */
00193 FF (b, c, d, a, x[11], S14); /* 12 */
00194 FF (a, b, c, d, x[12], S11); /* 13 */
00195 FF (d, a, b, c, x[13], S12); /* 14 */
00196 FF (c, d, a, b, x[14], S13); /* 15 */
00197 FF (b, c, d, a, x[15], S14); /* 16 */
00198
00199 /* Round 2 */
00200 GG (a, b, c, d, x[ 0], S21); /* 17 */
00201 GG (d, a, b, c, x[ 4], S22); /* 18 */
00202 GG (c, d, a, b, x[ 8], S23); /* 19 */
00203 GG (b, c, d, a, x[12], S24); /* 20 */
00204 GG (a, b, c, d, x[ 1], S21); /* 21 */
00205 GG (d, a, b, c, x[ 5], S22); /* 22 */
00206 GG (c, d, a, b, x[ 9], S23); /* 23 */
00207 GG (b, c, d, a, x[13], S24); /* 24 */
00208 GG (a, b, c, d, x[ 2], S21); /* 25 */
00209 GG (d, a, b, c, x[ 6], S22); /* 26 */
00210 GG (c, d, a, b, x[10], S23); /* 27 */
00211 GG (b, c, d, a, x[14], S24); /* 28 */
00212 GG (a, b, c, d, x[ 3], S21); /* 29 */
00213 GG (d, a, b, c, x[ 7], S22); /* 30 */
00214 GG (c, d, a, b, x[11], S23); /* 31 */
00215 GG (b, c, d, a, x[15], S24); /* 32 */
00216
00217 /* Round 3 */
00218 HH (a, b, c, d, x[ 0], S31); /* 33 */
00219 HH (d, a, b, c, x[ 8], S32); /* 34 */
00220 HH (c, d, a, b, x[ 4], S33); /* 35 */
00221 HH (b, c, d, a, x[12], S34); /* 36 */
00222 HH (a, b, c, d, x[ 2], S31); /* 37 */
00223 HH (d, a, b, c, x[10], S32); /* 38 */
00224 HH (c, d, a, b, x[ 6], S33); /* 39 */
00225 HH (b, c, d, a, x[14], S34); /* 40 */
00226 HH (a, b, c, d, x[ 1], S31); /* 41 */
00227 HH (d, a, b, c, x[ 9], S32); /* 42 */
00228 HH (c, d, a, b, x[ 5], S33); /* 43 */
00229 HH (b, c, d, a, x[13], S34); /* 44 */
00230 HH (a, b, c, d, x[ 3], S31); /* 45 */
00231 HH (d, a, b, c, x[11], S32); /* 46 */
00232 HH (c, d, a, b, x[ 7], S33); /* 47 */
00233 HH (b, c, d, a, x[15], S34); /* 48 */
00234
00235 state[0] += a;
00236 state[1] += b;
00237 state[2] += c;
00238 state[3] += d;
00239
00240 /* Zeroize sensitive information.*/
00241 Com_Memset ((POINTER)x, 0, sizeof (x));
00242 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 115 of file md4.c. References MD4_CTX::buffer, Com_Memcpy(), MD4_CTX::count, i, input, MD4Transform(), POINTER, and MD4_CTX::state. 00116 {
00117 unsigned int i, index, partLen;
00118
00119 /* Compute number of bytes mod 64 */
00120 index = (unsigned int)((context->count[0] >> 3) & 0x3F);
00121
00122 /* Update number of bits */
00123 if ((context->count[0] += ((UINT4)inputLen << 3))< ((UINT4)inputLen << 3))
00124 context->count[1]++;
00125
00126 context->count[1] += ((UINT4)inputLen >> 29);
00127
00128 partLen = 64 - index;
00129
00130 /* Transform as many times as possible.*/
00131 if (inputLen >= partLen)
00132 {
00133 Com_Memcpy((POINTER)&context->buffer[index], (POINTER)input, partLen);
00134 MD4Transform (context->state, context->buffer);
00135
00136 for (i = partLen; i + 63 < inputLen; i += 64)
00137 MD4Transform (context->state, &input[i]);
00138
00139 index = 0;
00140 }
00141 else
00142 i = 0;
00143
00144 /* Buffer remaining input */
00145 Com_Memcpy ((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i);
00146 }
|
Here is the call graph for this function:

|
|
Initial value: {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
Definition at line 81 of file md4.c. Referenced by MD4Final(). |
1.3.9.1