osu-crypto / libOTe

A fast, portable, and easy to use Oblivious Transfer Library
Other
428 stars 107 forks source link

VOLE genSilentBaseOts doesn't run properly #103

Closed alpnn closed 1 year ago

alpnn commented 1 year ago

Please check the below code. The Program exited with non 0 and doesn't print suceeded in both processes.

# Program output
configuration done
configuration done
#include "oprf.hpp"
#include <unistd.h>
#include <sys/wait.h>

void oprf_send(cp::AsioSocket &as, int numOTs) {
    PRNG prng(sysRandomSeed());
    SilentVoleSender sndr;
    sndr.configure(numOTs);
    std::cout << "configuration done" << std::endl;
    cp::sync_wait(sndr.genSilentBaseOts(prng, as));
    std::cout << "suceeded" << std::endl;
    cp::sync_wait(as.flush());
}

void oprf_receive(cp::AsioSocket &as, int numOTs) {
    PRNG prng(sysRandomSeed());
    SilentVoleReceiver recv;
    recv.configure(numOTs);
    std::cout << "configuration done" << std::endl;
    cp::sync_wait(recv.genSilentBaseOts(prng, as));
    std::cout << "suceeded" << std::endl;
    cp::sync_wait(as.flush());
}

int main(void) {
    pid_t p1, p2, wpid;
    if((p1 = fork()) == 0) {
        auto as = cp::asioConnect("127.0.0.1:12600", 0);
        oprf_send(as, 1 << 20);
        return 0;
    }
    if((p2 = fork()) == 0) {
        auto as = cp::asioConnect("127.0.0.1:12600", 1);
        oprf_receive(as, 1 << 20);
        return 0;
    }
    int status;
    while((wpid = wait(&status)) > 0) {
        if(status != 0) {
            return status;
        }
    };
}
ladnir commented 1 year ago

Looks correct. Maybe try to attach a debugger