Skip to content

Commit

Permalink
working with SEAL 2.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
sga001 committed Aug 20, 2018
1 parent 97b9b10 commit 5b60d18
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1,844 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "SealPIR"]
path = SealPIR
url = https://github.com/sga001/SealPIR.git
[submodule "sealpir"]
path = sealpir
url = https://github.com/microsoft/sealpir.git
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = ["Sebastian Angel <sebs@cs.utexas.edu>"]

[build-dependencies]
gcc = "0.3.54"
cmake = "0.1.33"

[dependencies]
libc = "0.2.42"
Expand Down
34 changes: 3 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,13 @@

SealPIR is a research library and should not be used in production systems. SealPIR allows a client to download an element from a database stored by a server without revealing which element was downloaded. SealPIR was introduced in our [paper](https://eprint.iacr.org/2017/1142.pdf).

SealPIR relies on SEAL v2.3.1. The rest of this README assumes that the SEAL v2.3.1 source code is placed in the folder
deps/SEAL_2.3.1 within this repository. You can get SEAL v2.3.1 from this [link](http://sealcrypto.org).

SealPIR relies on SEAL. The rest of this README assumes that SEAL is installed in the folder deps/SEAL within this repository. See below for instructions on how to install SEAL.

# Compiling SEAL

SealPIR depends on SEAL v2.3.0-4 and a patch that exposes the substitution operator. You can get SEAL v2.3.0-4 from this [link](http://sealcrypto.org).

Once you have downloaded SEAL, apply the patch SEAL_v2.3.0-4.patch (available in this repository) to it. Here are the exact steps.

We assume that you are in the SEAL directory, and that you have copied the patch to this directory.

First, convert the SEAL directory into a git repo:

```sh
$ git init
$ git add .
$ git commit -m "SEAL v2.3.0-4"
```
Then, apply the patch:

```sh
$ git am SEAL_v2.3.0-4.patch
```

Finally, compile SEAL (NOTE: gcc-8 is not currently supported):

```sh
$ cd SEAL
$ ./configure CXXFLAGS="-O3 -march=native -fPIC"
$ make clean && make
```

# Compiling SealPIR-Rust

SealPIR's Rust wrapper works with [Rust](https://www.rust-lang.org/) nightly (we have tested with Rust 1.28.0). It also depends on the C++ version of SealPIR (included as a submodule) and SEAL (see above).
SealPIR's Rust wrapper works with [Rust](https://www.rust-lang.org/) nightly (we have tested with Rust 1.30.0). It also depends on the C++ version of SealPIR (included as a submodule) and SEAL (see above). We have tested these versions with g++ 8.1.0.

To compile SealPIR-Rust just do:

Expand Down
1,801 changes: 0 additions & 1,801 deletions SEAL_v2.3.0-4.patch

This file was deleted.

1 change: 0 additions & 1 deletion SealPIR
Submodule SealPIR deleted from d82128
22 changes: 14 additions & 8 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
extern crate gcc;
extern crate cmake;

use std::env;

fn main() {
gcc::Build::new()
.file("SealPIR/pir.cpp")
.file("SealPIR/pir_server.cpp")
.file("SealPIR/pir_client.cpp")
.file("sealpir/pir.cpp")
.file("sealpir/pir_server.cpp")
.file("sealpir/pir_client.cpp")
.file("sealpir-bindings/pir_rust.cpp")
.include("sealpir-bindings/")
.include("SealPIR/")
.include("deps/SEAL/SEAL/")
.include("sealpir/")
.include("deps/SEAL_2.3.1/SEAL/")
.flag("-Wno-unknown-pragmas")
.flag("-Wno-sign-compare")
.flag("-Wno-unused-parameter")
.flag("-std=c++11")
.flag("-std=c++17")
.flag("-fopenmp")
.pic(true)
.cpp(true)
.compile("libsealpir.a");

let link_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
// Compile and link SEAL
let dst = cmake::Config::new("deps/SEAL_2.3.1/SEAL/")
// .define("CMAKE_BUILD_TYPE", "Release")
.define("CMAKE_POSITION_INDEPENDENT_CODE", "ON")
.build();

println!("cargo:rustc-link-search={}/deps/SEAL/bin/", link_dir);
println!("cargo:rustc-link-search={}/lib/", dst.display());
println!("cargo:rustc-link-lib=static=seal");
}
1 change: 1 addition & 0 deletions sealpir
Submodule sealpir added at 603ab7

0 comments on commit 5b60d18

Please sign in to comment.