Summary
The fix implemented in commit 64ed308 (September 2022) for Issue #110 never worked. All HYBRID key switching users that does not need PRE pay unnecessary storage and performance overhead on public keys because PREMode defaults to INDCPA instead of NOT_SET.
The Problem
Issue #110 identified that GetParamsPK() returns the extended Q×P basis for all HYBRID scenarios, even when PRE functionality isn’t needed. Commit 64ed308 attempted to fix this by adding a check in rns-cryptoparameters.h:
if ((m_ksTechnique == HYBRID) && (m_PREMode != NOT_SET))
return m_paramsQP;
However, the default value for PREMode in gen-cryptocontext-params-defaults.h is INDCPA, not NOT_SET:
namespace CKKSRNS_SCHEME_DEFAULTS {
constexpr ProxyReEncryptionMode PREMode = INDCPA;
};
// Same for BFVRNS_SCHEME_DEFAULTS and BGVRNS_SCHEME_DEFAULTS
Since INDCPA != NOT_SET is always true, GetParamsPK() always returns m_paramsQP for HYBRID - the fix never worked.
Timeline
| Date | Commit | Change |
|---|---|---|
| Aug 3, 2022 | 8e1a341 |
PREMode = INDCPA added as default |
| Sep 6, 2022 | 64ed308 |
Fix attempted with m_PREMode != NOT_SET check |
| Present | - | Bug persists (fix was dead on arrival) |
Impact
- Larger public keys for all HYBRID users (overhead depends on parameters)
- Slower key generation and encryption
- No security impact (purely optimization issue)
- Affected users: Everyone using HYBRID key switching (default for CKKS and BGV)
Proposed Fix
Change the default PREMode from INDCPA to NOT_SET in src/pke/include/scheme/gen-cryptocontext-params-defaults.h:
namespace CKKSRNS_SCHEME_DEFAULTS {
constexpr ProxyReEncryptionMode PREMode = NOT_SET; // was INDCPA
};
namespace BFVRNS_SCHEME_DEFAULTS {
constexpr ProxyReEncryptionMode PREMode = NOT_SET; // was INDCPA
};
namespace BGVRNS_SCHEME_DEFAULTS {
constexpr ProxyReEncryptionMode PREMode = NOT_SET; // was INDCPA
};
Also update pre-buffer.cpp to explicitly set PREMode = INDCPA since PRE now requires opt-in.
I Have a Fix Ready
I have implemented and tested this fix locally:
- All unit tests pass (
make testall) - PRE examples (pre-buffer, pre-hra-secure) work correctly
I tried to submit a PR but cannot create one directly. My fork with the fix is at:
How can I submit this fix?
Thanks!
Related
- Original issue: https://github.com/openfheorg/openfhe-development/issues/110
- Attempted fix commit (would’ve like to hyperlink it, but new users cannot have more than 2 hyperlinks in their post…): /github.com/openfheorg/openfhe-development/commit/64ed308