v4.0.0: codec 2.60.4 security release, --pq-box sealed-box mode, F-16 fix
Some checks failed
CI / build-and-test (clang) (push) Has been cancelled
CI / build-and-test (gcc) (push) Has been cancelled
CI / strict-warnings (clang, -Wall -Wextra -Wpedantic -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnull-dereference -O2 -std=c11 -Werror) (push) Has been cancelled
CI / strict-warnings (gcc, -Wall -Wextra -Wpedantic -Wshadow -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnull-dereference -Wformat-security -Wlogical-op -Wjump-misses-init -Wdouble-promotion -O2 -std=c11 -Werror) (push) Has been cancelled
CI / sanitizers (push) Has been cancelled
CI / pie-hardening (push) Has been cancelled
CI / cross-aarch64 (push) Has been cancelled
CI / dist-reproducibility (push) Has been cancelled
CI / packaging-syntax (push) Has been cancelled
CI / release (push) Has been cancelled

Major release. Highlights:

- Codec: vendored VaptVupt codec moves to canonical 2.60.4 security
  release. Fixes a high-severity OOB heap write in the AVX2 decode fast
  path (reachable on a valid stream sized to exactly content_size, both
  tail variants). Brings CBMC-formally-verified BCJ filters with
  automatic ELF/PE/Mach-O detection. Compressed output stays
  byte-identical (ratio gate Δ 0.00%); wire format unchanged at v1.6.
- New --pq-box sealed-box recipient mode (vendored libpqvaptvupt 0.6.0):
  ML-KEM-768 + X25519 combined via HKDF-SHA256 with domain separation,
  AES-256-CTR + HMAC-SHA256 EtM. Legacy --pq and --pq-sdk stay readable.
- F-16: discloses and fixes a pre-existing data-loss defect in the
  <= 3.8.0 in-tree BCJ encoder. Full back-compat matrix decodes
  byte-exact under 4.0.0; every readable pre-4.0 archive remains readable.

Repository hygiene:
- Sync full 4.0.0 source tree (codec, crypto, SDK, GUI, packaging, tests).
- Remove internal scratch files (PROMPT.md, FORMAL_AUDIT_PROMPT.md)
  and superseded version-specific docs (INTEGRATION_PROTOCOL_2.60.4.md,
  docs/FINDINGS-2.x.md) and a stray test binary.
- Refresh README download/install section to real 4.0.0 release assets;
  bump version badge to 4.0.0.
- Add .gitignore for build outputs (keeps vendored prebuilt libraries).
This commit is contained in:
Cristian Cezar Moisés 2026-06-10 18:48:58 -03:00
commit 544a2cd647
98 changed files with 15615 additions and 1397 deletions

57
include/vv_bcj.h Normal file
View file

@ -0,0 +1,57 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* VaptVupt BCJ branch filters (see src/vv_bcj.c).
*
* Reversible, architecture-specific branch converters that improve the
* compression of machine code by turning relative call targets into an
* absolute form. Each is an exact bijection on arbitrary input, so a file
* filtered with the wrong architecture (or no machine code at all) still
* round-trips byte-for-byte.
*/
#ifndef VV_BCJ_H
#define VV_BCJ_H
#include <stddef.h>
#include <stdint.h>
/*
* x86 / x86-64 BCJ. Converts near CALL (0xE8) and JMP (0xE9) relative
* displacements to/from absolute. encoding != 0 = forward (compress-side),
* 0 = inverse (decode-side). `ip` is the stream offset of byte 0 (use 0 for
* whole-buffer transforms). Returns the prefix length that may have been
* modified. vv_bcj_x86(b,n,0,0) undoes vv_bcj_x86(b,n,0,1).
*/
size_t vv_bcj_x86(uint8_t *data, size_t size, uint32_t ip, int encoding);
/*
* AArch64 (ARM64) BL + ADRP filter. Converts BL (call) 26-bit relative word
* offsets and ADRP (PC-relative page address) 21-bit page offsets to/from an
* absolute form, each modulo its immediate width. Same calling convention as
* vv_bcj_x86. Only BL (opcode 100101) and ADRP (1xx10000) are touched;
* opcode and register bits are preserved, so the transform is an exact
* bijection on arbitrary input. vv_bcj_arm64(b,n,0,0) undoes
* vv_bcj_arm64(b,n,0,1).
*/
size_t vv_bcj_arm64(uint8_t *data, size_t size, uint32_t ip, int encoding);
/* Which branch filter best fits a buffer, by sniffing an executable header. */
typedef enum {
VV_FILTER_NONE = 0,
VV_FILTER_X86 = 1,
VV_FILTER_ARM64 = 2
} vv_filter_kind_t;
/*
* Inspect the first bytes of `data` for an ELF, PE (MZ/PE), or Mach-O header
* and return the BCJ filter that matches its machine type:
* - x86 / x86-64 (and 32-bit x86) -> VV_FILTER_X86
* - AArch64 (ARM64) -> VV_FILTER_ARM64
* - anything else, or no recognised header-> VV_FILTER_NONE
* Fully bounds-checked: safe on truncated or arbitrary input. Detection
* errors are never correctness bugs a missed match just means no filter,
* and a spurious match still round-trips (the filters are bijections), it
* merely may not improve the ratio.
*/
vv_filter_kind_t vv_bcj_detect(const uint8_t *data, size_t size);
#endif /* VV_BCJ_H */