Coder Social home page Coder Social logo

cryptobiu / libscapi Goto Github PK

View Code? Open in Web Editor NEW
179.0 179.0 64.0 281.97 MB

Comprehensive Open Source Library for Secure Multiparty Computation

License: MIT License

C++ 52.74% C 7.06% Shell 2.02% CMake 0.17% Makefile 0.21% Assembly 28.22% HTML 9.47% M4 0.01% PowerShell 0.01% Dockerfile 0.01% Java 0.09%

libscapi's People

Contributors

abarak-biu avatar amiller avatar asafkleinbort avatar fabrice102 avatar hros avatar ishaq avatar levymeit avatar liorko87 avatar moriyaw avatar ran-proshan avatar ruth1993 avatar schoppmp avatar

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  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  avatar  avatar  avatar  avatar  avatar  avatar

libscapi's Issues

DamgardJurik Encryption Incorrect Results

I wrote a short program to test DamgardJurik homomorphic encryption operations, but the results seem to be unstable. The code has been enclosed. I compiled the code and ran several times without any modification. The results are as follows, sometimes the result is correct, but sometimes it returns a big number or just corrupts with information "Sizes of ciphertexts do not match".

xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 857489264902169263442986642532019006464198707881808385057494651564759059744
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 7613194334867773861088025509117736357398436373830484580326431442625258663984
terminate called after throwing an instance of 'std::invalid_argument'
what(): Sizes of ciphertexts do not match
Aborted (core dumped)
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 1091673282608333264355044839660329762660415024419661640799801461129230991879
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
terminate called after throwing an instance of 'std::invalid_argument'
what(): Sizes of ciphertexts do not match
Aborted (core dumped)

I do not know what is the problem. Any help or advice would be appreciated. Thank you.
Test Code(1).pdf

Cannot compile the code

Describe the bug

  1. Folder "test" doesn't exist in libscapi folder, so I go to folder "tests" instead. However, I cannot run "make" command and there is no ./tests.exe to build and run the test.
    image
  2. I cannot build and run the simples program because there is no samples folder as mentioned in the documentation.
    image
  3. I try to run and compile DlogExample.cpp which provide in the tutorial section. However, it cannot compile because it said that "scapi.a: No such file or directory".
    image

I would be really appreciated if you help me solve issues. Thank you

Machine details (please complete the following information):

  • OS: Ubuntu
  • Version 16.04

OpenSSL & MacOS Build Process

Are there any plans to update the install instructions for macos Mojave? I recently updated, but now, when I tried to re-compile libscapi with the install instructions listed here, the brew link openssl step returns the following error:

Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
  echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set:
  export LDFLAGS="-L/usr/local/opt/openssl/lib"
  export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

I have put each of those export statements in my .bash_profile and I've made sure that /usr/local/opt/openssl/bin comes before all other directories in the PATH.

I've also tried linking manually (according to this stackoverflow page), to no avail:

brew update    
brew install openssl    
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/    
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

From what glean off forums, it might be that macos Mojave has it's own ssl library and that brew doesn't have the credentials to make openssl a default (even with the brew link --force option.) If I try to compile libscapi without first linking openssl, the compilation will progress for a while, and then it will terminate with the following error:

