UFO: Alien Invasion
Loading...
Searching...
No Matches
md4.cpp File Reference

An implementation of MD4 designed for use in the samba SMB authentication protocol. More...

#include "../shared/shared.h"
#include "md4.h"
Include dependency graph for md4.cpp:

Go to the source code of this file.

Macros

#define F(X, Y, Z)
#define G(X, Y, Z)
#define H(X, Y, Z)
#define lshift(x, s)
#define ROUND1(a, b, c, d, k, s)
#define ROUND2(a, b, c, d, k, s)
#define ROUND3(a, b, c, d, k, s)

Functions

static void mdfour64 (uint32_t *M)
static void copy64 (uint32_t *M, const unsigned char *in)
static void copy4 (unsigned char *out, uint32_t x)
static void mdfour_begin (struct mdfour *md)
static void mdfour_tail (const unsigned char *in, int n)
static void mdfour_update (struct mdfour *md, const unsigned char *in, int n)
static void mdfour_result (struct mdfour *md, unsigned char *out)
static void mdfour (unsigned char *out, const unsigned char *in, int n)
unsigned Com_BlockChecksum (const void *buffer, int length)

Variables

static struct mdfour * m

Detailed Description

An implementation of MD4 designed for use in the samba SMB authentication protocol.

Note
This code makes no attempt to be fast!
It assumes that a int is at least 32 bits long

Definition in file md4.cpp.

Macro Definition Documentation

◆ F

#define F ( X,
Y,
Z )
Value:
(((X)&(Y)) | ((~(X))&(Z)))

Definition at line 37 of file md4.cpp.

Referenced by Com_SHA2Process().

◆ G

#define G ( X,
Y,
Z )
Value:
(((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z)))

Definition at line 38 of file md4.cpp.

Referenced by Com_SHA2Process().

◆ H

#define H ( X,
Y,
Z )
Value:
((X)^(Y)^(Z))

Definition at line 39 of file md4.cpp.

Referenced by Com_SHA2Process().

◆ lshift

#define lshift ( x,
s )
Value:
(((x)<<(s)) | ((x)>>(32-(s))))

Definition at line 43 of file md4.cpp.

◆ ROUND1

#define ROUND1 ( a,
b,
c,
d,
k,
s )
Value:
a = lshift(a + F(b,c,d) + X[k], s)
#define lshift(x, s)
Definition md4.cpp:43
#define F(X, Y, Z)
Definition md4.cpp:37

Definition at line 46 of file md4.cpp.

Referenced by mdfour64().

◆ ROUND2

#define ROUND2 ( a,
b,
c,
d,
k,
s )
Value:
a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s)
#define G(X, Y, Z)
Definition md4.cpp:38

Definition at line 47 of file md4.cpp.

Referenced by mdfour64().

◆ ROUND3

#define ROUND3 ( a,
b,
c,
d,
k,
s )
Value:
a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s)
#define H(X, Y, Z)
Definition md4.cpp:39

Definition at line 48 of file md4.cpp.

Referenced by mdfour64().

Function Documentation

◆ Com_BlockChecksum()

unsigned Com_BlockChecksum ( const void * buffer,
int length )

MD4-based checksum utility functions Copyright (C) 2000 Jeff Teunissen d2dee.nosp@m.k@pm.nosp@m.ail.n.nosp@m.et Author: Jeff Teunissen d2dee.nosp@m.k@pm.nosp@m.ail.n.nosp@m.et Date: 01 Jan 2000

Definition at line 202 of file md4.cpp.

References Com_BlockChecksum(), and length.

Referenced by CM_AddMapTile(), Com_BlockChecksum(), and Com_GetScriptChecksum().

◆ copy4()

void copy4 ( unsigned char * out,
uint32_t x )
static

Definition at line 107 of file md4.cpp.

References copy4().

Referenced by copy4(), mdfour_result(), and mdfour_tail().

◆ copy64()

void copy64 ( uint32_t * M,
const unsigned char * in )
static

Definition at line 101 of file md4.cpp.

References copy64(), i, and M.

Referenced by copy64(), mdfour_tail(), and mdfour_update().

◆ mdfour()

void mdfour ( unsigned char * out,
const unsigned char * in,
int n )
static

Definition at line 187 of file md4.cpp.

References mdfour_begin(), mdfour_result(), and mdfour_update().

◆ mdfour64()

void mdfour64 ( uint32_t * M)
static

Definition at line 51 of file md4.cpp.

References mdfour::A, mdfour::B, mdfour::C, mdfour::D, M, m, mdfour64(), ROUND1, ROUND2, and ROUND3.

Referenced by mdfour64(), mdfour_tail(), and mdfour_update().

◆ mdfour_begin()

void mdfour_begin ( struct mdfour * md)
static

Definition at line 115 of file md4.cpp.

References mdfour::A, mdfour::B, mdfour::C, mdfour::D, mdfour_begin(), and mdfour::totalN.

Referenced by mdfour(), and mdfour_begin().

◆ mdfour_result()

void mdfour_result ( struct mdfour * md,
unsigned char * out )
static

Definition at line 176 of file md4.cpp.

References mdfour::A, mdfour::B, mdfour::C, copy4(), mdfour::D, m, and mdfour_result().

Referenced by mdfour(), and mdfour_result().

◆ mdfour_tail()

void mdfour_tail ( const unsigned char * in,
int n )
static

Definition at line 125 of file md4.cpp.

References copy4(), copy64(), M, m, mdfour64(), mdfour_tail(), OBJZERO, and mdfour::totalN.

Referenced by mdfour_tail(), and mdfour_update().

◆ mdfour_update()

void mdfour_update ( struct mdfour * md,
const unsigned char * in,
int n )
static

start of edit by Forest 'LordHavoc' Hale commented out to prevent crashing when length is 0 if (n == 0) mdfour_tail(in, n); end of edit by Forest 'LordHavoc' Hale

Definition at line 152 of file md4.cpp.

References copy64(), M, m, mdfour64(), mdfour_tail(), mdfour_update(), and mdfour::totalN.

Referenced by mdfour(), and mdfour_update().

Variable Documentation

◆ m

struct mdfour* m
static

Definition at line 35 of file md4.cpp.

Referenced by mdfour64(), mdfour_result(), mdfour_tail(), and mdfour_update().