浏览代码

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

Karel Miko 9 年之前
父节点
当前提交
979e9a9d15
共有 1 个文件被更改,包括 3 次插入2 次删除
  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];
 
   /* for every byte of the multiplicands */
-  for (x = -1;; ) {
+  for (x = 0;; ) {
      /* grab a nibble */
      if (++nibble == 4) {
-        ++x; if (x == len) break;
+        if (x == len) break;
         bitbufA = tA[x];
         bitbufB = tB[x];
         nibble  = 0;
+        ++x;
      }
 
      /* extract two bits from both, shift/update */