|
@@ -27,40 +27,58 @@ public class Retrieve extends Protocol {
|
|
|
super(con1, con2);
|
|
|
}
|
|
|
|
|
|
- public OutAccess runE(PreData predata, Tree OTi, byte[] Ni, byte[] Nip1_pr, int h, Timer timer) {
|
|
|
+ public OutAccess runE(PreData[] predata, Tree OTi, byte[] Ni, byte[] Nip1_pr, int h, Timer timer) {
|
|
|
+ // 1st eviction
|
|
|
Access access = new Access(con1, con2);
|
|
|
Reshuffle reshuffle = new Reshuffle(con1, con2);
|
|
|
PostProcessT postprocesst = new PostProcessT(con1, con2);
|
|
|
UpdateRoot updateroot = new UpdateRoot(con1, con2);
|
|
|
Eviction eviction = new Eviction(con1, con2);
|
|
|
|
|
|
- OutAccess outaccess = access.runE(predata, OTi, Ni, Nip1_pr, timer);
|
|
|
- Tuple[] path = reshuffle.runE(predata, outaccess.E_P, OTi.getTreeIndex() == 0, timer);
|
|
|
- Tuple Ti = postprocesst.runE(predata, outaccess.E_Ti, OTi.getTreeIndex() == h - 1, timer);
|
|
|
+ OutAccess outaccess = access.runE(predata[0], OTi, Ni, Nip1_pr, timer);
|
|
|
+ Tuple[] path = reshuffle.runE(predata[0], outaccess.E_P, OTi.getTreeIndex() == 0, timer);
|
|
|
+ Tuple Ti = postprocesst.runE(predata[0], outaccess.E_Ti, OTi.getTreeIndex() == h - 1, timer);
|
|
|
Tuple[] root = Arrays.copyOfRange(path, 0, OTi.getStashSize());
|
|
|
- root = updateroot.runE(predata, OTi.getTreeIndex() == 0, outaccess.Li, root, Ti, timer);
|
|
|
+ root = updateroot.runE(predata[0], OTi.getTreeIndex() == 0, outaccess.Li, root, Ti, timer);
|
|
|
System.arraycopy(root, 0, path, 0, root.length);
|
|
|
- eviction.runE(predata, OTi.getTreeIndex() == 0, outaccess.Li,
|
|
|
+ eviction.runE(predata[0], OTi.getTreeIndex() == 0, outaccess.Li,
|
|
|
OTi.getTreeIndex() == 0 ? new Tuple[] { Ti } : path, OTi, timer);
|
|
|
|
|
|
+ // 2nd eviction
|
|
|
+ OutAccess outaccess2 = access.runE2(OTi, timer);
|
|
|
+ Tuple[] path2 = outaccess2.E_P;
|
|
|
+ Tuple Ti2 = outaccess2.E_Ti;
|
|
|
+ Tuple[] root2 = Arrays.copyOfRange(path2, 0, OTi.getStashSize());
|
|
|
+ root2 = updateroot.runE(predata[1], OTi.getTreeIndex() == 0, outaccess2.Li, root2, Ti2, timer);
|
|
|
+ System.arraycopy(root2, 0, path2, 0, root2.length);
|
|
|
+ eviction.runE(predata[1], OTi.getTreeIndex() == 0, outaccess2.Li,
|
|
|
+ OTi.getTreeIndex() == 0 ? new Tuple[] { Ti2 } : path2, OTi, timer);
|
|
|
+
|
|
|
return outaccess;
|
|
|
}
|
|
|
|
|
|
- public void runD(PreData predata, Tree OTi, byte[] Ni, byte[] Nip1_pr, Timer timer) {
|
|
|
+ public void runD(PreData predata[], Tree OTi, byte[] Ni, byte[] Nip1_pr, Timer timer) {
|
|
|
+ // 1st eviction
|
|
|
Access access = new Access(con1, con2);
|
|
|
Reshuffle reshuffle = new Reshuffle(con1, con2);
|
|
|
PostProcessT postprocesst = new PostProcessT(con1, con2);
|
|
|
UpdateRoot updateroot = new UpdateRoot(con1, con2);
|
|
|
Eviction eviction = new Eviction(con1, con2);
|
|
|
|
|
|
- byte[] Li = access.runD(predata, OTi, Ni, Nip1_pr, timer);
|
|
|
+ byte[] Li = access.runD(predata[0], OTi, Ni, Nip1_pr, timer);
|
|
|
reshuffle.runD();
|
|
|
postprocesst.runD();
|
|
|
- updateroot.runD(predata, OTi.getTreeIndex() == 0, Li, OTi.getW(), timer);
|
|
|
- eviction.runD(predata, OTi.getTreeIndex() == 0, Li, OTi, timer);
|
|
|
+ updateroot.runD(predata[0], OTi.getTreeIndex() == 0, Li, OTi.getW(), timer);
|
|
|
+ eviction.runD(predata[0], OTi.getTreeIndex() == 0, Li, OTi, timer);
|
|
|
+
|
|
|
+ // 2nd eviction
|
|
|
+ byte[] Li2 = access.runD2(OTi, timer);
|
|
|
+ updateroot.runD(predata[1], OTi.getTreeIndex() == 0, Li2, OTi.getW(), timer);
|
|
|
+ eviction.runD(predata[1], OTi.getTreeIndex() == 0, Li2, OTi, timer);
|
|
|
}
|
|
|
|
|
|
- public OutAccess runC(PreData predata, Metadata md, int ti, byte[] Li, int h, Timer timer) {
|
|
|
+ public OutAccess runC(PreData[] predata, Metadata md, int ti, byte[] Li, int h, Timer timer) {
|
|
|
+ // 1st eviction
|
|
|
Access access = new Access(con1, con2);
|
|
|
Reshuffle reshuffle = new Reshuffle(con1, con2);
|
|
|
PostProcessT postprocesst = new PostProcessT(con1, con2);
|
|
@@ -68,12 +86,24 @@ public class Retrieve extends Protocol {
|
|
|
Eviction eviction = new Eviction(con1, con2);
|
|
|
|
|
|
OutAccess outaccess = access.runC(md, ti, Li, timer);
|
|
|
- Tuple[] path = reshuffle.runC(predata, outaccess.C_P, ti == 0, timer);
|
|
|
- Tuple Ti = postprocesst.runC(predata, outaccess.C_Ti, Li, outaccess.C_Lip1, outaccess.C_j2, ti == h - 1, timer);
|
|
|
+ Tuple[] path = reshuffle.runC(predata[0], outaccess.C_P, ti == 0, timer);
|
|
|
+ Tuple Ti = postprocesst.runC(predata[0], outaccess.C_Ti, Li, outaccess.C_Lip1, outaccess.C_j2, ti == h - 1,
|
|
|
+ timer);
|
|
|
Tuple[] root = Arrays.copyOfRange(path, 0, md.getStashSizeOfTree(ti));
|
|
|
- root = updateroot.runC(predata, ti == 0, root, Ti, timer);
|
|
|
+ root = updateroot.runC(predata[0], ti == 0, root, Ti, timer);
|
|
|
System.arraycopy(root, 0, path, 0, root.length);
|
|
|
- eviction.runC(predata, ti == 0, ti == 0 ? new Tuple[] { Ti } : path, md.getLBitsOfTree(ti) + 1,
|
|
|
+ eviction.runC(predata[0], ti == 0, ti == 0 ? new Tuple[] { Ti } : path, md.getLBitsOfTree(ti) + 1,
|
|
|
+ md.getStashSizeOfTree(ti), md.getW(), timer);
|
|
|
+
|
|
|
+ // 2nd eviction
|
|
|
+ byte[] Li2 = Util.nextBytes(md.getLBytesOfTree(ti), Crypto.sr);
|
|
|
+ OutAccess outaccess2 = access.runC2(md, ti, Li2, timer);
|
|
|
+ Tuple[] path2 = outaccess2.C_P;
|
|
|
+ Tuple Ti2 = outaccess2.C_Ti;
|
|
|
+ Tuple[] root2 = Arrays.copyOfRange(path2, 0, md.getStashSizeOfTree(ti));
|
|
|
+ root2 = updateroot.runC(predata[1], ti == 0, root2, Ti2, timer);
|
|
|
+ System.arraycopy(root2, 0, path2, 0, root2.length);
|
|
|
+ eviction.runC(predata[1], ti == 0, ti == 0 ? new Tuple[] { Ti2 } : path2, md.getLBitsOfTree(ti) + 1,
|
|
|
md.getStashSizeOfTree(ti), md.getW(), timer);
|
|
|
|
|
|
return outaccess;
|
|
@@ -115,10 +145,11 @@ public class Retrieve extends Protocol {
|
|
|
System.out.println("N=" + BigInteger.valueOf(N).toString(2));
|
|
|
|
|
|
System.out.print("Precomputation... ");
|
|
|
- PreData[] predata = new PreData[numTrees];
|
|
|
+ PreData[][] predata = new PreData[numTrees][2];
|
|
|
PreRetrieve preretrieve = new PreRetrieve(con1, con2);
|
|
|
for (int ti = 0; ti < numTrees; ti++) {
|
|
|
- predata[ti] = new PreData();
|
|
|
+ predata[ti][0] = new PreData();
|
|
|
+ predata[ti][1] = new PreData();
|
|
|
|
|
|
if (party == Party.Eddie) {
|
|
|
ete_off.start();
|
|
@@ -127,12 +158,12 @@ public class Retrieve extends Protocol {
|
|
|
|
|
|
} else if (party == Party.Debbie) {
|
|
|
ete_off.start();
|
|
|
- preretrieve.runD(predata[ti], md, ti, ti == 0 ? null : predata[ti - 1], timer);
|
|
|
+ preretrieve.runD(predata[ti], md, ti, ti == 0 ? null : predata[ti - 1][0], timer);
|
|
|
ete_off.stop();
|
|
|
|
|
|
} else if (party == Party.Charlie) {
|
|
|
ete_off.start();
|
|
|
- preretrieve.runC(predata[ti], md, ti, ti == 0 ? null : predata[ti - 1], timer);
|
|
|
+ preretrieve.runC(predata[ti], md, ti, ti == 0 ? null : predata[ti - 1][0], timer);
|
|
|
ete_off.stop();
|
|
|
|
|
|
} else {
|