summaryrefslogtreecommitdiff
path: root/source4/lib/crypto
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-05-25 16:24:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:15 -0500
commitf9d8f8843dc0ab8c9d59abde7222e0f118b86b5d (patch)
tree8c6360be102dee63e893526ac7128e9cd52d362c /source4/lib/crypto
parent59e739a2f9f4b10f5f6184ef397f034d09959f26 (diff)
downloadsamba-f9d8f8843dc0ab8c9d59abde7222e0f118b86b5d.tar.gz
samba-f9d8f8843dc0ab8c9d59abde7222e0f118b86b5d.tar.bz2
samba-f9d8f8843dc0ab8c9d59abde7222e0f118b86b5d.zip
r884: convert samba4 to use [u]int32_t instead of [u]int32
metze (This used to be commit 0e5517d937a2eb7cf707991d1c7498c1ab456095)
Diffstat (limited to 'source4/lib/crypto')
-rw-r--r--source4/lib/crypto/crc32.c4
-rw-r--r--source4/lib/crypto/md4.c28
-rw-r--r--source4/lib/crypto/md5.c28
3 files changed, 30 insertions, 30 deletions
diff --git a/source4/lib/crypto/crc32.c b/source4/lib/crypto/crc32.c
index da3aeaa901..f2d76332f9 100644
--- a/source4/lib/crypto/crc32.c
+++ b/source4/lib/crypto/crc32.c
@@ -55,9 +55,9 @@ static const unsigned long CRCTable[256] =
0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D
};
-uint32 crc32_calc_buffer( const char *buffer, uint32 count)
+uint32_t crc32_calc_buffer( const char *buffer, uint32_t count)
{
- uint32 crc=0xffffffff, i;
+ uint32_t crc=0xffffffff, i;
for(i=0;i<count;i++)
crc = (crc>>8) ^ CRCTable[(buffer[i] ^ crc) & 0xff];
crc^=0xffffffff;
diff --git a/source4/lib/crypto/md4.c b/source4/lib/crypto/md4.c
index 417e87bd8e..cc8b9b6841 100644
--- a/source4/lib/crypto/md4.c
+++ b/source4/lib/crypto/md4.c
@@ -26,40 +26,40 @@
*/
struct mdfour_state {
- uint32 A, B, C, D;
+ uint32_t A, B, C, D;
};
-static uint32 F(uint32 X, uint32 Y, uint32 Z)
+static uint32_t F(uint32_t X, uint32_t Y, uint32_t Z)
{
return (X&Y) | ((~X)&Z);
}
-static uint32 G(uint32 X, uint32 Y, uint32 Z)
+static uint32_t G(uint32_t X, uint32_t Y, uint32_t Z)
{
return (X&Y) | (X&Z) | (Y&Z);
}
-static uint32 H(uint32 X, uint32 Y, uint32 Z)
+static uint32_t H(uint32_t X, uint32_t Y, uint32_t Z)
{
return X^Y^Z;
}
-static uint32 lshift(uint32 x, int s)
+static uint32_t lshift(uint32_t x, int s)
{
x &= 0xFFFFFFFF;
return ((x<<s)&0xFFFFFFFF) | (x>>(32-s));
}
#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] + (uint32)0x5A827999,s)
-#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s)
+#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + (uint32_t)0x5A827999,s)
+#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32_t)0x6ED9EBA1,s)
/* this applies md4 to 64 byte chunks */
-static void mdfour64(struct mdfour_state *s, uint32 *M)
+static void mdfour64(struct mdfour_state *s, uint32_t *M)
{
int j;
- uint32 AA, BB, CC, DD;
- uint32 X[16];
+ uint32_t AA, BB, CC, DD;
+ uint32_t X[16];
for (j=0;j<16;j++)
X[j] = M[j];
@@ -107,7 +107,7 @@ static void mdfour64(struct mdfour_state *s, uint32 *M)
X[j] = 0;
}
-static void copy64(uint32 *M, const unsigned char *in)
+static void copy64(uint32_t *M, const unsigned char *in)
{
int i;
@@ -116,7 +116,7 @@ static void copy64(uint32 *M, const unsigned char *in)
(in[i*4+1]<<8) | (in[i*4+0]<<0);
}
-static void copy4(unsigned char *out, uint32 x)
+static void copy4(unsigned char *out, uint32_t x)
{
out[0] = x&0xFF;
out[1] = (x>>8)&0xFF;
@@ -128,8 +128,8 @@ static void copy4(unsigned char *out, uint32 x)
void mdfour(unsigned char *out, const unsigned char *in, int n)
{
unsigned char buf[128];
- uint32 M[16];
- uint32 b = n * 8;
+ uint32_t M[16];
+ uint32_t b = n * 8;
int i;
struct mdfour_state state;
diff --git a/source4/lib/crypto/md5.c b/source4/lib/crypto/md5.c
index 2121b17047..dbb3462bd4 100644
--- a/source4/lib/crypto/md5.c
+++ b/source4/lib/crypto/md5.c
@@ -22,18 +22,18 @@
#include "md5.h"
-static void MD5Transform(uint32 buf[4], uint32 const in[16]);
+static void MD5Transform(uint32_t buf[4], uint32_t const in[16]);
/*
* Note: this code is harmless on little-endian machines.
*/
static void byteReverse(unsigned char *buf, unsigned longs)
{
- uint32 t;
+ uint32_t t;
do {
- t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
+ t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
- *(uint32 *) buf = t;
+ *(uint32_t *) buf = t;
buf += 4;
} while (--longs);
}
@@ -59,12 +59,12 @@ void MD5Init(struct MD5Context *ctx)
*/
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
- register uint32 t;
+ register uint32_t t;
/* Update bitcount */
t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
+ if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
@@ -82,7 +82,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
}
memmove(p, buf, t);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
buf += t;
len -= t;
}
@@ -91,7 +91,7 @@ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
while (len >= 64) {
memmove(ctx->in, buf, 64);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
buf += 64;
len -= 64;
}
@@ -126,7 +126,7 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
/* Two lots of padding: Pad the first block to 64 bytes */
memset(p, 0, count);
byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
@@ -137,10 +137,10 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
+ ((uint32_t *) ctx->in)[14] = ctx->bits[0];
+ ((uint32_t *) ctx->in)[15] = ctx->bits[1];
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ MD5Transform(ctx->buf, (uint32_t *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memmove(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
@@ -163,9 +163,9 @@ void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
-static void MD5Transform(uint32 buf[4], uint32 const in[16])
+static void MD5Transform(uint32_t buf[4], uint32_t const in[16])
{
- register uint32 a, b, c, d;
+ register uint32_t a, b, c, d;
a = buf[0];
b = buf[1];