FerranAlborch / Implementation-RLWE-based-distributed-key-generation-and-threshold-decryption

1 stars 0 forks source link

Decryption result is not correct #1

Closed bo-hub closed 2 years ago

bo-hub commented 2 years ago

Hi, thank you for your wonderful work. I am trying to test the threshold decryption program here. And I uncomment this line in decryption_sim.c file. https://github.com/FerranAlborch/Implementation-RLWE-based-distributed-key-generation-and-threshold-decryption/blob/b6fcd0648d14f6308ff1700ca7211034627b43bb/decryption_sim.c#L367

Then I compile the decryption_sim.c file use

gcc decryption_sim.c functions.c -lm -lgmp -lssl -lcrypto -lflint -lmpfr -o decrypt.out -O2

And I run the output by

./decrypt.out 1024 7 2

But the output said the decryption is not correct:

bob@bobvm:~/code/crypto/lattice_crypto/RLWE_TE$ ./decrypt.out 1024 7 2 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0 Returns 1 if the threshold decryption is correct, 0 otherwise: 0

Is there anything I missed or misunderstand? Thanks!

FerranAlborch commented 2 years ago

Hi,

The error has been solved, interdec was not being properly computed following the conditions on Theorem 1 of the paper (it was bigger), and therefore the rounding did not give a correct result. The changes are at line 204 of the decryption_sim.c file. Thank you for bringing the issue to our attention.