diff options
Diffstat (limited to 'crypto/heimdal/cf/crypto.m4')
-rw-r--r-- | crypto/heimdal/cf/crypto.m4 | 136 |
1 files changed, 64 insertions, 72 deletions
diff --git a/crypto/heimdal/cf/crypto.m4 b/crypto/heimdal/cf/crypto.m4 index c79ba4c..69b2fc9 100644 --- a/crypto/heimdal/cf/crypto.m4 +++ b/crypto/heimdal/cf/crypto.m4 @@ -1,40 +1,38 @@ -dnl $Id: crypto.m4,v 1.16.2.1 2003/05/05 20:08:32 joda Exp $ +dnl $Id: crypto.m4 22080 2007-11-16 11:10:54Z lha $ dnl dnl test for crypto libraries: dnl - libcrypto (from openssl) -dnl - libdes (from krb4) -dnl - own-built libdes +dnl - own-built libhcrypto m4_define([test_headers], [ #undef KRB5 /* makes md4.h et al unhappy */ #ifdef HAVE_OPENSSL + #ifdef HAVE_SYS_TYPES_H + #include <sys/types.h> + #endif + #include <openssl/evp.h> #include <openssl/md4.h> #include <openssl/md5.h> #include <openssl/sha.h> - #define OPENSSL_DES_LIBDES_COMPATIBILITY #include <openssl/des.h> #include <openssl/rc4.h> + #include <openssl/aes.h> + #include <openssl/engine.h> + #include <openssl/ui.h> #include <openssl/rand.h> + #include <openssl/hmac.h> + #include <openssl/pkcs12.h> #else - #include <md4.h> - #include <md5.h> - #include <sha.h> - #include <des.h> - #include <rc4.h> - #endif - #ifdef OLD_HASH_NAMES - typedef struct md4 MD4_CTX; - #define MD4_Init(C) md4_init((C)) - #define MD4_Update(C, D, L) md4_update((C), (D), (L)) - #define MD4_Final(D, C) md4_finito((C), (D)) - typedef struct md5 MD5_CTX; - #define MD5_Init(C) md5_init((C)) - #define MD5_Update(C, D, L) md5_update((C), (D), (L)) - #define MD5_Final(D, C) md5_finito((C), (D)) - typedef struct sha SHA_CTX; - #define SHA1_Init(C) sha_init((C)) - #define SHA1_Update(C, D, L) sha_update((C), (D), (L)) - #define SHA1_Final(D, C) sha_finito((C), (D)) + #include <hcrypto/evp.h> + #include <hcrypto/md4.h> + #include <hcrypto/md5.h> + #include <hcrypto/sha.h> + #include <hcrypto/des.h> + #include <hcrypto/rc4.h> + #include <hcrypto/aes.h> + #include <hcrypto/engine.h> + #include <hcrypto/hmac.h> + #include <hcrypto/pkcs12.h> #endif ]) m4_define([test_body], [ @@ -42,15 +40,21 @@ m4_define([test_body], [ MD4_CTX md4; MD5_CTX md5; SHA_CTX sha1; + SHA256_CTX sha256; MD4_Init(&md4); MD5_Init(&md5); SHA1_Init(&sha1); + SHA256_Init(&sha256); + EVP_CIPHER_iv_length(((EVP_CIPHER*)0)); #ifdef HAVE_OPENSSL RAND_status(); + UI_UTIL_read_pw_string(0,0,0,0); #endif - des_cbc_encrypt(0, 0, 0, schedule, 0, 0); + OpenSSL_add_all_algorithms(); + AES_encrypt(0,0,0); + DES_cbc_encrypt(0, 0, 0, schedule, 0, 0); RC4(0, 0, 0, 0);]) @@ -58,12 +62,11 @@ AC_DEFUN([KRB_CRYPTO],[ crypto_lib=unknown AC_WITH_ALL([openssl]) -DIR_des= +DIR_hcrypto= AC_MSG_CHECKING([for crypto library]) openssl=no -old_hash=no if test "$crypto_lib" = "unknown" -a "$with_krb4" != "no"; then save_CPPFLAGS="$CPPFLAGS" @@ -83,24 +86,17 @@ if test "$crypto_lib" = "unknown" -a "$with_krb4" != "no"; then for j in $cdirs; do for k in $clibs; do LIBS="$j $k $save_LIBS" - AC_TRY_LINK(test_headers, test_body, - openssl=yes ires="$i" lres="$j $k"; break 3) + AC_LINK_IFELSE([AC_LANG_PROGRAM([test_headers], + [test_body])], + [openssl=yes ires="$i" lres="$j $k"; break 3]) done done CFLAGS="$i $save_CFLAGS" for j in $cdirs; do for k in $clibs; do LIBS="$j $k $save_LIBS" - AC_TRY_LINK(test_headers, test_body, - openssl=no ires="$i" lres="$j $k"; break 3) - done - done - CFLAGS="-DHAVE_OLD_HASH_NAMES $i $save_CFLAGS" - for j in $cdirs; do - for k in $clibs; do - LIBS="$j $k $save_LIBS" - AC_TRY_LINK(test_headers, test_body, - openssl=no ires="$i" lres="$j $k"; break 3) + AC_LINK_IFELSE([AC_LANG_PROGRAM([test_headers],[test_body])], + [openssl=no ires="$i" lres="$j $k"; break 3]) done done done @@ -108,36 +104,36 @@ if test "$crypto_lib" = "unknown" -a "$with_krb4" != "no"; then CFLAGS="$save_CFLAGS" LIBS="$save_LIBS" if test "$ires" -a "$lres"; then - INCLUDE_des="$ires" - LIB_des="$lres" + INCLUDE_hcrypto="$ires" + LIB_hcrypto="$lres" crypto_lib=krb4 AC_MSG_RESULT([same as krb4]) - LIB_des_a='$(LIB_des)' - LIB_des_so='$(LIB_des)' - LIB_des_appl='$(LIB_des)' + LIB_hcrypto_a='$(LIB_hcrypto)' + LIB_hcrypto_so='$(LIB_hcrypto)' + LIB_hcrypto_appl='$(LIB_hcrypto)' fi fi if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then save_CFLAGS="$CFLAGS" save_LIBS="$LIBS" - INCLUDE_des= - LIB_des= + INCLUDE_hcrypto= + LIB_hcrypto= if test "$with_openssl_include" != ""; then - INCLUDE_des="-I${with_openssl_include}" + INCLUDE_hcrypto="-I${with_openssl_include}" fi if test "$with_openssl_lib" != ""; then - LIB_des="-L${with_openssl_lib}" + LIB_hcrypto="-L${with_openssl_lib}" fi - CFLAGS="-DHAVE_OPENSSL ${INCLUDE_des} ${CFLAGS}" - saved_LIB_des="$LIB_des" - for lres in "" "-lnsl -lsocket"; do - LIB_des="${saved_LIB_des} -lcrypto $lres" - LIB_des_a="$LIB_des" - LIB_des_so="$LIB_des" - LIB_des_appl="$LIB_des" - LIBS="${LIBS} ${LIB_des}" - AC_TRY_LINK(test_headers, test_body, [ + CFLAGS="-DHAVE_OPENSSL ${INCLUDE_hcrypto} ${CFLAGS}" + saved_LIB_hcrypto="$LIB_hcrypto" + for lres in "" "-ldl" "-lnsl -lsocket" "-lnsl -lsocket -ldl"; do + LIB_hcrypto="${saved_LIB_hcrypto} -lcrypto $lres" + LIB_hcrypto_a="$LIB_hcrypto" + LIB_hcrypto_so="$LIB_hcrypto" + LIB_hcrypto_appl="$LIB_hcrypto" + LIBS="${LIBS} ${LIB_hcrypto}" + AC_LINK_IFELSE([AC_LANG_PROGRAM([test_headers],[test_body])], [ crypto_lib=libcrypto openssl=yes AC_MSG_RESULT([libcrypto]) ]) @@ -151,13 +147,13 @@ 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" + DIR_hcrypto='hcrypto' + LIB_hcrypto='$(top_builddir)/lib/hcrypto/libhcrypto.la' + LIB_hcrypto_a='$(top_builddir)/lib/hcrypto/.libs/libhcrypto.a' + LIB_hcrypto_so='$(top_builddir)/lib/hcrypto/.libs/libhcrypto.so' + LIB_hcrypto_appl="-lhcrypto" - AC_MSG_RESULT([included libdes]) + AC_MSG_RESULT([included libhcrypto]) fi @@ -170,16 +166,12 @@ fi if test "$openssl" = "yes"; then AC_DEFINE([HAVE_OPENSSL], 1, [define to use openssl's libcrypto]) fi -if test "$old_hash" = yes; then - AC_DEFINE([HAVE_OLD_HASH_NAMES], 1, - [define if you have hash functions like md4_finito()]) -fi AM_CONDITIONAL(HAVE_OPENSSL, test "$openssl" = yes)dnl -AC_SUBST(DIR_des) -AC_SUBST(INCLUDE_des) -AC_SUBST(LIB_des) -AC_SUBST(LIB_des_a) -AC_SUBST(LIB_des_so) -AC_SUBST(LIB_des_appl) +AC_SUBST(DIR_hcrypto) +AC_SUBST(INCLUDE_hcrypto) +AC_SUBST(LIB_hcrypto) +AC_SUBST(LIB_hcrypto_a) +AC_SUBST(LIB_hcrypto_so) +AC_SUBST(LIB_hcrypto_appl) ]) |