Hybrid PQ-CP-ABE Library for Windows/Linux - Version 5.2.0¶
Note
IMPORTANT NOTICE:
- From Version 4.0, this library natively supports and includes Post-Quantum Cryptography (PQC).
- If your project DOES NOT need PQC (to save space, avoid liboqs dependencies, or minimize performance overhead), please download and use Version 3.1 from the Releases page.
Overview¶
Version 5.2.0 focuses on a massive overhaul of the underlying cryptographic backend (rabe-ffi). We have successfully upgraded the core rabe Rust dependency from the outdated v0.2.6 to the latest v0.4.2. This update brings critical improvements to cryptographic soundness (AEAD support), modernizes the API layer, and provides strict memory safety guarantees by completely eliminating legacy Undefined Behavior (UB) patterns.
Enhancements & Security Upgrades¶
1. Core Dependency Upgrade: rabe 0.4.2¶
- The
rabecryptographic dependency used by therabe-ffimodule has been bumped from0.2.6to0.4.2. - Authenticated Encryption (AEAD): By migrating to
rabe 0.4.2, the internal symmetric encryption layer now securely utilizesaes-gcm(which includes an authentication tag). This replaces the older unauthenticated AES implementation, preventing ciphertext malleability attacks and ensuring cryptographically sound data integrity. - API Modernization: The C-FFI wrappers for AC17, BSW, AW11, BDABE, MKE08, LSW, and YCT14 schemes have been fully rewritten to support the new
rabe 0.4.xstrict reference-based APIs (e.g., converting C-string arrays into Rust&[&str]) and robust error-handling mechanisms (Resultmapping instead ofOption).
2. CI/CD Pipeline & GitHub Release Automation¶
- Automated GitHub Releases: CI/CD workflows on the
rabe-ffisubmodule have been enhanced to automatically package release artifacts (.zipfor Windows,.tar.gzfor macOS/Linux) and publish a new GitHub Release whenever a version tag (e.g.,v0.4.3) is pushed. - Node.js 16 Deprecation Fix: Upgraded GitHub Actions
actions/checkoutandactions/upload-artifacttov4to resolve workflow failures caused by GitHub's deprecation ofv3actions.
Bug Fixes¶
Memory Safety & Undefined Behavior (UB) Elimination¶
- Fixed Allocator Mismatch in
rabe_free_json: Prevented potential heap corruption and allocator layout mismatches by correctly usingCString::from_rawinstead ofBox::from_rawto deallocate memory originally allocated byCString::into_raw. - Eliminated
String::from_raw_partsUB: Completely removed dangerous memory-borrowing patterns that converted C pointers directly into RustStringobjects (which requires specific allocator alignment and layout). Safely replaced this withCStr::from_ptrand idiomatic Rust borrowing (&str), ensuring strict memory safety during FFI interop. - Macro Hardening: Fortified the
set_last_error!macro to safely filter and handle null-bytes within error messages to preventCStringinstantiation panics.
macOS Stack Overflow (SIGTRAP) Resolution¶
- Fixed a persistent issue where macOS unit tests would crash with
signal: 5, SIGTRAPduring heavy cryptographic operations. - Root Cause: macOS allocates a tiny 512KB default stack for secondary threads (like Rust test threads), which was being overflowed by large elliptic-curve pairing allocations on the stack.
- Resolution: Explicitly configured
RUST_MIN_STACK: 8388608(8MB) in the macOS testing environment, ensuring rock-solid stability for all unit tests across all operating systems.