# Bug Report: Incomplete Fix for Issue #110 - HYBRID Public Keys Always Use Q×P Basis

**URL:** <https://openfhe.discourse.group/t/bug-report-incomplete-fix-for-issue-110-hybrid-public-keys-always-use-qxp-basis/2257>\
**Category:** Misc\
**Created:** [January 12, 2026, 1:28pm UTC](https://openfhe.discourse.group/t/bug-report-incomplete-fix-for-issue-110-hybrid-public-keys-always-use-qxp-basis/2257 "2026-01-12T13:28:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BurakK](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@BurakK](https://openfhe.discourse.group/u/BurakK)\
**Post date:** [January 12, 2026, 1:28pm UTC](https://openfhe.discourse.group/t/bug-report-incomplete-fix-for-issue-110-hybrid-public-keys-always-use-qxp-basis/2257/1 "2026-01-12T13:28:23Z")

</div>

## 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`:

```cpp
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`:

```cpp
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`:

```cpp
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:

> **[GitHub - BurakKTopal/openfhe-development at BurakKTopal\_issue110](https://github.com/BurakKTopal/openfhe-development/tree/BurakKTopal_issue110)**
>
> BurakKTopal\_issue110

How can I submit this fix?

Thanks!

## Related

- Original issue: [https://github.com/openfheorg/openfhe-development/issues/110](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

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [January 19, 2026, 10:02pm UTC](https://openfhe.discourse.group/t/bug-report-incomplete-fix-for-issue-110-hybrid-public-keys-always-use-qxp-basis/2257/2 "2026-01-19T22:02:28Z")

</div>

Thank you for spotting the bug. I’ve added you access to create issues and PRs. I am concerned about the side effects resulting from the proposed solution. For instance, some existing PRE-based applications, e.g., [GitHub - openfheorg/openfhe-network-examples: OpenFHE Experiments in Encrypted Network Control and Secure Data Distribution with Proxy Re-Encryption](https://github.com/openfheorg/openfhe-network-examples), might be using the default. Please create an issue and let us continue the discussion there to figure out the right way to fix it.

---

<div class="post-metadata">

**Author:** ![BurakK](https://avatars.discourse-cdn.com/v4/letter/b/b9bd4f/32.png) [@BurakK](https://openfhe.discourse.group/u/BurakK)\
**Post date:** [January 20, 2026, 1:19pm UTC](https://openfhe.discourse.group/t/bug-report-incomplete-fix-for-issue-110-hybrid-public-keys-always-use-qxp-basis/2257/3 "2026-01-20T13:19:55Z")

</div>

[Incomplete Fix for Issue #110 - PREMode default causes public keys to always use Q×P basis when using HYBRID key switching · Issue #1108 · openfheorg/openfhe-development](https://github.com/openfheorg/openfhe-development/issues/1108)

Done 👍
