summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in87
1 files changed, 59 insertions, 28 deletions
diff --git a/configure.in b/configure.in
index 548d2727d..ba36417aa 100644
--- a/configure.in
+++ b/configure.in
@@ -212,37 +212,27 @@ AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
212 LDFLAGS="$saved_LDFLAGS" 212 LDFLAGS="$saved_LDFLAGS"
213 fi 213 fi
214 214
215 for WANTS_RSAREF in "" 1 ; do 215 LIBS="$saved_LIBS -lcrypto"
216
217 if test -z "$WANTS_RSAREF" ; then
218 LIBS="$saved_LIBS -lcrypto"
219 else
220 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
221 fi
222 216
223 AC_TRY_RUN( 217 # Basic test to check for compatible version and correct linking
224 [ 218 # *does not* test for RSA - that comes later.
219 AC_TRY_RUN(
220 [
225#include <string.h> 221#include <string.h>
226#include <openssl/rand.h> 222#include <openssl/rand.h>
227#include <openssl/rsa.h>
228#include <openssl/bn.h>
229#include <openssl/sha.h>
230int main(void) 223int main(void)
231{ 224{
232 RSA *key; char a[2048],b[2048];; 225 char a[2048];
233 memset(a, 0, sizeof(a));memset(b, 0, sizeof(b)); 226 memset(a, 0, sizeof(a));
234 RAND_add(a, sizeof(a), sizeof(a)); 227 RAND_add(a, sizeof(a), sizeof(a));
235 key=RSA_generate_key(32,3,NULL,NULL); 228 return(RAND_status() <= 0);
236 if (key==NULL) return(1);
237 return(-1==RSA_private_decrypt(RSA_size(key),a,b,key,RSA_NO_PADDING));
238} 229}
239 ], 230 ],
240 [ 231 [
241 found_crypto=1 232 found_crypto=1
242 break; 233 break;
243 ], [] 234 ], []
244 ) 235 )
245 done
246 236
247 if test ! -z "$found_crypto" ; then 237 if test ! -z "$found_crypto" ; then
248 break; 238 break;
@@ -272,13 +262,54 @@ if test ! -z "$ac_cv_openssldir" -a ! "x$ac_cv_openssldir" = "x(system)" ; then
272 blibpath="$blibpath:$ssldir:$ssldir/lib" 262 blibpath="$blibpath:$ssldir:$ssldir/lib"
273 fi 263 fi
274fi 264fi
275if test -z "$WANTS_RSAREF" ; then 265LIBS="$saved_LIBS -lcrypto"
276 LIBS="$saved_LIBS -lcrypto" 266
267# Now test RSA support
268saved_LIBS="$LIBS"
269AC_MSG_CHECKING([for RSA support])
270for WANTS_RSAREF in "" 1 ; do
271 if test -z "$WANTS_RSAREF" ; then
272 LIBS="$saved_LIBS"
273 else
274 LIBS="$saved_LIBS -lRSAglue -lrsaref"
275 fi
276 AC_TRY_RUN([
277#include <string.h>
278#include <openssl/rand.h>
279#include <openssl/rsa.h>
280#include <openssl/bn.h>
281#include <openssl/sha.h>
282int main(void)
283{
284 int num; RSA *key; static unsigned char p_in[] = "blahblah";
285 unsigned char c[256], p[256];
286 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
287 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
288 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
289 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
290}
291 ],
292 [
293 rsa_works=1
294 break;
295 ], [])
296done
297
298if test ! -z "$no_rsa" ; then
299 AC_MSG_RESULT(disabled)
277else 300else
278 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref" 301 if test -z "$rsa_works" ; then
302 AC_MSG_WARN([*** No RSA support found *** ])
303 else
304 if test -z "$WANTS_RSAREF" ; then
305 AC_MSG_RESULT(yes)
306 else
307 AC_MSG_RESULT(using RSAref)
308 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
309 fi
310 fi
279fi 311fi
280 312
281
282# Checks for data types 313# Checks for data types
283AC_CHECK_SIZEOF(char, 1) 314AC_CHECK_SIZEOF(char, 1)
284AC_CHECK_SIZEOF(short int, 2) 315AC_CHECK_SIZEOF(short int, 2)