ecp_nistp224.c:43:9: error: unknown type name '__uint128_t'
typedef __uint128_t uint128_t;  /* nonstandard; implemented by gcc on 64-bit
        ^
ecp_nistp224.c:460:33: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
        (((widelimb) 1) << 104) - (((widelimb) 1) << 64);
                                ^
ecp_nistp224.c:456:51: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two120 = ((widelimb) 1) << 120;
                                                  ^  ~~~
ecp_nistp224.c:457:55: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two120m64 = (((widelimb) 1) << 120) -
                                                      ^  ~~~
ecp_nistp224.c:458:25: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 64);
                        ^  ~~
ecp_nistp224.c:459:59: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two120m104m64 = (((widelimb) 1) << 120) -
                                                          ^  ~~~
ecp_nistp224.c:460:25: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 104) - (((widelimb) 1) << 64);
                        ^  ~~~
ecp_nistp224.c:460:51: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 104) - (((widelimb) 1) << 64);
                                                  ^  ~~
ecp_nistp224.c:486:60: warning: overflow in expression; result is 2147483392 with type 'int' [-Winteger-overflow]
    static const widelimb two64m8 = (((widelimb) 1) << 64) -
                                                           ^
ecp_nistp224.c:484:53: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two64p8 = (((widelimb) 1) << 64) +
                                                    ^  ~~
ecp_nistp224.c:486:53: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two64m8 = (((widelimb) 1) << 64) -
                                                    ^  ~~
ecp_nistp224.c:488:56: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two64m48m8 = (((widelimb) 1) << 64) -
                                                       ^  ~~
ecp_nistp224.c:489:25: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 48) - (((widelimb) 1) << 8);
                        ^  ~~
ecp_nistp224.c:572:32: warning: overflow in expression; result is -2147483648 with type 'int' [-Winteger-overflow]
        (((widelimb) 1) << 71) - (((widelimb) 1) << 55);
                               ^
ecp_nistp224.c:567:55: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two127p15 = (((widelimb) 1) << 127) +
                                                      ^  ~~~
ecp_nistp224.c:569:55: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two127m71 = (((widelimb) 1) << 127) -
                                                      ^  ~~~
ecp_nistp224.c:570:25: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 71);
                        ^  ~~
ecp_nistp224.c:571:58: warning: shift count >= width of type [-Wshift-count-overflow]
    static const widelimb two127m71m55 = (((widelimb) 1) << 127) -
                                                         ^  ~~~
ecp_nistp224.c:572:25: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 71) - (((widelimb) 1) << 55);
                        ^  ~~
ecp_nistp224.c:572:50: warning: shift count >= width of type [-Wshift-count-overflow]
        (((widelimb) 1) << 71) - (((widelimb) 1) << 55);
                                                 ^  ~~
ecp_nistp224.c:584:35: warning: shift count >= width of type [-Wshift-count-overflow]
    output[3] += (in[6] & 0xffff) << 40;
                                  ^  ~~
ecp_nistp224.c:588:35: warning: shift count >= width of type [-Wshift-count-overflow]
    output[2] += (in[5] & 0xffff) << 40;
                                  ^  ~~
ecp_nistp224.c:592:39: warning: shift count >= width of type [-Wshift-count-overflow]
    output[1] += (output[4] & 0xffff) << 40;
                                      ^  ~~
ecp_nistp224.c:596:28: warning: shift count >= width of type [-Wshift-count-overflow]
    output[3] += output[2] >> 56;
                           ^  ~~
ecp_nistp224.c:599:27: warning: shift count >= width of type [-Wshift-count-overflow]
    output[4] = output[3] >> 56;
                          ^  ~~
ecp_nistp224.c:607:39: warning: shift count >= width of type [-Wshift-count-overflow]
    output[1] += (output[4] & 0xffff) << 40;
                                      ^  ~~
ecp_nistp224.c:611:28: warning: shift count >= width of type [-Wshift-count-overflow]
    output[1] += output[0] >> 56;
                           ^  ~~
ecp_nistp224.c:614:28: warning: shift count >= width of type [-Wshift-count-overflow]
    output[2] += output[1] >> 56;
                           ^  ~~
ecp_nistp224.c:617:28: warning: shift count >= width of type [-Wshift-count-overflow]
    output[3] += output[2] >> 56;
                           ^  ~~
28 warnings and 1 error generated.
make[3]: *** [ecp_nistp224.o] Error 1
make[2]: *** [subdirs] Error 1
make[1]: *** [build_crypto] Error 1
make: *** [compile-openssl] Error 2

How could I remedy this? Any help at all would be much appreciated.

Boost error when running communication example from tutorial

Hello,

I'm trying to set up communication channels for two parties using the tutorial and code provided by https://biulibscapi.readthedocs.io/en/latest/quickstart.html (the part on Establishing Secure Communication). The problem is that it's not clear to me how I should compile, because when I compile, it works, but then when I try to run it, it gives me the following error:

error while loading shared libraries libboost_system.so:1.64.0: cannot open shared object file

I'm using the following line to compile:

g++ communication.cpp -I/home/name -I/home/name/boost_1_64_0 -std=c++14 ../libscapi/libscapi.a -ldl -lboost_log -lboost_system -lboost_thread -lboost_serialization -lboost_filesystem -L/home/name/boost_1_64_0/stage/lib -lssl -lcrypto -lgmp -lpthread

The example files in the folder libscapi/examples are working though, so I've already tried looking at the makefile to see what is in there, but it would be very helpful for beginning users like me to show how to compile. :) Thanks in advance!

Kind regards, Ruth

Adapt circuit to your format

Hi,
I'm trying to adapt this circuit:
https://www.cs.bris.ac.uk/Research/CryptographySecurity/MPC/comparator_32bit_signed_lt.txt

to the format of your library. However, I tried this:

300 2
1 32
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

2 32
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

1 1
363
2 1
363

But I got segmentation fault. Any idea of my error? Can you help me with this?

Error using AND compositions for Sigma protocols

Hello,

Could anyone help me with the following problem? I want to use AND compositions for Sigma protocols, but I'm getting the following error:

src/primitives/Dlog.cpp:414: virtual void ECElementSendableData::initFromString(const string&): Assertion str_vec.size() == 2' failed.`

This is my (simplified) code:

Prover class:

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();
vector<shared_ptr<SigmaProverComputation>> provers;

provers.push_back(make_shared<SigmaDlogProverComputation>(dlog, 40));

ZKFromSigmaProver prover(channel, make_shared<SigmaANDProverComputation>(provers, 40));
biginteger q = dlog->getOrder();
biginteger r = 5;
auto co1 = dlog->exponentiate(g.get(), r);

vector<shared_ptr<SigmaProverInput>> inputs;

inputs.push_back(make_shared<SigmaDlogProverInput>(co1, r));

shared_ptr<SigmaMultipleProverInput> input = make_shared<SigmaMultipleProverInput>(inputs);
prover.prove(input);

Verifier class:

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();

vector<shared_ptr<SigmaVerifierComputation>> verifiers;

biginteger r = 5;
auto co1 = dlog->exponentiate(g.get(), r);

verifiers.push_back(make_shared<SigmaDlogVerifierComputation>(dlog, 40, get_seeded_prg()));

ZKFromSigmaVerifier verifier(channel, make_shared<SigmaANDVerifierComputation>(verifiers, 40), get_seeded_prg());

vector<shared_ptr<SigmaProtocolMsg>> msgAs;
vector<shared_ptr<SigmaProtocolMsg>> msgZs;

msgAs.push_back(make_shared<SigmaGroupElementMsg(dlog->getIdentity()->generateSendableData()));
msgZs.push_back(make_shared<SigmaBIMsg>());

auto msgA = make_shared<SigmaMultipleMsg>(msgAs);
auto msgZ = make_shared<SigmaMultipleMsg>(msgZs);

vector<shared_ptr<SigmaCommonInput>> inputs;

inputs.push_back(make_shared<SigmaDlogCommonInput>(co1));

shared_ptr<SigmaMultipleCommonInput> input = make_shared<SigmaMultipleCommonInput>(inputs);
			
cout << "verified: " << verifier.verify(input.get(), msgA, msgZ) << endl;

It goes wrong at line 109 of ZeroKnowledge.cpp. For some reason it is not able to interpret the incoming message as an element of the dlog group. However, when I use a dlog object based on primes instead of elliptic curves, it works fine. Also when I remove the AND compositions and execute the following code, it works perfectly, so I don't know if the problem really lies in the use of elliptic curves (because the error points me in that direction) or the AND compositions.

Prover class (with AND compositions removed, so "standard" dlog sigma protocol):

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();
ZKFromSigmaProver prover(channel, make_shared<SigmaDlogProverComputation>(dlog, 40));
biginteger q = dlog->getOrder();
biginteger r = 5;
auto co = dlog->exponentiate(g.get(), r);
shared_ptr<SigmaDlogProverInput> input = make_shared<SigmaDlogProverInput>(co, r);

prover.prove(input);

Verifier class:

auto dlog = make_shared<OpenSSLDlogECF2m>("K-233");
auto g = dlog->getGenerator();
ZKFromSigmaVerifier verifier(channel, make_shared<SigmaDlogVerifierComputation>(dlog, 40, get_seeded_prg()), get_seeded_prg());
auto msgA = make_shared<SigmaGroupElementMsg>(dlog->getIdentity()->generateSendableData());
auto msgZ = make_shared<SigmaBIMsg>();
auto co = dlog->exponentiate(g.get(), 5);
shared_ptr<SigmaDlogCommonInput> input = make_shared<SigmaDlogCommonInput>(co);

cout << verifier.verify(input.get(), msgA, msgZ) << endl;

If anyone could help me out, that would be great. :) Thanks in advance!

Kind regards, Ruth

Boost status in the build is a tad unclear

In the installation guide for Linux, you mention Boost 1.60 must be installed.

However, during the build of libscapi an embedded Boost 1.64 is installed...

I therefore tried not to install the external Boost library (i.e. the 1.60 version); in this case all compiles well... until I try the sample compilation, which complains about the lack of Boost serialization. I checked, and indeed only a subset of Boost libraries is installed, with serialization omitted:

screen shot 2017-12-26 at 09 21 12

Wouldn't it be cleaner to omit the Boost 1.60 step and add serialization (and potentially other required Boost modules) in the libscapi build?

Android compile

Hi,

Anyone is working in integrate this in Android?

Thanks.

Cannot use DamgardJurik encryption

I tried to use the DamgardJurik encryption (not exactly follow the documentation, just to test encryption and decryption now), the code is as follows:

#include
#include <libscapi/include/mid_layer/DamgardJurikEnc.hpp>
int main(int argc, char* argv[]) {
// create a DamgardJurik encryption object
DamgardJurikEnc encryptor;

// generate a key pair using the object
DJKeyGenParameterSpec spec(128, 40);
auto pair = encryptor.generateKey(spec);
encryptor.setKey(pair.first, pair.second);

// create a plaintext
BigIntegerPlainText plaintext("123");
shared_ptr<Plaintext> sharePlaintext = make_shared(plaintext);
shared_ptr cipher = encryptor.encrypt(sharePlaintext);
shared_ptr<Plaintext> plain = encryptor.decrypt(cipher.get());
std::cout<<"Decrypted plaintext is: "<<plain.get()<<std::endl;
return 0;
}

I compile the code, but received an error:

DJPaillierExamples.cpp: In function ‘int main(int, char**)’:
DJPaillierExamples.cpp:15:43: error: no matching function for call to ‘DamgardJurikEnc::generateKey(DJKeyGenParameterSpec&)’
auto pair = encryptor.generateKey(spec);

Actually the code inspection noticed: "No matching member function for call to "generateKey", candidate function not viable: requires 0 arguments, but 1 was provided."

I am not sure whether I used it correctly. Any advice would be appreciated. Thank you.

get error when following the Tutorials on https://biulibscapi.readthedocs.io/en/latest/quickstart.html

Describe the bug
A clear and concise description of what the bug is.
when following the step and compile the first example successfully, I get an error
terminate called after throwing an instance of 'char const.

after a few testing, I found that the error was causedby inti an new class OpenSSLDlogECF2m on the first line.

and after audit the source code, I notice that class OpenSSLDlogECF2m need three parameters,
in include/primitives/DlogOpenSSL.hpp line 220:
void init(string fileName, string curveName, const shared_ptr & random) override;

But after passing three parameters to this class I still get the same error.what can I do?

Machine details (please complete the following information):
Directly, I'm on ubuntn 18.04 using Docker image of libscapi

Cannot be installed on windows (missing libraries)

Hello, I am trying to install this library on windows and I am following the exact structures mentioned in https://biulibscapi.readthedocs.io/en/latest/install.html#installing-libscapi-windows.

  1. I installed, git, Visual Studio 2019, open ssl, and boost binaries for windows.
  2. I cloned libscapi from GitHub.

And here comes my problem: in the next step it says:
Build Miracl for windows 64:
Open solution MiraclWin64.sln at: C:\code\libscapi\lib\MiraclCompilation
Build the solution once for debug and once for release.

But when I go to C:\code\libscapi\lib there is no such a file (MiraclCompilation) and also there is no any MiraclWin64.sln. I have the same problem for other libraries (NTL-WIN64.sln, OTExtension.sln, etc).
I would really appreciate if you could help me with this problem as soon as possible.

Double-free issues in generateSendableData() methods

Many of the classes defined in include/CryptoInfra/PlainText.hpp that derive from NetworkSerialized override the generateSendableData() in the following way:

shared_ptr<AsymmetricCiphertextSendableData> generateSendableData() {
	return shared_ptr<AsymmetricCiphertextSendableData>(this);
}

See class BigIntegerCiphertext for an example.

The problem here is that this method wraps a pointer to an existing object in a shared_ptr. Thus, when the pointer returned by generateSendableData() goes out of scope, it frees the object pointed to by this, even if it is still accessible. Then, when the original object goes out of scope, it gets freed again, resulting in a double-free error.

A minimal example:

#include "CryptoInfra/PlainText.hpp"
#include <iostream>

int main() {
    auto a = BigIntegerCiphertext(3);
    std::cout << a.generateSendableData() << "\n";
    std::cout << a.toString() << "\n";
}

A possible fix would be to pass an empty destructor to the shared_ptr constructor, so that it doesn't delete anything when going out of scope:

shared_ptr<AsymmetricCiphertextSendableData> generateSendableData() {
	return shared_ptr<AsymmetricCiphertextSendableData>(this, [](void*){});
}

That way, implementations of generateSendableData() that actually allocate memory can still manage it using a shared_ptr, but those that don't (such as BigIntegerCiphertext) will not cause double-free errors.
However, I'm not sure if some other part of your code somehow relies on the object being destroyed after calling generateSendableData(). If that's not the case, I can open a pull request that fixes the issue as described above.

error on making libscapi

When I'm trying to make the project I got:


Install the project...
-- Install configuration: ""
-- Installing: /usr/local/include/relic/relic.h
CMake Error at cmake_install.cmake:36 (file):
  file INSTALL cannot copy file
  "/home/patriciarvsousa/test/libscapi/build/EMP/relic/include/relic.h" to
  "/usr/local/include/relic/relic.h".


Makefile:71: recipe for target 'install' failed
make[1]: *** [install] Error 1
make[1]: Leaving directory '/home/patriciarvsousa/test/libscapi/build/EMP/relic'
makefile:67: recipe for target 'pr

Make examples error

error when cd examples && make

In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/c++allocator.h:33:0,
                 from /usr/include/c++/7/bits/allocator.h:46,
                 from /usr/include/c++/7/string:41,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/boost/random/additive_combine.hpp:19,
                 from /usr/include/boost/random.hpp:36,
                 from /home/g/install/libscapi-master/examples/Commitment/../../include/interactive_mid_protocols/../infra/Common.hpp:33,
                 from /home/g/install/libscapi-master/examples/Commitment/../../include/interactive_mid_protocols/RandomValue.hpp:30,
                 from /home/g/install/libscapi-master/examples/Commitment/../../include/interactive_mid_protocols/CommitmentScheme.hpp:29,
                 from /home/g/install/libscapi-master/examples/Commitment/CommitmentExample.hpp:30,
                 from /home/g/install/libscapi-master/examples/Commitment/CommitmentExample.cpp:29:
/usr/include/c++/7/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = CmtSimpleHashCommitter; _Args = {std::shared_ptr<CommParty>&}; _Tp = CmtSimpleHashCommitter]’:
/usr/include/c++/7/bits/alloc_traits.h:475:4:   required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = CmtSimpleHashCommitter; _Args = {std::shared_ptr<CommParty>&}; _Tp = CmtSimpleHashCommitter; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<CmtSimpleHashCommitter>]’
/usr/include/c++/7/bits/shared_ptr_base.h:526:39:   required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {std::shared_ptr<CommParty>&}; _Tp = CmtSimpleHashCommitter; _Alloc = std::allocator<CmtSimpleHashCommitter>; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]’
/usr/include/c++/7/bits/shared_ptr_base.h:637:4:   required from ‘std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = CmtSimpleHashCommitter; _Alloc = std::allocator<CmtSimpleHashCommitter>; _Args = {std::shared_ptr<CommParty>&}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]’
/usr/include/c++/7/bits/shared_ptr_base.h:1295:35:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<CmtSimpleHashCommitter>; _Args = {std::shared_ptr<CommParty>&}; _Tp = CmtSimpleHashCommitter; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]’
/usr/include/c++/7/bits/shared_ptr.h:344:64:   required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocator<CmtSimpleHashCommitter>; _Args = {std::shared_ptr<CommParty>&}; _Tp = CmtSimpleHashCommitter]’
/usr/include/c++/7/bits/shared_ptr.h:690:14:   required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = CmtSimpleHashCommitter; _Alloc = std::allocator<CmtSimpleHashCommitter>; _Args = {std::shared_ptr<CommParty>&}]’
/usr/include/c++/7/bits/shared_ptr.h:706:39:   required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = CmtSimpleHashCommitter; _Args = {std::shared_ptr<CommParty>&}]’
/home/g/install/libscapi-master/examples/Commitment/CommitmentExample.cpp:63:52:   required from here
/usr/include/c++/7/ext/new_allocator.h:136:4: error: invalid new-expression of abstract class type ‘CmtSimpleHashCommitter’ 
  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
In file included from /home/gw/install/libscapi-master/examples/Commitment/CommitmentExample.hpp:37:0,
                 from /home/gw/install/libscapi-master/examples/Commitment/CommitmentExample.cpp:29:
/home/gw/install/libscapi-master/examples/Commitment/../../include/interactive_mid_protocols/CommitmentSchemeEquivocal.hpp:43:7: note:   because the following virtual functions are pure within ‘CmtEquivocalCommitter’:
 class CmtEquivocalCommitter : public CmtCommitter, public EquivocalCmt {
       ^~~~~~~~~~~~~~~~~~~~~
In file included from /home/gw/install/libscapi-master/examples/Commitment/CommitmentExample.hpp:30:0,
                 from /home/gw/install/libscapi-master/examples/Commitment/CommitmentExample.cpp:29:
/home/gw/install/libscapi-master/examples/Commitment/../../include/interactive_mid_protocols/CommitmentScheme.hpp:360:40: note:         virtual std::shared_ptr<CmtCCommitmentMsg> CmtCommitter::generateCommitmentMsg(const std::shared_ptr<CmtCommitValue>&, biginteger, long int)
  virtual shared_ptr<CmtCCommitmentMsg> generateCommitmentMsg(const shared_ptr<CmtCommitValue> & input, biginteger r, long id) = 0;
                                        ^~~~~~~~~~~~~~~~~~~~~
CMakeFiles/libscapi_example.dir/build.make:107: recipe for target 'CMakeFiles/libscapi_example.dir/Commitment/CommitmentExample.cpp.o' failed

Machine details

  • ubuntu 18.04
  • gcc 7.5
  • boost 1.71.0, and I tried boost 1.69.0, but the error remains.

Thank You

Can't build examples

Hi, the library is correctly installed since it passes all the tests.
Unfortunately I can't build examples in libscapi/examples as in https://biulibscapi.readthedocs.io/en/latest/install.html#samples.

When I launch make, the output is the following:

g++ --std=c++14 -I../../boost_1_64_0 -I../install/include -I../lib/OTExtensionBristol -I../install/include/libOTe -I../install/include/libOTe/cryptoTools -O3 -Wall -Wno-unused-function -Wno-unused-variable -Wno-expansion-to-defined -Wno-ignored-attributes -no-pie examples_main.cpp -o libscapi_example simple_dlog.o simple_sha1.o simple_gmac.o CommitmentExample.o OTExample.o SigmaProtocolExample.o comm_example.o App1.o YaoParties.o OTExtensionBristolExample.o ../libscapi.a ../install/lib/libOTExtensionBristol.a ../install/lib/libOTe.a ../install/lib/libcryptoTools.a ../install/lib/libmiracl.a ../install/lib/libsimpleot.a -L../install/lib -L../../boost_1_64_0/stage/lib ../install/lib/libcrypto.a -ldl -lboost_log -lboost_system -lboost_thread -lboost_serialization -lboost_filesystem -lpthread ../install/lib/libssl.a -lgmp -lrt
g++: error: ../install/lib/libcrypto.a: No such file or directory
g++: error: ../install/lib/libssl.a: No such file or directory
makefile:11: recipe for target 'libscapi_example' failed
make: *** [libscapi_example] Error 1

Thanks, Giuseppe.

Compiling error on Mac Mojave

I'm followed the installation instruction, and make process seems successful, but failed on illegal copy.

[90%] Building CXX object libOTe_Tests/CMakeFiles/libOTe_Tests.dir/UnitTests.cpp.o
[ 92%] Linking CXX static library ../lib/liblibOTe_Tests.a
[ 92%] Built target libOTe_Tests
Scanning dependencies of target frontend_libOTe
[ 93%] Building CXX object frontend/CMakeFiles/frontend_libOTe.dir/CLP.cpp.o
[ 95%] Building CXX object frontend/CMakeFiles/frontend_libOTe.dir/main.cpp.o
[ 96%] Building CXX object frontend/CMakeFiles/frontend_libOTe.dir/signalHandle.cpp.o
[ 98%] Building CXX object frontend/CMakeFiles/frontend_libOTe.dir/util.cpp.o
[100%] Linking CXX executable ../bin/frontend_libOTe
[100%] Built target frontend_libOTe
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvXc] source_file ... target_directory
make: *** [compile-libote] Error 1

But the libscapi.a doesn't generated, so the tests make failed:

g++ -std=c++11 -maes -mavx -I/usr/include/openssl -I../install/include -o tests.exe tests.cpp interactiveMidProtocolsTests.cpp ../libscapi.a -ldl -lpthread -L../install/lib -lssl -lboost_system -lntl -lgmp -lcrypto
clang: error: no such file or directory: '../libscapi.a'
make: *** [tests.exe] Error 1

The example make also failed:

In file included from Yao/App1.cpp:29:
In file included from Yao/YaoExample.hpp:36:
Yao/../../include/interactive_mid_protocols/OTExtensionBristol.hpp:31:10: fatal error: 'OTExtensionBristol/OT/OTExtensionWithMatrix.h' file not found
#include <OTExtensionBristol/OT/OTExtensionWithMatrix.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [App1.o] Error 1

Error making Scapi (libOTe)

Hi people,

When I make Scapi, I get the following error in building libOTe on Ubuntu 18.04:

[ 40%] Building CXX object cryptoTools/frontend_cryptoTools/CMakeFiles/frontend_cryptoTools.dir/Tutorials/Network.cpp.o
[ 41%] Building CXX object cryptoTools/frontend_cryptoTools/CMakeFiles/frontend_cryptoTools.dir/main.cpp.o
[ 43%] Building CXX object cryptoTools/frontend_cryptoTools/CMakeFiles/frontend_cryptoTools.dir/signalHandle.cpp.o
[ 45%] Linking CXX executable ../../bin/frontend_cryptoTools
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
cryptoTools/frontend_cryptoTools/CMakeFiles/frontend_cryptoTools.dir/build.make:150: recipe for target 'bin/frontend_cryptoTools' failed
make[3]: *** [bin/frontend_cryptoTools] Error 1
make[3]: Leaving directory '/home/osboxes/libscapi/build/libOTe'
CMakeFiles/Makefile2:253: recipe for target 'cryptoTools/frontend_cryptoTools/CMakeFiles/frontend_cryptoTools.dir/all' failed
make[2]: *** [cryptoTools/frontend_cryptoTools/CMakeFiles/frontend_cryptoTools.dir/all] Error 2
make[2]: Leaving directory '/home/osboxes/libscapi/build/libOTe'
Makefile:129: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/osboxes/libscapi/build/libOTe'
makefile:246: recipe for target 'compile-libote' failed
make: *** [compile-libote] Error 2

Could anyone help me with this error? Thanks in advance!

Error while building examples

I get an error while building the examples:

/libscapi/samples$ make
g++ -std=c++14 -I../../boost_1_64_0 -I../install/include -I../lib/OTExtensionBristol -I../install/include/libOTe -I../install/include/libOTe/cryptoTools -O3 -Wall -Wno-unused-function -Wno-unused-variable examples_main.cpp -o libscapi_example simple_dlog.o simple_sha1.o simple_gmac.o CommitmentExample.o OTExample.o SigmaProtocolExample.o comm_example.o App1.o YaoParties.o OTExtensionBristolExample.o ../libscapi.a ../install/lib/libOTExtensionBristol.a ../install/lib/libOTe.a ../install/lib/libcryptoTools.a ../install/lib/libmiracl.a ../install/lib/libsimpleot.a -L../install/lib -L../../boost_1_64_0/stage/lib ../install/lib/libcrypto.a -ldl -lboost_log -lboost_system -lboost_thread -lboost_serialization -lboost_filesystem -lpthread ../install/lib/libssl.a -lgmp -lrt
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge25519_lookup_niels.o): relocation R_X86_64_32S against symbol `CONST_2P0' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(gfe4x_square.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(gfe4x_mul.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge4x_double_p1p1.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge4x_add_p1p1.o): relocation R_X86_64_32S against symbol `Gk' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge4x_niels_add_p1p1.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge4x_lookup_niels.o): relocation R_X86_64_32S against symbol `_allone' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge4x_lookup.o): relocation R_X86_64_32S against symbol `_allone' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(fe25519_freeze.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(fe25519_mul.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(fe25519_nsquare.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(fe25519_square.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge25519_dbl_p1p1.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge25519_add_p1p1.o): relocation R_X86_64_32S against symbol `CONST_2P0' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge25519_nielsadd2.o): relocation R_X86_64_32S against symbol `CONST_2P0' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge25519_p1p1_to_p2.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: ../install/lib/libsimpleot.a(ge25519_p1p1_to_p3.o): relocation R_X86_64_32S against symbol `CONST_REDMASK51' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/x86_64-linux-gnu-ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
makefile:11: recipe for target 'libscapi_example' failed
make: *** [libscapi_example] Error 1

Undefined reference to EVP_CIPHER_CTX_init

Hello,

I think I found a bug. When I try to compile dlog_example.cpp, I get the following errors:

../libscapi/libscapi.a(Prg.o): In function PrgFromOpenSSLAES::~PrgFromOpenSSLAES()': /home/name/libscapi/src/primitives/Prg.cpp:244: undefined reference to EVP_CIPHER_CTX_cleanup'
../libscapi/libscapi.a(Prg.o): In function PrgFromOpenSSLAES::setKey(SecretKey&)': /home/name/libscapi/src/primitives/Prg.cpp:271: undefined reference to EVP_CIPHER_CTX_init'
/home/name/libscapi/src/primitives/Prg.cpp:284: undefined reference to EVP_CIPHER_CTX_cleanup' /home/name/libscapi/src/primitives/Prg.cpp:285: undefined reference to EVP_CIPHER_CTX_init'
collect2: error: ld returned 1 exit status

I have googled around, but it seems to do with the version of OpenSSL, since in newer versions (v1.1.0 and higher), EVP_CIPHER_CTX_init has been replaced by

EVP_CIPHER_CTX *ctx;
ctx = EVP_CIPHER_CTX_new()

(see also https://forum.dlang.org/post/[email protected])

I'm not entirely sure if this is a real bug or if I did something wrong, so if anyone could comment on this, that would be great. :)

Kind regards, Ruth

Building SCAPI without root

Hello,

during the build of libscapi by calling make the following error occurs.

Install the project...
-- Install configuration: ""
CMake Error at cmake_install.cmake:36 (file):
  file cannot create directory: /usr/local/include/relic.  Maybe need
  administrative privileges.


make[1]: *** [Makefile:107: install] Error 1
make[1]: Leaving directory '/path/to/libscapi/build/EMP/relic'
make: *** [makefile:71: prepare-emp] Error 2

Of course, running sudo make would allow to create the directory under /usr/local. But, for once, I hesitate to compile with root permissions and I would like to avoid installing it globally on my system. Then, on other systems I might not have sufficient permissions.

The problem to solve seems to be to put the relic header somewhere, where they can be found by the other libraries. This should be possible without installing this stuff globally.

I have currently a limited overview of the build process and would like to ask if anyone has worked on this problem already?

Error making GMW

I'm trying to "make" the GMW protocol following the instructions of the README inside the same folder.

I get the error:

➔ make
[ 10%] Building CXX object CMakeFiles/gmw.dir/main.cpp.o
In file included from /home/patriciarvsousa/work/MPCFrameworks/multiparty/libraries/libscapi/protocols/GMW/MPCCommunication.h:8:0,
                 from /home/patriciarvsousa/work/MPCFrameworks/multiparty/libraries/libscapi/protocols/GMW/main.cpp:3:
/home/patriciarvsousa/work/MPCFrameworks/multiparty/libraries/libscapi/protocols/GMW/../../include/interactive_mid_protocols/OTBatch.hpp:33:45: fatal error: OTExtensionBristol/OT/BitMatrix.h: No such file or directory
 #include <OTExtensionBristol/OT/BitMatrix.h>
                                             ^
compilation terminated.
CMakeFiles/gmw.dir/build.make:62: recipe for target 'CMakeFiles/gmw.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/gmw.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/gmw.dir/all' failed
make[1]: *** [CMakeFiles/gmw.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

How to implement basic primitives?

Hello, I have to test and implement the basic primitives such as cryptographic hash. I am following this structure: https://biulibscapi.readthedocs.io/en/latest/primitives/cryptographic_hash.html
In order to implement this primitive I did the following in the terminal (which might be totally wrong):

zeinab@zeinab:$ cd libscapi/
zeinab@zeinab:
/libscapi$ cd include/
zeinab@zeinab:/libscapi/include$ cd primitives/
zeinab@zeinab:
/libscapi/include/primitives$ cmake . && make
CMake Error: The source directory "/home/zeinab/libscapi/include/primitives" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
zeinab@zeinab:~/libscapi/include/primitives$ ls -al
total 204
drwxr-xr-x 2 zeinab zeinab 4096 Oct 2 09:55 .
drwxr-xr-x 10 zeinab zeinab 4096 Oct 2 09:55 ..
-rw-r--r-- 1 zeinab zeinab 33393 Oct 2 09:55 Dlog.hpp
-rw-r--r-- 1 zeinab zeinab 13199 Oct 2 09:55 DlogOpenSSL.hpp
-rw-r--r-- 1 zeinab zeinab 3943 Oct 2 09:55 HashBlake2.hpp
-rw-r--r-- 1 zeinab zeinab 4618 Oct 2 09:55 Hash.hpp
-rw-r--r-- 1 zeinab zeinab 4367 Oct 2 09:55 HashOpenSSL.hpp
-rw-r--r-- 1 zeinab zeinab 4982 Oct 2 09:55 Kdf.hpp
-rw-r--r-- 1 zeinab zeinab 10929 Oct 2 09:55 Matrix.hpp
-rw-r--r-- 1 zeinab zeinab 16464 Oct 2 09:55 Mersenne.hpp
-rw-r--r-- 1 zeinab zeinab 23061 Oct 2 09:55 Prf.hpp
-rw-r--r-- 1 zeinab zeinab 13605 Oct 2 09:55 PrfOpenSSL.hpp
-rw-r--r-- 1 zeinab zeinab 13413 Oct 2 09:55 Prg.hpp
-rw-r--r-- 1 zeinab zeinab 4658 Oct 2 09:55 RandomOracle.hpp
-rw-r--r-- 1 zeinab zeinab 15771 Oct 2 09:55 TrapdoorPermutation.hpp
-rw-r--r-- 1 zeinab zeinab 3689 Oct 2 09:55 TrapdoorPermutationOpenSSL.hpp

Since there is no executable file in this folder, can someone help me what should I do to run these primitives?
Thank you for your time.

Problem compiling on different directory rather them home directory

I get the following error when it gets to compiling libOTe:

Scanning dependencies of target sha_asm
[  1%] /repo/libscapi/build/libOTe/cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/sha_lnx.S.o
[  1%] Built target sha_asm
Scanning dependencies of target cryptoTools
[  3%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/BitIterator.cpp.o
In file included from /repo/libscapi/build/libOTe/cryptoTools/cryptoTools/Common/BitIterator.cpp:1:
In file included from /repo/libscapi/build/libOTe/cryptoTools/cryptoTools/Common/BitIterator.h:3:
/repo/libscapi/build/libOTe/cryptoTools/cryptoTools/Common/Defines.h:11:10: fatal error: 
      'boost/lexical_cast.hpp' file not found
#include <boost/lexical_cast.hpp>
         ^~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/BitIterator.cpp.o] Error 1
make[2]: *** [cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [compile-libote] Error 2

I see that boost was compiled and exists in build/boost_1_64_0

Error making libscapi (libOTe)

Hello,

When I make libscapi, I get the following error in building libOTe library:

make[3]: Entering directory '/home/manel/libscapi/build/libOTe'
[ 1%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/Timer.cpp.o
[ 2%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/Log.cpp.o
[ 3%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/CLP.cpp.o
[ 4%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/CuckooIndex.cpp.o
[ 5%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/Defines.cpp.o
[ 7%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/TestCollection.cpp.o
[ 8%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Common/BitVector.cpp.o
[ 9%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/AES.cpp.o
[ 10%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/RCurve.cpp.o
[ 11%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/Curve.cpp.o
[ 12%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/Blake2.cpp.o
[ 14%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/sha1.cpp.o
[ 15%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Crypto/PRNG.cpp.o
[ 16%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Circuit/BetaCircuit.cpp.o
[ 17%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Circuit/BetaLibrary.cpp.o
[ 18%] Building CXX object cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Network/Session.cpp.o
In file included from /home/manel/libscapi/build/libOTe/cryptoTools/cryptoTools/Network/Session.h:4:0,
from /home/manel/libscapi/build/libOTe/cryptoTools/cryptoTools/Network/Session.cpp:1:
/home/manel/libscapi/build/libOTe/cryptoTools/cryptoTools/Network/Channel.h:360:22: error: ‘boost::asio::strand {aka boost::asio::io_service::strand}’ is not a template
boost::asio::strandboost::asio::io_context::executor_type mSendStrand, mRecvStrand;
^
compilation terminated due to -Wfatal-errors.
cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/build.make:422: recipe for target 'cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Network/Session.cpp.o' failed
make[3]: *** [cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/Network/Session.cpp.o] Error 1
make[3]: Leaving directory '/home/manel/libscapi/build/libOTe'
CMakeFiles/Makefile2:142: recipe for target 'cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/all' failed
make[2]: *** [cryptoTools/cryptoTools/CMakeFiles/cryptoTools.dir/all] Error 2
make[2]: Leaving directory '/home/manel/libscapi/build/libOTe'
Makefile:127: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/manel/libscapi/build/libOTe'
makefile:168: recipe for target 'compile-libote' failed
make: *** [compile-libote] Error 2

Steps to reproduce the bug
I simply created a ubuntu virtual machine and then ran the following:

$ sudo apt-get update
$ sudo apt-get install -y git build-essential
$ sudo apt-get install -y libssl-ocaml-dev libssl-dev
$ sudo apt-get install -y libgmp3-dev
$ sudo apt-get -y install g++ gcc libicu-dev

Download Boost:

$ wget -O boost_1_64_0.tar.bz2 http://sourceforge.net/projects/boost/files/boost/1.64.0/boost_1_64_0.tar.bz2/download
$ tar --bzip2 -xf boost_1_64_0.tar.bz2
$ cd boost_1_64_0

Run the script which prepares Boost's build process
sudo ./bootstrap.sh --prefix=/usr/local --with-libraries=all

Compile the project
sudo ./b2 install

Add the Boost libraries path to the default Ubuntu library search path
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/boost.conf'

Update the default Ubuntu library search paths
sudo ldconfig

Clone and make libscapi

$ cd ~
$ git clone https://github.com/cryptobiu/libscapi.git
$ cd libscapi
$ make

Machine details:

  • OS: Ubuntu
  • Version 16.04.3-desktop-amd64
  • Compiler Version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0

Additional context
Before the error I received the following warnings:

CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
  Imported targets not available for Boost version 106400
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)
  cryptoTools/cryptoTools/CMakeLists.txt:129 (find_package)
CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
  Imported targets not available for Boost version 106400
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)
  cryptoTools/cryptoTools/CMakeLists.txt:129 (find_package)
CMake Warning:
  Manually-specified variables were not used by the project:

    LIBSCAPI_ROOT

macOS support

I've almost managed to compile libscapi on macOS (see pull requests #19, #20, #21, #22, #23, #24, #29).
The only component which does not compile is BristolOTExtension because of SimpleOT.

More precisely, I get the following error:

fe25519_freeze.s:213:1: error: 32-bit absolute addressing is not supported in 64-bit mode

(file: lib/OTExtensionBristol/SimpleOT/fe25519_freeze.s).

I think the issue can be solved by following https://stackoverflow.com/a/25804623 and https://ghc.haskell.org/trac/ghc/wiki/Commentary/PositionIndependentCode (basically suffixing global constants by @GOTPCREL(%rip)). But I am not comfortable making the change, as I am not sure how to easily test that there is no regression (both for correctness and performance).

It is possible to compile libscapi without BristolOTExtension by creating an empty file compile-otextension-bristol.

(I have just managed to compile the library libscapi itself. I have not tested whether the resulting library is working on macOS.)

Samples semiHonestOT and maliciousOT do not seem to work properly

On a fresh install on Ubuntu 16.04 (commit 796e73f - master branch), I get the following results:

# semi-honest
$ ./libscapi_example semiHonestOT 1
Waiting for receiver to connect on port: 7766
Receiver connected
PrecomputeNaorPinkasSender and OTExtensionSender init took: 38 ms
x0 :
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
x1 :
255 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255

$ ./libscapi_example semiHonestOT 2
187 106 89 176 60 101 136 233 199 74 144 227 205 154 108 120

# malicious
$ ./libscapi_example maliciousOT 1
OT verification unsuccessful
x0 :
161 103 203 6 38 23 129 202 144 243 91 0 220 3 199 179
x1 :
110 103 8 99 185 100 54 234 219 165 130 44 25 20 135 245

$ ./libscapi_example maliciousOT 2
Error at position i = 0, k = 0, with X1 = 6e and res = 7e
126 244 14 71 246 185 251 141 69 36 74 223 123 159 116 137

For the semi-honest case, I think the reason is the following: in https://github.com/cryptobiu/libscapi/blob/796e73f69/src/interactive_mid_protocols/OTSemiHonestExtension.cpp#L235, libscapi implicitly assumes that the function send will update x0 and x1, while it does not (see

m_vValues[0] = x0;
).

For the malicious case, I have no idea what the problem is. However, on macOS (see #25), libscapi_example just segfaults in the malicious case (but not in the semi-honest case, where it works as on Ubuntu 16.04).

Error running a segment of the code of OTExample

Hello everyone,

Hope I find you well!

Issue Description

So, after trying for a while to compile the example script with no success, I've decided to analise the code inside each example main in order to understand all the steps.

For each example, I've started by creating an empty script and copy piece by piece segments of your example code. For each segment copied, I compiled the code, printed the outputs, and commented the code (just for sake of my own understanding).

Everything went fine for the Communication example. However, in the Oblivious Transfer example, I can't get rid of an error which is:

terminate called after throwing an instance of 'char const*'
Aborted (core dumped)

This error occurs when I try to run the code in line: auto dlog = make_shared<OpenSSLDlogECF2m>(); inside the readConfigFile function.


How to reproduce the bug

This is my "test_oblivious_transfer.cpp" file (I didn't manage to copy much of the example code because the errors occurs very soon in the code). You have to copy this code inside a cpp. Pay attention to the "../../../../" on the includes in order to understand in what folder the file should be put in.

/*
This is just a test script.
*/

