re-write the handling of crypto libraries. try to use the one of
openssl's libcrypto or krb4's libdes that has all the required functionality (md4, md5, sha1, des, rc4). if there is no such library, the included lib/des is built. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10519 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
114
cf/crypto.m4
Normal file
114
cf/crypto.m4
Normal file
@@ -0,0 +1,114 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl test for crypto libraries:
|
||||
dnl - libcrypto (from openssl)
|
||||
dnl - libdes (from krb4)
|
||||
dnl - own-built libdes
|
||||
|
||||
AC_DEFUN([KRB_CRYPTO],[
|
||||
crypto_lib=unknown
|
||||
AC_ARG_WITH(openssl,
|
||||
[ --with-openssl=dir if you want to use openssl's libcrypto in dir])
|
||||
|
||||
DIR_des=
|
||||
|
||||
AC_MSG_CHECKING([for crypto library])
|
||||
|
||||
if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then
|
||||
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
INCLUDE_des=
|
||||
LIB_des=
|
||||
if test "$with_openssl" != ""; then
|
||||
INCLUDE_des="-I${with_openssl}/include"
|
||||
CPPFLAGS="${INCLUDE_des} ${CPPFLAGS}"
|
||||
LIB_des="-L${with_openssl}/lib"
|
||||
fi
|
||||
LIB_des_a="$LIB_des"
|
||||
LIB_des_so="$LIB_des"
|
||||
LIB_des_appl="$LIB_des"
|
||||
LIBS="${LIBS} ${LIB_des}"
|
||||
AC_TRY_LINK([
|
||||
#include <openssl/md4.h>
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/rc4.h>
|
||||
],
|
||||
[
|
||||
MD4_CTX md4;
|
||||
MD5_CTX md5;
|
||||
SHA1_CTX sha1;
|
||||
|
||||
MD4_Init(&md4);
|
||||
MD5_Init(&md5);
|
||||
SHA1_Init(&sha1);
|
||||
|
||||
des_cbc_encrypt(NULL, NULL, 0, NULL, NULL, 0);
|
||||
RC4(NULL, 0, NULL, NULL);
|
||||
], [
|
||||
crypto_lib=libcrypto
|
||||
AC_DEFINE([HAVE_OPENSSL], 1, [define to use openssl's libcrypto])
|
||||
AC_MSG_RESULT([libcrypto])])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
LIBS="$save_LIBS"
|
||||
fi
|
||||
|
||||
if test "$crypto_lib" = "unknown" -a "$with_krb4" != "no"; then
|
||||
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
save_LIBS="$LIBS"
|
||||
INCLUDE_des="${INCLUDE_krb4}"
|
||||
LIB_des=
|
||||
if test "$krb4_libdir"; then
|
||||
LIB_des="-L${krb4_libdir}"
|
||||
fi
|
||||
CPPFLAGS="${CPPFLAGS} ${INCLUDE_des}"
|
||||
LIBS="${LIBS} ${LIB_des}"
|
||||
LIB_des_a="$LIB_des"
|
||||
LIB_des_so="$LIB_des"
|
||||
LIB_des_appl="$LIB_des"
|
||||
LIBS="${LIBS} ${LIB_des}"
|
||||
AC_TRY_LINK([
|
||||
#undef KRB5 /* makes md4.h et al unhappy */
|
||||
#define KRB4
|
||||
#include <md4.h>
|
||||
#include <md5.h>
|
||||
#include <sha.h>
|
||||
#include <des.h>
|
||||
#include <rc4.h>
|
||||
],
|
||||
[
|
||||
MD4_CTX md4;
|
||||
MD5_CTX md5;
|
||||
SHA1_CTX sha1;
|
||||
|
||||
MD4_Init(&md4);
|
||||
MD5_Init(&md5);
|
||||
SHA1_Init(&sha1);
|
||||
|
||||
des_cbc_encrypt(NULL, NULL, 0, NULL, NULL, 0);
|
||||
RC4(NULL, 0, NULL, NULL);
|
||||
], [crypto_lib=krb4; AC_MSG_RESULT([krb4's libdes])])
|
||||
|
||||
fi
|
||||
|
||||
if test "$crypto_lib" = "unknown"; then
|
||||
|
||||
DIR_des='des'
|
||||
LIB_des='$(top_builddir)/lib/des/libdes.la'
|
||||
LIB_des_a='$(top_builddir)/lib/des/.libs/libdes.a'
|
||||
LIB_des_so='$(top_builddir)/lib/des/.libs/libdes.so'
|
||||
LIB_des_appl="-ldes"
|
||||
|
||||
AC_MSG_RESULT([included libdes])
|
||||
|
||||
fi
|
||||
|
||||
AC_SUBST(DIR_des)
|
||||
AC_SUBST(LIB_des)
|
||||
AC_SUBST(LIB_des_a)
|
||||
AC_SUBST(LIB_des_so)
|
||||
AC_SUBST(LIB_des_appl)
|
||||
])
|
Reference in New Issue
Block a user