2017-08-03 07:28:29 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
CT='ct.c'
|
|
|
|
|
|
|
|
echo '#include <assert.h>' > "$CT"
|
|
|
|
echo '#include <sodium.h>' >> "$CT"
|
|
|
|
echo 'int main(void) {' >> "$CT"
|
2023-11-23 05:36:02 -07:00
|
|
|
for macro in $(grep -Er '#define crypto_.*BYTES(_[A-Z]+)? ' src/libsodium/include | \
|
2017-08-03 07:28:29 -07:00
|
|
|
cut -d: -f2- | cut -d' ' -f2 | \
|
|
|
|
fgrep -v edwards25519sha512batch | sort -u); do
|
|
|
|
func=$(echo "$macro" | tr A-Z a-z)
|
2017-08-25 05:49:47 -07:00
|
|
|
echo " assert($func() == $macro);" >> "$CT"
|
2017-08-03 07:28:29 -07:00
|
|
|
done
|
|
|
|
echo "return 0; }" >> "$CT"
|
|
|
|
|
2019-04-22 10:49:18 -07:00
|
|
|
CPPFLAGS="${CPPFLAGS} -Wno-deprecated-declarations"
|
2024-05-24 04:13:37 -07:00
|
|
|
CPPFLAGS="${CPPFLAGS} -I/opt/homebrew/include"
|
|
|
|
LDFLAGS="${LDFLAGS} -L/opt/homebrew/lib"
|
2017-09-15 04:06:21 -07:00
|
|
|
${CC:-cc} "$CT" $CPPFLAGS $CFLAGS $LDFLAGS -lsodium || exit 1
|
2017-08-25 05:49:47 -07:00
|
|
|
./a.out || exit 1
|
2017-08-03 07:28:29 -07:00
|
|
|
rm -f a.out "$CT"
|
|
|
|
|