summaryrefslogtreecommitdiff
path: root/security/openssh/patches/patch-aa
blob: 25699584041df28d44d58d79ec860e0625949d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
$NetBSD: patch-aa,v 1.13 2000/11/09 09:18:24 itojun Exp $

--- configure.in.orig	Sun Nov  5 18:08:45 2000
+++ configure.in	Thu Nov  9 18:03:33 2000
@@ -389,6 +389,7 @@
 saved_LIBS="$LIBS"
 saved_LDFLAGS="$LDFLAGS"
 saved_CFLAGS="$CFLAGS"
+crypto_LIBS=""
 if test "x$prefix" != "xNONE" ; then
 	tryssldir="$tryssldir $prefix"
 fi
@@ -405,12 +406,25 @@
 			LDFLAGS="$saved_LDFLAGS"
 		fi
 
-		LIBS="$saved_LIBS -lcrypto"
-
-		# Basic test to check for compatible version and correct linking
-		# *does not* test for RSA - that comes later.
-		AC_TRY_RUN(
-			[
+		# Some ELF systems can't resolve all the symbols in libcrypto
+		# if libcrypto was linked against RSAREF, and fail to link the
+		# test program correctly, even though a correct installation
+		# of OpenSSL exists.  So we test the linking three times in
+		# case the RSAREF libraries are needed right away.  We'll test
+		# for them explicitly later on.
+		#
+		for libcrypto in \
+			"-lcrypto" \
+			"-lcrypto -lrsaref" \
+			"-lcrypto -lRSAglue -lrsaref"
+		do
+			LIBS="$saved_LIBS $libcrypto"
+
+			# Basic test to check for compatible version and
+			# correct linking *does not* test for RSA - that comes
+			# later.
+			AC_TRY_RUN(
+				[
 #include <string.h>
 #include <openssl/rand.h>
 int main(void) 
@@ -420,12 +434,14 @@
 	RAND_add(a, sizeof(a), sizeof(a));
 	return(RAND_status() <= 0);
 }
-			],
-			[
-				found_crypto=1
-				break;
-			], []
-		)
+				],
+				[
+					found_crypto=1
+					crypto_LIBS=$libcrypto
+					break;
+				], []
+			)
+		done
 
 		if test ! -z "$found_crypto" ; then
 			break;
@@ -455,7 +471,7 @@
 		blibpath="$blibpath:$ssldir:$ssldir/lib"
 	fi
 fi
-LIBS="$saved_LIBS -lcrypto"
+LIBS="$saved_LIBS $crypto_LIBS"
 
 # Now test RSA support
 saved_LIBS="$LIBS"