Ver código fonte

Compute indoffset so as to avoid having to negate it later

When it might be an XOR index share later, we don't want to have to deal
with that.
Ian Goldberg 2 anos atrás
pai
commit
56b4c8f2e2
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4 4
      duoram.tcc

+ 4 - 4
duoram.tcc

@@ -126,8 +126,8 @@ Duoram<T>::Shape::MemRefAS::operator T()
         RDPFTriple dt = shape.tio.rdpftriple(shape.addr_size);
 
         // Compute the index offset
-        RegAS indoffset = idx;
-        indoffset -= dt.as_target;
+        RegAS indoffset = dt.as_target;
+        indoffset -= idx;
 
         // We only need two of the DPFs for reading
         RDPFPair dp(std::move(dt), 0, player == 0 ? 2 : 1);
@@ -146,7 +146,7 @@ Duoram<T>::Shape::MemRefAS::operator T()
         auto indshift = combine(indoffset, peerindoffset, shape.addr_size);
 
         // Evaluate the DPFs and compute the dotproducts
-        StreamEval ev(dp, -indshift, shape.tio.aes_ops());
+        StreamEval ev(dp, indshift, shape.tio.aes_ops());
         for (size_t i=0; i<shape.shape_size; ++i) {
             auto L = ev.next();
             // The values from the two DPFs
@@ -175,7 +175,7 @@ Duoram<T>::Shape::MemRefAS::operator T()
 
         // Evaluate the DPFs to compute the cancellation terms
         T gamma0, gamma1;
-        StreamEval ev(dp, -indshift, shape.tio.aes_ops());
+        StreamEval ev(dp, indshift, shape.tio.aes_ops());
         for (size_t i=0; i<shape.shape_size; ++i) {
             auto L = ev.next();