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.
This commit is contained in:
parent
b70ab85b2b
commit
9fa5f5fd96
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=57511
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
45
secure/lib/librsaintl/Makefile
Normal file
45
secure/lib/librsaintl/Makefile
Normal file
@ -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>
|
45
secure/lib/librsausa/Makefile
Normal file
45
secure/lib/librsausa/Makefile
Normal file
@ -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>
|
@ -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 \
|
||||
|
Loading…
Reference in New Issue
Block a user