intel / hexl

Intel:registered: Homomorphic Encryption Acceleration Library accelerates modular arithmetic operations used in homomorphic encryption
https://intel.github.io/hexl
Apache License 2.0
219 stars 50 forks source link

CKKS multiply experimental feature doesn't work correctly when integrated with SEAL #97

Closed tgonzalez89-intel closed 2 years ago

tgonzalez89-intel commented 2 years ago

When trying to integrate the HEXL experimental features into SEAL, I found that it's not giving me the correct results. I'm not sure if I'm doing something wrong or if there is an error in the CKKS multiply implementation of HEXL.

How to reproduce:

git clone https://github.com/tgonzalez89-intel/SEAL.git
git checkout hexl-ckks-mult-bug
./build.sh
cd build/bin
./sealtest

Observe that the tests fail.

You can run git diff 3.7.2 to observe the changes I made to SEAL in order to integrate HEXL's CKKS multiply.

joserochh commented 2 years ago

Hello @tgonzalez89-intel I have debugged test CKKSEncryptNaiveMultiplyDecrypt in SEAL and I found out that the HEXL method is not working fine when operand1 and operand2 are a pointer to the same ciphertext. The same thing should be happening in CKKSEncryptSquareRelinDecrypt where in place multiplication is also called in the following way:

evaluator.multiply_inplace(encrypted, encrypted);

Thanks for spotting this. We will be fixing this on HEXL.

tgonzalez89-intel commented 2 years ago

Created PR with fix (#98)