constcheck: grab a few more constants

This commit is contained in:
Frank Denis 2017-08-25 14:49:47 +02:00
parent 0ccdfd0c8d
commit a0b9bc46e4

View File

@ -5,14 +5,15 @@ CT='ct.c'
echo '#include <assert.h>' > "$CT"
echo '#include <sodium.h>' >> "$CT"
echo 'int main(void) {' >> "$CT"
for macro in $(egrep -r '#define crypto_.*BYTES ' src/libsodium/include | \
for macro in $(egrep -r '#define crypto_.*BYTES(_[A-Z]+)? ' src/libsodium/include | \
cut -d: -f2- | cut -d' ' -f2 | \
fgrep -v edwards25519sha512batch | sort -u); do
func=$(echo "$macro" | tr A-Z a-z)
echo " assert($func() == $macro);" >> "$CT"
echo " assert($func() == $macro);" >> "$CT"
done
echo "return 0; }" >> "$CT"
cc "$CT" -lsodium && ./a.out
cc "$CT" -lsodium || exit 1
./a.out || exit 1
rm -f a.out "$CT"