Ec::mulSmallInt errors if negative

update-fork
MITSUNARI Shigeo 5 years ago
parent 846b4ff8f6
commit 13d9500f3f
  1. 2
      include/mcl/ec.hpp

@ -994,7 +994,7 @@ public:
bool operator<=(const EcT& rhs) const { return !operator>(rhs); } bool operator<=(const EcT& rhs) const { return !operator>(rhs); }
static inline void mulArray(EcT& z, const EcT& x, const fp::Unit *y, size_t yn, bool isNegative, bool constTime = false) static inline void mulArray(EcT& z, const EcT& x, const fp::Unit *y, size_t yn, bool isNegative, bool constTime = false)
{ {
if (!constTime && yn == 1 && *y <= 16) { if (!constTime && yn == 1 && *y <= 16 && !isNegative) {
if (mulSmallInt(z, x, static_cast<int>(*y), isNegative)) return; if (mulSmallInt(z, x, static_cast<int>(*y), isNegative)) return;
} }
if (mulArrayGLV && (constTime || yn > 1)) { if (mulArrayGLV && (constTime || yn > 1)) {

Loading…
Cancel
Save