#include <iostream>

#include <boost/thread/thread.hpp>
#include "../../../../libscapi/include/infra/ConfigFile.hpp"
#include "../../../../libscapi/include/interactive_mid_protocols/OTSemiHonest.hpp"
#include "../../../../libscapi/include/interactive_mid_protocols/OTPrivacyOnly.hpp"
#include "../../../../libscapi/include/interactive_mid_protocols/OTOneSidedSimulation.hpp"
#include "../../../../libscapi/include/interactive_mid_protocols/OTFullSimulation.hpp"
#include "../../../../libscapi/include/interactive_mid_protocols/OTFullSimulationROM.hpp"
#include "../../../../libscapi/include/interactive_mid_protocols/OTUC.hpp"
#include "../../../../libscapi/include/primitives/Prg.hpp"

struct ObliviousTransConfig
{
    //IpAddress sender_ip;
    //IpAddress receiver_ip;
    std::string sender_ip;
    std::string receiver_ip;
    int sender_port;
    int receiver_port;
    std::string protocol_name;
    shared_ptr<GroupElement> g0;
    shared_ptr<GroupElement> g1;
    shared_ptr<GroupElement> h0;
    shared_ptr<GroupElement> h1;

    /*/ Constructor
    ObliviousTransConfig(IpAddress senderIp, IpAddress receiverIp, int senderPort, int receiverPort, string protocolName)
    {
        this->sender_ip = senderIp;
		this->receiver_ip = receiverIp;
		this->sender_port = senderPort;
		this->receiver_port = receiverPort;
		this->protocol_name = protocolName;
    }*/
};

