Skip to content

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 rabe cryptographic dependency used by the rabe-ffi module has been bumped from 0.2.6 to 0.4.2.
  • Authenticated Encryption (AEAD): By migrating to rabe 0.4.2, the internal symmetric encryption layer now securely utilizes aes-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.x strict reference-based APIs (e.g., converting C-string arrays into Rust &[&str]) and robust error-handling mechanisms (Result mapping instead of Option).

2. CI/CD Pipeline & GitHub Release Automation

  • Automated GitHub Releases: CI/CD workflows on the rabe-ffi submodule have been enhanced to automatically package release artifacts (.zip for Windows, .tar.gz for 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/checkout and actions/upload-artifact to v4 to resolve workflow failures caused by GitHub's deprecation of v3 actions.

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 using CString::from_raw instead of Box::from_raw to deallocate memory originally allocated by CString::into_raw.
  • Eliminated String::from_raw_parts UB: Completely removed dangerous memory-borrowing patterns that converted C pointers directly into Rust String objects (which requires specific allocator alignment and layout). Safely replaced this with CStr::from_ptr and 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 prevent CString instantiation panics.

macOS Stack Overflow (SIGTRAP) Resolution

  • Fixed a persistent issue where macOS unit tests would crash with signal: 5, SIGTRAP during 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.