Przeglądaj źródła

fix for #90 ltc_ecc_mul2add.c integer sign issue (sjaeckel's way)

Karel Miko 9 lat temu
rodzic
commit
979e9a9d15
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      src/pk/ecc/ltc_ecc_mul2add.c

+ 3 - 2
src/pk/ecc/ltc_ecc_mul2add.c

@@ -134,13 +134,14 @@ int ltc_ecc_mul2add(ecc_point *A, void *kA,
   bitbufB = tB[0];
   bitbufB = tB[0];
 
 
   /* for every byte of the multiplicands */
   /* for every byte of the multiplicands */
-  for (x = -1;; ) {
+  for (x = 0;; ) {
      /* grab a nibble */
      /* grab a nibble */
      if (++nibble == 4) {
      if (++nibble == 4) {
-        ++x; if (x == len) break;
+        if (x == len) break;
         bitbufA = tA[x];
         bitbufA = tA[x];
         bitbufB = tB[x];
         bitbufB = tB[x];
         nibble  = 0;
         nibble  = 0;
+        ++x;
      }
      }
 
 
      /* extract two bits from both, shift/update */
      /* extract two bits from both, shift/update */