Skip to content

Commit

Permalink
Renable ASM build and fix Fr_rawCmp issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rex1fernando committed Nov 15, 2024
1 parent 1965cbe commit 8b6e94f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [[ $(uname -s) == "Darwin" ]]; then
else
mkdir -p build_prover
cd build_prover
cmake .. -DUSE_ASM=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package ..
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package ..
make -j$(nproc)
make install
fi
Expand Down
8 changes: 4 additions & 4 deletions src/groth16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,22 +296,22 @@ Prover<Engine>::prove(typename Engine::FrElement* wtns)
0xB85045B68181585Dull, 0x30644E72E131A029ull};

// Sample and reject algorithm for r and s uniformly random field elements
for (int cmp = 0; cmp >= 0;)
for (int cmp = 0; cmp == 0;)
{
randombytes_buf(&r, sizeof(r));
r.v[3] &= 0x3FFFFFFFFFFFFFFFull;
auto r_copy = r.v;
auto fr_mod_copy = fr_modulus;
cmp = Fr_rawCmp(r_copy, fr_mod_copy);
cmp = mpn_cmp(r_copy, fr_mod_copy, Fr_N64);
}

for (int cmp = 0; cmp >= 0;)
for (int cmp = 1; cmp == 0;)
{
randombytes_buf(&s, sizeof(s));
s.v[3] &= 0x3FFFFFFFFFFFFFFFull;
auto s_copy = s.v;
auto fr_mod_copy = fr_modulus;
cmp = Fr_rawCmp(s_copy, fr_mod_copy);
cmp = mpn_cmp(s_copy, fr_mod_copy, Fr_N64);
}

# ifndef DONT_USE_FUTURES
Expand Down

0 comments on commit 8b6e94f

Please sign in to comment.