1#! /bin/sh 2 3CT='ct.c' 4 5echo '#include <assert.h>' > "$CT" 6echo '#include <sodium.h>' >> "$CT" 7echo 'int main(void) {' >> "$CT" 8for macro in $(egrep -r '#define crypto_.*BYTES(_[A-Z]+)? ' src/libsodium/include | \ 9 cut -d: -f2- | cut -d' ' -f2 | \ 10 fgrep -v edwards25519sha512batch | sort -u); do 11 func=$(echo "$macro" | tr A-Z a-z) 12 echo " assert($func() == $macro);" >> "$CT" 13done 14echo "return 0; }" >> "$CT" 15 16${CC:-cc} "$CT" $CPPFLAGS $CFLAGS $LDFLAGS -lsodium || exit 1 17./a.out || exit 1 18rm -f a.out "$CT" 19 20