GNU libmicrohttpd  0.9.29
md5.c File Reference
#include "md5.h"
#include "mhd_byteorder.h"
Include dependency graph for md5.c:

Go to the source code of this file.

Macros

#define PUT_64BIT_LE(cp, value)
 
#define PUT_32BIT_LE(cp, value)
 
#define F1(x, y, z)   (z ^ (x & (y ^ z)))
 
#define F2(x, y, z)   F1(z, x, y)
 
#define F3(x, y, z)   (x ^ y ^ z)
 
#define F4(x, y, z)   (y ^ (x | ~z))
 
#define MD5STEP(f, w, x, y, z, data, s)   ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
 

Functions

void MD5Init (struct MD5Context *ctx)
 
void MD5Update (struct MD5Context *ctx, const unsigned char *input, size_t len)
 
void MD5Pad (struct MD5Context *ctx)
 
void MD5Final (unsigned char digest[MD5_DIGEST_SIZE], struct MD5Context *ctx)
 
void MD5Transform (uint32_t state[4], const uint8_t block[MD5_BLOCK_SIZE])
 

Variables

static uint8_t PADDING [MD5_BLOCK_SIZE]
 

Macro Definition Documentation

◆ F1

#define F1 (   x,
  y,
 
)    (z ^ (x & (y ^ z)))

Definition at line 153 of file md5.c.

Referenced by MD5Transform().

◆ F2

#define F2 (   x,
  y,
 
)    F1(z, x, y)

Definition at line 154 of file md5.c.

Referenced by MD5Transform().

◆ F3

#define F3 (   x,
  y,
 
)    (x ^ y ^ z)

Definition at line 155 of file md5.c.

Referenced by MD5Transform().

◆ F4

#define F4 (   x,
  y,
 
)    (y ^ (x | ~z))

Definition at line 156 of file md5.c.

Referenced by MD5Transform().

◆ MD5STEP

#define MD5STEP (   f,
  w,
  x,
  y,
  z,
  data,
 
)    ( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )

Definition at line 159 of file md5.c.

Referenced by MD5Transform().

◆ PUT_32BIT_LE

#define PUT_32BIT_LE (   cp,
  value 
)
Value:
do { \
(cp)[3] = (uint8_t)((value) >> 24); \
(cp)[2] = (uint8_t)((value) >> 16); \
(cp)[1] = (uint8_t)((value) >> 8); \
(cp)[0] = (uint8_t)((value)); } while (0)

Definition at line 33 of file md5.c.

Referenced by MD5Final().

◆ PUT_64BIT_LE

#define PUT_64BIT_LE (   cp,
  value 
)
Value:
do { \
(cp)[7] = (uint8_t)((value) >> 56); \
(cp)[6] = (uint8_t)((value) >> 48); \
(cp)[5] = (uint8_t)((value) >> 40); \
(cp)[4] = (uint8_t)((value) >> 32); \
(cp)[3] = (uint8_t)((value) >> 24); \
(cp)[2] = (uint8_t)((value) >> 16); \
(cp)[1] = (uint8_t)((value) >> 8); \
(cp)[0] = (uint8_t)((value)); } while (0)

Definition at line 23 of file md5.c.

Referenced by MD5Pad().

Function Documentation

◆ MD5Final()

void MD5Final ( unsigned char  digest[MD5_DIGEST_SIZE],
struct MD5Context ctx 
)

Definition at line 135 of file md5.c.

References MD5Pad(), PUT_32BIT_LE, and MD5Context::state.

Referenced by calculate_nonce(), digest_calc_ha1(), and digest_calc_response().

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

◆ MD5Init()

void MD5Init ( struct MD5Context ctx)

Definition at line 50 of file md5.c.

References MD5Context::count, and MD5Context::state.

Referenced by calculate_nonce(), digest_calc_ha1(), and digest_calc_response().

Here is the caller graph for this function:

◆ MD5Pad()

void MD5Pad ( struct MD5Context ctx)

Definition at line 111 of file md5.c.

References MD5Context::count, MD5_BLOCK_SIZE, MD5Update(), PADDING, and PUT_64BIT_LE.

Referenced by MD5Final().

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

◆ MD5Transform()

void MD5Transform ( uint32_t  state[4],
const uint8_t  block[MD5_BLOCK_SIZE] 
)

Definition at line 168 of file md5.c.

References F1, F2, F3, F4, and MD5STEP.

Referenced by MD5Update().

Here is the caller graph for this function:

◆ MD5Update()

void MD5Update ( struct MD5Context ctx,
const unsigned char *  input,
size_t  len 
)

Definition at line 67 of file md5.c.

References MD5Context::buffer, MD5Context::count, MD5_BLOCK_SIZE, MD5Transform(), and MD5Context::state.

Referenced by calculate_nonce(), digest_calc_ha1(), digest_calc_response(), and MD5Pad().

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

Variable Documentation

◆ PADDING

uint8_t PADDING[MD5_BLOCK_SIZE]
static
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 39 of file md5.c.

Referenced by MD5Pad().