Git Product home page Git Product logo

cifer's People

Contributors

janhartman avatar miha-stopar avatar mlewa89 avatar rubdos avatar thibsg avatar tilenmarc 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cifer's Issues

Multiple definition of Symbols

When I build the library from source code, it generates at make command.

.....
/usr/bin/ld: CMakeFiles/cifer_test.dir/test/serialization/gpsw_ser.c.o:(.bss+0x360): multiple definition of `big_suite'; CMakeFiles/cifer_test.dir/test/test.c.o:(.bss+0x380): first defined here
/usr/bin/ld: CMakeFiles/cifer_test.dir/test/serialization/gpsw_ser.c.o:(.bss+0x380): multiple definition of `dlog_suite'; CMakeFiles/cifer_test.dir/test/test.c.o:(.bss+0x3a0): first defined here
/usr/bin/ld: CMakeFiles/cifer_test.dir/test/serialization/gpsw_ser.c.o:(.bss+0x3a0): multiple definition of `vector_suite'; CMakeFiles/cifer_test.dir/test/test.c.o:(.bss+0x3c0): first defined here
/usr/bin/ld: CMakeFiles/cifer_test.dir/test/serialization/gpsw_ser.c.o:(.bss+0x3c0): multiple definition of `matrix_suite'; CMakeFiles/cifer_test.dir/test/test.c.o:(.bss+0x3e0): first defined here
/usr/bin/ld: CMakeFiles/cifer_test.dir/test/serialization/gpsw_ser.c.o:(.bss+0x3e0): multiple definition of `keygen_suite'; CMakeFiles/cifer_test.dir/test/test.c.o:(.bss+0x400): first defined here
/usr/bin/ld: CMakeFiles/cifer_test.dir/test/serialization/gpsw_ser.c.o:(.bss+0x400): multiple definition of `prime_suite'; CMakeFiles/cifer_test.dir/test/test.c.o:(.bss+0x420): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/cifer_test.dir/build.make:658: cifer_test] Error 1
make[1]: *** [CMakeFiles/Makefile2:113: CMakeFiles/cifer_test.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

os: ubuntu

Variable prod never initialized in README example

Dear CiFEr team,

The example shown in the README under the section Using a multi input scheme uses a variable prod that is used without initialization.

The code in question:

size_t numClients = 2;             // number of encryptors
size_t l = 3;                 // length of input vectors
mpz_t bound, prod;
mpz_init_set_ui(bound, 1000); // upper bound for input vectors

// Simulate collection of input data.
// X and Y represent matrices of input vectors, where X are collected
// from numClients encryptors (ommitted), and Y is only known by a single decryptor.
// Encryptor i only knows its own input vector X[i].
cfe_mat X, Y;
cfe_mat_inits(numClients, l, &X, &Y, NULL);
cfe_uniform_sample_mat(&X, bound);
cfe_uniform_sample_mat(&Y, bound);

// Trusted entity instantiates scheme instance and generates
// master keys for all the encryptors. It also derives the FE
// key derivedKey for the decryptor.
size_t modulus_len = 64;
cfe_ddh_multi m, decryptor;
cfe_ddh_multi_init(&m, numClients, l, modulus_len, bound);

cfe_mat mpk;
cfe_ddh_multi_sec_key msk;
cfe_ddh_multi_master_keys_init(&mpk, &msk, &m);
cfe_ddh_multi_generate_master_keys(&mpk, &msk, &m);
cfe_ddh_multi_fe_key fe_key;
cfe_ddh_multi_fe_key_init(&fe_key, &m);
cfe_ddh_multi_derive_fe_key(&fe_key, &m, &msk, &Y);

// Different encryptors may reside on different machines.
// We simulate this with the for loop below, where numClients
// encryptors are generated.
cfe_ddh_multi_enc encryptors[numClients];
for (size_t i = 0; i < numClients; i++) {
    cfe_ddh_multi_enc_init(&encryptors[i], &m);
}

// Each encryptor encrypts its own input vector X[i] with the
// keys given to it by the trusted entity.
cfe_mat ciphertext;
cfe_mat_init(&ciphertext, numClients, l + 1);
for (size_t i = 0; i < numClients; i++) {
    cfe_vec ct;
    cfe_vec *pub_key = cfe_mat_get_row_ptr(&mpk, i);
    cfe_vec *otp = cfe_mat_get_row_ptr(&msk.otp_key, i);
    cfe_vec *x_vec = cfe_mat_get_row_ptr(&X, i);
    cfe_ddh_multi_ciphertext_init(&ct, &encryptors[i]);
    cfe_ddh_multi_encrypt(&ct, &encryptors[i], x_vec, pub_key, otp);
    cfe_mat_set_vec(&ciphertext, &ct, i);
    cfe_vec_free(&ct);
}

// Ciphers are collected by decryptor, who then computes
// inner product over vectors from all encryptors.
cfe_ddh_multi_copy(&decryptor, &m);
cfe_ddh_multi_decrypt(prod, &decryptor, &ciphertext, &fe_key, &Y);

As the function cfe_ddh_multi_decrypt assumes that all the variables are initialized, the code should add an mpz_init(prod) before calling cfe_ddh_multi_decrypt(prod, &decryptor, &ciphertext, &fe_key, &Y).

This oversight is corroborated by the previous example shown in the README and the test files for multi_ddh where prod corresponds to xy which is initialized in both cases.

Best regards,
Aymeric

About cfe_dmcfe

Hi,

Would you develop the MCFE version of "Decentralized scheme based on paper by Chotard, Dufour Sans, Gay, Phan and Pointcheval (paper)? This scheme does not require a trusted party to generate keys. It is built on pairings (cfe_dmcfe)."?

We need the Centralized version, but I found it hard to change the code of DMCFE to MCFE. Because the discrete logarithm "cfe_baby_giant_FP12_BN256_with_neg" is not compatible with one generator. Should I use the "damgard" as the base code to develop MCFE?

I'm looking forward to your help

Addition of elements in fp12

Hello,

CiFEr configures amcl with BN254. The BN254 internally uses fp12 to represent points.
For some implementation we need addition in fp12 which is unfortunately not implemented
in the amcl library. Is there a reason why this is not in general possible.

Aside
Do you know of any pairing friendly curve where addition of curve elements is possible ?

my challenges using the library

I want to use the library to implement an access control using ABE. The process involves communication between two parties. I initiated the cpabe-setup at the receiver end and send the public key through a safe channel to the sender of the message. After receiving the public key and perform the encryption of the message with some sets of access structure and the public key, i sent the resulting ciphertext to the receiver but the decryption never possible, i get segmentation (core dumped) always. what could be the possible problems and how can i correct it?

my question about ABE

Please forgive me for my poor English.I am a student in Asian.
How can I get character string from FP12_BN254 ?
I use the function "extern void FP12_BN254_toOctet(octet *S,FP12_BN254 *x);".
But I cannot get the character string what I use the function'extern void FP12_BN254_fromOctet(FP12_BN254 *x,octet *S);' to input.

Cannot compute negative logarithm

I am trying to compute the Baby step giant algorithm to solve the dlog
problem for a functional encryption scheme that is relatively similar
to fhipe. For fhipe the cfe_baby_giant_FP12_BN256_with_neg computes
negative and positive results as expected. In my scheme it will positive
results as expected but will give CFE_ERR_DLOG_NOT_FOUND when
it is supposed to output a negative result.

question on quadratic SGP scheme

Hello,
Could you please explain me why in quadratic SGP scheme, instead of having a generateKeys function that generates a public key and a master secret key (used then to compute the FE key), there is only a function GenerateMasterKey that outputs a key that is used both by the encryptor as public key and by the authority to generate the FE key used by the decryptor?

Regards,
Lorenzo

cfe_ddh_multi_fe_key size discrepancy

Dear CiFEr team,

In multi_ddh.c:73, the function cfe_ddh_multi_fe_key_init(cfe_ddh_multi_fe_key *key, cfe_ddh_multi *m) initializes key->keys with the size of the input vectors (i.e., m->scheme.l) instead of (presumably) the number of users (i.e., m->slots).

As a result, if m->slots is greater than m->scheme.l and since in multi_ddh.c:127, the function cfe_ddh_multi_derive_fe_key(cfe_ddh_multi_fe_key *res, cfe_ddh_multi *m, cfe_ddh_multi_sec_key *msk, cfe_mat *y) calls cfe_vec_set(&res->keys, key, i) from i = 0 to m->slots, this can potentially cause an assertion error at vec.c:132: because i > v->size. The same would occur in multi_ddh.c:163 with the function cfe_ddh_multi_decrypt(mpz_t res, cfe_ddh_multi *m, cfe_mat *ciphertext, cfe_ddh_multi_fe_key *key, cfe_mat *y) since cfe_vec_get(k, &key->keys, i) is called with the same range.

Below is a minimal working example that triggers the assertion error:

#include <gmp.h>
#include "cifer/data/mat.h"
#include "cifer/innerprod/simple/ddh_multi.h"

int main(void)
{
	size_t numClients = 3;
	size_t l = 2;
	mpz_t bound;
	mpz_init_set_ui(bound, 1000);

	cfe_mat Y;
	cfe_mat_init(&Y, numClients, l);

	size_t modulus_len = 64;
	cfe_ddh_multi m;
	cfe_ddh_multi_init(&m, numClients, l, modulus_len, bound);

	cfe_mat mpk;
	cfe_ddh_multi_sec_key msk;
	cfe_ddh_multi_master_keys_init(&mpk, &msk, &m);
	cfe_ddh_multi_generate_master_keys(&mpk, &msk, &m);
	cfe_ddh_multi_fe_key fe_key;
	cfe_ddh_multi_fe_key_init(&fe_key, &m);
	/* The next line will cause an assertion error */
	cfe_ddh_multi_derive_fe_key(&fe_key, &m, &msk, &Y);

	mpz_clear(bound);
	cfe_mat_frees(&Y, &mpk, NULL);
	cfe_ddh_multi_free(&m);
	cfe_ddh_multi_sec_key_free(&msk);
	cfe_ddh_multi_fe_key_free(&fe_key);

	return 0;
}

Best regards,
Aymeric

About measuring communication cost

Hi there, I am using CiFEr to achieve a multi-party functional encryption. I took the example presented in CiFEr's cover page, and it works well.

I am wondering how to measure the traffic cost between different parties.The code of your example just mixed the computation of all parties together. Is there a way to split the code into different pieces for encryptors and decryptor, and then measure the communication among them?

Thanks for your help in advance!

Speed benchmark

It would be good to have in the README a basic time benchmark, like time to encrypt/decrypt a vector and time to compute an inner product of two vectors.

Do you already have some time benchmarks which you could share?
I'm particularly interested in a full encrypt/decrypt/evaluate-inner-product cycle for the case of 128 float vectors.

This might be inspirational for a future benchmark file: https://github.com/microsoft/SEAL/blob/master/native/examples/6_performance.cpp

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.