Giter Club home page Giter Club logo

gazelle_mpc's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gazelle_mpc's Issues

parameters meaning

we con't understand some parameters in your code,such as n_circ.could you please add annotates?

Segmentation fault

When I try to run the conv1d-benchmark, I get a segmentation fault. This is the command line output:

~/test_gazelle/gazelle_mpc$ ./bin/demo/ahe/conv1d-benchmark
NN Layers Benchmark (ms):
KeyGen (3 keys): 6.5802
Preprocess Vector (2 windows): 0.62092
Preprocess Filter: 0.930723
Segmentation fault (core dumped)

Do you have any idea what goes wrong here? Thanks

PS: I build gazelle as you instruct and the other demo scrips work fine

How to deal with fixed-point weights and inputs?

I understand there does not seem to be any code in this library for loading neural network weights and running inference.

I could implement this myself, but I am unsure how I am supposed to deal with rational numbers, since all the examples work on random integers. Naively, I would store the weights and inputs in integer variables, keep track of a scaling factor for each weight and input, and then finally interpret the result as a fixed point number, where the scaling factor is the product of the scaling factors for each weight.

It would be awesome if someone could confirm, whether this is somewhat correct.

undefined reference to boost::system::system_category()

Hi chiraag, I'm trying to compile gazelle on ubuntu 20.04 LTS. But there is a problem when I use make -j8. I have Installed cryptotools successfully. My boost version is 1.64.0. I get the following log.

/home/project/gazelle/gazelle_mpc# make -j8
 -- core:linking bin/lib/libgazelle.so from COREOBJECTS
