summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-09 18:25:34 +0100
committerVolker Lendecke <vl@samba.org>2007-12-21 09:58:20 +0100
commit184c927bf5a5107db38cdb3ae7b518826ecb7133 (patch)
treef8383d399ff21b4a11d69101fca7b69e11124c97
parent89f7883fe9b62248e8cc9e508ddef3a26330f71c (diff)
downloadsamba-184c927bf5a5107db38cdb3ae7b518826ecb7133.tar.gz
samba-184c927bf5a5107db38cdb3ae7b518826ecb7133.tar.bz2
samba-184c927bf5a5107db38cdb3ae7b518826ecb7133.zip
Remove some statics from md4.c
(This used to be commit 7e193c68b2a7eb16afc12379a4ceed41053d1eeb)
-rw-r--r--source3/lib/md4.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/lib/md4.c b/source3/lib/md4.c
index 61d5848aae..bae0091e36 100644
--- a/source3/lib/md4.c
+++ b/source3/lib/md4.c
@@ -24,7 +24,14 @@
It assumes that a int is at least 32 bits long
*/
+#if 0
static uint32 A, B, C, D;
+#else
+#define A (state[0])
+#define B (state[1])
+#define C (state[2])
+#define D (state[3])
+#endif
static uint32 F(uint32 X, uint32 Y, uint32 Z)
{
@@ -52,7 +59,7 @@ static uint32 lshift(uint32 x, int s)
#define ROUND3(a,b,c,d,k,s) a = lshift(a + H(b,c,d) + X[k] + (uint32)0x6ED9EBA1,s)
/* this applies md4 to 64 byte chunks */
-static void mdfour64(uint32 *M)
+static void mdfour64(uint32_t *state, uint32 *M)
{
int j;
uint32 AA, BB, CC, DD;
@@ -121,6 +128,7 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
{
unsigned char buf[128];
uint32 M[16];
+ uint32 state[4];
uint32 b = n * 8;
int i;
@@ -131,7 +139,7 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
while (n > 64) {
copy64(M, in);
- mdfour64(M);
+ mdfour64(state, M);
in += 64;
n -= 64;
}
@@ -144,13 +152,13 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
if (n <= 55) {
copy4(buf+56, b);
copy64(M, buf);
- mdfour64(M);
+ mdfour64(state, M);
} else {
copy4(buf+120, b);
copy64(M, buf);
- mdfour64(M);
+ mdfour64(state, M);
copy64(M, buf+64);
- mdfour64(M);
+ mdfour64(state, M);
}
for (i=0;i<128;i++)
@@ -161,8 +169,6 @@ void mdfour(unsigned char *out, const unsigned char *in, int n)
copy4(out+4, B);
copy4(out+8, C);
copy4(out+12, D);
-
- A = B = C = D = 0;
}