Skip to content

Commit

Permalink
fix tunsten wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ladnir committed Jan 31, 2024
1 parent 08df6fb commit 540f72c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions libOTe/Tools/TungstenCode/TungstenCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ namespace osuCrypto {
return;

auto xi = x + i;
auto xs = x + ((i + 1) % size);
auto xs = x + ((i + Table::max + 1) % size);
ctx.plus(*xs, *xs, *xi);
ctx.mulConst(*xs, *xs);

Expand All @@ -247,7 +247,7 @@ namespace osuCrypto {
{
auto xi = x + i;

auto xs = xi + 1;
auto xs = xi + Table::max + 1;
auto x0 = xi + table[j].data()[0];
auto x1 = xi + table[j].data()[1];
auto x2 = xi + table[j].data()[2];
Expand Down Expand Up @@ -297,7 +297,7 @@ namespace osuCrypto {
// for the first iteration, the last accumulateBlock
// will wrap anmd change its value. We therefore can't
// yet map the output for this part. We do this at the end.
while (i < Table::max)
while (i <= Table::max)
{
TungstenNoop noop;
if (i < main)
Expand Down
2 changes: 1 addition & 1 deletion libOTe_Tests/TungstenCode_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace tests_libOTe
if (i == x.size())
return;

auto idx = (i + 1) % x.size();
auto idx = (i + Table::max + 1) % x.size();
ctx.plus(x[idx], x[idx], x[i]);
ctx.mulConst(x[idx], x[idx]);

Expand Down

0 comments on commit 540f72c

Please sign in to comment.