Commit 8debc71d authored by Jack Doerner's avatar Jack Doerner

Huh. Surprising how much that helps.

parent e24e0b09
......@@ -38,10 +38,10 @@ void bitpropagator_Z_pusher(bitpropagator * bp, bitpropagator_offline * bpo, Pro
size_t thislevel = ii- bp->startlevel -1;
omp_set_lock(&bp->locks[thislevel]);
for (size_t jj = 0; jj < BLOCKSIZE; jj++) revealOblivChar(&Z_local[jj], bp->Z[thislevel*BLOCKSIZE+jj], 1);
for (size_t jj = 0; jj < BLOCKSIZE/sizeof(uint64_t); jj++) revealOblivLLong(&((uint64_t *)Z_local)[jj], ((obliv uint64_t *)(&bp->Z[thislevel*BLOCKSIZE]))[jj], 1);
revealOblivBool(&advicebit_local_l, bp->advicebits[thislevel*2+0], 1);
revealOblivBool(&advicebit_local_r, bp->advicebits[thislevel*2+1], 1);
for (size_t jj = 0; jj < BLOCKSIZE; jj++) revealOblivChar(&Z_local[jj], bp->Z[thislevel*BLOCKSIZE+jj], 2);
for (size_t jj = 0; jj < BLOCKSIZE/sizeof(uint64_t); jj++) revealOblivLLong(&((uint64_t *)Z_local)[jj], ((obliv uint64_t *)(&bp->Z[thislevel*BLOCKSIZE]))[jj], 2);
revealOblivBool(&advicebit_local_l, bp->advicebits[thislevel*2+0], 2);
revealOblivBool(&advicebit_local_r, bp->advicebits[thislevel*2+1], 2);
......@@ -148,8 +148,8 @@ void bitpropagator_getblockvector_with_callback(obliv uint8_t * activeblock_pair
ocCopyN(&ocCopyChar, &bp->blocktemp_B[ii*BLOCKSIZE], &bp->toplevel[(1ll << bp->startlevel)*BLOCKSIZE], BLOCKSIZE);
}
}
for (size_t ii = 0; ii < (1ll << bp->startlevel); ii++) for (size_t jj = 0; jj < BLOCKSIZE; jj++) revealOblivChar(&bp->toplevel_local[ii * BLOCKSIZE + jj], bp->blocktemp_A[ii * BLOCKSIZE + jj], 1);
for (size_t ii = 0; ii < (1ll << bp->startlevel); ii++) for (size_t jj = 0; jj < BLOCKSIZE; jj++) revealOblivChar(&bp->toplevel_local[ii * BLOCKSIZE + jj], bp->blocktemp_B[ii * BLOCKSIZE + jj], 2);
for (size_t ii = 0; ii < (1ll << bp->startlevel); ii++) for (size_t jj = 0; jj < BLOCKSIZE/sizeof(uint64_t); jj++) revealOblivLLong(&((uint64_t *)(&bp->toplevel_local[ii * BLOCKSIZE]))[jj], ((obliv uint64_t *)(&bp->blocktemp_A[ii * BLOCKSIZE]))[jj], 1);
for (size_t ii = 0; ii < (1ll << bp->startlevel); ii++) for (size_t jj = 0; jj < BLOCKSIZE/sizeof(uint64_t); jj++) revealOblivLLong(&((uint64_t *)(&bp->toplevel_local[ii * BLOCKSIZE]))[jj], ((obliv uint64_t *)(&bp->blocktemp_B[ii * BLOCKSIZE]))[jj], 2);
ocCopyN(&ocCopyChar, bp->activeblock_B, &bp->toplevel[(1ll << bp->startlevel)*BLOCKSIZE], BLOCKSIZE);
......@@ -196,11 +196,11 @@ bitpropagator * bitpropagator_new(size_t size, uint32_t startlevel) {
if (ocCurrentParty() == 1) {
get_random_bytes(keyL, KEYSIZE);
get_random_bytes(keyR, KEYSIZE);
for (size_t ii=0; ii< KEYSIZE;ii++) ocBroadcastChar(keyL[ii],1);
for (size_t ii=0; ii< KEYSIZE;ii++) ocBroadcastChar(keyR[ii],1);
for (size_t ii=0; ii< KEYSIZE/sizeof(uint64_t);ii++) ocBroadcastLLong(((uint64_t *)keyL)[ii],1);
for (size_t ii=0; ii< KEYSIZE/sizeof(uint64_t);ii++) ocBroadcastLLong(((uint64_t *)keyR)[ii],1);
} else {
for (size_t ii=0; ii< KEYSIZE;ii++) keyL[ii] = ocBroadcastChar(NULL,1);
for (size_t ii=0; ii< KEYSIZE;ii++) keyR[ii] = ocBroadcastChar(NULL,1);
for (size_t ii=0; ii< KEYSIZE/sizeof(uint64_t);ii++) ((uint64_t *)keyL)[ii] = ocBroadcastLLong(NULL,1);
for (size_t ii=0; ii< KEYSIZE/sizeof(uint64_t);ii++) ((uint64_t *)keyR)[ii] = ocBroadcastLLong(NULL,1);
}
online_prf_keyschedule_double(&bp->keyL, &bp->keyR, keyL, keyR);
......
......@@ -163,8 +163,8 @@ flatoram* flatoram_new(OcCopy* cpy, void* data, size_t n) {
feedOblivCharArray(loadtemp, loadtemp_local, BLOCKSIZE * ram->blockcount * ram->blockmultiple, 2);
for (size_t ii = 0; ii<(ram->blockmultiple * BLOCKSIZE * ram->blockcount);ii++) loadtemp[ii] ^= feedOblivChar(loadtemp_local[ii], 1);
for (size_t ii = 0; ii<(ram->blockmultiple * BLOCKSIZE * ram->blockcount);ii++) revealOblivChar(&(loadtemp_local[ii]), loadtemp[ii], 2);
for (size_t ii = 0; ii<(ram->blockmultiple * BLOCKSIZE * ram->blockcount)/sizeof(uint64_t);ii++) ((obliv uint64_t *)loadtemp)[ii] ^= feedOblivLLong(((uint64_t *)loadtemp_local)[ii], 1);
for (size_t ii = 0; ii<(ram->blockmultiple * BLOCKSIZE * ram->blockcount)/sizeof(uint64_t);ii++) revealOblivLLong(&(((uint64_t *)loadtemp_local)[ii]), ((obliv uint64_t *)loadtemp)[ii], 2);
size_t blockid, subblockid;
for (size_t ii = 0; ii < ram->size; ii++) {
......@@ -178,7 +178,7 @@ flatoram* flatoram_new(OcCopy* cpy, void* data, size_t n) {
}
}
for (size_t ii = 0; ii<(ram->blockmultiple * BLOCKSIZE * ram->blockcount);ii++) revealOblivChar(&(loadtemp_local[ii]), loadtemp[ii], 1);
for (size_t ii = 0; ii<(ram->blockmultiple * BLOCKSIZE * ram->blockcount)/sizeof(uint64_t);ii++) revealOblivLLong(&(((uint64_t *)loadtemp_local)[ii]), ((obliv uint64_t *)loadtemp)[ii], 1);
free(loadtemp);
......
......@@ -72,18 +72,18 @@ void scanrom_write_xor_shares(scanrom* rom, obliv uint8_t * data, size_t indexin
scanrom_encrypt_offline(&rom->local_data[index * rom->fullblocksize], data, rom->local_halfkey, index, rom->fullblocksize * MIN(len, rom->blockcount - index));
for (; index < MIN(indexinit + len, rom->blockcount); index++) {
for (size_t ii = 0; ii < rom->fullblocksize; ii++) {
if (ocCurrentParty() == 1) rom->local_data[index * rom->fullblocksize + ii] ^= ocBroadcastChar(NULL, 2);
else ocBroadcastChar(rom->local_data[index * rom->fullblocksize + ii], 2);
for (size_t ii = 0; ii < rom->fullblocksize/sizeof(uint64_t); ii++) {
if (ocCurrentParty() == 1) ((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii] ^= ocBroadcastLLong(NULL, 2);
else ocBroadcastLLong(((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii], 2);
}
}
index = indexinit;
for (; index < MIN(indexinit + len, rom->blockcount); index++) {
for (size_t ii = 0; ii < rom->fullblocksize; ii++) {
if (ocCurrentParty() == 2 ) rom->local_data[index * rom->fullblocksize + ii] = ocBroadcastChar(NULL, 1);
else ocBroadcastChar(rom->local_data[index * rom->fullblocksize + ii], 1);
for (size_t ii = 0; ii < rom->fullblocksize/sizeof(uint64_t); ii++) {
if (ocCurrentParty() == 2 ) ((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii] = ocBroadcastLLong(NULL, 1);
else ocBroadcastLLong(((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii], 1);
}
}
}
......@@ -104,16 +104,16 @@ void scanrom_clear(scanrom* rom) {
scanrom_encrypt_offline(rom->local_data, NULL, rom->local_halfkey, 0, rom->fullblocksize * rom->blockcount);
for (size_t index = 0; index < rom->blockcount; index++) {
for (size_t ii = 0; ii < rom->fullblocksize; ii++) {
if (ocCurrentParty() == 1) rom->local_data[index * rom->fullblocksize + ii] ^= ocBroadcastChar(NULL, 2);
else ocBroadcastChar(rom->local_data[index * rom->fullblocksize + ii], 2);
for (size_t ii = 0; ii < rom->fullblocksize/sizeof(uint64_t); ii++) {
if (ocCurrentParty() == 1) ((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii] ^= ocBroadcastLLong(NULL, 2);
else ocBroadcastLLong(((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii], 2);
}
}
for (size_t index = 0; index < rom->blockcount; index++) {
for (size_t ii = 0; ii < rom->fullblocksize; ii++) {
if (ocCurrentParty() == 2 ) rom->local_data[index * rom->fullblocksize + ii] = ocBroadcastChar(NULL, 1);
else ocBroadcastChar(rom->local_data[index * rom->fullblocksize + ii], 1);
for (size_t ii = 0; ii < rom->fullblocksize/sizeof(uint64_t); ii++) {
if (ocCurrentParty() == 2 ) ((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii] = ocBroadcastLLong(NULL, 1);
else ocBroadcastLLong(((uint64_t *)(&rom->local_data[index * rom->fullblocksize]))[ii], 1);
}
}
}
......@@ -179,8 +179,8 @@ void scanwrom_write_with_blockvector(scanwrom* rom, obliv uint8_t * active_block
for (size_t ii = 0; ii < rom->fullblocksize; ii++) {
rom->blocktemp[ii] ^= rom->blocktemp[rom->fullblocksize + ii] ^ rom->blocktemp[2*rom->fullblocksize + ii];
}
for (size_t ii = 0; ii < rom->fullblocksize; ii++) revealOblivChar(&rom->local_blocktemp[ii], rom->blocktemp[ii], 2);
for (size_t ii = 0; ii < rom->fullblocksize; ii++) revealOblivChar(&rom->local_blocktemp[ii], rom->blocktemp[ii], 1);
for (size_t ii = 0; ii < rom->fullblocksize/sizeof(uint64_t); ii++) revealOblivLLong(&((uint64_t *)rom->local_blocktemp)[ii], ((obliv uint64_t *)rom->blocktemp)[ii], 2);
for (size_t ii = 0; ii < rom->fullblocksize/sizeof(uint64_t); ii++) revealOblivLLong(&((uint64_t *)rom->local_blocktemp)[ii], ((obliv uint64_t *)rom->blocktemp)[ii], 1);
scanwrom_write_with_blockvector_offline(rom->local_data, blockvector, bitvector, rom->local_blocktemp, rom->blockmultiple != 1, rom->fullblocksize, rom->blockcount);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment