X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=hmac.c;h=bd97ba43fd2c7321d6d5229e80c98c4c0a27b01e;hp=de44162796b6339164e4c41dd88009bae76c3c43;hb=02064cb9589d2bd1b63131e2a3912496df147bf8;hpb=a737a50df4004443459e818e1e463141ef246280 diff --git a/hmac.c b/hmac.c index de441627..bd97ba43 100644 --- a/hmac.c +++ b/hmac.c @@ -1,7 +1,7 @@ #include "quakedef.h" #include "hmac.h" -void hmac( +qboolean hmac( hashfunc_t hfunc, int hlen, int hblock, unsigned char *out, unsigned char *in, int n, @@ -15,15 +15,15 @@ void hmac( int i; if(sizeof(hashbuf) < (size_t) hlen) - Host_Error("Invalid hash function used for HMAC - too long hash length"); + return false; if(sizeof(k_xor_ipad) < (size_t) hblock) - Host_Error("Invalid hash function used for HMAC - too long hash block length"); + return false; if(sizeof(k_xor_ipad) < (size_t) hlen) - Host_Error("Invalid hash function used for HMAC - too long hash length"); + return false; if(sizeof(catbuf) < (size_t) hblock + (size_t) hlen) - Host_Error("Invalid hash function used for HMAC - too long hash block length"); + return false; if(sizeof(catbuf) < (size_t) hblock + (size_t) n) - Host_Error("Invalid hash function used for HMAC - too long message length"); + return false; if(k > hblock) { @@ -56,4 +56,5 @@ void hmac( memcpy(catbuf, k_xor_opad, hblock); memcpy(catbuf + hblock, hashbuf, hlen); hfunc(out, catbuf, hblock + hlen); + return true; }