X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=mdfour.c;h=e057a94bde771a84ad1d21331893b406ce5bd344;hb=97118366ca807adfaa9bb45eed6266eb514b41b7;hp=cd0ce05a65c4ebdf16bf1a74396187af9b199a2a;hpb=9e279d8ea4a631713d98132cd1b01338e81f5c0b;p=xonotic%2Fdarkplaces.git diff --git a/mdfour.c b/mdfour.c index cd0ce05a..e057a94b 100644 --- a/mdfour.c +++ b/mdfour.c @@ -27,6 +27,8 @@ $Id$ */ +#include "quakedef.h" + #include /* XoXus: needed for memset call */ #include "mdfour.h" @@ -104,7 +106,7 @@ static void mdfour64(uint32 *M) m->A = A; m->B = B; m->C = C; m->D = D; } -static void copy64(uint32 *M, unsigned char *in) +static void copy64(uint32 *M, const unsigned char *in) { int i; @@ -131,7 +133,7 @@ void mdfour_begin(struct mdfour *md) } -static void mdfour_tail(unsigned char *in, int n) +static void mdfour_tail(const unsigned char *in, int n) { unsigned char buf[128]; uint32 M[16]; @@ -158,11 +160,14 @@ static void mdfour_tail(unsigned char *in, int n) } } -void mdfour_update(struct mdfour *md, unsigned char *in, int n) +void mdfour_update(struct mdfour *md, const unsigned char *in, int n) { uint32 M[16]; - if (n == 0) mdfour_tail(in, n); +// 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 m = md; @@ -189,7 +194,7 @@ void mdfour_result(struct mdfour *md, unsigned char *out) } -void mdfour(unsigned char *out, unsigned char *in, int n) +void mdfour(unsigned char *out, const unsigned char *in, int n) { struct mdfour md; mdfour_begin(&md);