osu-crypto / BaRK-OPRF

Efficient Batched Oblivious PRF with Applications to Private Set Intersection (CCS 2016)
http://eprint.iacr.org/2016/799
The Unlicense
78 stars 35 forks source link

Making without sudo privileges #3

Closed danxinnoble closed 6 years ago

danxinnoble commented 6 years ago

Hi

I'm trying to install BaRK-OPRF on an Ubuntu system on which I do not have sudo privileges. Is this possible?

Here is what I tried. I looked at thirdparty/all_linux.get. I saw that it uses sudo to install certain libraries. Most of these were already installed: $ which bzip2 /bin/bzip2 $ which unzip /usr/bin/unzip $ which m4 /usr/bin/m4

I assume the command "sudo apt-get install gcc-c++" installs g++ and/or gcc, both of which are installed. $ gcc --version gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005 $ g++ --version g++ (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005

The remaining sudo command is to "apt-get install libboost-all-dev". I was not able to run this. But I saw that there seem to be some commands to install libboost locally, so I skipped over this and hoped for the best.

I ran: $ bash all_linux.get I then CTRL-C'ed over all of the sudo commands.

I then navigated to BaRK-OPRF path and ran: $ make

At first I experienced something to the effect of the following error when running all_linux.get: wake.cpp: 34:15 narrowing conversion of "38...420u" from "unsigned int" to "int" inside { } [-Wnarrowing]. When I then tried to run make this resulted in the error: error: "cannot find -lcryptopp" I modified the source file cryptopp/wake.cpp line 26 to make the tt[] array an unsigned int. I then ran make inside the cryptopp directory again. This solved this error.

I then experienced an error when I ran make: error: "cannot find -lboost_filesystem". I modified boost.get, line 15, to include --with-filesystem: ./b2 stage --with-system --with-thread --with-filesystem link=static -mt I removed the boost directory and re-ran boost.get $ bash boost.get This fixed this error.

However when I ran make again I got the following error: /usr/bin/ld: ./thirdparty/linux/miracl/miracl_osmt/source/libmiracl.a(mrcore.o): relocation R_X86_64_32 against symbol `mr_key' can not be used when making a shared object; recompile with -fPIC

For this one I am at a loss. Any ideas what I need to do? Is what I'm trying to do possible?

Note: The reason in my previous question I asked about installing on a vm is that I was having trouble installing on this environment in which I don't have sudo privileges, so I tried first to install on an environment where I did have sudo privileges (a vm).

ladnir commented 6 years ago

Again, I encourage you to use libOTe where such issues have been fixed! No root is required, its maintained, portable, and faster...

Looking at the error that is produced, gcc is telling you to recompile miracl.a with -fPIC. I would start there.

ladnir commented 6 years ago

@nitrieu , maybe you should just push an update to the readme that says this repo is here only for the case when people want to directly compare against the implementation that is used in the paper...

danxinnoble commented 6 years ago

I'm confused...

Does libOTe also include the psi implementation described in https://eprint.iacr.org/2016/799.pdf?

On Tue, Jan 23, 2018 at 7:41 PM, Peter Rindal notifications@github.com wrote:

@nitrieu https://github.com/nitrieu , maybe you should just push an update to the readme that says this repo is here only for the case if people want to directly compare against the implementation that is used in the paper...

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/osu-crypto/BaRK-OPRF/issues/3#issuecomment-359981517, or mute the thread https://github.com/notifications/unsubscribe-auth/AYm6XaXCk_fBoPvztGnbh0xwKxX_CoP5ks5tNnxFgaJpZM4RqhTA .

ladnir commented 6 years ago

Kinda, libPSI does... It is also optimized over this repo.

nitrieu commented 6 years ago

Thanks for your feedback @danxinnoble

If you want to run the project without root, you can build the required library with --prefix. I have updated some common issues when compiling the project on the different system at the ReadMe. I think that you are using version>=6 of g++, thus you met an issue in wake.cpp

The libOTe/kkrt has the implementation of BaRK-OPRF (one-of-out-N OTs). You can also find the psi implemention of 2016/799.pdf here

Note that the above implementation computes PSI without stash bins (I've already mentioned it at README.md )

danxinnoble commented 6 years ago

Hmm. In my case I need the stash bins.

I'll just ask someone with sudo privileges to install the relevant packages.

Thanks for the info.

nitrieu commented 6 years ago

Sorry @danxinnoble. I will update the project that can be built without root when I have time (I am quite busy now).

I think that you can manually install each package with --prefix=$your_folder and then export it into $PATH. https://blog.eduardovalle.com/2015/10/15/installing-software-without-root/

danxinnoble commented 6 years ago

I asked someone with sudo privileges to run the command $ sudo apt-get install libboost-all-dev

However, when I run make in ./BaRK-OPRF I still get the -fPIC error.

If I replace all instances of "g++ -c" with "g++ -c -fPIC" in /miracl/miracl/source/linux64 and run bash miracl.get again, the -fPIC error still happens.

I looked into compiling miracl from source code. But on the instructions for installing miracl on Linux (https://github.com/miracl/MIRACL/blob/master/linux.txt) it seems you already need a certain miracl.zip file, which does not seem to be located anywhere in the miracl repo.

Any ideas?

ladnir commented 6 years ago

@nitrieu It looks like the miracl.get script is broken, it refers to linux64 but only linux64_cpp exists...

@danxinnoble this issue is likely that you are trying to link miracl.a to a shared library? I dont really use shared libraries so its hard to me to help. Can you instead of using a shared library build static libraries and then only link miracl.a when you are linking the execute? Or maybe try to make miracl a shared library?

danxinnoble commented 6 years ago

Bingo!

Looking at the building of the static libraries was along the right lines.

It turns out that running make in BaRK-OPRF calls /thirdparty/linux/miracl/miracl_osmt/source/libmiracl.a But this library is not updated by the miracl.get script. It just comes with the repo.

I'm guessing if the environment is not the same as that in which miracle_osmt/source/libmiracl.a was built in, then something goes wrong.

To make miracl.get update /miracl_osmt/source you need to change lines 5 and 6 of miracl.get to: cd ../../../miracl/miracl_osmt/source bash linux64_cpp

Then I ran: $ bash miracl.get Then I went to miracl_osmt/source, deleted the file libmiracl.a and renamed miracl.a to libmiracl.a.

Then I ran make in the home dir and it worked. I cded to ./Release and ran ./bOPRFmain.exe -t and it produced a good psi result.

Cheers