aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-12-10 14:12:04 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-12-10 14:12:04 +0800
commita29506decb09b0c8df5acbdb06668ab233fdd085 (patch)
tree79f31f9d58c353867751456e022f2f638fe04ecc
parent99a8fe21c58d43057f7de87bfbc6a275bdc0a6a7 (diff)
downloadtangerine-mcl-a29506decb09b0c8df5acbdb06668ab233fdd085.tar.gz
tangerine-mcl-a29506decb09b0c8df5acbdb06668ab233fdd085.tar.zst
tangerine-mcl-a29506decb09b0c8df5acbdb06668ab233fdd085.zip
fix ; correct array
-rw-r--r--include/mcl/ec.hpp8
-rw-r--r--src/bn_c_impl.hpp2
2 files changed, 5 insertions, 5 deletions
diff --git a/include/mcl/ec.hpp b/include/mcl/ec.hpp
index 7054557..299cd00 100644
--- a/include/mcl/ec.hpp
+++ b/include/mcl/ec.hpp
@@ -786,8 +786,8 @@ public:
memset(buf, 0, n);
} else {
char *p = reinterpret_cast<char*>(buf);
- EcT P(*this);
- P.normalize();
+ EcT P;
+ EcT::normalize(P, *this);
if (P.x.serialize(p, maxBufSize) == 0) return 0;
if (P.y.isOdd()) {
p[n - 1] |= 0x80;
@@ -805,9 +805,9 @@ public:
z = 1;
#endif
if (!isFixedSizeByteSeq()) return 0;
- const size_t n = sizeof(Fp);
+ const size_t n = Fp::getByteSize();
if (bufSize < n) return 0;
- char p[n];
+ char p[sizeof(Fp)];
memcpy(p, buf, n);
if (fp::isZeroArray(p, n)) {
clear();
diff --git a/src/bn_c_impl.hpp b/src/bn_c_impl.hpp
index ff8adea..0acc88f 100644
--- a/src/bn_c_impl.hpp
+++ b/src/bn_c_impl.hpp
@@ -97,7 +97,7 @@ mclRetType deserialize(T *x, const void *buf, mclSize bufSize, const char *msg)
#ifdef MCLBN_USE_NEW_DESERIALIZE_API
return mclSize(n);
#else
- return n == 0 ? -1 : 0;
+ return n ? 0 : -1;
#endif
} catch (std::exception& e) {
if (g_fp) fprintf(g_fp, "%s %s\n", msg, e.what());