Commit df9f53f8 authored by Jack Doerner's avatar Jack Doerner

Cleaning. Put non-obliv-c demo code in its own directory

parent a4d07496
......@@ -129,9 +129,6 @@ void bitpropagator_getblockvector(obliv uint8_t * activeblock_pair, uint8_t * lo
}
void bitpropagator_getadvice(bool * advicebit_local_l, bool * advicebit_local_r, obliv uint8_t * blocks_A, obliv uint8_t * blocks_B, obliv bool rightblock) {
//uint8_t tlcw = (s0l[0]&0x1) ^ (s1l[0]&01) ^ ai ^ 1;
//uint8_t trcw = (s0r[0]&0x1) ^ (s1r[0]&01) ^ ai;
obliv bool advicebit_l = ((obliv bool *)blocks_A)[0] ^ ((obliv bool *)blocks_B)[0] ^ rightblock ^ 1;
obliv bool advicebit_r = ((obliv bool *)blocks_A)[BLOCKSIZE*8] ^ ((obliv bool *)blocks_B)[BLOCKSIZE*8] ^ rightblock;
revealOblivBool(advicebit_local_l, advicebit_l, 0);
......
......@@ -116,7 +116,7 @@ flatoram* flatoram_new(OcCopy* cpy, void* data, size_t n) {
ram->blockcpy=ocCopyCharN(ram->blockmultiple * BLOCKSIZE);
ram->bitpropagator = bitpropagator_new(ram->blockcount, MIN(5, LOG2LL(ram->blockcount)));
ram->blockvector_local = malloc(ram->blockcount * BLOCKSIZE);
flatoram_pma(&ram->blockvector_local, 16, ram->blockcount * BLOCKSIZE);
ram->bitvector_local = malloc(ram->blockcount * sizeof(bool));
ram->blocktemp_local = malloc(ram->blockmultiple * BLOCKSIZE);
ram->activeblock_pair = calloc(2, BLOCKSIZE * sizeof(obliv uint8_t));
......@@ -141,6 +141,8 @@ flatoram* flatoram_new(OcCopy* cpy, void* data, size_t n) {
//Now fill the scanrom with data, if there is data with which to fill it
if (data != NULL) {
//TODO: simplify
obliv uint8_t * loadtemp = calloc(ram->blockcount, ram->blockcpy.eltsize);
get_random_bytes(ram->blocktemp_local, KEYSIZE);
for (size_t ii = 0; ii < KEYSIZE; ii++) ram->blocktemp[ii] = feedOblivChar(ram->blocktemp_local[ii],1);
......
......@@ -28,6 +28,9 @@ void get_random_bytes(void *buf, size_t bytes) {
fclose(fp);
}
int flatoram_pma(void** dst, size_t alignment, size_t size) {
return posix_memalign(dst, alignment, size);
}
// Locking callback
void openmp_locking_callback(int mode, int type, char *file, int line) {
......
......@@ -15,6 +15,7 @@
_a < _b ? _a : _b; })
void get_random_bytes(void *buf, size_t bytes);
int flatoram_pma(void** dst, size_t alignment, size_t size);
typedef void (* generic_function)(void *);
void network_parallelizer(generic_function fn1, generic_function fn2, void* data1, void* data2);
......
......@@ -39,7 +39,7 @@ void scanrom_read_with_bitvector(obliv uint8_t * data, scanrom * rom, obliv size
for (size_t ii = 0; ii < rom->fullblocksize; ii++) rom->blocktemp[2*rom->fullblocksize+ii] ^= feedOblivChar(rom->local_blocktemp[ii], 2);
}
ocCopy(rom->blockcpy, data, &rom->blocktemp[2*rom->fullblocksize]);
~obliv() memset(&rom->blocktemp[rom->fullblocksize] ,0,rom->fullblocksize * sizeof(obliv uint8_t));
~obliv() memset(&rom->blocktemp[rom->fullblocksize], 0, rom->fullblocksize * sizeof(obliv uint8_t));
oaes_ctx * ctx;
......
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