]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhficlass.c
syntax sugar
[proxmark3-svn] / client / cmdhficlass.c
index acf3de8769c2edfa2f6124f981e12c8c1bb6319f..3891d431c304698f6eff88f810d6d6baff228ac1 100644 (file)
@@ -199,7 +199,6 @@ int usage_hf_iclass_snoop(void){
        PrintAndLog("            hf iclass snoop");     
        return 0;
 }
-
 int xorbits_8(uint8_t val) {
        uint8_t res = val ^ (val >> 1); //1st pass
        res = res ^ (res >> 1);                 // 2nd pass
@@ -473,13 +472,14 @@ int CmdHFiClassDecrypt(const char *Cmd) {
        uint8_t key[16] = { 0 };
        if(readKeyfile("iclass_decryptionkey.bin", 16, key)) return usage_hf_iclass_decrypt();
        
-       PrintAndLog("Decryption file found...");
+       PrintAndLog("Decryption key loaded from file [ok]");
 
        //Open the tagdump-file
        FILE *f;
        char filename[FILE_PATH_SIZE];
        if(opt == 'f' && param_getstr(Cmd, 1, filename) > 0) {
-               if ( (f = fopen(filename, "rb")) == NULL) {
+               f = fopen(filename, "rb");
+               if (!f) {
                        PrintAndLog("Could not find file %s", filename);
                        return 1;
                }               
@@ -880,7 +880,7 @@ int CmdHFiClassReader_Dump(const char *Cmd) {
        if (have_debit_key) memcpy(tag_data+(3*8),div_key,8);
        if (have_credit_key) memcpy(tag_data+(4*8),c_div_key,8);
        
-       printf("Num of bytes:  %u\n", gotBytes);
+       printf("Num of bytes:  %zu\n", gotBytes);
        
        // print the dump
        printf("------+--+-------------------------+\n");
@@ -1388,25 +1388,6 @@ int CmdHFiClassReadTagFile(const char *Cmd) {
        return 0;
 }
 
-/*
-uint64_t xorcheck(uint64_t sdiv,uint64_t hdiv) {
-       uint64_t new_div = 0x00;
-       new_div ^= sdiv;
-       new_div ^= hdiv;
-       return new_div;
-}
-
-uint64_t hexarray_to_uint64(uint8_t *key) {
-       char temp[17];
-       uint64_t uint_key;
-       for (int i = 0;i < 8;i++)
-               sprintf(&temp[(i *2)],"%02X",key[i]);
-       temp[16] = '\0';
-       if (sscanf(temp,"%016"llX,&uint_key) < 1)
-               return 0;
-       return uint_key;
-}
-*/
 void HFiClassCalcDivKey(uint8_t        *CSN, uint8_t   *KEY, uint8_t *div_key, bool elite){
        uint8_t keytable[128] = {0};
        uint8_t key_index[8] = {0};
@@ -1577,7 +1558,7 @@ static int loadKeys(char *filename) {
 static int saveKeys(char *filename) {
        FILE *f;
        f = fopen(filename,"wb");
-       if (f == NULL) {
+       if (!f) {
                printf("error opening file %s\n",filename);
                return 0;
        }
Impressum, Datenschutz