Mercurial > hg > dhcpcd
changeset 4461:e29dad61e98c draft
compat: Provide consttime_memequal if not in libc
Public domain version by Matthias Drochner <drochner@netbsd.org>
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Fri, 19 Apr 2019 21:42:07 +0100 |
| parents | 130cd805b577 |
| children | 7444e7099fb9 |
| files | configure |
| diffstat | 1 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/configure Fri Apr 19 21:40:14 2019 +0100 +++ b/configure Fri Apr 19 21:42:07 2019 +0100 @@ -13,6 +13,7 @@ INET6= ARC4RANDOM= CLOSEFROM= +CONSTTIME_MEMEQUAL= STRLCPY= UDEV= OS= @@ -846,6 +847,27 @@ 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
