Skip to content

Release v0.5.0 - #14

Merged
gnuykeat merged 1 commit into
CryptoLabInc:mainfrom
leejonghyeong:release-0.5.0
Sep 18, 2026
Merged

gnuykeat merged 1 commit into
CryptoLabInc:mainfrom
leejonghyeong:release-0.5.0

Conversation

@leejonghyeong

Copy link
Copy Markdown
Contributor

Syncs the public repository with the internal one. Base for this diff is the tree merged as #13 ("General optimize"); everything below landed internally after that.

Seed-only ciphertext: drop the PUBLICKEY seed mode

Only the UNIFORM a-part can be regenerated from a seed alone. The public-key variant needed the encryption key to reconstruct a, which defeats the purpose and made the deserialized ciphertext unusable without extra context. CipherSeedMode::PUBLICKEY, the matching EncryptorT::completeCiphertext() overload and the corresponding serialization path are removed. examples/SeedOnlyCiphertext.cpp and the EnDec tests are updated accordingly.

Serialization size guard (2 GiB)

FlatBuffers' internal size counter is a uint32 guarded only by an assert that compiles out in release builds, so a buffer past ~4 GiB silently wrapped and produced corrupt output. Both serialize and deserialize now reject anything above a 2 GiB bound up front with a clear error. Covered by new cases in Serialize-test.cpp.

SeedGenerator thread safety

  • Gen() and Reseed() mutated the singleton's RNG state with no synchronization. Both are now serialized behind a file-local mutex (GetInstance()'s magic-static initialization was already safe; the state was not).
  • Reseed() documented "when empty a random seed is chosen" but called seed.value() and threw std::bad_optional_access. The constructor's random_device seeding is factored into makeEntropySeed() and shared, so the documented behavior now holds.
  • seed.value_or(SeedGenerator::Gen()) evaluated Gen() unconditionally, so a caller supplying a deterministic seed still advanced the singleton. The Encryptor and KeyGenerator call sites select lazily now.

OpenMP

The saved thread count in OmpUtils was a function-level static int, so concurrent scopes clobbered each other's saved value; it is thread_local now. Adds a thread-limit guard in OmpUtils.hpp.

Install / packaging

  • find_package(deb) failed on a default (static) install: debConfig.cmake.in unconditionally required alea and flatbuffers, which a static build links through BUILD_INTERFACE and bakes into libdeb.a, so neither package is present. Those find_dependency calls are now conditional on DEB_INSTALL_ALEA / DEB_INSTALL_FLATBUFFERS.
  • DEB_SERIALIZE_API puts flatbuffers into the public include graph (installed Serialize.hpp → DebFBType.h → <flatbuffers/flatbuffers.h>), so DEB_INSTALL_FLATBUFFERS is forced on whenever we install at all.
  • Generated headers are installed flat next to the headers that include them, instead of keeping the extra generated/ level, and ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} is added to the install interface to mirror the build interface.
  • BLAKE3 (benchmark-only) writes libblake3.pc into its own binary dir but installs it from the top-level one, so cmake --install failed on a file that was never there. Its install rules are skipped for the duration of that subdirectory.

Warnings

New set_deb_no_warnings() helper, applied to the flatbuffers targets, plus INTERFACE_SYSTEM_INCLUDE_DIRECTORIES on flatbuffers. A consumer project with global warning flags (add_compile_options(-Wall ...)) leaked them into every add_subdirectory(), surfacing warnings from dependencies we neither own nor can fix.

Drift fixes picked up along the way

Two items that were lost in an earlier sync rather than being new work, flagged here so they are easy to drop if you would rather they landed separately:

  • CMakePresets.json sets "DEB_ARCH": "x86-64-v3" for the benchmark preset, but CMakeLists.txt no longer declared or used DEB_ARCH, so the preset was a no-op. The cache variable and the -march plumbing are restored.
  • .clang-tidy had ccpcoreguidelines-* (typo), which silently disabled that whole check group. Fixed to cppcoreguidelines-*.

Project version is bumped to 0.5.0.

Testing

cmake --preset ci + cmake --build --preset ci builds clean with no warnings, and ctest --preset all-test passes 6/6 (Operation, EnDecryption, KeyGen, NTT, U32, Serialize) on Linux / GCC 14.3 / OpenMP.

🤖 Generated with Claude Code

Sync with the internal repository. Changes since the last sync (v0.4.1):

* Seed-only ciphertext: drop the PUBLICKEY seed mode. Only the UNIFORM
  a-part can be reconstructed from a seed without the encryption key, so
  the public-key variant is removed from CipherSeedMode, Encryptor and
  the serialization format.
* Serialization: add a 2 GiB size guard on both serialize and
  deserialize. FlatBuffers' internal size counter is a uint32 that only
  asserts in debug builds, so oversized buffers silently corrupted in
  release.
* SeedGenerator: serialize Gen()/Reseed() behind a mutex, make Reseed()
  honor its documented empty-optional behavior, and stop evaluating
  Gen() eagerly through value_or() at the Encryptor/KeyGenerator call
  sites.
* OmpUtils: make the saved thread count thread_local and add an OMP
  thread limit guard.
* Install: fix find_package(deb) on a default (static) install by making
  the alea/flatbuffers find_dependency calls conditional, install the
  generated headers flat next to the headers that include them, and add
  the per-project include root to the install interface. Skip BLAKE3's
  broken subproject install rules.
* Warnings: add set_deb_no_warnings() and apply it to the flatbuffers
  targets so a consumer's global warning flags don't surface warnings we
  don't own.
* Restore the DEB_ARCH cache variable, which CMakePresets.json already
  referenced but CMakeLists.txt no longer declared.
* .clang-tidy: fix the "ccpcoreguidelines-*" typo that disabled that
  check group.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@leejonghyeong
leejonghyeong requested a review from a team September 18, 2026 05:51
@gnuykeat
gnuykeat merged commit f0af000 into CryptoLabInc:main Sep 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants