This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | MD5Context |
Defines | |
| #define | _ANSI_ARGS_(x) () |
| #define | EXTERN extern |
Typedefs | |
| typedef unsigned | UNSIGNED32 |
| typedef MD5Context | MD5_CTX |
Functions | |
| EXTERN void | our_MD5Init (MD5_CTX *) |
| EXTERN void | ourMD5Update (MD5_CTX *, const unsigned char *, unsigned int) |
| EXTERN void | our_MD5Pad (MD5_CTX *) |
| EXTERN void | our_MD5Final (unsigned char[16], MD5_CTX *) |
| EXTERN char * | our_MD5End (MD5_CTX *, char *) |
| EXTERN char * | our_MD5File (const char *, char *) |
| EXTERN char * | our_MD5Data (const unsigned char *, unsigned int, char *) |
| typedef struct MD5Context MD5_CTX |
| typedef unsigned UNSIGNED32 |
| EXTERN char* our_MD5Data | ( | const unsigned char * | , | |
| unsigned | int, | |||
| char * | ||||
| ) |
Definition at line 61 of file our_md5hl.c.
References our_MD5End(), our_MD5Init(), and ourMD5Update().
Referenced by Authenticator::computeDigestResponse(), RTSPClient::sendRequest(), and Authenticator::setRealmAndRandomNonce().
00062 { 00063 MD5_CTX ctx; 00064 00065 our_MD5Init(&ctx); 00066 ourMD5Update(&ctx,data,len); 00067 return our_MD5End(&ctx, buf); 00068 }
| EXTERN char* our_MD5End | ( | MD5_CTX * | , | |
| char * | ||||
| ) |
Definition at line 22 of file our_md5hl.c.
References LENGTH, and our_MD5Final().
Referenced by our_MD5Data(), and our_MD5File().
00023 { 00024 int i; 00025 unsigned char digest[LENGTH]; 00026 static const char hex[]="0123456789abcdef"; 00027 00028 if (!buf) 00029 buf = (char*)malloc(2*LENGTH + 1); 00030 if (!buf) 00031 return 0; 00032 our_MD5Final(digest, ctx); 00033 for (i = 0; i < LENGTH; i++) { 00034 buf[i+i] = hex[digest[i] >> 4]; 00035 buf[i+i+1] = hex[digest[i] & 0x0f]; 00036 } 00037 buf[i+i] = '\0'; 00038 return buf; 00039 }
| EXTERN char* our_MD5File | ( | const char * | , | |
| char * | ||||
| ) |
Definition at line 42 of file our_md5hl.c.
References BUFSIZ, NULL, our_MD5End(), our_MD5Init(), and ourMD5Update().
00043 { 00044 unsigned char buffer[BUFSIZ]; 00045 MD5_CTX ctx; 00046 int i; 00047 FILE* f; 00048 00049 our_MD5Init(&ctx); 00050 f = fopen(filename, "r"); 00051 if (f == NULL) return 0; 00052 while ((i = fread(buffer,1,sizeof buffer,f)) > 0) { 00053 ourMD5Update(&ctx,buffer,i); 00054 } 00055 fclose(f); 00056 if (i < 0) return 0; 00057 return our_MD5End(&ctx, buf); 00058 }
| EXTERN void our_MD5Final | ( | unsigned char | digest[16], | |
| MD5_CTX * | context | |||
| ) |
our_MD5Final: : 16-byte buffer to write MD5 checksum. : MD5 context to be finalized.
Ends an MD5 message-digest operation, writing the the message digest and zeroing the context. The context must be initialized with our_MD5Init() before being used for other MD5 checksum calculations.
Definition at line 294 of file our_md5.c.
References MD5Context::count, Encode(), ourMD5Update(), and PADDING.
Referenced by our_MD5End().
00295 { 00296 unsigned char bits[8]; 00297 unsigned int index, padLen; 00298 00299 /* Save number of bits */ 00300 Encode(bits, context->count, 8); 00301 00302 /* 00303 * Pad out to 56 mod 64. 00304 */ 00305 index = (unsigned int) ((context->count[0] >> 3) & 0x3f); 00306 padLen = (index < 56) ? (56 - index) : (120 - index); 00307 ourMD5Update(context, PADDING, padLen); 00308 00309 /* Append length (before padding) */ 00310 ourMD5Update(context, bits, 8); 00311 /* Store state in digest */ 00312 Encode(digest, context->state, 16); 00313 00314 /* 00315 * Zeroize sensitive information. 00316 */ 00317 memset((unsigned char *) context, 0, sizeof(*context)); 00318 }
| EXTERN void our_MD5Init | ( | MD5_CTX * | context | ) |
our_MD5Init: : MD5 context to be initialized.
Initializes MD5 context for the start of message digest computation.
Definition at line 229 of file our_md5.c.
References MD5Context::count, and MD5Context::state.
Referenced by our_MD5Data(), and our_MD5File().
00230 { 00231 context->count[0] = context->count[1] = 0; 00232 /* Load magic initialization constants. */ 00233 context->state[0] = 0x67452301; 00234 context->state[1] = 0xefcdab89; 00235 context->state[2] = 0x98badcfe; 00236 context->state[3] = 0x10325476; 00237 }
| EXTERN void our_MD5Pad | ( | MD5_CTX * | ) |
| EXTERN void ourMD5Update | ( | MD5_CTX * | context, | |
| const unsigned char * | input, | |||
| unsigned int | inputLen | |||
| ) |
ourMD5Update: : MD5 context to be updated. : pointer to data to be fed into MD5 algorithm. : size of data in bytes.
MD5 block update operation. Continues an MD5 message-digest operation, processing another message block, and updating the context.
Definition at line 250 of file our_md5.c.
References MD5Context::buffer, MD5Context::count, MD5Transform(), and MD5Context::state.
Referenced by our_MD5Data(), our_MD5File(), and our_MD5Final().
00251 { 00252 unsigned int i, index, partLen; 00253 00254 /* Compute number of bytes mod 64 */ 00255 index = (unsigned int) ((context->count[0] >> 3) & 0x3F); 00256 00257 /* Update number of bits */ 00258 if ((context->count[0] += ((UNSIGNED32) inputLen << 3)) < ((UNSIGNED32) inputLen << 3)) { 00259 context->count[1]++; 00260 } 00261 context->count[1] += ((UNSIGNED32) inputLen >> 29); 00262 00263 partLen = 64 - index; 00264 00265 /* Transform as many times as possible. */ 00266 if (inputLen >= partLen) { 00267 memcpy((unsigned char *) & context->buffer[index], (unsigned char *) input, partLen); 00268 MD5Transform(context->state, context->buffer); 00269 00270 for (i = partLen; i + 63 < inputLen; i += 64) { 00271 MD5Transform(context->state, &input[i]); 00272 } 00273 index = 0; 00274 } else { 00275 i = 0; 00276 } 00277 /* Buffer remaining input */ 00278 if ((inputLen - i) != 0) { 00279 memcpy((unsigned char *) & context->buffer[index], (unsigned char *) & input[i], inputLen - i); 00280 } 00281 }
1.5.2