Rework OpenSSL usage.

- Lookup for crypto functions in libcrypto instead of libssl.  Some systems
  (Mac OS) do not provide libssl, and the other have crypto functions in
  libcrypto but libssl is dynamically linked against libcrypto:
  % ldd /usr/lib/libssl.so
  /usr/lib/libssl.so:
         libcrypto.so.6 => /lib/libcrypto.so.6 (0x800c00000)
         libc.so.7 => /lib/libc.so.7 (0x800647000)
- Do not explicitly link against libssl (instead of libcrypto BTW): the
  autotools magic already does this at some point;
- Improve error message when headers cannot be found.
This commit is contained in:
Romain Tartiere 2010-09-04 10:47:07 +00:00
parent 05bd15b1d3
commit 8a477773f7
3 changed files with 7 additions and 7 deletions

View file

@ -53,8 +53,8 @@ AC_DEFINE([_BSD_SOURCE], [1], [Define on BSD to activate all library features])
CFLAGS="$CFLAGS -std=c99"
# Crypto functions for MIFARE DesFire support are provided by OpenSSL.
AC_CHECK_LIB([ssl], [DES_ecb_encrypt], [], [AC_MSG_ERROR([Cannot find libssl.])])
AC_CHECK_HEADER([openssl/des.h], [], [AC_MSG_ERROR([Cannot find libssl headers.])])
AC_CHECK_LIB([crypto], [DES_ecb_encrypt], [], [AC_MSG_ERROR([Cannot find libcrypto.])])
AC_CHECK_HEADER([openssl/des.h], [], [AC_MSG_ERROR([Cannot find openssl headers.])])
# Checks for pkg-config modules.
LIBNFC_REQUIRED_VERSION=1.3.4

View file

@ -11,19 +11,19 @@ bin_PROGRAMS = mifare-classic-format \
mifare-desfire-write-ndef
mifare_classic_format_SOURCES = mifare-classic-format.c
mifare_classic_format_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la -lssl
mifare_classic_format_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la
mifare_classic_write_ndef_SOURCES = mifare-classic-write-ndef.c
mifare_classic_write_ndef_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la
mifare_desfire_access_SOURCES = mifare-desfire-access.c
mifare_desfire_access_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la -lssl
mifare_desfire_access_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la
mifare_desfire_format_SOURCES = mifare-desfire-format.c
mifare_desfire_format_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la -lssl
mifare_desfire_format_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la
mifare_desfire_info_SOURCES = mifare-desfire-info.c
mifare_desfire_info_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la -lssl -lm
mifare_desfire_info_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la -lm
mifare_desfire_write_ndef_SOURCES = mifare-desfire-write-ndef.c
mifare_desfire_write_ndef_LDADD = -lnfc $(top_builddir)/libfreefare/libfreefare.la

View file

@ -53,7 +53,7 @@ test_mifare_desfire_aid_la_SOURCES = test_mifare_desfire_aid.c
test_mifare_desfire_aid_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la
test_mifare_desfire_des_la_SOURCES = test_mifare_desfire_des.c
test_mifare_desfire_des_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la -lssl
test_mifare_desfire_des_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la
test_mifare_desfire_key_la_SOURCES = test_mifare_desfire_key.c
test_mifare_desfire_key_la_LIBADD = $(top_builddir)/libfreefare/libfreefare.la