void usageMessage()
{
    auto message = R"(
        To be able to run this script you need to execute it as:

        ./executable_file <party_number> <path_to_config_file>

        Where:
        <party_number> can be 1 or 2
    )";

    std::cerr << message << std::endl;
}

ObliviousTransConfig readConfigFile(std::string configFile)
{
    // Read the config file
    ConfigFile cf(configFile);
    
    // Creates a new ObliviousTransferConfig Object
    ObliviousTransConfig output;

    // Fills the object atributes
    output.sender_ip = cf.Value("", "senderIp");
    output.receiver_ip = cf.Value("", "receiverIp");
    output.sender_port = std::stoi(cf.Value("", "senderPort"));
	output.receiver_port = std::stoi(cf.Value("", "receiverPort"));
    output.protocol_name = cf.Value("", "protocolName");

    std::cerr << "Sender IP: " << output.sender_ip << std::endl;
    std::cerr << "Receiver IP: " << output.receiver_ip << std::endl;
    std::cerr << "Sender PORT: " << output.sender_port << std::endl;
    std::cerr << "Receiver PORT: " << output.receiver_port << std::endl;
    std::cerr << "Protocol Name: " << output.protocol_name << std::endl;

    if(output.protocol_name == "UCOnByteArray" || output.protocol_name == "UCOnGroupElement")
    {
        // Creates a discrete log group
        auto dlog = make_shared<OpenSSLDlogECF2m>();
        
        // Creates a vector of big integers with a size of 2
        std::vector<biginteger> point(2);
        
        // Generate First Element
        point[0] =  biginteger("4373527398576640063579304354969275615843559206632");
        point[1] =  biginteger("3705292482178961271312284701371585420180764402649");
        output.g0 = dlog->generateElement(false, point);

        // Generate Second Element
        point[0] =  biginteger("5358538915372747505940066348728070469076553372492");
        point[1] =  biginteger("9028382283996304130045455598981082528772297505697");
        output.g1 = dlog->generateElement(false, point);

        // Generate Third Element
        point[0] =  biginteger("582941706599807092180704244329891555852679544026");
        point[1] =  biginteger("9405288600072608660829837034337429060956333420529");
        output.h0 = dlog->generateElement(false, point);

        // Generate Fourth Element
        point[0] =  biginteger("5171406319926278015143700754389901479380894481649");
        point[1] =  biginteger("4324109033029607118050375077650365756171591181543");
        output.h1 = dlog->generateElement(false, point);

        std::cerr << "G0: " << output.g0 << std::endl;
        std::cerr << "G1: " << output.g1 << std::endl;
        std::cerr << "H0: " << output.h0 << std::endl;
        std::cerr << "H1: " << output.h1 << std::endl;
    }

    return output;
}

