3 dnl test for crypto libraries:
4 dnl - libcrypto (from openssl)
5 dnl - own-built libhcrypto
7 m4_define([test_headers], [
8 #undef KRB5 /* makes md4.h et al unhappy */
10 #ifdef HAVE_SYS_TYPES_H
11 #include <sys/types.h>
13 #include <openssl/evp.h>
14 #include <openssl/md4.h>
15 #include <openssl/md5.h>
16 #include <openssl/sha.h>
17 #include <openssl/des.h>
18 #include <openssl/rc4.h>
19 #include <openssl/aes.h>
20 #include <openssl/ec.h>
21 #include <openssl/engine.h>
22 #include <openssl/ui.h>
23 #include <openssl/rand.h>
24 #include <openssl/hmac.h>
25 #include <openssl/pkcs12.h>
27 #include <hcrypto/evp.h>
28 #include <hcrypto/md4.h>
29 #include <hcrypto/md5.h>
30 #include <hcrypto/sha.h>
31 #include <hcrypto/des.h>
32 #include <hcrypto/rc4.h>
33 #include <hcrypto/aes.h>
34 #include <hcrypto/engine.h>
35 #include <hcrypto/hmac.h>
36 #include <hcrypto/pkcs12.h>
39 m4_define([test_body], [
48 EVP_MD_CTX_init(&mdctx);
49 EVP_DigestInit_ex(&mdctx, EVP_sha1(), (ENGINE *)0);
50 EVP_CIPHER_iv_length(((EVP_CIPHER*)0));
51 UI_UTIL_read_pw_string(0,0,0,0);
57 OpenSSL_add_all_algorithms();
59 DES_cbc_encrypt(0, 0, 0, schedule, 0, 0);
63 AC_DEFUN([KRB_CRYPTO],[
65 AC_WITH_ALL([openssl])
69 AC_MSG_CHECKING([for crypto library])
73 if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then
78 if test "$with_openssl_include" != ""; then
79 INCLUDE_hcrypto="-I${with_openssl_include}"
81 if test "$with_openssl_lib" != ""; then
82 LIB_hcrypto="-L${with_openssl_lib}"
84 CFLAGS="-DHAVE_OPENSSL ${INCLUDE_hcrypto} ${CFLAGS}"
85 saved_LIB_hcrypto="$LIB_hcrypto"
86 for lres in "" "-ldl" "-lnsl -lsocket" "-lnsl -lsocket -ldl"; do
87 LIB_hcrypto="${saved_LIB_hcrypto} -lcrypto $lres"
88 LIB_hcrypto_a="$LIB_hcrypto"
89 LIB_hcrypto_so="$LIB_hcrypto"
90 LIB_hcrypto_appl="$LIB_hcrypto"
91 LIBS="${LIBS} ${LIB_hcrypto}"
92 AC_LINK_IFELSE([AC_LANG_PROGRAM([test_headers],[test_body])], [
93 crypto_lib=libcrypto openssl=yes
94 AC_MSG_RESULT([libcrypto])
96 if test "$crypto_lib" = libcrypto ; then
100 CFLAGS="$save_CFLAGS"
104 if test "$crypto_lib" = "unknown"; then
106 DIR_hcrypto='hcrypto'
107 LIB_hcrypto='$(top_builddir)/lib/hcrypto/libhcrypto.la'
108 LIB_hcrypto_a='$(top_builddir)/lib/hcrypto/.libs/libhcrypto.a'
109 LIB_hcrypto_so='$(top_builddir)/lib/hcrypto/.libs/libhcrypto.so'
110 LIB_hcrypto_appl="-lhcrypto"
112 AC_MSG_RESULT([included libhcrypto])
116 if test "$openssl" = "yes"; then
117 AC_DEFINE([HAVE_OPENSSL], 1, [define to use openssl's libcrypto])
119 AM_CONDITIONAL(HAVE_OPENSSL, test "$openssl" = yes)dnl
121 AC_SUBST(DIR_hcrypto)
122 AC_SUBST(INCLUDE_hcrypto)
123 AC_SUBST(LIB_hcrypto)
124 AC_SUBST(LIB_hcrypto_a)
125 AC_SUBST(LIB_hcrypto_so)
126 AC_SUBST(LIB_hcrypto_appl)