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 uint16_t UINT2
 
typedef uint32_t UINT4
 

Functions

 __FBSDID ("$FreeBSD$")
 
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 (unsigned char digest[static 16], MD4_CTX *context)
 
static void MD4Transform (UINT4 state[4], const unsigned char block[64])
 
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

◆ F

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

Definition at line 70 of file md4c.c.

◆ FF

#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:76
#define F(x, y, z)
Definition: md4c.c:70

Definition at line 80 of file md4c.c.

◆ G

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

Definition at line 71 of file md4c.c.

◆ GG

#define GG (   a,
  b,
  c,
  d,
  x,
 
)
Value:
{ \
(a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \
(a) = ROTATE_LEFT ((a), (s)); \
}
#define G(x, y, z)
Definition: md4c.c:71
uint32_t UINT4
Definition: md4c.c:37

Definition at line 84 of file md4c.c.

◆ H

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

Definition at line 72 of file md4c.c.

◆ HH

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

Definition at line 88 of file md4c.c.

◆ PROTO_LIST

#define PROTO_LIST (   list)    list

Definition at line 39 of file md4c.c.

◆ ROTATE_LEFT

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

Definition at line 76 of file md4c.c.

◆ S11

#define S11   3

Definition at line 43 of file md4c.c.

◆ S12

#define S12   7

Definition at line 44 of file md4c.c.

◆ S13

#define S13   11

Definition at line 45 of file md4c.c.

◆ S14

#define S14   19

Definition at line 46 of file md4c.c.

◆ S21

#define S21   3

Definition at line 47 of file md4c.c.

◆ S22

#define S22   5

Definition at line 48 of file md4c.c.

◆ S23

#define S23   9

Definition at line 49 of file md4c.c.

◆ S24

#define S24   13

Definition at line 50 of file md4c.c.

◆ S31

#define S31   3

Definition at line 51 of file md4c.c.

◆ S32

#define S32   9

Definition at line 52 of file md4c.c.

◆ S33

#define S33   11

Definition at line 53 of file md4c.c.

◆ S34

#define S34   15

Definition at line 54 of file md4c.c.

Typedef Documentation

◆ POINTER

typedef unsigned char* POINTER

Definition at line 35 of file md4c.c.

◆ UINT2

typedef uint16_t UINT2

Definition at line 36 of file md4c.c.

◆ UINT4

typedef uint32_t UINT4

Definition at line 37 of file md4c.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ Decode()

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

Definition at line 275 of file md4c.c.

Referenced by MD4Transform().

Here is the caller graph for this function:

◆ Encode()

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:

◆ MD4Final()

void MD4Final ( unsigned char  digest[static 16],
MD4_CTX *  context 
)

Definition at line 169 of file md4c.c.

References Encode(), and MD4Pad().

Here is the call graph for this function:

◆ MD4Init()

void MD4Init ( MD4_CTX *  context)

Definition at line 96 of file md4c.c.

◆ MD4Pad()

void MD4Pad ( MD4_CTX *  context)

Definition at line 147 of file md4c.c.

References Encode(), MD4Update(), and PADDING.

Referenced by MD4Final().

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

◆ MD4Transform()

static void MD4Transform ( UINT4  state[4],
const unsigned char  block[64] 
)
static

Definition at line 185 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:

◆ MD4Update()

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

Definition at line 113 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:

◆ PROTO_LIST() [1/3]

static void Decode PROTO_LIST ( (UINT4 *, const unsigned char *, unsigned int)  )
static

◆ PROTO_LIST() [2/3]

static void MD4Transform PROTO_LIST ( (UINT4[4], const unsigned char[64])  )
static

◆ PROTO_LIST() [3/3]

static void Encode PROTO_LIST ( (unsigned char *, UINT4 *, unsigned int)  )
static

Variable Documentation

◆ PADDING

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 62 of file md4c.c.

Referenced by MD4Pad().