summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-04-19 21:42:07 +0100
committerRoy Marples <roy@marples.name>2019-04-19 21:42:07 +0100
commitcfde89ab66cb4e5957b1c4b68ad6a9449e2784da (patch)
tree1faad748405b7d635ff1d4d35a0b95012cca9e40
parent7121040790b611ca3fbc400a1bbcd4364ef57233 (diff)
downloaddhcpcd-cfde89ab66cb4e5957b1c4b68ad6a9449e2784da.tar.xz
compat: Provide consttime_memequal if not in libc
Public domain version by Matthias Drochner <drochner@netbsd.org>
-rwxr-xr-xconfigure22
1 files changed, 22 insertions, 0 deletions
diff --git a/configure b/configure
index 570e65f2..4f58f0f3 100755
--- a/configure
+++ b/configure
@@ -13,6 +13,7 @@ IPV4LL=
INET6=
ARC4RANDOM=
CLOSEFROM=
+CONSTTIME_MEMEQUAL=
STRLCPY=
UDEV=
OS=
@@ -846,6 +847,27 @@ if [ "$STRTOI" = no ]; then
echo "#include \"compat/strtoi.h\"" >>$CONFIG_H
fi
+if [ -z "$CONSTTIME_MEMEQUAL" ]; then
+ printf "Testing for consttime_memequal ... "
+ cat <<EOF >_consttime_memequal.c
+#include <string.h>
+int main(void) {
+ return consttime_memequal("deadbeef", "deadbeef", 8);
+}
+EOF
+ if $XCC _consttime_memequal.c -o _consttime_memequal 2>&3; then
+ CONSTTIME_MEMEQUAL=yes
+ else
+ CONSTTIME_MEMEQUAL=no
+ fi
+ echo "$CONSTTIME_MEMEQUAL"
+ rm -f _consttime_memequal.c _consttime_memequal
+fi
+if [ "$CONSTTIME_MEMEQUAL" = no ]; then
+ echo "#include \"compat/consttime_memequal.h\"" \
+ >>$CONFIG_H
+fi
+
if [ -z "$DPRINTF" ]; then
printf "Testing for dprintf ... "
cat <<EOF >_dprintf.c