int main(int argc, char* argv[])
{
    // Do not let the code compile if there are not enough arguments given by the user
    if(argc < 2)
    {
        // Prints an example command line
        usageMessage();
        return 1;
    }

    std::cerr << "Argument 1: " << argv[1] << std::endl;
    std::cerr << "Argument 2: " << argv[2] << std::endl;

    // Read the configuration file for the oblivious transfer
    ObliviousTransConfig otConfig = readConfigFile(argv[2]);

    return 0;
}

Along side with this file, I've copied the OTConfig file inside the libscapi OTExample folder.

Compile and run it. To run the code I type the command: ./compiled_file <config_file> (which in my case was ./exe_oblivious_transfer 1 "test_oblivious_transfer_config.txt").


Machine details

  • OS: Xubuntu
  • 18.04
  • Compiler Version: GCC 7.5.0

Did anyone else had this error? Can someone help me?

Thanks.
Best regards, André

One or two tests fail

Describe the bug
My build fails with one or sometime two (!?) errors from tests.exe.

dave@mpc:~/libscapi/tests$ ./tests.exe

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests.exe is a Catch v1.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
TrapdoorPermutation
  OpenSSL
-------------------------------------------------------------------------------
tests/tests.cpp:817
...............................................................................

tests/tests.cpp:834: FAILED:
  REQUIRE( re_inv->getElement() == re_src->getElement() )
