osu-crypto / libOTe

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

Segmentation fault when running silent OT benchmark #106

Closed shashankballa closed 1 year ago

shashankballa commented 1 year ago

I am trying to use silent OT with silver codes. The following is my docker file:

FROM debian:stable
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install \
    -y vim git make g++ cmake libtool python

RUN git clone https://github.com/osu-crypto/libOTe.git
RUN cd libOTe && python build.py --all --boost --sodium
RUN cd libOTe/out/build/linux/frontend/ && ./frontend_libOTe -s -silver

The code is very minimal and follows the build instructions as is, but the test ./frontend_libOTe -s -silver fails with a Segmentation fault. Hope someone can help me fix this.

Thanks

ladnir commented 1 year ago

I'll take a look

shashankballa commented 1 year ago

Hi Peter, I got the silver tests to work with the following dockerfile:

FROM debian:stable

RUN apt-get update \
    && \
    DEBIAN_FRONTEND=noninteractive apt-get install \
        -y vim git make g++ cmake libtool python

RUN git clone https://github.com/osu-crypto/libOTe.git

RUN cd libOTe \
    && \
    git submodule update --init \
    && \
    mkdir -p out/build/linux \
    && \
    cmake -S . -B out/build/linux \
        -DENABLE_ASAN=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DFETCH_AUTO=ON -DENABLE_RELIC=ON -DENABLE_ALL_OT=ON \
        -DENABLE_BOOST=ON -DCOPROTO_ENABLE_BOOST=ON \
        -DENABLE_SILENT_VOLE=ON -DENABLE_BITPOLYMUL=ON \
        -DNO_SILVER_WARNING=ON

RUN cd libOTe \
    && \
    cmake --build out/build/linux

There seems to be an issue in automating the build with the python script. It might be helpful to users if you could add these foolproof instructions as well to your readme.

Thanks

ladnir commented 1 year ago

Hmm, that was supposed to be the point of the python script. Any idea what setting was wrong?

shashankballa commented 1 year ago

I don't have much experience with C++ so I can't pinpoint it. I did notice that the python script was not doing a good job parsing the CMAKE variables, e.g. when I ran python build.py --all --boost --sodium -DENABLE_SIMPLESTOT_ASM=OFF the last CLI arg ENABLE_SIMPLESTOT_ASM was not passed on to the CMAKE build. I confirmed this by running cmake -LAH in out/build/linux/, the output of which showed that ENABLE_SIMPLESTOT_ASM was set to ON.

ladnir commented 1 year ago

ok, the normal build instructions should work. It was an annoying bug that disappeared if you turned c++17 or higher on, which I normally do.