summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-05-17 23:29:18 +1000
committerDamien Miller <djm@mindrot.org>2000-05-17 23:29:18 +1000
commit3b512e18dc4c8fead872548bdb1a89f85681d0cf (patch)
treee98c4236dd34530fb3ac24ecee15000d8a8bd93e
parentc4be7ce66992811c555375cb303f504153e1b33f (diff)
- Detect OpenSSL seperatly from RSA
- Better test for RSA (more compatible with RSAref). Based on work by Ed Eden <ede370@stl.rural.usda.gov>
-rw-r--r--CREDITS1
-rw-r--r--ChangeLog3
-rw-r--r--configure.in87
3 files changed, 63 insertions, 28 deletions
diff --git a/CREDITS b/CREDITS
index 8ed3d80cc..95fc7c160 100644
--- a/CREDITS
+++ b/CREDITS
@@ -20,6 +20,7 @@ David Agraz <dagraz@jahoopa.com> - Build fixes
20David Del Piero <David.DelPiero@qed.qld.gov.au> - bug fixes 20David Del Piero <David.DelPiero@qed.qld.gov.au> - bug fixes
21David Hesprich <darkgrue@gue-tech.org> - Configure fixes 21David Hesprich <darkgrue@gue-tech.org> - Configure fixes
22David Rankin <drankin@bohemians.lexington.ky.us> - libwrap, AIX, NetBSD fixes 22David Rankin <drankin@bohemians.lexington.ky.us> - libwrap, AIX, NetBSD fixes
23Ed Eden <ede370@stl.rural.usda.gov> - configure fixes
23Gary E. Miller <gem@rellim.com> - SCO support 24Gary E. Miller <gem@rellim.com> - SCO support
24Ged Lodder <lodder@yacc.com.au> - HPUX fixes and enhancements 25Ged Lodder <lodder@yacc.com.au> - HPUX fixes and enhancements
25Gert Doering <gd@hilb1.medat.de> - bug and portability fixes 26Gert Doering <gd@hilb1.medat.de> - bug and portability fixes
diff --git a/ChangeLog b/ChangeLog
index 635bc2440..f995dafb9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,9 @@
32 - Checking for ssize_t and memmove. Based on patch from SAKAI Kiyotaka 32 - Checking for ssize_t and memmove. Based on patch from SAKAI Kiyotaka
33 <ksakai@kso.netwk.ntt-at.co.jp> 33 <ksakai@kso.netwk.ntt-at.co.jp>
34 - RSAless operation patch from kevin_oconnor@standardandpoors.com 34 - RSAless operation patch from kevin_oconnor@standardandpoors.com
35 - Detect OpenSSL seperatly from RSA
36 - Better test for RSA (more compatible with RSAref). Based on work by
37 Ed Eden <ede370@stl.rural.usda.gov>
35 38
3620000513 3920000513
37 - Fix for non-recognised DSA keys from Arkadiusz Miskiewicz 40 - Fix for non-recognised DSA keys from Arkadiusz Miskiewicz
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)