with expansion:
  0 == 23
with message:
  re_enc->getElement() := 12

-------------------------------------------------------------------------------
asymmetric encryption
  El Gamal on group element
-------------------------------------------------------------------------------
tests/tests.cpp:1066
...............................................................................

tests/tests.cpp:1068: FAILED:
  {Unknown expression after the reported line}
due to unexpected exception with message:
  GroupElements in the given ciphertexts must be a members in the DlogGroup of
  type Zp*

===============================================================================
test cases:  18 |  16 passed | 2 failed
assertions: 499 | 497 passed | 2 failed

dave@mpc:~/libscapi/tests$ ./tests.exe

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests.exe is a Catch v1.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
asymmetric encryption
  El Gamal on group element
-------------------------------------------------------------------------------
tests/tests.cpp:1066
...............................................................................

tests/tests.cpp:1068: FAILED:
  {Unknown expression after the reported line}
due to unexpected exception with message:
  GroupElements in the given ciphertexts must be a members in the DlogGroup of
  type Zp*

===============================================================================
test cases:  18 |  17 passed | 1 failed
assertions: 499 | 498 passed | 1 failed

Steps to reproduce the bug
On Macintosh hardware create a VM using the latest VirtualBox and ubuntu-18.04-desktop-amd64.iso. Then run these commands:

$ cd
$ sudo apt-get update
$ sudo apt-get install -y git
$ sudo apt-get install -y build-essential
$ sudo apt-get install -y libssl-dev libgmp3-dev cmake liblog4cpp5-dev libboost-all-dev
$ git clone https://github.com/cryptobiu/libscapi.git
$ cd libscapi
$ make

Machine details (please complete the following information):

  • OS: Ubuntu
  • Version 18.04
  • Compiler Version: GCC 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)

Additional context

Boost error while compiling

I tried to compile the code on the Quickstart page and came across this particular error:

In file included from libscapi/include/primitives/Dlog.hpp:31:0,
                 from libscapi/include/primitives/DlogOpenSSL.hpp:34,
                 from scapistart.cpp:1:
libscapi/include/primitives/../infra/Common.hpp:33:28: fatal error: boost/random.hpp: No such file or directory
 #include <boost/random.hpp>
                            ^
compilation terminated.

Apparently it's something in the library itself.

We want to use libscapi for our undergraduate thesis, which will be part of a project concerning SMPC undertaken by ATHENA Research & Innovation Center in Athens. It is very important for us to make this work, so any help would be greatly appreciated.

Error Building SemiHonestYao MPC-Benchmark with libscapi

Hello,

I cloned libscapi and went successfully through all the steps to build it. Then, I was aiming to use MPC-Benchmark implementation of Semi-honest Yao Protocol but received undefined reference errors related with libscapi library.

I do not have header files related to intrin_sequential_ks1_enc1.c, intrin_sequential_ks2_enc2.c, intrin_sequential_ks4_enc4.c and intrin_sequential_ks4_enc8.c inside "libscapi/include" folder. Consequently, the folder "libscapi/obj/circuits_c" is empty. Is this related with libscapi make process?

Steps to reproduce the bug

  1. Install libscapi in my home directory
  2. cd libscapi
  3. git clone https://github.com/cryptobiu/MPC-Benchmark
  4. cd MPC-Benchmark/SemiHonestYao
  5. cmake . && make

Error

