diff --git a/configure b/configure index a60da137..07d68349 100755 --- a/configure +++ b/configure @@ -1150,9 +1150,31 @@ EOF echo "$CONSTTIME_MEMEQUAL" rm -f _consttime_memequal.c _consttime_memequal fi +if [ "$CONSTTIME_MEMEQUAL" = no ] && [ -z "$TIMINGSAFE_BCMP" ]; then + printf "Testing for timingsafe_bcmp ... " + cat <_timingsafe_bcmp.c +#include +int main(void) { + return timingsafe_bcmp("deadbeef", "deadbeef", 8); +} +EOF + if $XCC _timingsafe_bcmp.c -o _timingsafe_bcmp 2>&3; then + TIMINGSAFE_BCMP=yes + else + TIMINGSAFE_BCMP=no + fi + echo "$TIMINGSAFE_BCMP" + rm -f _timingsafe_bcmp.c _timingsafe_bcmp +fi + if [ "$CONSTTIME_MEMEQUAL" = no ]; then - echo "#include \"compat/consttime_memequal.h\"" \ - >>$CONFIG_H + if [ "$TIMINGSAFE_BCMP" = yes ]; then + echo "#define consttime_memequal !timingsafe_bcmp" \ + >>$CONFIG_H + else + echo "#include \"compat/consttime_memequal.h\"" \ + >>$CONFIG_H + fi fi if [ -z "$DPRINTF" ]; then