homenc / HElib

HElib is an open-source software library that implements homomorphic encryption. It supports the BGV scheme with bootstrapping and the Approximate Number CKKS scheme. HElib also includes optimizations for efficient homomorphic evaluation, focusing on effective use of ciphertext packing techniques and on the Gentry-Halevi-Smart optimizations.
https://homenc.github.io/HElib
Other
3.11k stars 759 forks source link

Why compare address? #496

Open sctarget opened 1 year ago

sctarget commented 1 year ago

When I read context from a serialized string and use the context, my program crashed. The reason is "Context mismatch" or "inconsistent contexts". So I wonder why compare the address of context?

crockeea commented 8 months ago

I think this is caused by https://github.com/homenc/HElib/blob/3e337a66a91a92d49de6a9505340826b0eb71081/src/keys.cpp#L1333

There's a comment that asks "Why are we comparing contexts rather than addresses", and the answer is "because of serialization, the context in the ciphertext may be different from the context in the secret key".