[100%] Linking CXX executable SemiHonestYao
/home/manel/libscapi/libscapi.a(FourToTwoGarbledBoleanCircuitNoAssumptions.o): In function FourToTwoGarbledBoleanCircuitNoAssumptions::compute(long long __vector(2), long long __vector(2))': /home/manel/libscapi/src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp:483: undefined reference to intrin_sequential_ks2_enc2'
/home/manel/libscapi/src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp:451: undefined reference to intrin_sequential_ks2_enc2' /home/manel/libscapi/libscapi.a(FourToTwoGarbledBoleanCircuitNoAssumptions.o): In function FourToTwoGarbledBoleanCircuitNoAssumptions::internalVerify(long long __vector(2), long long __vector(2))':
/home/manel/libscapi/src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp:676: undefined reference to intrin_sequential_ks4_enc8' /home/manel/libscapi/src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp:606: undefined reference to intrin_sequential_ks4_enc4'
/home/manel/libscapi/libscapi.a(FourToTwoGarbledBoleanCircuitNoAssumptions.o): In function FourToTwoGarbledBoleanCircuitNoAssumptions::garble(long long __vector(2), long long __vector(2), std::vector<unsigned char, std::allocator >&, long long __vector(2))': /home/manel/libscapi/src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp:247: undefined reference to intrin_sequential_ks4_enc8'
/home/manel/libscapi/src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp:182: undefined reference to intrin_sequential_ks4_enc4' /home/manel/libscapi/libscapi.a(HalfGatesGarbledBoleanCircuitNoFixedKey.o): In function HalfGatesGarbledBoleanCircuitNoFixedKey::compute(long long __vector(2), long long __vector(2))':
/home/manel/libscapi/src/circuits/HalfGatesGarbledBoleanCircuitNoFixedKey.cpp:295: undefined reference to intrin_sequential_ks2_enc2' /home/manel/libscapi/libscapi.a(HalfGatesGarbledBoleanCircuitNoFixedKey.o): In function HalfGatesGarbledBoleanCircuitNoFixedKey::internalVerify(long long __vector(2), long long __vector(2))':
/home/manel/libscapi/src/circuits/HalfGatesGarbledBoleanCircuitNoFixedKey.cpp:393: undefined reference to intrin_sequential_ks4_enc4' /home/manel/libscapi/libscapi.a(HalfGatesGarbledBoleanCircuitNoFixedKey.o): In function HalfGatesGarbledBoleanCircuitNoFixedKey::garble(long long __vector(2), long long __vector(2), std::vector<unsigned char, std::allocator >&, long long __vector(2))':
/home/manel/libscapi/src/circuits/HalfGatesGarbledBoleanCircuitNoFixedKey.cpp:166: undefined reference to `intrin_sequential_ks4_enc4'
collect2: error: ld returned 1 exit status
CMakeFiles/SemiHonestYao.dir/build.make:99: recipe for target 'SemiHonestYao' failed
make[2]: *** [SemiHonestYao] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/SemiHonestYao.dir/all' failed
make[1]: *** [CMakeFiles/SemiHonestYao.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

Machine details (please complete the following information):
OS: Ubuntu
Version 16.04.3-desktop-amd64
Compiler Version: gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Stepping: 3
CPU MHz: 2591.998
BogoMIPS: 5183.99
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 6144K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase avx2 invpcid rdseed clflushopt

Thank you!

Cannot build the examples

I checkout the master and follow the docs, installing libscapi. However, when I build the examples, I've got some header file include error.

Scanning dependencies of target libscapi_example
[ 10%] Building CXX object CMakeFiles/libscapi_example.dir/examples_main.cpp.o
[ 20%] Building CXX object CMakeFiles/libscapi_example.dir/Comm/comm_example.cpp.o
[ 30%] Building CXX object CMakeFiles/libscapi_example.dir/Commitment/CommitmentExample.cpp.o
[ 40%] Building CXX object CMakeFiles/libscapi_example.dir/OT/OTExample.cpp.o
[ 50%] Building CXX object CMakeFiles/libscapi_example.dir/SigmaProtocols/SigmaProtocolExample.cpp.o
[ 60%] Building CXX object CMakeFiles/libscapi_example.dir/Simple/simple_dlog.cpp.o
[ 70%] Building CXX object CMakeFiles/libscapi_example.dir/Simple/simple_gmac.cpp.o
[ 80%] Building CXX object CMakeFiles/libscapi_example.dir/Simple/simple_sha1.cpp.o
[ 90%] Building CXX object CMakeFiles/libscapi_example.dir/Yao/YaoParties.cpp.o
In file included from /home/xxx/Documents/projects/libscapi/examples/Yao/../../include/interactive_mid_protocols/OTExtensionBristol.hpp:32:0,
from /home/xxx/Documents/projects/libscapi/examples/Yao/YaoExample.hpp:36,
from /home/xxx/Documents/projects/libscapi/examples/Yao/YaoParties.cpp:29:
/home/xxx/Documents/projects/libscapi/examples/Yao/../../include/interactive_mid_protocols/OTBatch.hpp:37:10: fatal error: OTExtensionBristol/OT/BitMatrix.h: No such file or directory
#include <OTExtensionBristol/OT/BitMatrix.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/libscapi_example.dir/build.make:254: recipe for target 'CMakeFiles/libscapi_example.dir/Yao/YaoParties.cpp.o' failed
make[2]: *** [CMakeFiles/libscapi_example.dir/Yao/YaoParties.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/libscapi_example.dir/all' failed
make[1]: *** [CMakeFiles/libscapi_example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

After I resolve these header file error, I've met another error.

[ 10%] Building CXX object CMakeFiles/libscapi_example.dir/examples_main.cpp.o
[ 20%] Building CXX object CMakeFiles/libscapi_example.dir/Comm/comm_example.cpp.o
[ 30%] Building CXX object CMakeFiles/libscapi_example.dir/Commitment/CommitmentExample.cpp.o
[ 40%] Building CXX object CMakeFiles/libscapi_example.dir/OT/OTExample.cpp.o
[ 50%] Building CXX object CMakeFiles/libscapi_example.dir/SigmaProtocols/SigmaProtocolExample.cpp.o
[ 60%] Building CXX object CMakeFiles/libscapi_example.dir/Simple/simple_dlog.cpp.o
[ 70%] Building CXX object CMakeFiles/libscapi_example.dir/Simple/simple_gmac.cpp.o
[ 80%] Building CXX object CMakeFiles/libscapi_example.dir/Simple/simple_sha1.cpp.o
[ 90%] Building CXX object CMakeFiles/libscapi_example.dir/Yao/YaoParties.cpp.o
In file included from /home/xxx/Documents/projects/libscapi/examples/Yao/YaoExample.hpp:35:0,
from /home/xxx/Documents/projects/libscapi/examples/Yao/YaoParties.cpp:29:
/home/xxx/Documents/projects/libscapi/examples/Yao/../../include/circuits/GarbledBooleanCircuit.h:68:48: warning: ignoring attributes on template argument ‘block* {aka __vector(2) long long int*}’ [-Wignored-attributes]
std::tuple<block*, block*, std::vector > garble(block seed = nullptr);
^
/home/xxx/Documents/projects/libscapi/examples/Yao/../../include/circuits/GarbledBooleanCircuit.h:68:48: warning: ignoring attributes on template argument ‘block
{aka __vector(2) long long int*}’ [-Wignored-attributes]
In file included from /home/xxx/Documents/projects/libscapi/examples/Yao/YaoParties.cpp:29:0:
/home/xxx/Documents/projects/libscapi/examples/Yao/YaoExample.hpp:54:37: warning: ignoring attributes on template argument ‘block* {aka __vector(2) long long int*}’ [-Wignored-attributes]
tuple<block*, block*, vector > values;//this tuple includes the input and output keys (block*) and the translation table (vector)
^
/home/xxx/Documents/projects/libscapi/examples/Yao/YaoExample.hpp:54:37: warning: ignoring attributes on template argument ‘block* {aka __vector(2) long long int*}’ [-Wignored-attributes]
make[2]: *** No rule to make target '/home/xxx/libscapi/libscapi.a', needed by 'libscapi_example'. Stop.
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/libscapi_example.dir/all' failed
make[1]: *** [CMakeFiles/libscapi_example.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

It seems that the current examples do not match the docs. I think the code structure has been changed. SO, how can I actually run the examples or which branch is stable and matches the docs? Any suggestion would be appreciated. Thanks.

Sending IVCiphertext over communication channel

Hello!

I have a question about sending an IVCiphertext over a communication channel. So I used the communication layer as provided by libscapi. Now I want to send an IVCiphertext from one party to the other over this communication channel. However, I get a segmentation fault and I can't figure out what's the problem. My functions for sending and receiving are as follows:

Send function:

void send_aes_msg(shared_ptr<SymmetricCiphertext> c_m) {
	string c_m_string = c_m->toString();
	channel->writeWithSize(c_m_string);
}

Receive function:

shared_ptr<SymmetricCiphertext> recv_aes_msg() {
  shared_ptr<IVCiphertext> c_m;

  vector<byte> raw_msg;
	channel->readWithSizeIntoVector(raw_msg);
  c_m->initFromByteVector(raw_msg);

  return c_m;
}

I have implemented similar functions for ElGamal ciphertexts and ElGamal keys, and in those cases I used the libscapi function for generating sendable data and it works. However, there is no such function for symmetric ciphertexts, so that's why I tried it this way, but apparently it doesn't work.

Could anyone help me out? Thanks a lot!

Kind regards, Ruth

Compare two strings

Hi,

Can you give me some guidance about how can I do comparison of two strings securely and privately using this library?

Thanks

Incorrect output from BooleanCircuit (parsed from text file)

I've tried creating a basic boolean circuit and evaluating it.

The circuit is as follows (the comments are included for readability, the actual text file does not contain the comments, as I've found that the comments throw the parser off):

// addition_circuit.txt

1     // One gate
1     // One party

1     // First party
2     // Two inputs
0     // Input labeled as "0"
1     // Input labeled as "1"

1     // One output
2     // Output labeled as "2"

// First gate
2     // Two inputs
1     // One output
0     // Input labeled as "0"
1     // Input labeled as "1"
2     // Output labeled as "2"
0001  // Truth table representing "AND" 

Regardless of the input I set, I seem to get "0" as the output.

Here is the code that I am using

#include <iostream>
#include "../include/circuits/BooleanCircuits.hpp"

using namespace std;

int main() {

	BooleanCircuit bc(new scannerpp::File("addition_circuit.txt"));

        // Code to confirm that the gate has been parsed correctly from the text file.
	for (Gate gate : bc.getGates()) {
		cout << "\nGate is ";
		for (int bit : gate.getTruthTable()) {
			cout << bit;
		}
	}

        // Iterate over all combinations of inputs
	for (int i0 = 0; i0 < 2; i0++) {
		for (int i1 = 0; i1 < 2; i1++) {
			map<int, Wire> presetInputWires = { { 0, Wire(i0) },
                                                            { 1, Wire(i1) } };
			bc.setInputs(presetInputWires, 1);
			auto bc_result = bc.compute();
			int result = bc_result[2].getValue();
			std::cout << "\n\nInputs are " << i0 << " and " << i1;
			std::cout << "\nOutput is " << result << endl;
		}
	}
    return 0;
}	

Is there something obvious that I am missing?

I should add that I seem to get the correct results when instantiating the boolean circuit using Gate objects (as opposed to using a text file).

memory leaks when running the dlog sample

I am using the DamgardJurik encryption scheme and I seemed to have noticed garbage values in the output now and then. I ended up checking for memory leaks and it seemed like there were quite a few of them. Eventually, I ended up running the samples and there were a number of memory leaks in the dlog and sha1 samples, which makes me wonder if there's something broken in the original codebase or is it my implementation which is problematic.

Could someone please verify this?

P.S. I had used Valgrind for checking errors

Static linking build problems [solved]

Hi,
I want to run the GMW protocol in the MPC-Benchmark repository. But when I make, it says that libjsoncpp is not available in ~/libscapi/install/lib. Looking at makefile_libs, it seems there should be a folder for JsonCpp in libscapi/lib, but it's not present in the repository.

Should I download it myself and place it in that directory? Or should I do something else? When I do clone JsonCpp and make it, it continues but I get many errors like

/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(ge25519_lookup_niels.o): relocation R_X86_64_32S against symbol `CONST_2P0' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(gfe4x_square.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(gfe4x_mul.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(ge4x_double_p1p1.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(ge4x_add_p1p1.o): relocation R_X86_64_32S against symbol `Gk' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(ge4x_niels_add_p1p1.o): relocation R_X86_64_32S against symbol `scale19' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: /home/me/libscapi/install/lib/libsimpleot.a(ge4x_lookup_niels.o): relocation R_X86_64_32S against symbol `_allone' can not be used when making a PIE object; recompile with -fPIC
...
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/GMW.dir/build.make:132: GMW] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/GMW.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I got similar errors while trying to make the samples in libscapi. Is there something different about the build process now? I think something needs to be compiled statically that isn't? As far as I can tell, lib/OTExtensionBristol/SimpleOT/Makefile is building with -fPIC.

