compatible setByCSPRNG for big-endian

2merge^2
MITSUNARI Shigeo 4 years ago
parent 2e397d13dc
commit 3a2f09ca73
  1. 5
      include/mcl/fp.hpp

@ -460,8 +460,11 @@ public:
void setByCSPRNG(bool *pb, fp::RandGen rg = fp::RandGen()) void setByCSPRNG(bool *pb, fp::RandGen rg = fp::RandGen())
{ {
if (rg.isZero()) rg = fp::RandGen::get(); if (rg.isZero()) rg = fp::RandGen::get();
rg.read(pb, v_, op_.N * sizeof(Unit)); // byte size uint8_t x[sizeof(*this)];
const size_t n = op_.N * sizeof(Unit);
rg.read(pb, x, n); // byte size
if (!pb) return; if (!pb) return;
fp::convertArrayAsLE(v_, op_.N, x, n);
setArrayMask(v_, op_.N); setArrayMask(v_, op_.N);
} }
#ifndef CYBOZU_DONT_USE_EXCEPTION #ifndef CYBOZU_DONT_USE_EXCEPTION

Loading…
Cancel
Save