Skip to content

Commit 50843f0

Browse files
Check crypto library availability by type
1 parent e44f59f commit 50843f0

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

configure.ac

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ if test "x${TCLLIBDIR+set}" != "xset" ; then
159159
TCLLIBDIR="${TCLLIBDIR}/sqlite3"
160160
fi
161161

162-
AC_CHECK_LIB([crypto], [HMAC_Init_ex], ,
163-
AC_MSG_ERROR([Library crypto not found. Install openssl!"]))
164-
165162
#########
166163
# Set up an appropriate program prefix
167164
#
@@ -260,14 +257,18 @@ AC_ARG_WITH([crypto-lib],
260257
AC_HELP_STRING([--with-crypto-lib],[Specify which crypto library to use]),
261258
crypto_lib=$withval)
262259
AC_MSG_CHECKING([for crypto library to use])
263-
if test "$crypto_lib" = "libtomcrypto"; then
264-
CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPTO"
265-
BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPTO"
266-
AC_MSG_RESULT([libtomcrypto])
260+
if test "$crypto_lib" = "libtomcrypt"; then
261+
CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPT"
262+
BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPT"
263+
AC_MSG_RESULT([libtomcrypt])
264+
AC_CHECK_LIB([tomcrypt], [register_cipher], ,
265+
AC_MSG_ERROR([Library crypto not found. Install libtomcrypt!"]))
267266
else
268267
CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"
269268
BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"
270-
AC_MSG_RESULT([openssl])
269+
AC_MSG_RESULT([openssl])
270+
AC_CHECK_LIB([crypto], [HMAC_Init_ex], ,
271+
AC_MSG_ERROR([Library crypto not found. Install openssl!"]))
271272
fi
272273

273274
##########

src/crypto_libtomcrypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPTO
1+
#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPT
22
#include <tomcrypt.h>
33

44
void sqlcipher_activate(void *ctx) {

0 commit comments

Comments
 (0)