FreeBSD kernel kern code
md4c.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/md4.h>
Include dependency graph for md4c.c:

Go to the source code of this file.

Macros

#define PROTO_LIST(list)   list
 
#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
 
#define F(x, y, z)   (((x) & (y)) | ((~x) & (z)))
 
#define G(x, y, z)   (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
 
#define H(x, y, z)   ((x) ^ (y) ^ (z))
 
#define ROTATE_LEFT(x, n)   (((x) << (n)) | ((x) >> (32-(n))))
 
#define FF(a, b, c, d, x, s)
 
#define GG(a, b, c, d, x, s)
 
#define HH(a, b, c, d, x, s)
 

Typedefs

typedef unsigned char * POINTER
 
typedef u_int16_t UINT2
 
typedef u_int32_t UINT4
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static void MD4Transform PROTO_LIST ((UINT4[4], const unsigned char[64]))
 
static void Encode PROTO_LIST ((unsigned char *, UINT4 *, unsigned int))
 
static void Decode PROTO_LIST ((UINT4 *, const unsigned char *, unsigned int))
 
void MD4Init (MD4_CTX *context)
 
void MD4Update (MD4_CTX *context, const unsigned char *input, unsigned int inputLen)
 
void MD4Pad (MD4_CTX *context)
 
void MD4Final (digest, MD4_CTX *context)
 
static void MD4Transform (state, block)
 
static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
 
static void Decode (UINT4 *output, const unsigned char *input, unsigned int len)
 

Variables

static unsigned char PADDING [64]
 

Macro Definition Documentation

#define F (   x,
  y,
 
)    (((x) & (y)) | ((~x) & (z)))

Definition at line 68 of file md4c.c.

#define FF (   a,
  b,
  c,
  d,
  x,
 
)
Value:
{ \
(a) += F ((b), (c), (d)) + (x); \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define ROTATE_LEFT(x, n)
Definition: md4c.c:74
#define F(x, y, z)
Definition: md4c.c:68

Definition at line 78 of file md4c.c.

Referenced by MD4Transform().

#define G (   x,
  y,
 
)    (((x) & (y)) | ((x) & (z)) | ((y) & (z)))

Definition at line 69 of file md4c.c.

#define GG (   a,
  b,
  c,
  d,
  x,
 
)
Value:
{ \
(a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define ROTATE_LEFT(x, n)
Definition: md4c.c:74
#define G(x, y, z)
Definition: md4c.c:69
u_int32_t UINT4
Definition: md4c.c:35

Definition at line 82 of file md4c.c.

Referenced by MD4Transform().

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

Definition at line 70 of file md4c.c.

#define HH (   a,
  b,
  c,
  d,
  x,
 
)
Value:
{ \
(a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define ROTATE_LEFT(x, n)
Definition: md4c.c:74
u_int32_t UINT4
Definition: md4c.c:35
#define H(x, y, z)
Definition: md4c.c:70

Definition at line 86 of file md4c.c.

Referenced by MD4Transform().

#define PROTO_LIST (   list)    list

Definition at line 37 of file md4c.c.

#define ROTATE_LEFT (   x,
 
)    (((x) << (n)) | ((x) >> (32-(n))))

Definition at line 74 of file md4c.c.

#define S11   3

Definition at line 41 of file md4c.c.

Referenced by MD4Transform().

#define S12   7

Definition at line 42 of file md4c.c.

Referenced by MD4Transform().

#define S13   11

Definition at line 43 of file md4c.c.

Referenced by MD4Transform().

#define S14   19

Definition at line 44 of file md4c.c.

Referenced by MD4Transform().

#define S21   3

Definition at line 45 of file md4c.c.

Referenced by MD4Transform().

#define S22   5

Definition at line 46 of file md4c.c.

Referenced by MD4Transform().

#define S23   9

Definition at line 47 of file md4c.c.

Referenced by MD4Transform().

#define S24   13

Definition at line 48 of file md4c.c.

Referenced by MD4Transform().

#define S31   3

Definition at line 49 of file md4c.c.

Referenced by MD4Transform().

#define S32   9

Definition at line 50 of file md4c.c.

Referenced by MD4Transform().

#define S33   11

Definition at line 51 of file md4c.c.

Referenced by MD4Transform().

#define S34   15

Definition at line 52 of file md4c.c.

Referenced by MD4Transform().

Typedef Documentation

typedef unsigned char* POINTER

Definition at line 33 of file md4c.c.

typedef u_int16_t UINT2

Definition at line 34 of file md4c.c.

typedef u_int32_t UINT4

Definition at line 35 of file md4c.c.

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static void Decode ( UINT4 output,
const unsigned char *  input,
unsigned int  len 
)
static

Definition at line 277 of file md4c.c.

Referenced by MD4Transform().

Here is the caller graph for this function:

static void Encode ( unsigned char *  output,
UINT4 input,
unsigned int  len 
)
static

Definition at line 259 of file md4c.c.

Referenced by MD4Final(), and MD4Pad().

Here is the caller graph for this function:

void MD4Final ( digest  ,
MD4_CTX *  context 
)

Definition at line 167 of file md4c.c.

References Encode(), and MD4Pad().

Here is the call graph for this function:

void MD4Init ( MD4_CTX *  context)

Definition at line 93 of file md4c.c.

void MD4Pad ( MD4_CTX *  context)

Definition at line 145 of file md4c.c.

References Encode(), and MD4Update().

Referenced by MD4Final().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MD4Transform ( state  ,
block   
)
static

Definition at line 184 of file md4c.c.

References Decode(), FF, GG, HH, S11, S12, S13, S14, S21, S22, S23, S24, S31, S32, S33, and S34.

Referenced by MD4Update().

Here is the call graph for this function:

Here is the caller graph for this function:

void MD4Update ( MD4_CTX *  context,
const unsigned char *  input,
unsigned int  inputLen 
)

Definition at line 110 of file md4c.c.

References MD4Transform().

Referenced by MD4Pad().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MD4Transform PROTO_LIST ( (UINT4[4], const unsigned char[64])  )
static
static void Encode PROTO_LIST ( (unsigned char *, UINT4 *, unsigned int)  )
static
static void Decode PROTO_LIST ( (UINT4 *, const unsigned char *, unsigned int)  )
static

Variable Documentation

unsigned char PADDING[64]
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 60 of file md4c.c.