From 1742ee4e5c77e85ea0aaf5a43cb735dd290d6464 Mon Sep 17 00:00:00 2001 From: Nick Parker Date: Wed, 12 Jun 2013 12:15:13 -0500 Subject: [PATCH 1/2] Check defined for crypto impl flag & formatting --- src/crypto.h | 4 ++-- src/crypto_impl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/crypto.h b/src/crypto.h index f71f532..39924f7 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -36,8 +36,8 @@ #define CRYPTO_H #if !defined (SQLCIPHER_CRYPTO_CC) \ - && !defined(SQLCIPHER_CRYPTO_LIBTOMCRYPT) \ - && !defined(SQLCIPHER_CRYPTO_OPENSSL) + && !defined (SQLCIPHER_CRYPTO_LIBTOMCRYPT) \ + && !defined (SQLCIPHER_CRYPTO_OPENSSL) #define SQLCIPHER_CRYPTO_OPENSSL #endif diff --git a/src/crypto_impl.c b/src/crypto_impl.c index a58927c..0b2812d 100644 --- a/src/crypto_impl.c +++ b/src/crypto_impl.c @@ -95,10 +95,10 @@ void sqlcipher_activate() { #if defined (SQLCIPHER_CRYPTO_CC) extern int sqlcipher_cc_setup(sqlcipher_provider *p); sqlcipher_cc_setup(p); -#elif SQLCIPHER_CRYPTO_LIBTOMCRYPT +#elif defined (SQLCIPHER_CRYPTO_LIBTOMCRYPT) extern int sqlcipher_ltc_setup(sqlcipher_provider *p); sqlcipher_ltc_setup(p); -#elif SQLCIPHER_CRYPTO_OPENSSL +#elif defined (SQLCIPHER_CRYPTO_OPENSSL) extern int sqlcipher_openssl_setup(sqlcipher_provider *p); sqlcipher_openssl_setup(p); #else From be057d3e5f84de8e728ca782898c8f659d6d9551 Mon Sep 17 00:00:00 2001 From: Nick Parker Date: Wed, 12 Jun 2013 13:45:11 -0500 Subject: [PATCH 2/2] Adjusting the configure template for commoncrypto --- configure | 49 +------------------------------------------------ configure.ac | 4 +--- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/configure b/configure index be758ce..41cc8c7 100755 --- a/configure +++ b/configure @@ -10665,57 +10665,10 @@ fi else if test "$crypto_lib" = "commoncrypto"; then - CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL -DSQLCIPHER_CRYPTO_CC" + CFLAGS+=" -DSQLCIPHER_CRYPTO_CC" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL -DSQLCIPHER_CRYPTO_CC" { $as_echo "$as_me:${as_lineno-$LINENO}: result: commoncrypto" >&5 $as_echo "commoncrypto" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_Init_ex in -lcrypto" >&5 -$as_echo_n "checking for HMAC_Init_ex in -lcrypto... " >&6; } -if ${ac_cv_lib_crypto_HMAC_Init_ex+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char HMAC_Init_ex (); -int -main () -{ -return HMAC_Init_ex (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_HMAC_Init_ex=yes -else - ac_cv_lib_crypto_HMAC_Init_ex=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_HMAC_Init_ex" >&5 -$as_echo "$ac_cv_lib_crypto_HMAC_Init_ex" >&6; } -if test "x$ac_cv_lib_crypto_HMAC_Init_ex" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBCRYPTO 1 -_ACEOF - - LIBS="-lcrypto $LIBS" - -else - as_fn_error $? "Library crypto not found. Install openssl!\"" "$LINENO" 5 -fi - else CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" diff --git a/configure.ac b/configure.ac index 737d652..de3d84c 100644 --- a/configure.ac +++ b/configure.ac @@ -265,11 +265,9 @@ if test "$crypto_lib" = "libtomcrypt"; then AC_MSG_ERROR([Library crypto not found. Install libtomcrypt!"])) else if test "$crypto_lib" = "commoncrypto"; then - CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL -DSQLCIPHER_CRYPTO_CC" + CFLAGS+=" -DSQLCIPHER_CRYPTO_CC" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL -DSQLCIPHER_CRYPTO_CC" AC_MSG_RESULT([commoncrypto]) - AC_CHECK_LIB([crypto], [HMAC_Init_ex], , - AC_MSG_ERROR([Library crypto not found. Install openssl!"])) else CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"