]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mdfour.c
fs: Stub a struct that'll be used later.
[xonotic/darkplaces.git] / mdfour.c
index 85f6c9e85042505ebc4062341b759472a09bb4c0..46c3abf82e70c031b0c923f151f1d9750a3fddb7 100644 (file)
--- a/mdfour.c
+++ b/mdfour.c
@@ -27,9 +27,8 @@
        $Id$
 */
 
-#include "quakedef.h"
+#include "darkplaces.h"
 
-#include <string.h>            /* XoXus: needed for memset call */
 #include "mdfour.h"
 
 /* NOTE: This code makes no attempt to be fast!
@@ -51,7 +50,7 @@
 #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(struct mdfour *md, uint32 *M)
+static void mdfour64(struct mdfour_s *md, uint32 *M)
 {
        int j;
        uint32 AA, BB, CC, DD;
@@ -121,7 +120,7 @@ static void copy4(unsigned char *out,uint32 x)
        out[3] = (x>>24)&0xFF;
 }
 
-void mdfour_begin(struct mdfour *md)
+void mdfour_begin(struct mdfour_s *md)
 {
        md->A = 0x67452301;
        md->B = 0xefcdab89;
@@ -131,7 +130,7 @@ void mdfour_begin(struct mdfour *md)
 }
 
 
-static void mdfour_tail(struct mdfour *md, const unsigned char *in, int n)
+static void mdfour_tail(struct mdfour_s *md, const unsigned char *in, int n)
 {
        unsigned char buf[128];
        uint32 M[16];
@@ -148,24 +147,24 @@ static void mdfour_tail(struct mdfour *md, const unsigned char *in, int n)
        if (n <= 55) {
                copy4(buf+56, b);
                copy64(M, buf);
-               mdfour64(M);
+               mdfour64(md, M);
        } else {
                copy4(buf+120, b);
                copy64(M, buf);
-               mdfour64(M);
+               mdfour64(md, M);
                copy64(M, buf+64);
-               mdfour64(M);
+               mdfour64(md, M);
        }
 }
 
-void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
+void mdfour_update(struct mdfour_s *md, const unsigned char *in, int n)
 {
        uint32 M[16];
 
-// start of edit by Forest 'LordHavoc' Hale
+// start of edit by Ashley Rose Hale (LadyHavoc)
 // commented out to prevent crashing when length is 0
 //     if (n == 0) mdfour_tail(in, n);
-// end of edit by Forest 'LordHavoc' Hale
+// end of edit by Ashley Rose Hale (LadyHavoc)
 
        while (n >= 64) {
                copy64(M, in);
@@ -179,7 +178,7 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
 }
 
 
-void mdfour_result(struct mdfour *md, unsigned char *out)
+void mdfour_result(struct mdfour_s *md, unsigned char *out)
 {
        copy4(out, md->A);
        copy4(out+4, md->B);
@@ -190,7 +189,7 @@ void mdfour_result(struct mdfour *md, unsigned char *out)
 
 void mdfour(unsigned char *out, const unsigned char *in, int n)
 {
-       struct mdfour md;
+       struct mdfour_s md;
        mdfour_begin(&md);
        mdfour_update(&md, in, n);
        mdfour_result(&md, out);