Alter code to mangle pwdhash passwords
[pwdhash.git] / md5-cl.c
index 4ebe217..22f9c68 100644 (file)
--- 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])