mkdir -p bin/lib
g++ -std=c++14 -fPIC -fPIC -shared -Wl,--export-dynamic,-z,defs -Lthird_party/cryptoTools/thirdparty/linux/miracl/miracl/source -Lthird_party/cryptoTools/lib -o bin/lib/libgazelle.so src/bin/lib/gc/aescircuits.o src/bin/lib/gc/circuits.o src/bin/lib/gc/common.o src/bin/lib/gc/gates.o src/bin/lib/gc/gazelle_circuits.o src/bin/lib/gc/gc.o src/bin/lib/gc/util.o src/bin/lib/math/automorph.o src/bin/lib/math/bit_twiddle.o src/bin/lib/math/discretegaussiangenerator.o src/bin/lib/math/distributiongenerator.o src/bin/lib/math/nbtheory.o src/bin/lib/math/params.o src/bin/lib/math/transfrm.o src/bin/lib/ot/cot_recv.o src/bin/lib/ot/cot_send.o src/bin/lib/ot/sr_base_ot.o src/bin/lib/ot/tools.o src/bin/lib/pke/conv1d.o src/bin/lib/pke/conv2d.o src/bin/lib/pke/encoding.o src/bin/lib/pke/fv.o src/bin/lib/pke/gemm.o src/bin/lib/pke/layers.o src/bin/lib/pke/mat_mul.o src/bin/lib/pke/square.o src/bin/lib/utils/debug.o src/bin/lib/utils/network.o src/bin/lib/utils/test.o -pthread -lcryptoTools -lmiracl -lboost_system -lboost_thread 
/usr/bin/ld: src/bin/lib/gc/aescircuits.o: in function `_GLOBAL__sub_I_aescircuits.cpp':
aescircuits.cpp:(.text.startup+0x35): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: aescircuits.cpp:(.text.startup+0x3a): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: aescircuits.cpp:(.text.startup+0x3f): undefined reference to `boost::system::system_category()'
......
SocketAdapter.cpp:(.text.startup._GLOBAL__sub_I_SocketAdapter.cpp+0x6): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: SocketAdapter.cpp:(.text.startup._GLOBAL__sub_I_SocketAdapter.cpp+0xb): undefined reference to `boost::system::generic_category()'
/usr/bin/ld: SocketAdapter.cpp:(.text.startup._GLOBAL__sub_I_SocketAdapter.cpp+0x10): undefined reference to `boost::system::system_category()'
/usr/bin/ld: SocketAdapter.cpp:(.text.startup._GLOBAL__sub_I_SocketAdapter.cpp+0x15): undefined reference to `boost::system::system_category()'
/usr/bin/ld: third_party/cryptoTools/thirdparty/linux/miracl/miracl/source/libmiracl.a(mrcore.o): relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make: *** [Makefile.src:37: bin/lib/libgazelle.so] Error 1

One of the most common solutions is to add -lboost_system flag, but the flag was added.
g++ -std=c++14 -fPIC -fPIC -shared -Wl,--export-dynamic,-z,defs -Lthird_party/cryptoTools/thirdparty/linux/miracl/miracl/source -Lthird_party/cryptoTools/lib -o bin/lib/libgazelle.so src/bin/lib/gc/aescircuits.o src/bin/lib/gc/circuits.o src/bin/lib/gc/common.o src/bin/lib/gc/gates.o src/bin/lib/gc/gazelle_circuits.o src/bin/lib/gc/gc.o src/bin/lib/gc/util.o src/bin/lib/math/automorph.o src/bin/lib/math/bit_twiddle.o src/bin/lib/math/discretegaussiangenerator.o src/bin/lib/math/distributiongenerator.o src/bin/lib/math/nbtheory.o src/bin/lib/math/params.o src/bin/lib/math/transfrm.o src/bin/lib/ot/cot_recv.o src/bin/lib/ot/cot_send.o src/bin/lib/ot/sr_base_ot.o src/bin/lib/ot/tools.o src/bin/lib/pke/conv1d.o src/bin/lib/pke/conv2d.o src/bin/lib/pke/encoding.o src/bin/lib/pke/fv.o src/bin/lib/pke/gemm.o src/bin/lib/pke/layers.o src/bin/lib/pke/mat_mul.o src/bin/lib/pke/square.o src/bin/lib/utils/debug.o src/bin/lib/utils/network.o src/bin/lib/utils/test.o -pthread -lcryptoTools -lmiracl -lboost_system -lboost_thread
Do you have any suggestions? Thank you in advance.

Possible incorrect implementation of FV Encryption?

The actual encryption function should multiply the polynomials, but seems the code is performing coefficient-wise multiply

for(ui32 i=0; i<params.phim; i++){
if(params.fast_modulli){
ct.a[i] = opt::modq_full(opt::mul_modq_part(pk.a[i], u[i]) + ea[i]);
ct.b[i] = opt::modq_full(opt::mul_modq_part(pk.b[i], u[i]) + ct.b[i]);
} else {
ct.a[i] = mod(mod_mul(pk.a[i], u[i], params.q) + ea[i], params.q);
ct.b[i] = mod(mod_mul(pk.b[i], u[i], params.q) + ct.b[i], params.q);
}
}

Type of OT used?

Did you use regular (chosen) OT or correlated OT for the OT extension in your implementation? The code for IKNPSender::send seems to implement regular (chosen) OT, but also labels the OT extension files "cot_recv" and "cot_send", and "cot" is often used to represent correlated OT. cot_send.h also has a set_delta function and a block mDelta variable which I think are used with correlated OT, but the library never seems to use either of these.

Thanks!

bug in SHLCircuit() and SHRCircuit()

Hi, I think there is a bug in SHLCircuit() and SHRCircuit() functions in src/lib/gc/circuits.cpp:

in SHLCircuit():
for(ui64 i=shift; i<n; i++){
out[i] = in[i-1];
}
should be
for(ui64 i=shift; i<n; i++){
out[i] = in[i-shift];
}

and in SHRCircuit():
for(ui64 i=0; i<(n-shift); i++){
out[i] = in[i+1];
}

should be :
for(ui64 i=0; i<(n-shift); i++){
out[i] = in[i+shift];
}

Otherwise, the shift won't be performed correctly

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.