X-Git-Url: https://www.flypig.org.uk/git/?a=blobdiff_plain;f=md5-cl.c;h=22f9c687d92b79cb86c666b11ac50392777912f2;hb=4caa77290fcf59c37ed6fbae3023d0f09bb1fd96;hp=4ebe21773720520104ad3aa6ca6d9325eec7a9ed;hpb=fc0498ebf9d2479e9d620e96286dd7502ec781e5;p=pwdhash.git diff --git a/md5-cl.c b/md5-cl.c index 4ebe217..22f9c68 100644 --- a/md5-cl.c +++ b/md5-cl.c @@ -461,7 +461,7 @@ void md5hmac_none(u8 const * const inData, const u32x pw_len, u8 outDigest[16]) } } -void md5hmac_domain(u8 const * const inData, const u32x pw_len, u8 outDigest[16]) +void md5hmac_domain(u8 const * const in_key, const u32x key_len, u8 out_digest[16]) { u32 pos; @@ -469,10 +469,10 @@ void md5hmac_domain(u8 const * const inData, const u32x pw_len, u8 outDigest[16] u32x data_buf[16]; - for (pos = 0; pos < pw_len; pos++) { - ((u8 *)data_buf)[pos] = inData[pos]; + for (pos = 0; pos < domain_len; pos++) { + ((u8 *)data_buf)[pos] = domain[pos]; } - for (pos = pw_len; pos < 64; pos++) { + for (pos = domain_len; pos < 64; pos++) { ((u8 *)data_buf)[pos] = 0; } @@ -480,10 +480,10 @@ void md5hmac_domain(u8 const * const inData, const u32x pw_len, u8 outDigest[16] u32x key_buf[16]; - for (pos = 0; pos < domain_len; pos++) { - ((u8 *)key_buf)[pos] = domain[pos]; + for (pos = 0; pos < key_len; pos++) { + ((u8 *)key_buf)[pos] = in_key[pos]; } - for (pos = domain_len; pos < 64; pos++) { + for (pos = key_len; pos < 64; pos++) { ((u8 *)key_buf)[pos] = 0; } @@ -496,11 +496,11 @@ void md5hmac_domain(u8 const * const inData, const u32x pw_len, u8 outDigest[16] // loop - append_0x80_2x4_VV (data_buf, data_buf + 4, pw_len); + append_0x80_2x4_VV (data_buf, data_buf + 4, domain_len); - data_buf[14] = (64 + pw_len) * 8; + data_buf[14] = (64 + domain_len) * 8; - hmac_md5_run_cl (data_buf, data_buf + 4, data_buf + 8, data_buf + 12, ipad, opad, (u32x *)outDigest); + hmac_md5_run_cl (data_buf, data_buf + 4, data_buf + 8, data_buf + 12, ipad, opad, (u32x *)out_digest); } void md5hmac_cl(u8 * inKey, u32 key_len, u8 * inData, u32 pw_len, u8 outDigest[DIGEST_SIZE])