diff options
author | peter <peter@FreeBSD.org> | 2000-02-26 13:13:03 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-02-26 13:13:03 +0000 |
commit | 58c2a78aa2a72044e1717c1ff77cfdc9b2dc0463 (patch) | |
tree | 4667af4182179bf0fd04fc76aa3c798f4ff9d140 | |
parent | 527ba28c8fdf2e7a104fa19c1b56892d2612156b (diff) | |
download | FreeBSD-src-58c2a78aa2a72044e1717c1ff77cfdc9b2dc0463.zip FreeBSD-src-58c2a78aa2a72044e1717c1ff77cfdc9b2dc0463.tar.gz |
Merge from internat.freebsd.org repo, minus change to rsa_eay.c (missing)
Reorganize and unify libcrypto's interface so that the RSA implementation
is chosen at runtime via dlopen().
This is a checkpoint and may require more tweaks still.
-rw-r--r-- | crypto/openssl/apps/speed.c | 14 | ||||
-rw-r--r-- | crypto/openssl/crypto/err/err_all.c | 8 | ||||
-rw-r--r-- | crypto/openssl/crypto/rsa/rsa.h | 6 | ||||
-rw-r--r-- | crypto/openssl/crypto/rsa/rsa_lib.c | 7 | ||||
-rw-r--r-- | crypto/openssl/rsaref/rsar_err.c | 3 | ||||
-rw-r--r-- | crypto/openssl/rsaref/rsaref.c | 3 | ||||
-rw-r--r-- | crypto/openssl/rsaref/rsaref.h | 5 | ||||
-rw-r--r-- | secure/lib/Makefile | 6 | ||||
-rw-r--r-- | secure/lib/libcrypto/Makefile | 15 | ||||
-rw-r--r-- | secure/lib/libcrypto/Makefile.inc | 5 | ||||
-rw-r--r-- | secure/lib/librsaintl/Makefile | 45 | ||||
-rw-r--r-- | secure/lib/librsausa/Makefile | 45 | ||||
-rw-r--r-- | secure/usr.bin/openssl/Makefile | 7 |
13 files changed, 111 insertions, 58 deletions
diff --git a/crypto/openssl/apps/speed.c b/crypto/openssl/apps/speed.c index a298014..571b611 100644 --- a/crypto/openssl/apps/speed.c +++ b/crypto/openssl/apps/speed.c @@ -429,21 +429,9 @@ int MAIN(int argc, char **argv) else #endif #ifndef NO_RSA -#ifdef RSAref - if (strcmp(*argv,"rsaref") == 0) - { - RSA_set_default_method(RSA_PKCS1_RSAref()); - j--; - } - else -#endif if (strcmp(*argv,"openssl") == 0) { -#ifdef RSAref - RSA_set_default_method(RSA_PKCS1_RSAref()); -#else - RSA_set_default_method(RSA_PKCS1_SSLeay()); -#endif + RSA_set_default_method(RSA_PKCS1()); j--; } else diff --git a/crypto/openssl/crypto/err/err_all.c b/crypto/openssl/crypto/err/err_all.c index ad82022..c4370c9 100644 --- a/crypto/openssl/crypto/err/err_all.c +++ b/crypto/openssl/crypto/err/err_all.c @@ -1,4 +1,5 @@ /* crypto/err/err_all.c */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -64,9 +65,6 @@ #ifndef NO_RSA #include <openssl/rsa.h> #endif -#ifdef RSAref -#include <openssl/rsaref.h> -#endif #ifndef NO_DH #include <openssl/dh.h> #endif @@ -95,12 +93,8 @@ void ERR_load_crypto_strings(void) ERR_load_BIO_strings(); ERR_load_CONF_strings(); #ifndef NO_RSA -#ifdef RSAref - ERR_load_RSAREF_strings(); -#else ERR_load_RSA_strings(); #endif -#endif #ifndef NO_DH ERR_load_DH_strings(); #endif diff --git a/crypto/openssl/crypto/rsa/rsa.h b/crypto/openssl/crypto/rsa/rsa.h index 9230b2f..6c17ccc 100644 --- a/crypto/openssl/crypto/rsa/rsa.h +++ b/crypto/openssl/crypto/rsa/rsa.h @@ -1,4 +1,5 @@ /* crypto/rsa/rsa.h */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -175,11 +176,8 @@ RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth); /* This function needs the memory locking malloc callbacks to be installed */ int RSA_memory_lock(RSA *r); -/* If you have RSAref compiled in. */ -RSA_METHOD *RSA_PKCS1_RSAref(void); - /* these are the actual SSLeay RSA functions */ -RSA_METHOD *RSA_PKCS1_SSLeay(void); +RSA_METHOD *RSA_PKCS1(void); void ERR_load_RSA_strings(void ); diff --git a/crypto/openssl/crypto/rsa/rsa_lib.c b/crypto/openssl/crypto/rsa/rsa_lib.c index c0ca292..1cf8539 100644 --- a/crypto/openssl/crypto/rsa/rsa_lib.c +++ b/crypto/openssl/crypto/rsa/rsa_lib.c @@ -1,4 +1,5 @@ /* crypto/rsa/rsa_lib.c */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -105,11 +106,7 @@ RSA *RSA_new_method(RSA_METHOD *meth) if (default_RSA_meth == NULL) { -#ifdef RSAref - default_RSA_meth=RSA_PKCS1_RSAref(); -#else - default_RSA_meth=RSA_PKCS1_SSLeay(); -#endif + default_RSA_meth=RSA_PKCS1(); } ret=(RSA *)Malloc(sizeof(RSA)); if (ret == NULL) diff --git a/crypto/openssl/rsaref/rsar_err.c b/crypto/openssl/rsaref/rsar_err.c index d2eb3a2..438acf5 100644 --- a/crypto/openssl/rsaref/rsar_err.c +++ b/crypto/openssl/rsaref/rsar_err.c @@ -1,4 +1,5 @@ /* rsaref/rsar_err.c */ +/* $FreeBSD$ */ /* ==================================================================== * Copyright (c) 1999 The OpenSSL Project. All rights reserved. * @@ -102,7 +103,7 @@ static ERR_STRING_DATA RSAREF_str_reasons[]= #endif -void ERR_load_RSAREF_strings(void) +void ERR_load_RSA_strings(void) { static int init=1; diff --git a/crypto/openssl/rsaref/rsaref.c b/crypto/openssl/rsaref/rsaref.c index 7677eb9..6a5face 100644 --- a/crypto/openssl/rsaref/rsaref.c +++ b/crypto/openssl/rsaref/rsaref.c @@ -1,4 +1,5 @@ /* rsaref/rsaref.c */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -95,7 +96,7 @@ static RSA_METHOD rsa_pkcs1_ref_meth={ NULL, }; -RSA_METHOD *RSA_PKCS1_RSAref(void) +RSA_METHOD *RSA_PKCS1(void) { return(&rsa_pkcs1_ref_meth); } diff --git a/crypto/openssl/rsaref/rsaref.h b/crypto/openssl/rsaref/rsaref.h index 15f65dd..b9b3e61 100644 --- a/crypto/openssl/rsaref/rsaref.h +++ b/crypto/openssl/rsaref/rsaref.h @@ -1,4 +1,5 @@ /* rsaref/rsaref.h */ +/* $FreeBSD$ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -131,8 +132,8 @@ int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd); int R_RandomUpdate(RSARandomState *rnd, unsigned char *data, unsigned int n); int R_RandomFinal(RSARandomState *rnd); -void ERR_load_RSAREF_strings(void ); -RSA_METHOD *RSA_PKCS1_RSAref(void ); +void ERR_load_RSA_strings(void ); +RSA_METHOD *RSA_PKCS1(void ); #endif /* BEGIN ERROR CODES */ diff --git a/secure/lib/Makefile b/secure/lib/Makefile index 8608de2..8aeb2bf 100644 --- a/secure/lib/Makefile +++ b/secure/lib/Makefile @@ -6,6 +6,12 @@ SUBDIR+=libtelnet .endif .if !defined(NO_OPENSSL) SUBDIR+=libcrypto librsaglue libssl +.if exists(${.CURDIR}/../../crypto/openssl/rsaref) +SUBDIR+=librsausa +.endif +.if exists(${.CURDIR}/../../crypto/openssl/crypto/rsa/rsa_eay.c) +SUBDIR+=librsaintl +.endif .endif .if !defined(NO_OPENSSH) SUBDIR+=libssh diff --git a/secure/lib/libcrypto/Makefile b/secure/lib/libcrypto/Makefile index fd3acc7..6824189 100644 --- a/secure/lib/libcrypto/Makefile +++ b/secure/lib/libcrypto/Makefile @@ -125,15 +125,8 @@ SRCS+= rmd_dgst.c rmd_one.c # rsa .if defined(WITH_RSA) && ${WITH_RSA} == YES -SRCS+= rsa_chk.c rsa_err.c rsa_gen.c rsa_lib.c rsa_none.c rsa_oaep.c \ - rsa_pk1.c rsa_saos.c rsa_sign.c rsa_ssl.c -.if (!defined(RSAREF) || ${RSAREF} != YES) && exists(${LCRYPTO_SRC}/rsa/rsa_eay.c) -SRCS+= rsa_eay.c # native rsa -.else -SRCS+= rsar_err.c rsaref.c rsaref_stubs.c # external rsaref -HDRS+= ../rsaref/rsaref.h -CFLAGS+=-DRSAref -.endif +SRCS+= rsa_chk.c rsa_gen.c rsa_lib.c rsa_none.c rsa_oaep.c \ + rsa_pk1.c rsa_saos.c rsa_sign.c rsa_ssl.c rsa_stubs.c .endif # sha @@ -166,10 +159,6 @@ HDRS= asn1/asn1.h asn1/asn1_mac.h bio/bio.h bf/blowfish.h bn/bn.h \ sha/sha.h stack/stack.h tmdiff.h txt_db/txt_db.h x509/x509.h \ x509/x509_vfy.h x509v3/x509v3.h -.if defined(RSAREF) && ${RSAREF} == YES -HDRS+= ../rsaref/rsaref.h -.endif - beforedepend: ${.OBJDIR}/obj_dat.h ${.OBJDIR}/buildinf.h \ ${.OBJDIR}/openssl/opensslconf.h headers diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc index 11fee3a..6391c68 100644 --- a/secure/lib/libcrypto/Makefile.inc +++ b/secure/lib/libcrypto/Makefile.inc @@ -13,9 +13,4 @@ CFLAGS+= -DDEVRANDOM=\"/dev/urandom\" .endif .endif -LOCALBASE?= /usr/local - WITH_RSA?= YES -.if (!defined(USA_RESIDENT) || ${USA_RESIDENT} != NO) && ${WITH_RSA} != NO -RSAREF= YES -.endif diff --git a/secure/lib/librsaintl/Makefile b/secure/lib/librsaintl/Makefile new file mode 100644 index 0000000..e967203 --- /dev/null +++ b/secure/lib/librsaintl/Makefile @@ -0,0 +1,45 @@ +# $FreeBSD$ + +.include "../libcrypto/Makefile.inc" + +# Don't blame kris.. -peter +MAINTAINER= kris + +LIB= rsaINTL +SHLIB_MAJOR= 1 + +CFLAGS+= -I${.OBJDIR} + +# rsaref +SRCS+= rsa_err.c rsa_eay.c + +HDRS= asn1/asn1.h asn1/asn1_mac.h bio/bio.h bf/blowfish.h bn/bn.h \ + buffer/buffer.h cast/cast.h comp/comp.h conf/conf.h crypto.h \ + des/des.h dh/dh.h dsa/dsa.h ../e_os.h ../e_os2.h ebcdic.h \ + err/err.h evp/evp.h hmac/hmac.h lhash/lhash.h md2/md2.h \ + md5/md5.h mdc2/mdc2.h objects/objects.h opensslv.h pem/pem.h \ + pem/pem2.h pkcs12/pkcs12.h pkcs7/pkcs7.h rand/rand.h rc2/rc2.h \ + rc4/rc4.h rc5/rc5.h ripemd/ripemd.h rsa/rsa.h ../rsaref/rsaref.h \ + stack/safestack.h sha/sha.h stack/stack.h tmdiff.h txt_db/txt_db.h \ + x509/x509.h x509/x509_vfy.h x509v3/x509v3.h + +beforedepend: headers ${.OBJDIR}/openssl/opensslconf.h + +DPADD+= ${.OBJDIR}/openssl/opensslconf.h + +CLEANDIRS+= ${.OBJDIR}/openssl + +${.OBJDIR}/openssl/opensslconf.h: ../libcrypto/opensslconf-${MACHINE_ARCH}.h + @test -d ${.OBJDIR}/openssl || mkdir -p ${.OBJDIR}/openssl; \ + cp ${.OODATE} ${.TARGET} + +headers: + @test -d ${.OBJDIR}/openssl || mkdir -p ${.OBJDIR}/openssl; \ + for i in ${HDRS}; do \ + ${INSTALL} ${COPY} -m 444 ${LCRYPTO_SRC}/$$i \ + ${.OBJDIR}/openssl; \ + done + +.PATH: ${LCRYPTO_SRC}/rsa + +.include <bsd.lib.mk> diff --git a/secure/lib/librsausa/Makefile b/secure/lib/librsausa/Makefile new file mode 100644 index 0000000..9fed9eb --- /dev/null +++ b/secure/lib/librsausa/Makefile @@ -0,0 +1,45 @@ +# $FreeBSD$ + +.include "../libcrypto/Makefile.inc" + +# Don't blame kris.. -peter +MAINTAINER= kris + +LIB= rsaUSA +SHLIB_MAJOR= 1 + +CFLAGS+= -I${.OBJDIR} + +# rsaref +SRCS+= rsar_err.c rsaref.c rsaref_stubs.c + +HDRS= asn1/asn1.h asn1/asn1_mac.h bio/bio.h bf/blowfish.h bn/bn.h \ + buffer/buffer.h cast/cast.h comp/comp.h conf/conf.h crypto.h \ + des/des.h dh/dh.h dsa/dsa.h ../e_os.h ../e_os2.h ebcdic.h \ + err/err.h evp/evp.h hmac/hmac.h lhash/lhash.h md2/md2.h \ + md5/md5.h mdc2/mdc2.h objects/objects.h opensslv.h pem/pem.h \ + pem/pem2.h pkcs12/pkcs12.h pkcs7/pkcs7.h rand/rand.h rc2/rc2.h \ + rc4/rc4.h rc5/rc5.h ripemd/ripemd.h rsa/rsa.h ../rsaref/rsaref.h \ + stack/safestack.h sha/sha.h stack/stack.h tmdiff.h txt_db/txt_db.h \ + x509/x509.h x509/x509_vfy.h x509v3/x509v3.h + +beforedepend: headers ${.OBJDIR}/openssl/opensslconf.h + +DPADD+= ${.OBJDIR}/openssl/opensslconf.h + +CLEANDIRS+= ${.OBJDIR}/openssl + +${.OBJDIR}/openssl/opensslconf.h: ../libcrypto/opensslconf-${MACHINE_ARCH}.h + @test -d ${.OBJDIR}/openssl || mkdir -p ${.OBJDIR}/openssl; \ + cp ${.OODATE} ${.TARGET} + +headers: + @test -d ${.OBJDIR}/openssl || mkdir -p ${.OBJDIR}/openssl; \ + for i in ${HDRS}; do \ + ${INSTALL} ${COPY} -m 444 ${LCRYPTO_SRC}/$$i \ + ${.OBJDIR}/openssl; \ + done + +.PATH: ${LCRYPTO_SRC}/../rsaref + +.include <bsd.lib.mk> diff --git a/secure/usr.bin/openssl/Makefile b/secure/usr.bin/openssl/Makefile index 697faf1..93c19d8 100644 --- a/secure/usr.bin/openssl/Makefile +++ b/secure/usr.bin/openssl/Makefile @@ -15,13 +15,6 @@ CFLAGS+= -DMONOLITH -DNO_IDEA -I${.CURDIR} WITH_RSA?= YES .if ${WITH_RSA} == NO CFLAGS+= -DNO_RSA -DNO_SSL2 -.else -.if !defined(USA_RESIDENT) || ${USA_RESIDENT} != NO -RSAREF= YES -.endif -.endif -.if (defined(RSAREF) && ${RSAREF} == YES) || !exists(${LCRYPTO_SRC}/rsa/rsa_eay.c) -CFLAGS+= -DRSAref .endif SRCS= apps.c asn1pars.c ca.c ciphers.c crl.c crl2p7.c dgst.c dh.c \ |