code cleaning
authormerlokk <olegmsn@gmail.com>
Tue, 13 Feb 2018 10:35:33 +0000 (12:35 +0200)
committermerlokk <olegmsn@gmail.com>
Tue, 13 Feb 2018 10:35:33 +0000 (12:35 +0200)
client/cmdhflist.c

index 7059a223a38bc3fcc150ad5ebe0718f78cba865d..962c4f8273a3a44dcf03f7072ca8d6e12d72fa8b 100644 (file)
@@ -444,19 +444,9 @@ bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize,
 }
 
 bool CheckCrypto1Parity(uint8_t *cmd_enc, uint8_t cmdsize, uint8_t *cmd, uint8_t *parity_enc) {
-       uint8_t parity[16];
-       oddparitybuf(cmd, cmdsize, parity);
-       printf("parity check. size=%d\n", cmdsize);
-       printf("cmd    =%s\n", sprint_hex(cmd, cmdsize));
-       printf("cmd_enc=%s\n", sprint_hex(cmd_enc, cmdsize));
-       printf("parity    =%s\n", printBitsPar(parity, cmdsize));
-       printf("parity_enc=%s\n", printBitsPar(parity_enc, cmdsize));
-//     (oddparity8(ntx >> 8 & 0xff) ^ (ntx & 0x01) ^ ((ad->nt_enc_par >> 5) & 0x01) ^ (ad->nt_enc & 0x01)) ||
-//     (oddparity8(ntx >> 24 & 0xff) ^ (ntx >> 16 & 0x01) ^ ((ad->nt_enc_par >> 7) & 0x01) ^ (ad->nt_enc >> 16 & 0x01))
        for (int i = 0; i < cmdsize - 1; i++) {
-               bool b = oddparity8(cmd[i]) ^ (cmd[i + 1] & 0x01) ^ ((parity_enc[i / 8] >> (7 - i % 8)) & 0x01) ^ (cmd_enc[i + 1] & 0x01);
-               if (b)
-                       printf("!!! i=%d \n", i);
+               if (oddparity8(cmd[i]) ^ (cmd[i + 1] & 0x01) ^ ((parity_enc[i / 8] >> (7 - i % 8)) & 0x01) ^ (cmd_enc[i + 1] & 0x01))
+                       return false;
        }
        
        return true;
Impressum, Datenschutz