mirror of
https://github.com/encryptogroup/PSI.git
synced 2024-03-22 13:30:44 +08:00
Debugging
This commit is contained in:
parent
70d49f1871
commit
468ddd6b1e
2
Makefile
2
Makefile
|
@ -72,7 +72,7 @@ bench:
|
|||
demo:
|
||||
${CC} -o demo.exe ${SRC}/mains/psi_demo.cpp ${OBJECTS_DHPSI} ${OBJECTS_OTPSI} ${OBJECTS_NAIVE} ${OBJECTS_SERVERAIDED} ${OBJECTS_UTIL} ${OBJECTS_HASHING} ${OBJECTS_CRYPTO} ${OBJECTS_OT} ${OBJECTS_MIRACL} ${CFLAGS} ${DEBUG_OPTIONS} ${LIBRARIES} ${MIRACL_LIB} ${INCLUDE} ${COMPILER_OPTIONS}
|
||||
|
||||
test:
|
||||
test: core
|
||||
${CC} -o test.exe ${SRC}/mains/test_psi.cpp ${OBJECTS_DHPSI} ${OBJECTS_OTPSI} ${OBJECTS_NAIVE} ${OBJECTS_SERVERAIDED} ${OBJECTS_UTIL} ${OBJECTS_HASHING} ${OBJECTS_CRYPTO} ${OBJECTS_OT} ${OBJECTS_MIRACL} ${CFLAGS} ${DEBUG_OPTIONS} ${LIBRARIES} ${MIRACL_LIB} ${INCLUDE} ${COMPILER_OPTIONS}
|
||||
./test.exe -r 0 -t 10 &
|
||||
./test.exe -r 1 -t 10
|
||||
|
|
|
@ -79,7 +79,7 @@ WARNING: Some tests can still fail since the code is currently being debugged.
|
|||
|
||||
### Generating Random Email Adresses
|
||||
|
||||
Further random email adresses can be generated by navigating to `/sample_sets/emailgenerator/` and invoking:
|
||||
Further random email adresses can be generated by navigating to `sample_sets/emailgenerator/` and invoking:
|
||||
|
||||
```
|
||||
./emailgenerator.py "number_of_emails"
|
||||
|
|
|
@ -35,6 +35,7 @@ typedef struct hashing_state_ctx {
|
|||
uint32_t addrbytelen;
|
||||
uint32_t outbytelen;
|
||||
uint32_t* address_used;
|
||||
uint32_t mask;
|
||||
} hs_t;
|
||||
|
||||
//TODO: generate these randomly for each execution and communicate them between the parties
|
||||
|
@ -102,6 +103,10 @@ static void init_hashing_state(hs_t* hs, uint32_t nelements, uint32_t inbitlen,
|
|||
}
|
||||
//cout << "nhfvals = " << hs->nhfvals << endl;
|
||||
hs->address_used = (uint32_t*) calloc(nbins, sizeof(uint32_t));
|
||||
hs->mask = 0xFFFFFFFF;
|
||||
if(hs->inbytelen < sizeof(uint32_t)) {
|
||||
hs->mask >>= (sizeof(uint32_t) * 8 - hs->inbitlen - hs->addrbitlen);
|
||||
}
|
||||
}
|
||||
|
||||
static void free_hashing_state(hs_t* hs) {
|
||||
|
@ -134,6 +139,8 @@ inline void hashElement(uint8_t* element, uint32_t* address, uint8_t* val, hs_t*
|
|||
//Store the remaining hs->outbitlen bits in R and pad correspondingly
|
||||
R = (*((uint32_t*) element) & SELECT_BITS_INV[hs->addrbitlen]) >> (hs->addrbitlen);
|
||||
|
||||
R &= hs->mask;//mask = (1<<32-hs->addrbitlen)
|
||||
|
||||
|
||||
//assert(R < (1<<hs->outbitlen));
|
||||
//cout << "R = " << R << endl;
|
||||
|
@ -170,7 +177,7 @@ inline void hashElement(uint8_t* element, uint32_t* address, uint8_t* val, hs_t*
|
|||
//TODO copy remaining bits
|
||||
|
||||
//if(hs->outbytelen >= sizeof(uint32_t))
|
||||
if(hs->outbitlen + hs->addrbitlen >= sizeof(uint32_t) * 8) {
|
||||
if(hs->inbitlen > sizeof(uint32_t) * 8) {
|
||||
//memcpy(val + (sizeof(uint32_t) - hs->addrbytelen), element + sizeof(uint32_t), hs->outbytelen - (sizeof(uint32_t) - hs->addrbytelen));
|
||||
memcpy(val + (sizeof(uint32_t) - (hs->addrbitlen >>3)), element + sizeof(uint32_t), hs->outbytelen - (sizeof(uint32_t) - (hs->addrbitlen >>3)));
|
||||
|
||||
|
@ -189,6 +196,7 @@ inline void hashElement(uint8_t* element, uint32_t* address, uint8_t* val, hs_t*
|
|||
cout << (dec) << endl;*/
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
//cout << "Address for hfid = " << hfid << ": " << *address << ", L = " << L << ", R = " << R << endl;
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ int32_t main(int32_t argc, char** argv) {
|
|||
if(role == CLIENT) cout << endl;
|
||||
}
|
||||
|
||||
cout << "All tests successfully passed" << endl;
|
||||
if(role == CLIENT) cout << "All tests successfully passed" << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ uint32_t test_psi_prot(role_type role, CSocket* sock, uint32_t nelements,
|
|||
|
||||
pnelements = set_up_parameters(role, nelements, &elebytelen, &elements, &pelements, sock[0], crypt);
|
||||
|
||||
|
||||
if(role == CLIENT) cout << " (|A|: " << nelements << ", |B|: " << pnelements << ", b: " << elebytelen << "): " << std::flush;
|
||||
|
||||
|
||||
p_inter_size = plaintext_intersect(nelements, pnelements, elebytelen, elements, pelements,
|
||||
|
@ -102,13 +102,13 @@ uint32_t test_psi_prot(role_type role, CSocket* sock, uint32_t nelements,
|
|||
cout << "\t" << ot_inter_size << " elements in OT intersection" << endl;
|
||||
|
||||
cout << "Plaintext intersection (" << p_inter_size << "): " << endl;
|
||||
plot_set(p_intersection, p_inter_size, elebytelen);
|
||||
//plot_set(p_intersection, p_inter_size, elebytelen);
|
||||
cout << "Naive intersection (" << n_inter_size << "): " << endl;
|
||||
plot_set(n_intersection, n_inter_size, elebytelen);
|
||||
//plot_set(n_intersection, n_inter_size, elebytelen);
|
||||
cout << "DH intersection (" << dh_inter_size << "): " << endl;
|
||||
plot_set(dh_intersection, dh_inter_size, elebytelen);
|
||||
//plot_set(dh_intersection, dh_inter_size, elebytelen);
|
||||
cout << "OT intersection: (" << ot_inter_size << "): " << endl;
|
||||
plot_set(ot_intersection, ot_inter_size, elebytelen);
|
||||
//plot_set(ot_intersection, ot_inter_size, elebytelen);
|
||||
}
|
||||
|
||||
if(p_inter_size > 0)
|
||||
|
@ -123,7 +123,6 @@ uint32_t test_psi_prot(role_type role, CSocket* sock, uint32_t nelements,
|
|||
assert(success);
|
||||
}
|
||||
|
||||
|
||||
free(elements);
|
||||
free(pelements);
|
||||
|
||||
|
@ -220,8 +219,6 @@ uint32_t set_up_parameters(role_type role, uint32_t myneles, uint32_t* mybytelen
|
|||
sock.Send(*elements, myneles * *mybytelen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//memset(*elements, 0x00, *mybytelen);
|
||||
//memset(*pelements, 0x00, *mybytelen);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user