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