AtlatestRepositorysigil-crypto
1#!/bin/sh
2# Differential gate: sigil-crypto's Ed25519 verify core against libsodium
3# (what the minisign tool verifies with), over RFC 8032, Wycheproof and
4# ed25519-speccheck vectors plus 1,600 single-bit mutants.
5#
6# Needs guix (for gcc-toolchain + libsodium). Run from the repo root:
7# test/differential/run.sh
8# Exit 0 only when every case and mutant agrees; see the SUMMARY line.
9set -eu
10ROOT=$(cd "$(dirname "$0")/../.." && pwd)
11OUT=$(mktemp -d)
12trap 'rm -rf "$OUT"' EXIT
13guix shell gcc-toolchain libsodium pkg-config -- sh -c '
14 set -eu
15 gcc -std=c99 -O2 -Wall -Wextra \
16 -I"$1/native" -I"$1/vendor/monocypher/src" -I"$1/vendor/monocypher/src/optional" \
17 "$1/test/differential/ed25519-vs-libsodium.c" \
18 "$1/native/ed25519-verify.c" \
19 "$1/vendor/monocypher/src/monocypher.c" \
20 "$1/vendor/monocypher/src/optional/monocypher-ed25519.c" \
21 $(pkg-config --cflags --libs libsodium) -o "$2/diff"
22' sh "$ROOT" "$OUT"
23# Input lines are "<label> <pk> <sig> <msg> <expected>"; the harness reads
24# the first four fields.
25"$OUT/diff" < "$ROOT/test/vectors/ed25519-cases.txt"