Additionally, is there any more documentation about libscapi and using it to build protocols like GMW other than readthedocs? I'm not certain but I believe the readthedocs information is pretty out of date. I'd be interested in improving the documentation once I can get libscapi working. Thanks.

Error executing an example

I'm trying to make:

./libscapi_example commitment 1 Comm/CommConfig.txt

But I get the error:

terminate called after throwing an instance of 'char const*'
Aborted (core dumped)

How to generate circuit using C++?

Hello,
Does libscapi supports generating circuits for c++ using a software or something similar? We are developing a framework that uses large circuits consist of many gates and they can not be written manually (like creating a file and defining the circuit).
Many thanx.

libraries in lib does match makefile_lib command

Finally I successfully installed libscapi on ubuntu 16.04 machine. The most critical issus I found is that in master release, the requierd source code used by makefile_libs does NOT match librares in lib directory. As far as I can see, foorqlib json boost miracl OTExtension are not include in lib. So it will occurs many make error. hope you guys can fix this.

Error in making Scapi

Hi
I have the same problem as previous issue.
Making SCAPI produce these errors


make[1]: Entering directory '/home/me/libscapi/build/OTExtension'
In file included from cbitvector.cpp:8:0:
cbitvector.h:296:16: error: field ‘m_nKey’ has incomplete type ‘EVP_CIPHER_CTX {aka evp_cipher_ctx_st}’
AES_KEY_CTX m_nKey;
^
In file included from /usr/local/include/openssl/evp.h:14:0,
from ../util/typedefs.h:15,
from cbitvector.h:18,
from cbitvector.cpp:8:
/usr/local/include/openssl/ossl_typ.h:90:16: note: forward declaration of ‘EVP_CIPHER_CTX {aka struct evp_cipher_ctx_st}’
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
^
Makefile:55: recipe for target 'util/.o' failed
make[1]: *** [util/
.o] Error 1
make[1]: Leaving directory '/home/me/libscapi/build/OTExtension'
makefile:110: recipe for target 'compile-otextension' failed
make: *** [compile-otextension] Error 2


Problem in making SCAPI

Hi
i am trying to install Scapi on Ubuntu, after installation of prerequisites, when i wanted to make Scapi, i got this error:
make[1]: Entering directory '/home/hajikarami/libscapi/build/OTExtension'
In file included from cbitvector.cpp:8:0:
cbitvector.h:296:16: error: field ‘m_nKey’ has incomplete type ‘EVP_CIPHER_CTX {aka evp_cipher_ctx_st}’
AES_KEY_CTX m_nKey;
^
In file included from /usr/local/include/openssl/evp.h:14:0,
from ../util/typedefs.h:15,
from cbitvector.h:18,
from cbitvector.cpp:8:
/usr/local/include/openssl/ossl_typ.h:90:16: note: forward declaration of ‘EVP_CIPHER_CTX {aka struct evp_cipher_ctx_st}’
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
^
Makefile:55: recipe for target 'util/.o' failed
make[1]: *** [util/
.o] Error 1
make[1]: Leaving directory '/home/hajikarami/libscapi/build/OTExtension'
makefile:110: recipe for target 'compile-otextension' failed
make: *** [compile-otextension] Error 2

how can I solve this?

OpenSSL & MacOS Build Process (on High Sierra)

I have also replicated this same problem in a colleague's (Bon, who is also on this thread) computer on High Sierra 10.13, too. My computer has Mojave. The compiler used on High Sierra computer was clang.

Bons-MacBook-Pro:~ bon$ ls -l $(which cc)
lrwxr-xr-x  1 root  wheel  5 Oct 26 21:22 /usr/bin/cc -> clang

Bons-MacBook-Pro:libscapi bon$ ls -l $(which g++)
-rwxr-xr-x  1 root  wheel  18288 Sep 21 00:17 /usr/bin/g++

Bons-MacBook-Pro:libscapi bon$ g++ --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 

Originally posted by @dahadaller in https://github.com/cryptobiu/libscapi/issue_comments#issuecomment-437043808

Error when running commitment scheme example copied to own system

Hello :),

When I run the commitment scheme example from the example folder by opening two windows and running ./libscapi_example commitment 1 Commitment/CommitmentConfig.txt in one window and ./libscapi_example commitment 2 Commitment/CommitmentConfig.txt in the other, it works perfectly. However, I copied the files examples_main.cpp, examples_main.hpp, makefile and the folder Commitment to my own system (and changed the folder names in the #include lines accordingly of course) and then I tried executing the same things again. When I first run ./libscapi_example commitment 1 Commitment/CommitmentConfig.txt in one window I get no errors, but as soon as I enter ./libscapi_example commitment 2 Commitment/CommitmentConfig.txt in the other window, I get the following error:

terminate after throwing instance of char const*

Does anyone know the problem? I mean, I basically just copied the code from the example folder, so I guess the problem is not with the code, but somewhere in my system.

Btw, I'm using Ubuntu 14.04 with OpenSSL 1.0.2g.

Thanks in advance!

Kind regards, Ruth

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.