Add support for --with-crypto-lib from autoconf

The default configure script generated from autoconf will default to
using OpenSSL as the crypto library.  With the new --with-crypto-lib
flag, users can specify libtomcrypto as an alternative crypto library.
This commit is contained in:
Nick Parker 2013-06-03 16:45:44 -05:00
parent f6e4ed4783
commit e44f59f2b3
5 changed files with 25 additions and 4 deletions

View File

@ -142,8 +142,8 @@ CRYPTOSRC = \
$(TOP)/src/crypto.c \
$(TOP)/src/crypto_impl.h \
$(TOP)/src/crypto_impl.c \
$(TOP)/src/crypto_libtomcrypt.c
# $(TOP)/src/crypto_openssl.c
$(TOP)/src/crypto_libtomcrypt.c \
$(TOP)/src/crypto_openssl.c
# END CRYPTO

View File

@ -253,6 +253,23 @@ if test "$SQLITE_THREADSAFE" = "1"; then
AC_SEARCH_LIBS(pthread_create, pthread)
fi
##########
# Which crypto library do we use
#
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])
else
CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"
BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"
AC_MSG_RESULT([openssl])
fi
##########
# Do we want to allow a connection created in one thread to be used
# in another thread. This does not work on many Linux systems (ex: RedHat 9)

View File

@ -1,3 +1,4 @@
#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPTO
#include <tomcrypt.h>
void sqlcipher_activate(void *ctx) {
@ -105,3 +106,4 @@ int sqlcipher_ctx_init(void **ctx) {
int sqlcipher_ctx_free(void **ctx) {
return SQLITE_OK;
}
#endif

View File

@ -1,3 +1,4 @@
#ifdef SQLCIPHER_CRYPTO_OPENSSL
#include <openssl/rand.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
@ -138,5 +139,4 @@ int sqlcipher_ctx_free(void **ctx) {
sqlcipher_free(*ctx, sizeof(openssl_ctx));
return SQLITE_OK;
}
#endif

View File

@ -222,12 +222,14 @@ proc copy_file {filename} {
# used subroutines first in order to help the compiler find
# inlining opportunities.
#
foreach file {
sqliteInt.h
crypto.c
crypto_impl.c
crypto_libtomcrypt.c
crypto_openssl.c
global.c
ctime.c