Skip to content

add test suite#15

Closed
matthew-levan wants to merge 30 commits into
masterfrom
ml/tests
Closed

add test suite#15
matthew-levan wants to merge 30 commits into
masterfrom
ml/tests

Conversation

@matthew-levan
Copy link
Copy Markdown
Collaborator

@matthew-levan matthew-levan commented Oct 22, 2025

Adds a test runner that executes suites for all of our existing modules, plus CI. The tests themselves test reference vectors (see links in file comments), including the ones from the Hoon unit tests in tests/sys/zuse/crypto/.

@matthew-levan matthew-levan marked this pull request as ready for review October 29, 2025 14:45
@matthew-levan matthew-levan requested a review from a team as a code owner October 29, 2025 14:45
matthew-levan and others added 6 commits June 3, 2026 16:29
Brings the test suite (tests/, make check) onto the OpenSSL->Nettle base.

Conflicts resolved in favour of jb/close-ssl's Nettle + vendored aes_siv/
implementation; the test wiring in Makefile.am is rewritten to link Nettle
and the vendored libaes_siv.la (dropping the OpenSSL LIBCRYPTO_* / external
-laes_siv references and the /usr/local rpath). configure.ac keeps the
nettle >= 4.0 / secp256k1 recovery+Schnorr checks; README dependency and
install notes updated for Nettle + building secp256k1 with the required
modules.

Verified: all 11 suites (198 checks) pass against nettle 4.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replaces the stale OpenSSL-era CI (libssl-dev + cloning libaes_siv) with a
workflow matching the current dependencies:

- Triggers on push/PR to jb/close-ssl and master.
- build & test matrix on ubuntu-latest and macos-latest.
- A reusable composite action (.github/actions/setup-crypto-deps) builds the
  two dependencies the runners' package managers can't provide and caches
  them: nettle 4.0 (needed for the 2-argument *_digest() interface) from
  ftp.gnu.org, and libsecp256k1 v0.7.1 with the recovery + Schnorr modules.
- An AddressSanitizer + UBSan job, and a non-blocking cppcheck job over
  urcrypt/ and aes_siv/.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Vendored libscrypt (b64.c, crypto_scrypt-nosse.c, sha256.c) uses K&R-style
function definitions, which C23 removes. Recent Apple clang on the macos-latest
runner defaults to C23 and rejected them ("unknown type name 'src'"), while
gcc and older clang (defaulting to gnu17) compiled fine. Pin the scrypt library
to -std=gnu17 so the build is deterministic across compilers.
The ASan+UBSan job failed on a benign UBSan finding in the vendored ed25519
reference code (ed25519/src/fe.c:721: "left shift of negative value"), which is
exercised via its own test vectors and is not urcrypt's code to fix.

Build the sanitizer job with clang and pass an -fsanitize-ignorelist (a clang
feature gcc lacks) that excludes the vendored libraries from UBSan, mirroring
the cppcheck scope. AddressSanitizer still instruments everything.

Verified locally: without the ignore list the ed25519 shift error reproduces
and `make check` fails; with it, all 11 suites (198 checks) pass clean.
- Nettle is now cloned from the gnutls/nettle GitHub mirror at the 4.0 release
  tag (nettle_4.0_release_20260205) and bootstrapped (./.bootstrap runs
  autoconf, since the mirror ships no generated configure) instead of pulling
  the ftp.gnu.org tarball. jb/close-ssl only requires nettle >= 4.0 with no
  pinned version, and 4.0 is the sole 4.x release, so this matches.

- On Linux the dependencies (nettle, secp256k1) are built as static libraries
  with -fPIC, and urcrypt is configured --enable-static --disable-shared, so the
  test runner links them statically -- matching how urbit/vere links urcrypt
  statically. macOS keeps shared/dynamic linking (it can't fully static-link).

- README updated: build nettle 4.0 from the mirror, point configure at it, and
  run the tests.

Verified locally: a static build (static nettle + static secp256k1, urcrypt
--enable-static --disable-shared) passes all 11 suites (198 checks), and
otool -L confirms no dynamic nettle/secp linkage in the test runner.
Switch nettle back from the gnutls/nettle GitHub mirror to the canonical
ftp.gnu.org release tarball, pinned and verified by sha256
(3addbc00...f5094 for nettle-4.0.tar.gz).

Rationale: the GNU tarball is the official, GPG-signed release artifact and
ships a generated configure (no ./.bootstrap / autoconf needed). The GitHub
mirror is a third-party mirror whose auto-generated archive checksums are not
guaranteed byte-stable, making a hash pin fragile. For a dependency this
security-sensitive, a checksum-pinned signed tarball is the stronger supply
chain. The sha256 is verified before the tarball is used; a mismatch aborts.

README updated to match (build nettle 4.0 from the tarball).
@matthew-levan
Copy link
Copy Markdown
Collaborator Author

Closed in favor of #23.

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.

2 participants