]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
Code cleanup:
authorpwpiwi <pwpiwi@users.noreply.github.com>
Wed, 22 Feb 2017 21:45:00 +0000 (22:45 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Wed, 22 Feb 2017 21:45:00 +0000 (22:45 +0100)
- correctly use inttypes.h scanf and printf macros (PRIx64 et al)
- fix indendation warnings

14 files changed:
client/cmdcrc.c
client/cmddata.c
client/cmdhf14a.c
client/cmdhfepa.c
client/cmdhficlass.c
client/cmdhflegic.c
client/cmdhfmf.c
client/cmdlfti.c
client/flash.c
client/flasher.c
client/nonce2key/nonce2key.c
client/proxmark3.h
client/reveng/poly.c
client/scripting.c

index 0536529890c1dc221a80057d073b79f4702807a6..fddf0ac4d53283253bab7a50554485f22a8f1e89 100644 (file)
@@ -44,9 +44,10 @@ int split(char *str, char *arr[MAX_ARGS]){
                while(isspace(str[beginIndex])){
                        ++beginIndex;
                }
-               if(str[beginIndex] == '\0')
+               if(str[beginIndex] == '\0') {
                        break;
-                       endIndex = beginIndex;
+               }
+               endIndex = beginIndex;
                while (str[endIndex] && !isspace(str[endIndex])){
                        ++endIndex;
                }
index 2db1f8eb11d495e50c419ca2e58deb85067bc60b..1b4fd2384a0630cda9cacd66a68d0c1bc9379946 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <stdio.h>    // also included in util.h
 #include <string.h>   // also included in util.h
+#include <inttypes.h>
 #include <limits.h>   // for CmdNorm INT_MIN && INT_MAX
 #include "data.h"     // also included in util.h
 #include "cmddata.h"
@@ -171,22 +172,22 @@ void printEM410x(uint32_t hi, uint64_t id)
                }
                if (hi){
                        //output 88 bit em id
-                       PrintAndLog("\nEM TAG ID      : %06X%016llX", hi, id);
+                       PrintAndLog("\nEM TAG ID      : %06X%016" PRIX64, hi, id);
                } else{
                        //output 40 bit em id
-                       PrintAndLog("\nEM TAG ID      : %010llX", id);
-                       PrintAndLog("Unique TAG ID  : %010llX",  id2lo);
+                       PrintAndLog("\nEM TAG ID      : %010" PRIX64, id);
+                       PrintAndLog("Unique TAG ID  : %010" PRIX64,  id2lo);
                        PrintAndLog("\nPossible de-scramble patterns");
                        PrintAndLog("HoneyWell IdentKey {");
-                       PrintAndLog("DEZ 8          : %08lld",id & 0xFFFFFF);
-                       PrintAndLog("DEZ 10         : %010lld",id & 0xFFFFFFFF);
-                       PrintAndLog("DEZ 5.5        : %05lld.%05lld",(id>>16LL) & 0xFFFF,(id & 0xFFFF));
-                       PrintAndLog("DEZ 3.5A       : %03lld.%05lld",(id>>32ll),(id & 0xFFFF));
-                       PrintAndLog("DEZ 3.5B       : %03lld.%05lld",(id & 0xFF000000) >> 24,(id & 0xFFFF));
-                       PrintAndLog("DEZ 3.5C       : %03lld.%05lld",(id & 0xFF0000) >> 16,(id & 0xFFFF));
-                       PrintAndLog("DEZ 14/IK2     : %014lld",id);
-                       PrintAndLog("DEZ 15/IK3     : %015lld",id2lo);
-                       PrintAndLog("DEZ 20/ZK      : %02lld%02lld%02lld%02lld%02lld%02lld%02lld%02lld%02lld%02lld",
+                       PrintAndLog("DEZ 8          : %08" PRIu64,id & 0xFFFFFF);
+                       PrintAndLog("DEZ 10         : %010" PRIu64,id & 0xFFFFFFFF);
+                       PrintAndLog("DEZ 5.5        : %05lld.%05" PRIu64,(id>>16LL) & 0xFFFF,(id & 0xFFFF));
+                       PrintAndLog("DEZ 3.5A       : %03lld.%05" PRIu64,(id>>32ll),(id & 0xFFFF));
+                       PrintAndLog("DEZ 3.5B       : %03lld.%05" PRIu64,(id & 0xFF000000) >> 24,(id & 0xFFFF));
+                       PrintAndLog("DEZ 3.5C       : %03lld.%05" PRIu64,(id & 0xFF0000) >> 16,(id & 0xFFFF));
+                       PrintAndLog("DEZ 14/IK2     : %014" PRIu64,id);
+                       PrintAndLog("DEZ 15/IK3     : %015" PRIu64,id2lo);
+                       PrintAndLog("DEZ 20/ZK      : %02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64 "%02" PRIu64,
                            (id2lo & 0xf000000000) >> 36,
                            (id2lo & 0x0f00000000) >> 32,
                            (id2lo & 0x00f0000000) >> 28,
@@ -199,8 +200,8 @@ void printEM410x(uint32_t hi, uint64_t id)
                            (id2lo & 0x000000000f)
                        );
                        uint64_t paxton = (((id>>32) << 24) | (id & 0xffffff))  + 0x143e00;
-                       PrintAndLog("}\nOther          : %05lld_%03lld_%08lld",(id&0xFFFF),((id>>16LL) & 0xFF),(id & 0xFFFFFF));  
-                       PrintAndLog("Pattern Paxton : %lld [0x%llX]", paxton, paxton);
+                       PrintAndLog("}\nOther          : %05" PRIu64 "_%03" PRIu64 "_%08" PRIu64 "",(id&0xFFFF),((id>>16LL) & 0xFF),(id & 0xFFFFFF));  
+                       PrintAndLog("Pattern Paxton : %" PRIu64 " [0x%" PRIX64 "]", paxton, paxton);
 
                        uint32_t p1id = (id & 0xFFFFFF);
                        uint8_t arr[32] = {0x00};
@@ -1572,8 +1573,8 @@ int CmdFDXBdemodBI(const char *Cmd){
        if (g_debugMode) PrintAndLog("Raw ID Hex: %s", sprint_hex(raw,8));
 
        uint16_t calcCrc = crc16_ccitt_kermit(raw, 8);
-       PrintAndLog("Animal ID:     %04u-%012llu", countryCode, NationalCode);
-       PrintAndLog("National Code: %012llu", NationalCode);
+       PrintAndLog("Animal ID:     %04u-%012" PRIu64, countryCode, NationalCode);
+       PrintAndLog("National Code: %012" PRIu64, NationalCode);
        PrintAndLog("CountryCode:   %04u", countryCode);
        PrintAndLog("Extended Data: %s", dataBlockBit ? "True" : "False");
        PrintAndLog("reserved Code: %u", reservedCode);
index ecf3ba03e99b3de9ae7ff23fb0a53d3779a34bb1..e64df7d35548b9a309207a1854c7ad251f7fd601 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include <string.h>
 #include <unistd.h>
 #include "util.h"
@@ -490,7 +491,7 @@ int CmdHF14ASim(const char *Cmd)
 
        // Are we handling the (optional) second part uid?
        if (long_uid > 0xffffffff) {
-               PrintAndLog("Emulating ISO/IEC 14443 type A tag with 7 byte UID (%014"llx")",long_uid);
+               PrintAndLog("Emulating ISO/IEC 14443 type A tag with 7 byte UID (%014" PRIx64 ")",long_uid);
                // Store the second part
                c.arg[2] = (long_uid & 0xffffffff);
                long_uid >>= 32;
index f9f69a885c7f149db1e1b8fbe9643b8f6373c171..e50ce7082f9c2f973f72fee21e3e5d2b22966c01 100644 (file)
@@ -36,7 +36,7 @@ int CmdHFEPACollectPACENonces(const char *Cmd)
        m = m > 0 ? m : 1;
        n = n > 0 ? n : 1;
 
-       PrintAndLog("Collecting %u %"hhu"-byte nonces", n, m);
+       PrintAndLog("Collecting %u %u-byte nonces", n, m);
        PrintAndLog("Start: %u", time(NULL));
        // repeat n times
        for (unsigned int i = 0; i < n; i++) {
index cd4b4440415cad2baa4e3b3573b97fc044c37a7c..ce7d1f935d9447d8baca20115b1bea327b9c876f 100644 (file)
@@ -1349,7 +1349,7 @@ uint64_t hexarray_to_uint64(uint8_t *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)
+       if (sscanf(temp,"%016" SCNx64,&uint_key) < 1)
                return 0;
        return uint_key;
 }
index 4e52c35c168574b0c2af3c1e6682aa8572fa6747..777f524f2c1ffaf52391a71fcec7264ee0c2ff97 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <inttypes.h>
 #include "proxmark3.h"
 #include "data.h"
 #include "ui.h"
@@ -323,7 +324,7 @@ int CmdLegicRfSim(const char *Cmd)
    c.arg[0] = 6;
    c.arg[1] = 3;
    c.arg[2] = 0;
-   sscanf(Cmd, " %"lli" %"lli" %"lli, &c.arg[0], &c.arg[1], &c.arg[2]);
+   sscanf(Cmd, " %" SCNi64 " %" SCNi64 " %" SCNi64, &c.arg[0], &c.arg[1], &c.arg[2]);
    SendCommand(&c);
    return 0;
 }
@@ -331,7 +332,7 @@ int CmdLegicRfSim(const char *Cmd)
 int CmdLegicRfWrite(const char *Cmd)
 {
     UsbCommand c={CMD_WRITER_LEGIC_RF};
-    int res = sscanf(Cmd, " 0x%"llx" 0x%"llx, &c.arg[0], &c.arg[1]);
+    int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64, &c.arg[0], &c.arg[1]);
        if(res != 2) {
                PrintAndLog("Please specify the offset and length as two hex strings");
         return -1;
@@ -343,7 +344,7 @@ int CmdLegicRfWrite(const char *Cmd)
 int CmdLegicRfFill(const char *Cmd)
 {
     UsbCommand cmd ={CMD_WRITER_LEGIC_RF};
-    int res = sscanf(Cmd, " 0x%"llx" 0x%"llx" 0x%"llx, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
+    int res = sscanf(Cmd, " 0x%" SCNx64 " 0x%" SCNx64 " 0x%" SCNx64, &cmd.arg[0], &cmd.arg[1], &cmd.arg[2]);
     if(res != 3) {
         PrintAndLog("Please specify the offset, length and value as two hex strings");
         return -1;
index cdac64764dd33dd554c6dbd1a7c785f7038db7ef..54c5fc87788192c3ad7936e1de36bc818ce17435 100644 (file)
@@ -8,6 +8,7 @@
 // High frequency MIFARE commands\r
 //-----------------------------------------------------------------------------\r
 \r
+#include <inttypes.h>\r
 #include "cmdhfmf.h"\r
 #include "./nonce2key/nonce2key.h"\r
 \r
@@ -82,7 +83,7 @@ int CmdHF14AMifare(const char *Cmd)
        } else {\r
                isOK = 0;\r
                printf("------------------------------------------------------------------\n");\r
-               PrintAndLog("Found valid key:%012"llx" \n", r_key);\r
+               PrintAndLog("Found valid key:%012" PRIx64 " \n", r_key);\r
        }\r
        \r
        PrintAndLog("");\r
@@ -632,7 +633,7 @@ int CmdHF14AMfNested(const char *Cmd)
                }\r
                key64 = bytes_to_num(keyBlock, 6);\r
                if (key64) {\r
-                       PrintAndLog("Found valid key:%012"llx, key64);\r
+                       PrintAndLog("Found valid key:%012" PRIx64, key64);\r
 \r
                        // transfer key to the emulator\r
                        if (transferToEml) {\r
@@ -718,7 +719,7 @@ int CmdHF14AMfNested(const char *Cmd)
 \r
                                        key64 = bytes_to_num(keyBlock, 6);\r
                                        if (key64) {\r
-                                               PrintAndLog("Found valid key:%012"llx, key64);\r
+                                               PrintAndLog("Found valid key:%012" PRIx64, key64);\r
                                                e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
                                                e_sector[sectorNo].Key[trgKeyType] = key64;\r
                                        }\r
@@ -734,7 +735,7 @@ int CmdHF14AMfNested(const char *Cmd)
                PrintAndLog("|sec|key A           |res|key B           |res|");\r
                PrintAndLog("|---|----------------|---|----------------|---|");\r
                for (i = 0; i < SectorsCnt; i++) {\r
-                       PrintAndLog("|%03d|  %012"llx"  | %d |  %012"llx"  | %d |", i,\r
+                       PrintAndLog("|%03d|  %012" PRIx64 "  | %d |  %012" PRIx64 "  | %d |", i,\r
                                e_sector[i].Key[0], e_sector[i].foundKey[0], e_sector[i].Key[1], e_sector[i].foundKey[1]);\r
                }\r
                PrintAndLog("|---|----------------|---|----------------|---|");\r
@@ -925,7 +926,7 @@ int CmdHF14AMfChk(const char *Cmd)
                                        }\r
                                        memset(keyBlock + 6 * keycnt, 0, 6);\r
                                        num_to_bytes(strtoll(buf, NULL, 16), 6, keyBlock + 6*keycnt);\r
-                                       PrintAndLog("chk custom key[%2d] %012"llx, keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));\r
+                                       PrintAndLog("chk custom key[%2d] %012" PRIx64 , keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));\r
                                        keycnt++;\r
                                        memset(buf, 0, sizeof(buf));\r
                                }\r
@@ -969,7 +970,7 @@ int CmdHF14AMfChk(const char *Cmd)
                                res = mfCheckKeys(b, t, true, size, &keyBlock[6*c], &key64);\r
                                if (res != 1) {\r
                                        if (!res) {\r
-                                               PrintAndLog("Found valid key:[%012"llx"]",key64);\r
+                                               PrintAndLog("Found valid key:[%012" PRIx64 "]",key64);\r
                                                num_to_bytes(key64, 6, foundKey[t][i]);\r
                                                validKey[t][i] = true;\r
                                        } \r
@@ -1058,7 +1059,7 @@ void readerAttack(nonces_t ar_resp[], bool setEmulatorMem, bool doStandardAttack
                                uint8_t sectorNum = ar_resp[i+ATTACK_KEY_COUNT].sector;\r
                                uint8_t keyType = ar_resp[i+ATTACK_KEY_COUNT].keytype;\r
 \r
-                               PrintAndLog("M-Found Key%s for sector %02d: [%012"llx"]"\r
+                               PrintAndLog("M-Found Key%s for sector %02d: [%012" PRIx64 "]"\r
                                        , keyType ? "B" : "A"\r
                                        , sectorNum\r
                                        , key\r
@@ -1670,7 +1671,7 @@ int CmdHF14AMfEKeyPrn(const char *Cmd)
                }\r
                keyA = bytes_to_num(data, 6);\r
                keyB = bytes_to_num(data + 10, 6);\r
-               PrintAndLog("|%03d|  %012"llx"  |  %012"llx"  |", i, keyA, keyB);\r
+               PrintAndLog("|%03d|  %012" PRIx64 "  |  %012" PRIx64 "  |", i, keyA, keyB);\r
        }\r
        PrintAndLog("|---|----------------|----------------|");\r
        \r
index 12956abd09f54ec51fc1df55d8220296c044ab2f..ba6a36bb67115cb6fae33c0bbf153f6dc11d0fae 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "crc16.h"
 #include "proxmark3.h"
 #include "data.h"
@@ -273,7 +274,7 @@ int CmdTIWrite(const char *Cmd)
   UsbCommand c = {CMD_WRITE_TI_TYPE};
   int res = 0;
 
-  res = sscanf(Cmd, "%012"llx" %012"llx" %012"llx"", &c.arg[0], &c.arg[1], &c.arg[2]);
+  res = sscanf(Cmd, "%012" PRIx64 " %012" PRIx64 " %012" PRIx64 "", &c.arg[0], &c.arg[1], &c.arg[2]);
   
   if (res == 2) c.arg[2]=0;
   if (res < 2)
index 4e222ece2c213a3c898f8ecfb60890256dc3e63a..c840c92215224192624f3fe6f51971c0e97f8eb0 100644 (file)
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "proxmark3.h"
 #include "sleep.h"
 #include "flash.h"
@@ -295,7 +296,7 @@ static int get_proxmark_state(uint32_t *state)
                        *state = resp.arg[0];
                        break;
                default:
-                       fprintf(stderr, "Error: Couldn't get proxmark state, bad response type: 0x%04"llx"\n", resp.cmd);
+                       fprintf(stderr, "Error: Couldn't get proxmark state, bad response type: 0x%04" PRIx64 "\n", resp.cmd);
                        return -1;
                        break;
        }
@@ -357,7 +358,7 @@ static int wait_for_ack(void)
   UsbCommand ack;
        ReceiveCommand(&ack);
        if (ack.cmd != CMD_ACK) {
-               printf("Error: Unexpected reply 0x%04"llx" (expected ACK)\n", ack.cmd);
+               printf("Error: Unexpected reply 0x%04" PRIx64 " (expected ACK)\n", ack.cmd);
                return -1;
        }
        return 0;
index c273c1f383b759c76a008669d91f1300c30134e7..d6d37706cf3b5b4d367664427cb93a4d6df94277 100644 (file)
@@ -9,6 +9,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>
 #include "sleep.h"
 #include "proxmark3.h"
 #include "flash.h"
@@ -25,10 +26,10 @@ static char* serial_port_name;
 void cmd_debug(UsbCommand* UC) {
   //  Debug
   printf("UsbCommand length[len=%zd]\n",sizeof(UsbCommand));
-  printf("  cmd[len=%zd]: %016"llx"\n",sizeof(UC->cmd),UC->cmd);
-  printf(" arg0[len=%zd]: %016"llx"\n",sizeof(UC->arg[0]),UC->arg[0]);
-  printf(" arg1[len=%zd]: %016"llx"\n",sizeof(UC->arg[1]),UC->arg[1]);
-  printf(" arg2[len=%zd]: %016"llx"\n",sizeof(UC->arg[2]),UC->arg[2]);
+  printf("  cmd[len=%zd]: %016" PRIx64 "\n",sizeof(UC->cmd),UC->cmd);
+  printf(" arg0[len=%zd]: %016" PRIx64 "\n",sizeof(UC->arg[0]),UC->arg[0]);
+  printf(" arg1[len=%zd]: %016" PRIx64 "\n",sizeof(UC->arg[1]),UC->arg[1]);
+  printf(" arg2[len=%zd]: %016" PRIx64 "\n",sizeof(UC->arg[2]),UC->arg[2]);
   printf(" data[len=%zd]: ",sizeof(UC->d.asBytes));
   for (size_t i=0; i<16; i++) {
     printf("%02x",UC->d.asBytes[i]);
index 5647c42448b7b35cf243b66feb6ba8fbad45e138..2c47bc50213dcf767f9d12d342df1c0945082e62 100644 (file)
@@ -12,7 +12,6 @@
 
 #define __STDC_FORMAT_MACROS
 #include <inttypes.h>
-#define llx PRIx64
 
 #include "nonce2key.h"
 #include "mifarehost.h"
@@ -48,7 +47,7 @@ int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_
   // Reset the last three significant bits of the reader nonce
   nr &= 0xffffff1f;
   
-  PrintAndLog("\nuid(%08x) nt(%08x) par(%016"llx") ks(%016"llx") nr(%08"llx")\n\n",uid,nt,par_info,ks_info,nr);
+  PrintAndLog("\nuid(%08x) nt(%08x) par(%016" PRIx64") ks(%016" PRIx64") nr(%08" PRIx32")\n\n",uid,nt,par_info,ks_info,nr);
 
   for (pos=0; pos<8; pos++)
   {
@@ -86,7 +85,7 @@ int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_
                lfsr_rollback_word(state+i, uid^nt, 0);
                crypto1_get_lfsr(state + i, &key_recovered);
                *(state_s + i) = key_recovered;
-               //fprintf(fp, "%012llx\n",key_recovered);
+               //fprintf(fp, "%012" PRIx64 "\n",key_recovered);
        }
        //fclose(fp);
        
@@ -105,7 +104,7 @@ int nonce2key(uint32_t uid, uint32_t nt, uint32_t nr, uint64_t par_info, uint64_
                        p2 = state_s;
                        while ( *p1 != -1 && *p2 != -1 ) {
                                if (compar_state(p1, p2) == 0) {
-                                       printf("p1:%"llx" p2:%"llx" p3:%"llx" key:%012"llx"\n",(uint64_t)(p1-last_keylist),(uint64_t)(p2-state_s),(uint64_t)(p3-last_keylist),*p1);
+                                       printf("p1:%" PRIx64" p2:%" PRIx64 " p3:%" PRIx64" key:%012" PRIx64 "\n",(uint64_t)(p1-last_keylist),(uint64_t)(p2-state_s),(uint64_t)(p3-last_keylist),*p1);
                                        *p3++ = *p1++;
                                        p2++;
                                }
@@ -175,7 +174,7 @@ bool mfkey32(nonces_t data, uint64_t *outputkey) {
                crypto1_word(t, uid ^ nt, 0);
                crypto1_word(t, nr1_enc, 1);
                if (ar1_enc == (crypto1_word(t, 0, 0) ^ prng_successor(nt, 64))) {
-                       //PrintAndLog("Found Key: [%012"llx"]",key);
+                       //PrintAndLog("Found Key: [%012" PRIx64 "]",key);
                        outkey = key;
                        counter++;
                        if (counter==20) break;
@@ -226,7 +225,7 @@ bool tryMfk32_moebius(nonces_t data, uint64_t *outputkey) {
                crypto1_word(t, uid ^ nt1, 0);
                crypto1_word(t, nr1_enc, 1);
                if (ar1_enc == (crypto1_word(t, 0, 0) ^ prng_successor(nt1, 64))) {
-                       //PrintAndLog("Found Key: [%012"llx"]",key);
+                       //PrintAndLog("Found Key: [%012" PRIx64 "]",key);
                        outkey=key;
                        ++counter;
                        if (counter==20)
@@ -277,7 +276,7 @@ int tryMfk64(uint32_t uid, uint32_t nt, uint32_t nr_enc, uint32_t ar_enc, uint32
        lfsr_rollback_word(revstate, nr_enc, 1);
        lfsr_rollback_word(revstate, uid ^ nt, 0);
        crypto1_get_lfsr(revstate, &key);
-       PrintAndLog("Found Key: [%012"llx"]", key);
+       PrintAndLog("Found Key: [%012" PRIx64 "]", key);
        crypto1_destroy(revstate);
        *outputkey = key;
        
index 616d9c70aebfd1373262fb689938fcadfe741b0a..343ec8c9cc35c3c63a68719a2f9566562cea0f8c 100644 (file)
 #ifndef PROXMARK3_H__
 #define PROXMARK3_H__
 
-#define __STDC_FORMAT_MACROS
-#include <inttypes.h>
-#define llx PRIx64
-#define lli PRIi64
-#define llu PRIu64
-#define hhu PRIu8
-
 #include "usb_cmd.h"
 
 #define PROXPROMPT "proxmark3> "
index 1e22b8d27d7a014611a86de4844ccca751ab0bf5..4904dfda30ed61ab05938a197241625d6202c1db 100644 (file)
@@ -786,15 +786,16 @@ prev(poly_t *poly) {
        unsigned long fulllength = poly->length + ofs;
        bmp_t accu;
 
-       if(ofs)
+       if(ofs) {
                /* removable optimisation */
                if(poly->length < (unsigned long) BMP_BIT) {
                        *poly->bitmap = rev(*poly->bitmap >> ofs, (int) poly->length) << ofs;
                        return;
                }
+       }
 
-               /* claim remaining bits of last word (as we use public function pshift()) */
-               poly->length = fulllength;
+       /* claim remaining bits of last word (as we use public function pshift()) */
+       poly->length = fulllength;
 
        /* reverse and swap words in the array, leaving it right-justified */
        while(leftidx < rightidx) {
index 8d77c78a2e4a2b9aef6aae0b075a62c1910fc608..df8d73bc2b5d8f9785785653f64f219bacf9fee9 100644 (file)
@@ -161,7 +161,7 @@ static int l_nonce2key(lua_State *L){
        uint8_t dest_key[8];
        num_to_bytes(key,sizeof(dest_key),dest_key);
 
-       //printf("Pushing to lua stack: %012"llx"\n",key);
+       //printf("Pushing to lua stack: %012" PRIx64 "\n",key);
        lua_pushlstring(L,(const char *) dest_key,sizeof(dest_key));
 
        return 2; //Two return values
Impressum, Datenschutz