summaryrefslogtreecommitdiff
path: root/src/qcommon/md4.c
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2006-05-06 17:18:02 +0000
committerTim Angus <tim@ngus.net>2006-05-06 17:18:02 +0000
commitbb7bd83aaec4504b4fb90919cccaaf4d9a7b418d (patch)
treea99058fef0dbf93af48dab4581b9f785d93e68ff /src/qcommon/md4.c
parentbd9d761dd958aef00218de084bae00eb9bf788a4 (diff)
* Merged ioq3-r775
- SDL_GammaRamp stuff - Anisotropic texture filtering - q3testesque r_flares - cl_guid - Security fixes
Diffstat (limited to 'src/qcommon/md4.c')
-rw-r--r--src/qcommon/md4.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/src/qcommon/md4.c b/src/qcommon/md4.c
index 1b491be8..2501b2b6 100644
--- a/src/qcommon/md4.c
+++ b/src/qcommon/md4.c
@@ -30,21 +30,9 @@
#include "q_shared.h"
#include "qcommon.h"
-#ifndef int32
-#define int32 int
-#endif
-
-#if SIZEOF_INT > 4
-#define LARGE_INT32
-#endif
-
-#ifndef uint32
-#define uint32 unsigned int32
-#endif
-
struct mdfour {
- uint32 A, B, C, D;
- uint32 totalN;
+ uint32_t A, B, C, D;
+ uint32_t totalN;
};
@@ -58,23 +46,19 @@ static struct mdfour *m;
#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))
-#ifdef LARGE_INT32
-#define lshift(x,s) ((((x)<<(s))&0xFFFFFFFF) | (((x)>>(32-(s)))&0xFFFFFFFF))
-#else
#define lshift(x,s) (((x)<<(s)) | ((x)>>(32-(s))))
-#endif
#define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s)
#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s)
#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + 0x6ED9EBA1,s)
/* this applies md4 to 64 byte chunks */
-static void mdfour64(uint32 *M)
+static void mdfour64(uint32_t *M)
{
int j;
- uint32 AA, BB, CC, DD;
- uint32 X[16];
- uint32 A,B,C,D;
+ uint32_t AA, BB, CC, DD;
+ uint32_t X[16];
+ uint32_t A,B,C,D;
for (j=0;j<16;j++)
X[j] = M[j];
@@ -111,18 +95,13 @@ static void mdfour64(uint32 *M)
A += AA; B += BB; C += CC; D += DD;
-#ifdef LARGE_INT32
- A &= 0xFFFFFFFF; B &= 0xFFFFFFFF;
- C &= 0xFFFFFFFF; D &= 0xFFFFFFFF;
-#endif
-
for (j=0;j<16;j++)
X[j] = 0;
m->A = A; m->B = B; m->C = C; m->D = D;
}
-static void copy64(uint32 *M, byte *in)
+static void copy64(uint32_t *M, byte *in)
{
int i;
@@ -131,7 +110,7 @@ static void copy64(uint32 *M, byte *in)
(in[i*4+1]<<8) | (in[i*4+0]<<0);
}
-static void copy4(byte *out,uint32 x)
+static void copy4(byte *out,uint32_t x)
{
out[0] = x&0xFF;
out[1] = (x>>8)&0xFF;
@@ -152,8 +131,8 @@ void mdfour_begin(struct mdfour *md)
static void mdfour_tail(byte *in, int n)
{
byte buf[128];
- uint32 M[16];
- uint32 b;
+ uint32_t M[16];
+ uint32_t b;
m->totalN += n;
@@ -178,7 +157,7 @@ static void mdfour_tail(byte *in, int n)
static void mdfour_update(struct mdfour *md, byte *in, int n)
{
- uint32 M[16];
+ uint32_t M[16];
if (n == 0) mdfour_tail(in, n);