diff options
author | Martin Matuska <martin@matuska.org> | 2020-01-03 00:24:39 +0100 |
---|---|---|
committer | Martin Matuska <martin@matuska.org> | 2020-01-03 03:10:32 +0100 |
commit | f96a71144b7725ca4a94d84bd27d7dca8c2f58d2 (patch) | |
tree | 44e5f4496eb19dcb943b47e8cf716e17b54964a8 /configure.ac | |
parent | ded60625ca7cbd87a8aab6c23cb674373ea139f1 (diff) | |
download | libarchive-f96a71144b7725ca4a94d84bd27d7dca8c2f58d2.tar.gz |
Add mbed TLS as optional crypto provider
Make Nettle optional and OpenSSL default
Fixes #1301
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index a9e58b80..ce90ee83 100644 --- a/configure.ac +++ b/configure.ac @@ -421,8 +421,10 @@ fi AC_ARG_WITH([cng], AS_HELP_STRING([--without-cng], [Don't build support of CNG(Crypto Next Generation)])) +AC_ARG_WITH([mbedtls], + AS_HELP_STRING([--with-mbedtls], [Build with crypto support from mbed TLS])) AC_ARG_WITH([nettle], - AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle])) + AS_HELP_STRING([--with-nettle], [Build with crypto support from Nettle])) AC_ARG_WITH([openssl], AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) case "$host_os" in @@ -1120,7 +1122,22 @@ if test "x$with_cng" != "xno"; then ]]) fi -if test "x$with_nettle" != "xno"; then +if test "x$with_mbedtls" = "xyes"; then + AC_CHECK_HEADERS([mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h]) + saved_LIBS=$LIBS + AC_CHECK_LIB(mbedcrypto,mbedtls_sha1_init) + CRYPTO_CHECK(MD5, MBEDTLS, md5) + CRYPTO_CHECK(RMD160, MBEDTLS, rmd160) + CRYPTO_CHECK(SHA1, MBEDTLS, sha1) + CRYPTO_CHECK(SHA256, MBEDTLS, sha256) + CRYPTO_CHECK(SHA384, MBEDTLS, sha384) + CRYPTO_CHECK(SHA512, MBEDTLS, sha512) + if test "x$found_MBEDTLS" != "xyes"; then + LIBS=$saved_LIBS + fi +fi + +if test "x$with_nettle" = "xyes"; then AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h]) saved_LIBS=$LIBS |