Skip to content

Instantly share code, notes, and snippets.

@samee
Created June 10, 2014 02:41
Show Gist options
  • Save samee/bced02440c64ba76bef8 to your computer and use it in GitHub Desktop.
Save samee/bced02440c64ba76bef8 to your computer and use it in GitHub Desktop.
highest example patch
diff --git a/test/oblivc/highest/highest.h b/test/oblivc/highest/highest.h
index 8618e93..e03b51e 100644
--- a/test/oblivc/highest/highest.h
+++ b/test/oblivc/highest/highest.h
@@ -4,12 +4,10 @@
typedef struct protocolIO
{
- int i[100];
+ int i[MAXN];
int n;
int res;
} protocolIO;
void highest(void* args);
-
-const char* mySide();
diff --git a/test/oblivc/highest/highest.oc b/test/oblivc/highest/highest.oc
index c3c8433..4ac71f5 100644
--- a/test/oblivc/highest/highest.oc
+++ b/test/oblivc/highest/highest.oc
@@ -5,13 +5,12 @@
//dest is the pointer to the array of obliv ints
//n is the size of the array
//src is where the data is coming from
-void readValues(obliv int* dest,const int* src,int party)
+void readValues(obliv int* dest, int n, const int* src,int party)
{
OblivInputs specs[MAXN];
int i;
- for( i = 0;i<MAXN;++i)
- setupOblivInt(specs+i,dest+i,src[i]);
- feedOblivInputs(specs,MAXN,party);
+ for(i=0;i<n;++i) setupOblivInt(specs+i,dest+i,src[i]);
+ feedOblivInputs(specs,n,party);
}
void highest(void* args){
@@ -21,8 +20,8 @@ void highest(void* args){
obliv int i1[MAXN], i2[MAXN];
n1 = feedOblivInt(io->n, 1);
n2 = feedOblivInt(io->n, 2);
- readValues(i1,io->i, 1);
- readValues(i2,io->i, 2);
+ readValues(i1,MAXN,io->i, 1);
+ readValues(i2,MAXN,io->i, 2);
//runs the actual algorithm of higher value
obliv int high = i1[0];
for(k=0; k<MAXN; k++){
@@ -36,4 +35,4 @@ void highest(void* args){
high = i2[j];
}
revealOblivInt(&io->res,high,0);
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment