I give a C++ wrapper for OpenSSL, making it handy to use, without worrying about the cumbersome memory management and memorizing the complex interfaces. Based on this wrapper, I am going to build an efficient and modular crypto library.
Provide a set of neat interfaces for big integer and ec group operations, with the hope that the code is as succinct as paper description. Kunlun supports multithreading via OpenMP. So far, the library is not stable. It will keep evolving.
If the above two issues get solved, the performance of Kunlun will be better.
$ ./Configure darwin64-x86_64-cc shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-x86_64
$ make depend
$ sudo make install
test if the function x25519_scalar_mulx is available
$ cd /usr/local/lib
$ nm libcrypto.a | grep x25519_scalar_mulx
$ brew install libomp
do the same modification as in MACOS, then compile it according to
$ ./Configure no-shared enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --prefix=/usr/local/openssl
$ make depend
$ sudo make install
if reporting cannot find "opensslv.h" error, try to install libssl-dev
$ sudo apt-get install libssl-dev
$ sudo apt-get install libomp-dev
README.md
CmakeLists.txt: cmake file
/build
/include
/utility: dependent files
/crypto: C++ wrapper for OpenSSL
/pke: public key encryption schemes
/signature
/commitment
/gadgets
/cryptocurrency
/netio
mpc
/ot
naor_pinkas_ot.hpp: one base OT
iknp_ote.hpp: IKNP OT extension
/oprf
ote_oprf: OTE-based OPRF
ddh_oprf: DDH-based (permuted)-OPRF
vole_oprf: VOLE-based OPRF
/rpmt
cwprf_mqrpmt.hpp: mq-RPMT from commutative weak PRF
/pso
mqrpmt_psi.hpp: set intersection
mqrpmt_psi_card.hpp: intersection cardinality
mqrpmt_psi_card_sum.hpp: intersection sum and cardinality
mqrpmt_psu.hpp: union
mqrpmt_private_id.hpp: private-id protocol based on OTE-based OPRF and cwPRF-based mqRPMT
/okvs
baxos.hpp
ovks_utility.hpp
paxos.hpp
/vole
basevole.hpp
exconvcode.hpp
vole.hpp
zkp
/nizk: associated sigma protocol for twisted elgamal; obtained via Fiat-Shamir transform
nizk_plaintext_equality.hpp: NIZKPoK for twisted ElGamal plaintext equality in 3-recipient mode
nizk_plaintext_knowledge.hpp: NIZKPoK for twisted ElGamal plaintext and randomness knowledge
nizk_dlog_equality.hpp: NIZKPoK for discrete logarithm equality
nizk_dlog_knowledge.hpp: Schnorr protocol for dlog
nizk_enc_relation.hpp: prove one-out-of-n ciphertexts is encryption of 0
/bulletproofs
bullet_proof.hpp: the aggregating logarithmic size bulletproofs
innerproduct_proof.hpp: the inner product argument (used by Bulletproof to shrink the proof size)
/filter
/docs: the manual of all codes
$ mkdir build && cd build
$ cmake ..
$ make
$ ./test_xxx
Kunlun supports multithread by leveraging openmp. The underlying OpenSSL is not thread-safe, cause several threads may access a critial data structure "bn_ctx" concurrently. Kunlun is made thread-safe by introducing an array of bn_ctx. Thus, each thread has its own bn_ctx.
The global setting for multi-thread support lies at "include/global.hpp" line 19
For multi-thread (n)
inline const size_t NUMBER_OF_THREADS = n;
the default value of n is NUMBER_OF_PHYSICAL_CORES
For single-thread
inline const size_t NUMBER_OF_THREADS = 1;
inline int curve_id = NID_X9_62_prime256v1; // choose other curves by specifying curve-ID
#define ECPOINT_COMPRESSED // comment this line to enable uncompressed representation
#define ENABLE_X25519_ACCELERATION // (un)comment this line to enable x25519 acceleration method
Note: x22519 is an efficnet DDH-based non-interactive key exchange (NIKE) protocol based on curve25519. The essense of x25519 is exactly cwPRF. Its remarkable efficency is attained by performing "somehow EC exponentiation" with only X-coordinates (perhaps x25519 name after it). However, in x25519 the EC exponetiation is not standard, and EC addition is not well-defined. We stress that curve25519 certainly support standard EC exponentiation and addition, but x25519 method does not. Kunlun provides the option of using x25519 method to improve performance of applications when it is applicable (involving only cwPRF). But, since x25519 method is not full-fledged, ordinary EC curves are always necessary for base Naor-Pinkas OT. Therefore, users must specify one ordinary EC curve when implementing ECC.
This library is licensed under the MIT License.
We deeply thank Weiran Liu for many helpful discussions on the development of this library. Here we strongly recommend the efficient and easy-to-use MPC library for Java developed by his team. I thank my deer senior apprentice Prof. Zhi Guan for professional help.
install iperf3 via the following command
brew install iperf3
open it in two terminals (perhaps on two computers)
iperf3 -s
iperf3 -c [IP Address of first Mac]
See more information via https://www.macobserver.com/tmo/answers/how-to-test-speed-home-network-iperf