AtlatestRepositorysigil-crypto
sigil-crypto / tree / test / differentialrun.sh
1
#!/bin/sh2
# Differential gate: sigil-crypto's Ed25519 verify core against libsodium3
# (what the minisign tool verifies with), over RFC 8032, Wycheproof and4
# 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.sh8
# Exit 0 only when every case and mutant agrees; see the SUMMARY line.9
set -eu10
ROOT=$(cd "$(dirname "$0")/../.." && pwd)11
OUT=$(mktemp -d)12
trap 'rm -rf "$OUT"' EXIT13
guix shell gcc-toolchain libsodium pkg-config -- sh -c '14
set -eu15
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 reads24
# the first four fields.25
"$OUT/diff" < "$ROOT/test/vectors/ed25519-cases.txt"