The second reader. A package is one encrypted file — cleartext header, sealed manifest, model bytes sealed in chunks — and this opens it: the content key unwrapped with X25519 against the base key, the header verified as Ed25519 signed by a release key the root vouches for, the model decrypted into memory and handed to ANSModelSource, which the engines already take. It is a new library rather than code inside the engine layer, and deliberately free of the heavy dependencies around it: no CUDA, no OpenCV, no LabVIEW. That is what lets it build and be tested on every platform, including the ones where the engine layer does not build. THE TWO IMPLEMENTATIONS MUST AGREE, so this does not merely claim to: tests/ANSModelPackage-UnitTest/data/interop.ansmodel was written by ANSMINDCORE's packer, and the test opens it here — manifest, classes and a chunked payload, byte for byte. A change to either wire format shows up as this failing. The fixture's keys are derived by published rules, recorded beside it, so anyone can rebuild it. The AEAD and the small primitives are copies of ANSMINDCORE's, not reimplementations, for the same reason. Monocypher 4.0.2 is vendored here as it is there, including the RFC 8032 pair — its default EdDSA signs with BLAKE2b and would not interoperate. Verified by compiling and running the test directly: 19 checks, RFC 8439, RFC 7748 and RFC 8032 vectors, the interop fixture, a round trip, a flipped bit, an unknown root, a revoked signer, and rubbish bytes. ANSCORE's own CMake configure fails on this machine for reasons that predate this change — eight errors with or without it, all missing dependencies — so the new CMake targets still need a real build box. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
1.3 KiB
CMake
32 lines
1.3 KiB
CMake
# ANSModelPackage — reading an ANS model package (.ansmodel).
|
|
#
|
|
# Header-only apart from the vendored curves, and deliberately free of the
|
|
# heavy dependencies around it: no CUDA, no OpenCV, no LabVIEW. That is what
|
|
# lets it build — and be tested — on every platform, including the ones where
|
|
# the engine layer does not build at all.
|
|
add_library(ANSModelPackage STATIC
|
|
${CMAKE_SOURCE_DIR}/3rdparty/monocypher/monocypher.c
|
|
${CMAKE_SOURCE_DIR}/3rdparty/monocypher/monocypher-ed25519.c
|
|
)
|
|
|
|
target_include_directories(ANSModelPackage PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_SOURCE_DIR}/3rdparty/monocypher
|
|
)
|
|
|
|
# nlohmann/json comes from vcpkg on Windows and the system elsewhere, the same
|
|
# way ANSFR already takes it.
|
|
if(WIN32)
|
|
target_include_directories(ANSModelPackage PUBLIC ${VCPKG_INCLUDE_DIR})
|
|
else()
|
|
find_path(ANSCORE_NLOHMANN_INCLUDE nlohmann/json.hpp
|
|
HINTS /opt/homebrew/include /usr/local/include /usr/include)
|
|
if(ANSCORE_NLOHMANN_INCLUDE)
|
|
target_include_directories(ANSModelPackage PUBLIC ${ANSCORE_NLOHMANN_INCLUDE})
|
|
else()
|
|
message(WARNING "nlohmann/json.hpp not found — ANSModelPackage will not build")
|
|
endif()
|
|
endif()
|
|
|
|
set_target_properties(ANSModelPackage PROPERTIES POSITION_INDEPENDENT_CODE ON)
|