diff -u -r --new-file ~/downloads/SSLeay-0.6.3.orig SSLeay-0.6.3 diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/Makefile.ssl SSLeay-0.6.3/Makefile.ssl --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/Makefile.ssl Wed Aug 7 08:54:11 1996 +++ SSLeay-0.6.3/Makefile.ssl Tue Aug 13 14:56:40 1996 @@ -30,6 +30,7 @@ # # NOCONST - Define for C compilers that don't like the const key word. # NOPROTO - Define in if your compiler does not support prototypes. +# BSAFE - Define if we are to link with BSAFE. # RSAref - Define if we are to link with RSAref. # NOIDEA - Define to build without the IDEA algorithm # NORC4 - Define to build without the RC4 algorithm @@ -40,10 +41,14 @@ # TERMIOS - Define the termios terminal subsystem, Silicon Graphics. # LOCK_DEBUG - turns on lots of lock debug output :-) -CC= cc -CFLAG= -O -DNOPROTO +CC= gcc +#CFLAG= -O3 -fomit-frame-pointer -DTERMIO -Wall +#CFLAG= -g -O2 -DTERMIO -Wall +BSAFE_CFLAGS=-DBSAFE -I../../bsafe/include -I../../../bsafe/include +BSAFE_LIBS=-L../../bsafe/lib -L../../../bsafe/lib -lbsafe -lBSAFEglue +CFLAG= -g -DTERMIO -Wall $(BSAFE_CFLAGS) PEX_LIBS= -L. -L.. -L../.. -L../../.. -EX_LIBS= +EX_LIBS= $(BSAFE_LIBS) BN_MULW= bn_mulw.o # If you change the INSTALLTOP, make sure to also change the values @@ -58,7 +63,7 @@ SHELL=/bin/sh TOP= . -DIRS= crypto ssl rsaref apps test tools +DIRS= crypto ssl rsaref bsafe apps test tools ONEDIRS=out tmp EDIRS= times doc bugs util include certs ms shlib MISC= COPYRIGHT Configure INSTALL Makefile.ssl Makefile \ diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/Makefile.ssl SSLeay-0.6.3/bsafe/Makefile.ssl --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/Makefile.ssl Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/bsafe/Makefile.ssl Thu Aug 8 14:38:36 1996 @@ -0,0 +1,87 @@ +# +# SSLeay/bsafe/Makefile +# + +DIR= bsafe +TOP= .. +CC= cc +INCLUDES= -I../crypto -I../include +CFLAG=-g +INSTALLTOP=/usr/local/ssl +MAKE= make -f Makefile.ssl +MAKEDEPEND= makedepend -fMakefile.ssl +MAKEFILE= Makefile.ssl + +CFLAGS= $(INCLUDES) $(CFLAG) + +ERR=bsafe +ERRC=bsaf_err +GENERAL=Makefile +TEST= +APPS= + +LIB=$(TOP)/libBSAFEglue.a +LIBSRC= bsafe.c tstdlib.c $(ERRC).c +LIBOBJ= bsafe.o tstdlib.o $(ERRC).o + +SRC= $(LIBSRC) + +EXHEADER= +HEADER= $(EXHEADER) + +ALL= $(GENERAL) $(SRC) $(HEADER) + +top: + (cd ..; $(MAKE) DIRS=bsafe all) + +all: lib + +lib: $(LIBOBJ) + ar r $(LIB) $(LIBOBJ) + $(TOP)/util/ranlib.sh $(LIB) + @touch lib + +files: + perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO + +links: + /bin/rm -f Makefile + $(TOP)/util/point.sh Makefile.ssl Makefile + $(TOP)/util/mklink.sh ../include $(EXHEADER) + $(TOP)/util/mklink.sh ../test $(TEST) + $(TOP)/util/mklink.sh ../apps $(APPS) + +install: + +# @for i in $(EXHEADER) ; \ +# do \ +# (cp $$i $(INSTALLTOP)/include/$$i; \ +# chmod 644 $(INSTALLTOP)/include/$$i ) \ +# done; + +tags: + ctags $(SRC) + +tests: + +lint: + lint -DLINT $(INCLUDES) $(SRC)>fluff + +depend: + $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) + +dclean: + sed -e '/^# DO NOT DELETE THIS LINE/ q' $(MAKEFILE) >Makefile.new + mv -f Makefile.new $(MAKEFILE) + +clean: + /bin/rm -f *.o *.obj lib tags core .nfs* *.old *.bak fluff + +errors: + sed -e "/ERROR CODES/ r $(ERR).err" -e "/ERROR CODES/ q" \ + <$(ERR).h >$(ERR).new + mv $(ERR).h $(ERR).old + mv $(ERR).new $(ERR).h + perl ../crypto/error/err_genc.pl $(ERR).h $(ERRC).c >$(ERRC).c + +# DO NOT DELETE THIS LINE -- make depend depends on it. diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsaf_err.c SSLeay-0.6.3/bsafe/bsaf_err.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsaf_err.c Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/bsafe/bsaf_err.c Thu Aug 8 14:38:37 1996 @@ -0,0 +1,79 @@ +/* lib/bsafe/bsaf_err.c */ +/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au) + * All rights reserved. + * + * This file is part of an SSL implementation written + * by Eric Young (eay@mincom.oz.au). + * The implementation was written so as to conform with Netscapes SS + * specification. This library and applications are + * FREE FOR COMMERCIAL AND NON-COMMERCIAL USE + * as long as the following conditions are aheared to. + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. If this code is used in a product, + * Eric Young should be given attribution as the author of the parts used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Eric Young (eay@mincom.oz.au) + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIA + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include "rsa.h" +#include "aglobal.h" +#include "bsafe.h" +#include "bsafe_glue.h" + +/* BEGIN ERROR CODES */ +static ERR_STRING_DATA BSAFE_str_functs[]= + { +{ERR_PACK(0,BSAFE_F_RSA_BN2BIN,0), "RSA_BN2BIN"}, +{ERR_PACK(0,BSAFE_F_RSA_PRIVATE_DECRYPT,0), "RSA_PRIVATE_DECRYPT"}, +{ERR_PACK(0,BSAFE_F_RSA_PRIVATE_ENCRYPT,0), "RSA_PRIVATE_ENCRYPT"}, +{ERR_PACK(0,BSAFE_F_RSA_PUBLIC_DECRYPT,0), "RSA_PUBLIC_DECRYPT"}, +{ERR_PACK(0,BSAFE_F_RSA_PUBLIC_ENCRYPT,0), "RSA_PUBLIC_ENCRYPT"}, +{ERR_PACK(0,BSAFE_F_PUBLIC_BSAFE_TO_EAY,0), "BSAFE_PUBLIC_BSAFE_TO_EAY"}, +{ERR_PACK(0,BSAFE_F_PUBLIC_EAY_TO_BSAFE,0), "BSAFE_PUBLIC_EAY_TO_BSAFE"}, +{ERR_PACK(0,BSAFE_F_PRIVATE_BSAFE_TO_EAY,0), "BSAFE_PRIVATE_BSAFE_TO_EAY"}, +{ERR_PACK(0,BSAFE_F_PRIVATE_EAY_TO_BSAFE,0), "BSAFE_PRIVATE_EAY_TO_BSAFE"}, +{0,NULL}, + }; + +void ERR_load_BSAFE_strings() + { + static int init=1; + + if (init) + { + init=0; + ERR_load_strings(ERR_LIB_BSAFE,BSAFE_str_functs); + } + } diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsafe.c SSLeay-0.6.3/bsafe/bsafe.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsafe.c Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/bsafe/bsafe.c Thu Aug 8 14:38:37 1996 @@ -0,0 +1,545 @@ +/* bsafe/bsafe.c */ +/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au) + * All rights reserved. + * + * This file is part of an SSL implementation written + * by Eric Young (eay@mincom.oz.au). + * The implementation was written so as to conform with Netscapes SSL + * specification. This library and applications are + * FREE FOR COMMERCIAL AND NON-COMMERCIAL USE + * as long as the following conditions are aheared to. + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. If this code is used in a product, + * Eric Young should be given attribution as the author of the parts used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Eric Young (eay@mincom.oz.au) + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include "bn.h" +#include "rsa.h" +#include "x509.h" +#include "rand.h" +#include "objects.h" +#include "aglobal.h" +#include "bsafe.h" +#include "bsafe_glue.h" + +/* + *---------------------------------------------------------------------- + * BSAFE_Private_bsafe2eay -- + * + * Convert a private key from BSAFE format to SSLeay format. + * The conversion may not be the most efficient, but it is + * the only way to do it with publically available info. + * I could check to see if the data is held in essentially + * the same format and then do a direct conversion. + *---------------------------------------------------------------------- + */ +int +BSAFE_Private_bsafe2eay(from,to) +B_KEY_OBJ from; +RSA **to; + { + X509_PRIVKEY *privkey=NULL; + ITEM *bsafeKeyBER=NULL; + int i; + int length; + unsigned char *p; + + if ((i=B_GetKeyInfo((POINTER *)&bsafeKeyBER, + from,KI_PKCS_RSAPrivateBER)) != 0) + { + BSAFEerr(BSAFE_F_PRIVATE_BSAFE_TO_EAY,i); + goto err; + } + p=bsafeKeyBER->data; + length=bsafeKeyBER->len; + + if (! d2i_X509_PRIVKEY(&privkey,&p,length)) + { + BSAFEerr(BSAFE_F_PRIVATE_BSAFE_TO_EAY,i); + goto err; + } + + p=privkey->privkey->data; + length=privkey->privkey->length; + if (! d2i_RSAPrivateKey(to,&p,length)) + { + BSAFEerr(BSAFE_F_PRIVATE_BSAFE_TO_EAY,ERR_R_BSAFE_LIB); + goto err; + } + X509_PRIVKEY_free(privkey); + return 1; + err: + if (privkey != NULL) X509_PRIVKEY_free(privkey); + return 0; + } + +int +BSAFE_Private_eay2bsafe(from,to) +RSA *from; +B_KEY_OBJ *to; + { + X509_PRIVKEY *privkey=NULL; + int length; + int i; + ITEM bsafeKeyBER; + unsigned char *p; + + if (from == NULL || to == NULL) return 0; + privkey=X509_PRIVKEY_new(); + if (privkey == NULL) return 0; + bsafeKeyBER.data=NULL; + ASN1_INTEGER_set(privkey->version,0); + ASN1_OBJECT_free(privkey->algor->algorithm); + privkey->algor->algorithm=OBJ_nid2obj(NID_rsaEncryption); + length=i2d_RSAPrivateKey(from,NULL); + privkey->privkey->length=length; + p=malloc(length); + if (p == NULL) + { + BSAFEerr(BSAFE_F_PRIVATE_EAY_TO_BSAFE,ERR_R_BSAFE_LIB); + goto err; + } + privkey->privkey->data=p; + i2d_RSAPrivateKey(from,&p); + + length=i2d_X509_PRIVKEY(privkey,NULL); + bsafeKeyBER.len=length; + p=malloc(length); + if (p == NULL) goto err; + bsafeKeyBER.data=p; + i2d_X509_PRIVKEY(privkey,&p); + + if (*to == NULL) + { + if ((i=B_CreateKeyObject(to)) != 0) + { + BSAFEerr(BSAFE_F_PRIVATE_EAY_TO_BSAFE,i); + goto err; + } + } + if ((i=B_SetKeyInfo(*to,KI_PKCS_RSAPrivateBER, + (POINTER)&bsafeKeyBER)) != 0) + { + BSAFEerr(BSAFE_F_PRIVATE_EAY_TO_BSAFE,i); + goto err; + } + X509_PRIVKEY_free(privkey); + free(bsafeKeyBER.data); + return(1); + err: + if (privkey != NULL) X509_PRIVKEY_free(privkey); + if (bsafeKeyBER.data != NULL) free(bsafeKeyBER.data); + return 0; + } + +int +BSAFE_Public_bsafe2eay(from,to) +B_KEY_OBJ from; +RSA **to; + { + X509_PUBKEY *pubkey=NULL; + ITEM *bsafeKeyBER=NULL; + int i; + int length; + unsigned char *p; + + if ((i=B_GetKeyInfo((POINTER *)&bsafeKeyBER, + from,KI_RSAPublicBER)) != 0) + { + BSAFEerr(BSAFE_F_PUBLIC_BSAFE_TO_EAY,i); + goto err; + } + p=bsafeKeyBER->data; + length=bsafeKeyBER->len; + + if (! d2i_X509_PUBKEY(&pubkey,&p,length)) + { + BSAFEerr(BSAFE_F_PUBLIC_BSAFE_TO_EAY,i); + goto err; + } + + p=pubkey->public_key->data; + length=pubkey->public_key->length; + if (! d2i_RSAPublicKey(to,&p,length)) + { + BSAFEerr(BSAFE_F_PUBLIC_BSAFE_TO_EAY,ERR_R_BSAFE_LIB); + goto err; + } + X509_PUBKEY_free(pubkey); + return 1; + err: + if (pubkey != NULL) X509_PUBKEY_free(pubkey); + return 0; + } + +int +BSAFE_Public_eay2bsafe(from,to) +RSA *from; +B_KEY_OBJ *to; + { + X509_PUBKEY *pubkey=NULL; + int length; + int i; + ITEM bsafeKeyBER; + unsigned char *p; + + if (from == NULL || to == NULL) return 0; + pubkey=X509_PUBKEY_new(); + if (pubkey == NULL) return 0; + bsafeKeyBER.data=NULL; + ASN1_OBJECT_free(pubkey->algor->algorithm); + pubkey->algor->algorithm=OBJ_nid2obj(NID_rsaEncryption); + length=i2d_RSAPublicKey(from,NULL); + pubkey->public_key->length=length; + p=malloc(length); + if (p == NULL) + { + BSAFEerr(BSAFE_F_PUBLIC_EAY_TO_BSAFE,ERR_R_BSAFE_LIB); + goto err; + } + pubkey->public_key->data=p; + i2d_RSAPublicKey(from,&p); + + length=i2d_X509_PUBKEY(pubkey,NULL); + bsafeKeyBER.len=length; + p=malloc(length); + if (p == NULL) goto err; + bsafeKeyBER.data=p; + i2d_X509_PUBKEY(pubkey,&p); + + if (*to == NULL) + { + if ((i=B_CreateKeyObject(to)) != 0) + { + BSAFEerr(BSAFE_F_PUBLIC_EAY_TO_BSAFE,i); + goto err; + } + } + if ((i=B_SetKeyInfo(*to,KI_RSAPublicBER, + (POINTER)&bsafeKeyBER)) != 0) + { + BSAFEerr(BSAFE_F_PUBLIC_EAY_TO_BSAFE,i); + goto err; + } + X509_PUBKEY_free(pubkey); + free(bsafeKeyBER.data); + return(1); + err: + if (pubkey != NULL) X509_PUBKEY_free(pubkey); + if (bsafeKeyBER.data != NULL) free(bsafeKeyBER.data); + return 0; + } + +int +RSA_private_decrypt(len,from,to,rsa) +int len; +unsigned char *from,*to; +RSA *rsa; + { + int i,outlen= -1; + int outlenUpdate=0; + int n; + B_KEY_OBJ RSAKey=NULL; + B_ALGORITHM_OBJ rsaDecryptor=NULL; + B_ALGORITHM_METHOD *RSA_CHOOSER[] = { &AM_RSA_DECRYPT, + &AM_RSA_CRT_DECRYPT, NULL }; + + if (!BSAFE_Private_eay2bsafe(rsa,&RSAKey)) + goto err; + + if ((i=B_CreateAlgorithmObject(&rsaDecryptor)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + if ((i=B_SetAlgorithmInfo(rsaDecryptor, AI_PKCS_RSAPrivate, NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + if ((i=B_DecryptInit(rsaDecryptor,RSAKey,RSA_CHOOSER,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + n=RSA_size(rsa); + if ((i=B_DecryptUpdate(rsaDecryptor,to,&outlenUpdate,n, + from,len,NULL,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + if ((i=B_DecryptFinal(rsaDecryptor,to + outlenUpdate,&outlen, + n-outlenUpdate,NULL,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + outlen += outlenUpdate; +err: + /* memset(RSAKey,0,sizeof(RSAKey)); */ + if (rsaDecryptor) B_DestroyAlgorithmObject(&rsaDecryptor); + if (RSAKey) B_DestroyKeyObject(&RSAKey); + + return(outlen); + } + + +int +RSA_private_encrypt(len,from,to,rsa) +int len; +unsigned char *from,*to; +RSA *rsa; + { + int outlen= -1; + int outlenUpdate=0; + unsigned char buf[16]; + int i,n; + B_KEY_OBJ RSAKey=NULL; + B_ALGORITHM_OBJ randomAlg=NULL; + B_ALGORITHM_OBJ rsaEncryptor=NULL; + B_ALGORITHM_METHOD *RSA_CHOOSER[] = { &AM_RSA_ENCRYPT, + &AM_RSA_CRT_ENCRYPT, NULL }; + B_ALGORITHM_METHOD *RANDOM_CHOOSER[] = { &AM_MD5_RANDOM, NULL }; + + if (!BSAFE_Private_eay2bsafe(rsa,&RSAKey)) + goto err; + randomAlg=NULL; + if ((i=B_CreateAlgorithmObject(&randomAlg)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + if ((i=B_SetAlgorithmInfo(randomAlg,AI_MD5Random,NULL_PTR)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + if ((i=B_RandomInit(randomAlg,RANDOM_CHOOSER,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + + /* Throw in 256 bytes of random data */ + n=256; + while (n > 0) + { + RAND_bytes(buf,16); + if ((i=B_RandomUpdate(randomAlg,buf, + (unsigned int)((n>16)?16:n), NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_DECRYPT,i); + goto err; + } + n -= 16; + } + + if ((i=B_CreateAlgorithmObject(&rsaEncryptor)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_ENCRYPT,i); + goto err; + } + if ((i=B_SetAlgorithmInfo(rsaEncryptor,AI_PKCS_RSAPrivate,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_ENCRYPT,i); + goto err; + } + if ((i=B_EncryptInit(rsaEncryptor,RSAKey,RSA_CHOOSER,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_ENCRYPT,i); + goto err; + } + n=RSA_size(rsa); + if ((i=B_EncryptUpdate(rsaEncryptor,to,&outlenUpdate,n,from,len, + randomAlg, NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_ENCRYPT,i); + goto err; + } + if ((i=B_EncryptFinal(rsaEncryptor,to + outlenUpdate,&outlen, + n-outlenUpdate,randomAlg,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PRIVATE_ENCRYPT,i); + goto err; + } + outlen += outlenUpdate; +err: + B_DestroyAlgorithmObject(&randomAlg); + B_DestroyAlgorithmObject(&rsaEncryptor); + /* memset(&RSAKey,0,sizeof(RSAKey)); */ + B_DestroyKeyObject(&RSAKey); + return(outlen); + } + +int +RSA_public_decrypt(len,from,to,rsa) +int len; +unsigned char *from,*to; +RSA *rsa; + { + int i,outlen= -1; + int n; + int outlenUpdate=0; + B_KEY_OBJ RSAKey=NULL; + B_ALGORITHM_OBJ rsaDecryptor=NULL; + B_ALGORITHM_METHOD *RSA_CHOOSER[] = { &AM_RSA_DECRYPT, NULL }; + + if (!BSAFE_Public_eay2bsafe(rsa,&RSAKey)) + goto err; + + if ((i=B_CreateAlgorithmObject(&rsaDecryptor)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + if ((i=B_SetAlgorithmInfo(rsaDecryptor, AI_PKCS_RSAPublic, NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + if ((i=B_DecryptInit(rsaDecryptor,RSAKey,RSA_CHOOSER,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + n=RSA_size(rsa); + if ((i=B_DecryptUpdate(rsaDecryptor,to,&outlenUpdate,n, + from,len,NULL,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + if ((i=B_DecryptFinal(rsaDecryptor,to + outlenUpdate,&outlen, + n-outlenUpdate,NULL, NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + outlen += outlenUpdate; +err: + /* memset(RSAKey,0,sizeof(RSAKey)); */ + if (rsaDecryptor) B_DestroyAlgorithmObject(&rsaDecryptor); + if (RSAKey) B_DestroyKeyObject(&RSAKey); + + return(outlen); + } + +int +RSA_public_encrypt(len,from,to,rsa) +int len; +unsigned char *from,*to; +RSA *rsa; + { + int outlen= -1; + int outlenUpdate=0; + unsigned char buf[16]; + int i,n; + B_KEY_OBJ RSAKey=NULL; + B_ALGORITHM_OBJ randomAlg=NULL; + B_ALGORITHM_OBJ rsaEncryptor=NULL; + B_ALGORITHM_METHOD *RSA_CHOOSER[] = { &AM_RSA_ENCRYPT, NULL }; + B_ALGORITHM_METHOD *RANDOM_CHOOSER[] = { &AM_MD5_RANDOM, NULL }; + + if (!BSAFE_Public_eay2bsafe(rsa,&RSAKey)) + goto err; + randomAlg=NULL; + if ((i=B_CreateAlgorithmObject(&randomAlg)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + if ((i=B_SetAlgorithmInfo(randomAlg,AI_MD5Random,NULL_PTR)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + if ((i=B_RandomInit(randomAlg,RANDOM_CHOOSER,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + + /* Throw in 256 bytes of random data */ + n=256; + while (n > 0) + { + RAND_bytes(buf,16); + if ((i=B_RandomUpdate(randomAlg,buf, + (unsigned int)((n>16)?16:n), NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_DECRYPT,i); + goto err; + } + n-=16; + } + + if ((i=B_CreateAlgorithmObject(&rsaEncryptor)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_ENCRYPT,i); + goto err; + } + if ((i=B_SetAlgorithmInfo(rsaEncryptor,AI_PKCS_RSAPublic,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_ENCRYPT,i); + goto err; + } + if ((i=B_EncryptInit(rsaEncryptor,RSAKey,RSA_CHOOSER,NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_ENCRYPT,i); + goto err; + } + n=RSA_size(rsa); + if ((i=B_EncryptUpdate(rsaEncryptor,to,&outlenUpdate,n,from,len, + randomAlg, NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_ENCRYPT,i); + goto err; + } + if ((i=B_EncryptFinal(rsaEncryptor,to + outlenUpdate,&outlen, + n-outlenUpdate, randomAlg, NULL)) != 0) + { + BSAFEerr(BSAFE_F_RSA_PUBLIC_ENCRYPT,i); + goto err; + } +err: + B_DestroyAlgorithmObject(&randomAlg); + B_DestroyAlgorithmObject(&rsaEncryptor); + /* memset(&RSAKey,0,sizeof(RSAKey)); */ + B_DestroyKeyObject(&RSAKey); + return(outlen); + } diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsafe.err SSLeay-0.6.3/bsafe/bsafe.err --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsafe.err Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/bsafe/bsafe.err Tue Jun 11 17:44:14 1996 @@ -0,0 +1,16 @@ +/* Error codes for the BSAFE functions. */ + +/* Function codes. */ +#define BSAFE_F_RSA_BN2BIN 100 +#define BSAFE_F_RSA_PRIVATE_DECRYPT 101 +#define BSAFE_F_RSA_PRIVATE_ENCRYPT 102 +#define BSAFE_F_RSA_PUBLIC_DECRYPT 103 +#define BSAFE_F_RSA_PUBLIC_ENCRYPT 104 +#define BSAFE_F_PUBLIC_BSAFE_TO_EAY 105 +#define BSAFE_F_PUBLIC_EAY_TO_BSAFE 106 +#define BSAFE_F_PRIVATE_BSAFE_TO_EAY 107 +#define BSAFE_F_PRIVATE_BSAFE_TO_EAY 108 + +/* Reason codes. */ + +#endif diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsafe_glue.h SSLeay-0.6.3/bsafe/bsafe_glue.h --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/bsafe_glue.h Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/bsafe/bsafe_glue.h Mon Jun 24 14:01:13 1996 @@ -0,0 +1,81 @@ +/* bsafe/bsafe_glue.h */ +/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au) + * All rights reserved. + * + * This file is part of an SSL implementation written + * by Eric Young (eay@mincom.oz.au). + * The implementation was written so as to conform with Netscapes SSL + * specification. This library and applications are + * FREE FOR COMMERCIAL AND NON-COMMERCIAL USE + * as long as the following conditions are aheared to. + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. If this code is used in a product, + * Eric Young should be given attribution as the author of the parts used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Eric Young (eay@mincom.oz.au) + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BSAFE_GLUE_H +#define HEADER_BSAFE_GLUE_H + +#include "aglobal.h" +#include "bsafe.h" + +#ifndef NOPROTO +int BSAFE_Public_eay2bsafe(RSA * from, B_KEY_OBJ * to); +int BSAFE_Public_bsafe2eay(B_KEY_OBJ from, RSA ** to); +int BSAFE_Private_eay2bsafe(RSA * from, B_KEY_OBJ * to); +int BSAFE_Private_bsafe2eay(B_KEY_OBJ from, RSA ** to); +#else +int BSAFE_Public_eay2bsafe(); +int BSAFE_Public_bsafe2eay(); +int BSAFE_Private_eay2bsafe(); +int BSAFE_Private_bsafe2eay(); +#endif + +/* Error codes for the BSAFE functions. */ + +/* Function codes. */ +#define BSAFE_F_RSA_BN2BIN 100 +#define BSAFE_F_RSA_PRIVATE_DECRYPT 101 +#define BSAFE_F_RSA_PRIVATE_ENCRYPT 102 +#define BSAFE_F_RSA_PUBLIC_DECRYPT 103 +#define BSAFE_F_RSA_PUBLIC_ENCRYPT 104 +#define BSAFE_F_PUBLIC_BSAFE_TO_EAY 105 +#define BSAFE_F_PUBLIC_EAY_TO_BSAFE 106 +#define BSAFE_F_PRIVATE_BSAFE_TO_EAY 107 +#define BSAFE_F_PRIVATE_EAY_TO_BSAFE 108 + +/* Reason codes. */ + +#endif diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/tstdlib.c SSLeay-0.6.3/bsafe/tstdlib.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/bsafe/tstdlib.c Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/bsafe/tstdlib.c Thu Aug 8 14:38:37 1996 @@ -0,0 +1,111 @@ +/* Copyright (C) RSA Data Security, Inc. created 1992. + + This file is used to demonstrate how to interface to an + RSA Data Security, Inc. licensed development product. + + You have a royalty-free right to use, modify, reproduce and + distribute this demonstration file (including any modified + version), provided that you agree that RSA Data Security, + Inc. has no warranty, implied or otherwise, or liability + for this demonstration file or any modified version. + */ + +#include +#include +#include +#include "aglobal.h" +#include "bsafe.h" + +/* If the standard C library comes with a memmove() that correctly + handles overlapping buffers, MEMMOVE_PRESENT should be defined as + 1, else 0. + The following defines MEMMOVE_PRESENT as 1 if it has not already been + defined as 0 with C compiler flags. + */ +#ifndef MEMMOVE_PRESENT +#define MEMMOVE_PRESENT 1 +#endif + +#ifndef WIN32 +#ifndef CALL_CONV +#define CALL_CONV +#endif +#endif + +void CALL_CONV T_memset (p, c, count) +POINTER p; +int c; +unsigned int count; +{ + if (count != 0) + memset (p, c, count); +} + +void CALL_CONV T_memcpy (d, s, count) +POINTER d, s; +unsigned int count; +{ + if (count != 0) + memcpy (d, s, count); +} + +void CALL_CONV T_memmove (d, s, count) +POINTER d, s; +unsigned int count; +{ +#if MEMMOVE_PRESENT + if (count != 0) + memmove (d, s, count); +#else + unsigned int i; + + if ((char *)d == (char *)s) + return; + else if ((char *)d > (char *)s) { + for (i = count; i > 0; i--) + ((char *)d)[i-1] = ((char *)s)[i-1]; + } + else { + for (i = 0; i < count; i++) + ((char *)d)[i] = ((char *)s)[i]; + } +#endif +} + +int CALL_CONV T_memcmp (s1, s2, count) +POINTER s1, s2; +unsigned int count; +{ + if (count == 0) + return (0); + else + return (memcmp (s1, s2, count)); +} + +POINTER CALL_CONV T_malloc (size) +unsigned int size; +{ + return ((POINTER)malloc (size == 0 ? 1 : size)); +} + +POINTER CALL_CONV T_realloc (p, size) +POINTER p; +unsigned int size; +{ + POINTER result; + + if (p == NULL_PTR) + return (T_malloc (size)); + + if ((result = (POINTER)realloc (p, size == 0 ? 1 : size)) == NULL_PTR) + free (p); + return (result); +} + +void CALL_CONV T_free (p) +POINTER p; +{ + if (p != NULL_PTR) + free (p); +} + diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/asn1/Makefile.ssl SSLeay-0.6.3/crypto/asn1/Makefile.ssl --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/asn1/Makefile.ssl Wed Aug 7 08:54:28 1996 +++ SSLeay-0.6.3/crypto/asn1/Makefile.ssl Thu Oct 24 10:03:25 1996 @@ -33,7 +33,7 @@ p7_i_s.c p7_signi.c p7_signd.c p7_recip.c p7_enc_c.c p7_evp.c \ p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \ f_int.c i2d_dh.c d2i_dh.c n_pkey.c \ - a_hdr.c x_pkey.c a_bool.c x_exten.c \ + a_hdr.c x_pkey.c a_bool.c x_exten.c x_privkey.c \ asn1_par.c asn1_lib.c $(ERRC).c LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \ a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \ @@ -47,7 +47,7 @@ p7_i_s.o p7_signi.o p7_signd.o p7_recip.o p7_enc_c.o p7_evp.o \ p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \ f_int.o i2d_dh.o d2i_dh.o n_pkey.o \ - a_hdr.o x_pkey.o a_bool.o x_exten.o \ + a_hdr.o x_pkey.o a_bool.o x_exten.o x_privkey.o \ asn1_par.o asn1_lib.o $(ERRC).o SRC= $(LIBSRC) diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/asn1/asn1.h SSLeay-0.6.3/crypto/asn1/asn1.h --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/asn1/asn1.h Sat Jul 20 06:44:08 1996 +++ SSLeay-0.6.3/crypto/asn1/asn1.h Thu Oct 24 10:03:25 1996 @@ -539,6 +539,8 @@ #define ASN1_F_X509_SIG_NEW 211 #define ASN1_F_X509_VAL_FREE 212 #define ASN1_F_X509_VAL_NEW 213 +#define ASN1_F_X509_PRIVKEY_NEW 214 +#define ASN1_F_D2I_X509_PRIVKEY 215 /* Reason codes. */ #define ASN1_R_BAD_CLASS 100 diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/asn1/x_privkey.c SSLeay-0.6.3/crypto/asn1/x_privkey.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/asn1/x_privkey.c Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/crypto/asn1/x_privkey.c Thu Aug 8 14:38:52 1996 @@ -0,0 +1,121 @@ +/* lib/asn1/x_privkey.c */ +/* Copyright (C) 1995 Eric Young (eay@mincom.oz.au) + * All rights reserved. + * + * This file is part of an SSL implementation written + * by Eric Young (eay@mincom.oz.au). + * The implementation was written so as to conform with Netscapes SSL + * specification. This library and applications are + * FREE FOR COMMERCIAL AND NON-COMMERCIAL USE + * as long as the following conditions are aheared to. + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. If this code is used in a product, + * Eric Young should be given attribution as the author of the parts used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Eric Young (eay@mincom.oz.au) + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include "cryptlib.h" +#include "asn1_mac.h" +#include "x509.h" +#include "objects.h" + +/* + * ASN1err(ASN1_F_D2I_X509_KEYU,ASN1_R_LENGTH_MISMATCH); + * ASN1err(ASN1_F_X509_KEY_NEW,ASN1_R_BAD_GET_OBJECT); + */ + + +X509_PRIVKEY *X509_PRIVKEY_new() + { + X509_PRIVKEY *ret=NULL; + + M_ASN1_New_Malloc(ret,X509_PRIVKEY); + ret->type=NID; + M_ASN1_New(ret->version,ASN1_INTEGER_new); + M_ASN1_New(ret->algor,X509_ALGOR_new); + M_ASN1_New(ret->privkey,ASN1_OCTET_STRING_new); + M_ASN1_New(ret->attributes,sk_new_null); + return(ret); + M_ASN1_New_Error(ASN1_F_X509_PRIVKEY_NEW); + } + +void X509_PRIVKEY_free(a) +X509_PRIVKEY *a; + { + if (a == NULL) return; + ASN1_INTEGER_free(a->version); + X509_ALGOR_free(a->algor); + ASN1_OCTET_STRING_free(a->privkey); + sk_pop_free(a->attributes,ASN1_BIT_STRING_free); + free(a); + } + +int i2d_X509_PRIVKEY(a,pp) +X509_PRIVKEY *a; +unsigned char **pp; + { + M_ASN1_I2D_vars(a); + + M_ASN1_I2D_len(a->version, i2d_ASN1_INTEGER); + M_ASN1_I2D_len(a->algor, i2d_X509_ALGOR); + M_ASN1_I2D_len(a->privkey, i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_len_IMP_set_opt(a->attributes, i2d_X509_ATTRIBUTE,0); + + M_ASN1_I2D_seq_total(); + + M_ASN1_I2D_put(a->version, i2d_ASN1_INTEGER); + M_ASN1_I2D_put(a->algor, i2d_X509_ALGOR); + M_ASN1_I2D_put(a->privkey, i2d_ASN1_OCTET_STRING); + M_ASN1_I2D_put_IMP_set_opt(a->attributes, i2d_X509_ATTRIBUTE,0); + + M_ASN1_I2D_finish(); + } + +X509_PRIVKEY *d2i_X509_PRIVKEY(a,pp,length) +X509_PRIVKEY **a; +unsigned char **pp; +long length; + { + M_ASN1_D2I_vars(a,X509_PRIVKEY *,X509_PRIVKEY_new); + + M_ASN1_D2I_Init(); + M_ASN1_D2I_start_sequence(); + M_ASN1_D2I_get(ret->version, d2i_ASN1_INTEGER); + M_ASN1_D2I_get(ret->algor, d2i_X509_ALGOR); + M_ASN1_D2I_get(ret->privkey, d2i_ASN1_OCTET_STRING); + M_ASN1_D2I_get_IMP_set_opt(ret->attributes, d2i_X509_ATTRIBUTE,0); + + M_ASN1_D2I_Finish(a,X509_PRIVKEY_free,ASN1_F_D2I_X509_PRIVKEY); + } diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/error/err.h SSLeay-0.6.3/crypto/error/err.h --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/error/err.h Tue Jul 16 23:45:49 1996 +++ SSLeay-0.6.3/crypto/error/err.h Thu Aug 8 14:39:26 1996 @@ -87,6 +87,7 @@ #define ERR_LIB_CONF 14 #define ERR_LIB_SSL 20 #define ERR_LIB_RSAREF 30 +#define ERR_LIB_BSAFE 31 #define SYSerr(f,r) ERR_put_error(ERR_LIB_SYS,f,r,ERR_file_name,__LINE__) #define BNerr(f,r) ERR_put_error(ERR_LIB_BN,f,r,ERR_file_name,__LINE__) @@ -103,6 +104,7 @@ #define CONFerr(f,r) ERR_put_error(ERR_LIB_CONF,f,r,ERR_file_name,__LINE__) #define SSLerr(f,r) ERR_put_error(ERR_LIB_SSL,f,r,ERR_file_name,__LINE__) #define RSAREFerr(f,r) ERR_put_error(ERR_LIB_RSAREF,f,r,ERR_file_name,__LINE__) +#define BSAFEerr(f,r) ERR_put_error(ERR_LIB_BSAFE,f,r,ERR_file_name,__LINE__) /* Borland C seems too stupid to be able to shift and do longs in * the pre-processor :-( */ @@ -133,6 +135,7 @@ #define ERR_R_ASN1_LIB ERR_LIB_ASN1 #define ERR_R_CONF_LIB ERR_LIB_CONF #define ERR_R_SSL_LIB ERR_LIB_SSL +#define ERR_R_BSAFE_LIB ERR_LIB_BSAFE /* fatal error */ #define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/rsa/rsa_enc.c SSLeay-0.6.3/crypto/rsa/rsa_enc.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/rsa/rsa_enc.c Tue Jul 16 23:45:58 1996 +++ SSLeay-0.6.3/crypto/rsa/rsa_enc.c Thu Aug 8 14:39:54 1996 @@ -45,8 +45,11 @@ * [including the GNU Public Licence.] */ -#ifndef RSAref - +#ifdef RSAref +#include "../../rsaref/rsaref.c" +#elif defined(BSAFE) +#include "../../bsafe/bsafe.c" +#else #include #include "cryptlib.h" #include "bn.h" @@ -424,7 +427,5 @@ return(ret); } -#else -#include "../../rsaref/rsaref.c" #endif diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/rsa/rsa_err.c SSLeay-0.6.3/crypto/rsa/rsa_err.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/rsa/rsa_err.c Sat Jul 20 06:41:16 1996 +++ SSLeay-0.6.3/crypto/rsa/rsa_err.c Thu Aug 8 14:39:55 1996 @@ -49,6 +49,12 @@ #include "err.h" #include "rsa.h" +#ifdef RSAref +#include "../../rsaref/rsa_err.c" +#elif defined(BSAFE) +#include "../../bsafe/bsaf_err.c" +#endif + /* BEGIN ERROR CODES */ static ERR_STRING_DATA RSA_str_functs[]= { @@ -93,5 +99,10 @@ init=0; ERR_load_strings(ERR_LIB_RSA,RSA_str_functs); ERR_load_strings(ERR_LIB_RSA,RSA_str_reasons); +#ifdef RSAref + ERR_load_RSAREF_strings(); +#elif defined(BSAFE) + ERR_load_BSAFE_strings(); +#endif } } diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/x509/x509.h SSLeay-0.6.3/crypto/x509/x509.h --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/crypto/x509/x509.h Sat Jul 20 07:18:57 1996 +++ SSLeay-0.6.3/crypto/x509/x509.h Thu Oct 24 10:03:01 1996 @@ -83,6 +83,15 @@ ASN1_BIT_STRING *public_key; } X509_PUBKEY; +typedef struct x509_privkey_st + { + int type; /* Encrypted type not implemented */ + ASN1_INTEGER *version; + X509_ALGOR *algor; + ASN1_OCTET_STRING *privkey; + STACK *attributes; + } X509_PRIVKEY; + typedef struct X509_sig_st { X509_ALGOR *algor; @@ -187,9 +196,24 @@ } value; } X509_ATTRIBUTE; +typedef struct x509_pkey_info + { + /* PrivateKeyInfo type */ + ASN1_INTEGER *version; + X509_ALGOR *pkey_algor; + ASN1_OCTET_STRING *pkey; + STACK /* X509_ATTRIBUTE */ *attrs; + } X509_PKEY_INFO; + +typedef struct x509_enc_pkey_info + { + /* EncryptedPrivateKeyInfo type */ + X509_ALGOR *enc_algor; + ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ + } X509_ENC_PKEY_INFO; + typedef struct private_key_st { - int version; /* The PKCS#8 data types */ X509_ALGOR *enc_algor; ASN1_OCTET_STRING *enc_pkey; /* encrypted pub key */ @@ -450,6 +474,12 @@ X509_PUBKEY * d2i_X509_PUBKEY(X509_PUBKEY **a,unsigned char **pp, long length); +X509_PRIVKEY * X509_PRIVKEY_new(void ); +void X509_PRIVKEY_free(X509_PRIVKEY *a); +int i2d_X509_PRIVKEY(X509_PRIVKEY *a,unsigned char **pp); +X509_PRIVKEY * d2i_X509_PRIVKEY(X509_PRIVKEY **a,unsigned char **pp, + long length); + X509_SIG * X509_SIG_new(void ); void X509_SIG_free(X509_SIG *a); int i2d_X509_SIG(X509_SIG *a,unsigned char **pp); @@ -613,6 +643,10 @@ void X509_PUBKEY_free(); int i2d_X509_PUBKEY(); X509_PUBKEY * d2i_X509_PUBKEY(); +X509_PRIVKEY * X509_PRIVKEY_new(); +void X509_PRIVKEY_free(); +int i2d_X509_PRIVKEY(); +X509_PRIVKEY * d2i_X509_PRIVKEY(); X509_SIG * X509_SIG_new(); void X509_SIG_free(); int i2d_X509_SIG(); @@ -641,6 +675,7 @@ void X509_NAME_free(); int i2d_X509_NAME(); X509_NAME * d2i_X509_NAME(); +void X509_GENERAL_NAME_free_contents(); X509_CINF * X509_CINF_new(); void X509_CINF_free(); int i2d_X509_CINF(); diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/test/bsafetest.c SSLeay-0.6.3/test/bsafetest.c --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/test/bsafetest.c Wed Dec 31 16:00:00 1969 +++ SSLeay-0.6.3/test/bsafetest.c Mon Aug 12 16:36:09 1996 @@ -0,0 +1,312 @@ +/* Copyright (C) RSA Data Security, Inc. created 1993. + + This file is used to demonstrate how to interface to an + RSA Data Security, Inc. licensed development product. + + You have a royalty-free right to use, modify, reproduce and + distribute this demonstration file (including any modified + version), provided that you agree that RSA Data Security, + Inc. has no warranty, implied or otherwise, or liability + for this demonstration file or any modified version. + */ + +#include +#include +#include "aglobal.h" +#include "bsafe.h" + +/* SSLeay includes */ +#include "bn.h" +#include "rsa.h" +#include "x509.h" + +/* This chooser selects the standard C implementations of the algorithm + methods. + */ +B_ALGORITHM_METHOD *DEMO_ALGORITHM_CHOOSER[] = { + &AM_DESX_CBC_DECRYPT, + &AM_DESX_CBC_ENCRYPT, + &AM_DES_CBC_DECRYPT, + &AM_DES_CBC_ENCRYPT, + &AM_DES_EDE3_CBC_DECRYPT, + &AM_DES_EDE3_CBC_ENCRYPT, + &AM_DH_KEY_AGREE, + &AM_DH_PARAM_GEN, + &AM_MD2, + &AM_MD2_RANDOM, + &AM_MD5, + &AM_MD5_RANDOM, + &AM_MD, + &AM_MAC, + &AM_SHA, + &AM_RC2_CBC_DECRYPT, + &AM_RC2_CBC_ENCRYPT, + &AM_RC5_CBC_DECRYPT, + &AM_RC5_CBC_ENCRYPT, + &AM_RC4_DECRYPT, + &AM_RC4_ENCRYPT, + &AM_RC4_WITH_MAC_DECRYPT, + &AM_RC4_WITH_MAC_ENCRYPT, + &AM_RSA_CRT_DECRYPT, + &AM_RSA_CRT_ENCRYPT, + &AM_RSA_DECRYPT, + &AM_RSA_ENCRYPT, + &AM_RSA_KEY_GEN, + &AM_DSA_PARAM_GEN, + &AM_DSA_KEY_GEN, + &AM_DSA_SIGN, + &AM_DSA_VERIFY, + (B_ALGORITHM_METHOD *)NULL_PTR +}; + +/* the public key encryption exponent Fermat 4 (F4) = 65537 */ +unsigned char EXPONENT_F4[3] = {0x1, 0x0, 0x1}; + +static unsigned char PUBLIC_KEY3_DATA[1024]; +static unsigned int PUBLIC_KEY3_LEN = 0; +static unsigned char PRIVATE_KEY3_DATA[2048]; +static unsigned int PRIVATE_KEY3_LEN = 0; + +/* define parameters for password-based encryption */ +#define PBE_ITERATION_COUNT 1000 + +/* define size calculation macros for RSA key and DH parameter generation */ + +#define MAX_OBJECT_ID_LEN 11 +#define MAX_PBE_PARAMETER_LEN (2 + MAX_OBJECT_ID_LEN + 18) +#define MAX_RSA_PARAMETER_LEN 8 + +#define MAX_RSA_ALGORITHM_ID_LEN \ + (2 + MAX_OBJECT_ID_LEN + MAX_RSA_PARAMETER_LEN) + +#define MAX_PASSWORD_PROTECT_DELTA 8 +#define PUB_KEY_BYTES(modBits) (23 + MAX_RSA_ALGORITHM_ID_LEN + (modBits / 8)) + +#define PP_PRIV_KEY_BYTES(modBits) \ + (59 + MAX_RSA_ALGORITHM_ID_LEN + 2 * (modBits / 8) \ + + 5 * ((modBits + 1) / 16) + MAX_PASSWORD_PROTECT_DELTA) + +#define DH_PARAMS_BYTES(pBits) \ + (3 + MAX_OBJECT_ID_LEN + 13 + 2 * ((pBits / 8) + 1)) + +/* define maximum output buffer size for Diffie-Hellman computation, + RSA signatures and RSA Envelopes + */ + +#define MAX_DH_PRIME_BITS 2048 +#define MAX_DH_OUTPUT_BYTES (MAX_DH_PRIME_BITS / 8 + 1) +#define MAX_RSA_MODULUS 2048 +#define MAX_RSA_OUTPUT_BYTES (MAX_RSA_MODULUS / 8 + 1) + + +int BSL_MakeRSAKeyPairFromSeed + (publicKey, publicKeyLen, ppPrivateKey, ppPrivateKeyLen, + pbeParams, pbeParamsLen, keySizeBits, seed, seedLen, password, passwordLen) +unsigned char *publicKey; +unsigned int *publicKeyLen; +unsigned char *ppPrivateKey; +unsigned int *ppPrivateKeyLen; +unsigned char *pbeParams; +unsigned int *pbeParamsLen; +unsigned int keySizeBits; +unsigned char *seed; +unsigned int seedLen; +unsigned char *password; +unsigned int passwordLen; +{ + A_RSA_KEY_GEN_PARAMS keyGenParams; + B_ALGORITHM_OBJ generateAlgorithmObj = NULL_PTR; + B_ALGORITHM_OBJ pbEncryptionAlgorithmObj = NULL_PTR; + B_ALGORITHM_OBJ randomAlgorithmObj = NULL_PTR; + B_ALGORITHM_OBJ saltDigestAlgorithmObj = NULL_PTR; + B_KEY_OBJ passwordKeyObj = NULL_PTR; + B_KEY_OBJ privateKeyObj = NULL_PTR; + B_KEY_OBJ publicKeyObj = NULL_PTR; + B_PBE_PARAMS pbeParamsStruct; + ITEM passwordItem, *keyItemPtr, *pbeBERItemPtr; + int status; + unsigned char pbeSaltBuf[16]; + unsigned int digestLen, outputLen; + RSA *ssleayPublicKey=NULL; + RSA *ssleayPrivateKey=NULL; + B_KEY_OBJ bsafePublicKey=NULL; + B_KEY_OBJ bsafePrivateKey=NULL; + + unsigned char toPrivateEncrypt[32] = { + 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, + 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; + unsigned char publicEncrypted[64] = {0}; + unsigned char publicDecrypted[64] = {0}; + + unsigned char toPublicEncrypt[32] = { + 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, + 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32}; + unsigned char privateEncrypted[64] = {0}; + unsigned char privateDecrypted[64] = {0}; + + extern int BSAFE_Public_eay2bsafe(RSA * from, B_KEY_OBJ * to); + extern int BSAFE_Public_bsafe2eay(B_KEY_OBJ from, RSA ** to); + extern int BSAFE_Private_eay2bsafe(RSA * from, B_KEY_OBJ * to); + extern int BSAFE_Private_bsafe2eay(B_KEY_OBJ from, RSA ** to); + + /* do {} while(0); provides convenient way to ensure cleanup upon error */ + do { + + /* create random algorithm objects and set algorithm info */ + status = B_CreateAlgorithmObject (&randomAlgorithmObj); + if (status != 0) + break; + + status = B_SetAlgorithmInfo (randomAlgorithmObj, AI_MD5Random, NULL_PTR); + if (status != 0) + break; + /****************************************************************** + NOTE: The choice of MD5 for hashing random numbers is arbitrary. + AI_MD5Random may also be used. See Internet RFC1319 and RFC1321. + ******************************************************************/ + + /* call random init, update with supplied seed bytes */ + status = B_RandomInit + (randomAlgorithmObj, DEMO_ALGORITHM_CHOOSER, + (A_SURRENDER_CTX *)NULL_PTR); + if (status != 0) + break; + + status = B_RandomUpdate + (randomAlgorithmObj, seed, seedLen, (A_SURRENDER_CTX *)NULL_PTR); + if (status != 0) + break; + + /* create generate algorithm object */ + status = B_CreateAlgorithmObject (&generateAlgorithmObj); + if (status != 0) + break; + + /* set up key generation parameters and set algorithm object */ + keyGenParams.modulusBits = keySizeBits; + keyGenParams.publicExponent.data = EXPONENT_F4; + keyGenParams.publicExponent.len = sizeof (EXPONENT_F4); + status = B_SetAlgorithmInfo + (generateAlgorithmObj, AI_RSAKeyGen, (POINTER)&keyGenParams); + if (status != 0) + break; + /****************************************************************** + NOTE: The choice of F4 (65537) for a public exponent is arbitrary. + The value 3 or other value may also be used. See PKCS #1. + ******************************************************************/ + + /* generate init */ + status = B_GenerateInit + (generateAlgorithmObj, DEMO_ALGORITHM_CHOOSER, + (A_SURRENDER_CTX *)NULL_PTR); + if (status != 0) + break; + + /* create private and public key objects */ + status = B_CreateKeyObject (&privateKeyObj); + if (status != 0) + break; + + status = B_CreateKeyObject (&publicKeyObj); + if (status != 0) + break; + + /* generate keys and store in key objects (may take a few moments) */ + printf("Creating key pair...\n"); fflush(stdout); + status = B_GenerateKeypair + (generateAlgorithmObj, publicKeyObj, privateKeyObj, + randomAlgorithmObj, (A_SURRENDER_CTX *)NULL_PTR); + if (status != 0) + break; + + printf("BSAFE to SSLeay public key..."); fflush(stdout); + if (! BSAFE_Public_bsafe2eay(publicKeyObj, &ssleayPublicKey)) { + printf(" Failed.\n"); fflush(stdout); + break; + } else { + printf(" OK.\n"); fflush(stdout); + } + printf("SSLeay to BSAFE public key..."); fflush(stdout); + if (! BSAFE_Public_eay2bsafe(ssleayPublicKey, &bsafePublicKey)) { + printf(" Failed.\n"); fflush(stdout); + break; + } else { + printf(" OK.\n"); fflush(stdout); + } + + printf("BSAFE to SSLeay private key..."); fflush(stdout); + if (! BSAFE_Private_bsafe2eay(privateKeyObj, &ssleayPrivateKey)) { + printf(" Failed.\n"); fflush(stdout); + break; + } else { + printf(" OK.\n"); fflush(stdout); + } + + printf("SSLeay to BSAFE private key..."); fflush(stdout); + if (! BSAFE_Private_eay2bsafe(ssleayPrivateKey, &bsafePrivateKey)) { + printf(" Failed.\n"); fflush(stdout); + break; + } else { + printf(" OK.\n"); fflush(stdout); + } + + printf("RSA Private Encrypt..."); fflush(stdout); + if (RSA_private_encrypt(sizeof(toPrivateEncrypt), toPrivateEncrypt, + privateEncrypted, ssleayPrivateKey) == -1) { + printf(" Failed.\n"); fflush(stdout); + } else { + printf(" OK.\n"); fflush(stdout); + } + + printf("RSA Public Decrypt..."); fflush(stdout); + if (RSA_public_decrypt(sizeof(privateEncrypted), privateEncrypted, + privateDecrypted, ssleayPublicKey) == -1) { + printf(" Failed.\n"); fflush(stdout); + } else { + printf(" OK.\n"); fflush(stdout); + } + + printf("RSA Public Encrypt..."); fflush(stdout); + if (RSA_public_encrypt(sizeof(toPublicEncrypt), toPublicEncrypt, + publicEncrypted, ssleayPublicKey) == -1) { + printf(" Failed.\n"); fflush(stdout); + } else { + printf(" OK.\n"); fflush(stdout); + } + printf("RSA Private Decrypt..."); fflush(stdout); + if (RSA_private_decrypt(sizeof(publicEncrypted), publicEncrypted, + publicDecrypted, ssleayPrivateKey) == -1) { + printf(" Failed.\n"); fflush(stdout); + } else { + printf(" OK.\n"); fflush(stdout); + } + + } while (0); + + /* cleanup objects */ + B_DestroyAlgorithmObject (&generateAlgorithmObj); + B_DestroyAlgorithmObject (&pbEncryptionAlgorithmObj); + B_DestroyAlgorithmObject (&randomAlgorithmObj); + B_DestroyAlgorithmObject (&saltDigestAlgorithmObj); + B_DestroyKeyObject (&passwordKeyObj); + B_DestroyKeyObject (&privateKeyObj); + B_DestroyKeyObject (&publicKeyObj); + + return (status); +} + +main() +{ + int status; + unsigned int modulusBits = 512; + unsigned char *seed = "adfabadfafeafdkj"; + + if ((status = BSL_MakeRSAKeyPairFromSeed + (PUBLIC_KEY3_DATA, &PUBLIC_KEY3_LEN, PRIVATE_KEY3_DATA, + &PRIVATE_KEY3_LEN, (unsigned char *)NULL_PTR, 0, + (unsigned int)modulusBits, (unsigned char *)seed, + (unsigned int)strlen (seed), (unsigned char *)NULL_PTR, 0)) != 0) { + fprintf (stderr, "Error generating keys: %d\n", status); + exit(1); + } +} diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/util/mk1mf.pl SSLeay-0.6.3/util/mk1mf.pl --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/util/mk1mf.pl Tue Jul 30 17:17:57 1996 +++ SSLeay-0.6.3/util/mk1mf.pl Wed Nov 20 14:24:02 1996 @@ -11,14 +11,16 @@ $infile="MINFO"; %ops=( - "VC-NT", "Microsoft Visual C++ 4.[01] - Windows NT 3.51", - "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", - "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+", - "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS", - "BC-NT", "Borland C++ 4.5 - Windows NT - PROBABLY NOT WORKING", - "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING", - "FreeBSD","FreeBSD distribution", - "default","cc under unix", + "VC-NT", "Microsoft Visual C++ 4.[01] - Windows NT 3.51", + "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", + "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+", + "VC-MSDOS", "Microsoft Visual C++ 1.52 - MSDOS", + "BC-NT", "Borland C++ 4.5 - Windows NT - PROBABLY NOT WORKING", + "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING", + "FreeBSD", "FreeBSD distribution", + "Linux", "Linux distributions", + "Solaris", "Solaris distributions", + "default", "cc under unix", ); $type=""; @@ -34,9 +36,11 @@ elsif (/^no-md5$/) { $no_md5=1; } elsif (/^no-sock$/) { $no_sock=1; } elsif (/^no-asm$/) { $no_asm=1; } + elsif (/^no-bsafe$/) { $no_bsafe=1; } elsif (/^rsaref$/) { $rsaref=1; } elsif (/^gcc$/) { $gcc=1; } elsif (/^debug$/) { $debug=1; } + elsif (/^ansi$/) { $ansi=1; } elsif (/^shlib$/) { $shlib=1; } elsif (/^dll$/) { $shlib=1; } elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } @@ -68,13 +72,26 @@ } $cc=(defined($VARS{'CC'}))?$VARS{'CC'}:'cc'; -$src_dir=(defined($VARS{'SRC'}))?$VARS{'SRC'}:'.'; -$out_dir=(defined($VARS{'OUT'}))?$VARS{'OUT'}:'out'; -$tmp_dir=(defined($VARS{'TMP'}))?$VARS{'TMP'}:'tmp'; +if (defined($VARS{'SRC'})) { + $src_dir = $VARS{'SRC'}; +} else { + $src_dir = '.'; +} +if (defined($VARS{'OUT'})) { + $out_dir = $VARS{'OUT'}; +} else { + $out_dir = ($debug) ? 'debug-out' : 'release-out'; +} +if (defined($VARS{'TMP'})) { + $tmp_dir = $VARS{'TMP'}; +} else { + $tmp_dir = ($debug) ? 'debug-tmp' : 'release-tmp'; +} $ssl="ssl"; $crypto="crypto"; $RSAglue="RSAglue"; +$BSAFEglue="BSAFEglue"; $ranlib="echo ranlib"; push(@INC,"util/pl","pl"); @@ -116,13 +133,23 @@ $msdos=1; $w16=1; $shlib=0; $qw=1; require 'BC-16.pl'; } +elsif ($type eq "Linux") + { + require 'unix.pl'; + $cflags.=' -DL_ENDIAN'; + } +elsif ($type eq "Solaris") + { + require 'unix.pl'; + $ex_libs.= ' -lsocket -lnsl'; + } elsif ($type eq "FreeBSD") { $no_md2=1; $no_md5=1; $no_des=1; require 'unix.pl'; - $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; - $ex_libs="-ldes -lmd"; + $cflags.=' -DTERMIO'; + $ex_libs.=' -ldes -lmd'; } else { @@ -132,11 +159,11 @@ if ($gcc) { $cc="gcc"; - $cflags='-O3 -fomit-frame-pointer'; } $cflags.=' -DTERMIO'; } +$cflags.=' -DBSAFE $(I_BSAFE)' if (! $no_bsafe); $cflags.=" -DNO_IDEA" if $no_idea; $cflags.=" -DNO_RC2" if $no_rc2; $cflags.=" -DNO_RC4" if $no_rc4; @@ -145,6 +173,7 @@ $cflags.=" -DNO_DES" if $no_des; $cflags.=" -DNO_SOCK" if $no_sock; $cflags.=" -DRSAref" if $rsaref ne ""; +$ex_libs.=' $(L_BSAFE) $(O_BSAFEGLUE)' if (! $no_bsafe); if ($unix) { $cflags="$c_flags" if ($c_flags ne ""); } @@ -154,7 +183,7 @@ if ($ranlib ne "") { - $ranlib="RANLIB=\$(SRC_D)$o$ranlib"; + $ranlib="\$(SRC_D)$o$ranlib"; } if ($msdos) @@ -220,12 +249,16 @@ SSL=$ssl CRYPTO=$crypto RSAGLUE=$RSAglue +BSAFEGLUE=$BSAFEglue O_SSL= \$(LIB_D)$o$plib\$(SSL)$shlibp O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp O_RSAGLUE= \$(LIB_D)$o$plib\$(RSAGLUE)$libp +O_BSAFEGLUE=\$(LIB_D)$o$plib\$(BSAFEGLUE)$libp L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp +L_BSAFE= ..${o}bsafe${o}lib${o}${plib}bsafe${libp} +I_BSAFE= -I../bsafe/include L_LIBS= \$(L_SSL) \$(L_CRYPTO) #L_LIBS= \$(O_SSL) \$(O_RSAGLUE) -lrsaref \$(O_CRYPTO) @@ -251,7 +284,7 @@ INC=-DFLAT_INC -I\$(INC_D) -I\$(INCL_D) APP_CFLAGS=\$(INC) \$(CFLAG) \$(APP_CFLAG) LIB_CFLAGS=\$(INC) \$(CFLAG) \$(LIB_CFLAG) -LIBS_DEP=\$(O_CRYPTO) \$(O_RSAGLUE) \$(O_SSL) +LIBS_DEP=\$(O_CRYPTO) \$(O_RSAGLUE) \$(O_SSL) \$(O_BSAFEGLUE) ############################################# EOF @@ -390,6 +423,7 @@ $rules.=&do_lib_rule("\$(O_SSL)","ssl",$shlib); $rules.=&do_lib_rule("\$(O_RSAGLUE)","rsaglue",0); +$rules.=&do_lib_rule("\$(O_BSAFEGLUE)","bsafeglue",0); $rules.=&do_lib_rule("\$(O_CRYPTO)","crypto",$shlib); $rules.=&do_link_rule("\$(BIN_D)$o\$(E_EXE)$exep","\$(E_OBJ)","\$(LIBS_DEP)","\$(L_LIBS) \$(EX_LIBS)"); diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/util/pl/VC-32.pl SSLeay-0.6.3/util/pl/VC-32.pl --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/util/pl/VC-32.pl Tue Jul 9 16:47:31 1996 +++ SSLeay-0.6.3/util/pl/VC-32.pl Mon Nov 11 14:48:58 1996 @@ -45,7 +46,7 @@ $asm='ml /Cp /coff /c /Cx'; $afile='/Fo'; -if ($noasm) +if ($no_asm) { $bn_mulw_obj=''; $bn_mulw_src=''; @@ -62,6 +63,11 @@ $cflags.=" /MD"; $cflags.="d" if ($debug); } +else + { + $cflags.=" /MT"; + $cflags.="d" if ($debug); + } sub do_lib_rule { diff -u -r --new-file /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/util/pl/unix.pl SSLeay-0.6.3/util/pl/unix.pl --- /hosts/atlantic/home/chaffee/downloads/SSLeay-0.6.3.orig/util/pl/unix.pl Tue Jul 9 16:47:31 1996 +++ SSLeay-0.6.3/util/pl/unix.pl Mon Nov 11 14:48:58 1996 @@ -9,9 +9,21 @@ # C compiler stuff $cc="cc"; -$cflags="-O"; $obj='.o'; $ofile='-o '; +$cflags = '-DTERMIO'; +if ($ansi) { + $cflags .= ' -D_ANSI_SOURCE'; +} +if ($debug) { + $cflags.=' -g -D_DEBUG'; +} else { + if ($gcc) { + $cflags.=' -O2 -fomit-frame-pointer'; + } else { + $cflags.=' -O'; + } +} # EXE linking stuff $link='${CC}';