From 50843f0b85a71335d08132a8bb370d7132fbb517 Mon Sep 17 00:00:00 2001 From: Nick Parker Date: Tue, 4 Jun 2013 10:13:02 -0500 Subject: [PATCH] Check crypto library availability by type --- configure.ac | 17 +++++++++-------- src/crypto_libtomcrypt.c | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 875a5d8..2bd64eb 100644 --- a/configure.ac +++ b/configure.ac @@ -159,9 +159,6 @@ if test "x${TCLLIBDIR+set}" != "xset" ; then TCLLIBDIR="${TCLLIBDIR}/sqlite3" fi -AC_CHECK_LIB([crypto], [HMAC_Init_ex], , - AC_MSG_ERROR([Library crypto not found. Install openssl!"])) - ######### # Set up an appropriate program prefix # @@ -260,14 +257,18 @@ AC_ARG_WITH([crypto-lib], AC_HELP_STRING([--with-crypto-lib],[Specify which crypto library to use]), crypto_lib=$withval) AC_MSG_CHECKING([for crypto library to use]) -if test "$crypto_lib" = "libtomcrypto"; then - CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPTO" - BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPTO" - AC_MSG_RESULT([libtomcrypto]) +if test "$crypto_lib" = "libtomcrypt"; then + CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPT" + BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPT" + AC_MSG_RESULT([libtomcrypt]) + AC_CHECK_LIB([tomcrypt], [register_cipher], , + AC_MSG_ERROR([Library crypto not found. Install libtomcrypt!"])) else CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" - AC_MSG_RESULT([openssl]) + AC_MSG_RESULT([openssl]) + AC_CHECK_LIB([crypto], [HMAC_Init_ex], , + AC_MSG_ERROR([Library crypto not found. Install openssl!"])) fi ########## diff --git a/src/crypto_libtomcrypt.c b/src/crypto_libtomcrypt.c index 1199b02..5eff082 100644 --- a/src/crypto_libtomcrypt.c +++ b/src/crypto_libtomcrypt.c @@ -1,4 +1,4 @@ -#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPTO +#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPT #include void sqlcipher_activate(void *ctx) {