diff options
| author | Roy Marples <roy@marples.name> | 2017-10-05 14:13:02 +0100 |
|---|---|---|
| committer | Roy Marples <roy@marples.name> | 2017-10-05 14:13:02 +0100 |
| commit | 5cb0490cb9273864dcd5eeb36e31148dcc37a72d (patch) | |
| tree | 353f90f33c92f37bdcfde828367737a18af63c74 /configure | |
| parent | 18539557d779fbd72a887eb5eca484f5dedaecf5 (diff) | |
| download | dhcpcd-5cb0490cb9273864dcd5eeb36e31148dcc37a72d.tar.xz | |
Detect hmac(3) in libc or the library containing MD5.
If not found, a compat function is provided, taken from NetBSD.
Diffstat (limited to 'configure')
| -rwxr-xr-x | configure | 46 |
1 files changed, 45 insertions, 1 deletions
@@ -87,6 +87,7 @@ for x do --without-md5) MD5=no;; --without-sha2) SHA2=no;; --without-sha256) SHA2=no;; + --without-hmac) HMAC=no;; --without-dev) DEV=no;; --without-udev) UDEV=no;; --with-poll) POLL="$var";; @@ -487,7 +488,9 @@ if [ -z "$AUTH" -o "$AUTH" = yes ]; then echo "Enabling Authentication" echo "CPPFLAGS+= -DAUTH" >>$CONFIG_MK echo "SRCS+= auth.c" >>$CONFIG_MK - echo "CRYPT_SRCS+= crypt/hmac_md5.c" >>$CONFIG_MK + echo "CRYPT_SRCS+= \${HMAC_SRC}" >>$CONFIG_MK +fi +if [ -z "$INET6" -o "$INET6" = yes -o -z "$AUTH" -o "$AUTH" = yes -o ]; then echo "CRYPT_SRCS+= \${MD5_SRC} \${SHA256_SRC}" >>$CONFIG_MK fi @@ -1221,6 +1224,47 @@ else [ -n "$SHA2_LIB" ] && echo "LDADD+= $SHA2_LIB" >>$CONFIG_MK fi +if [ -z "$HMAC" ]; then + HMAC_LIB= + printf "Testing for hmac ... " + cat <<EOF >_hmac.c +#include <stdlib.h> +#include <hmac.h> +int main(void) { + hmac(NULL, NULL, 0, NULL, 0, NULL, 0); + return 0; +} +EOF + if $XCC _hmac.c $MD5_LIB -o _hmac 2>&3; then + HMAC=yes + echo "#define HAVE_HMAC_H" >>$CONFIG_H + else + # Remove this test if NetBSD-8 ships with + # hmac in it's own header and not stdlib.h + cat <<EOF >_hmac.c +#include <stdlib.h> +int main(void) { + hmac(NULL, NULL, 0, NULL, 0, NULL, 0); + return 0; +} +EOF + if $XCC _hmac.c $MD5_LIB -o _hmac 2>&3; then + HMAC=yes + else + HMAC=no + fi + fi + echo "$HMAC" + rm -f _hmac.c _hmac +fi +if [ "$HMAC" = no ]; then + echo "#include \"compat/crypt/hmac.h\"" >>$CONFIG_H + echo "HMAC_SRC= compat/crypt/hmac.c" >>$CONFIG_MK +else + # echo "#define HAVE_HMAC_H" >>$CONFIG_H + echo "HMAC_SRC=" >>$CONFIG_MK +fi + if [ "$DEV" != no -a "$UDEV" != no ]; then printf "Checking for libudev ... " if type "$PKG_CONFIG" >/dev/null 2>&1; then |
