Compare commits
	
		
			2 Commits
		
	
	
		
			OpenSSL_1_
			...
			OpenSSL_0_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					978ac53398 | ||
| 
						 | 
					9beaae61ec | 
							
								
								
									
										90
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										90
									
								
								CHANGES
									
									
									
									
									
								
							@@ -2,96 +2,10 @@
 | 
			
		||||
 OpenSSL CHANGES
 | 
			
		||||
 _______________
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.6 and 0.9.7  [xx XXX 2000]
 | 
			
		||||
 | 
			
		||||
  *) Fix for bug in DirectoryString mask setting. Add support for
 | 
			
		||||
     X509_NAME_print_ex() in 'req' and X509_print_ex() function
 | 
			
		||||
     to allow certificate printing to more controllable, additional
 | 
			
		||||
     'certopt' option to 'x509' to allow new printing options to be
 | 
			
		||||
     set.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Clean old EAY MD5 hack from e_os.h.
 | 
			
		||||
     [Richard Levitte]
 | 
			
		||||
 | 
			
		||||
  *) Fix SSL_CTX_set_read_ahead macro to actually use its argument.
 | 
			
		||||
 | 
			
		||||
     Copy SSL_CTX's read_ahead flag to SSL object directly in SSL_new
 | 
			
		||||
     and not in SSL_clear because the latter is also used by the
 | 
			
		||||
     accept/connect functions; previously, the settings made by
 | 
			
		||||
     SSL_set_read_ahead would be lost during the handshake.
 | 
			
		||||
     [Bodo Moeller; problems reported by Anders Gertz <gertz@epact.se>]     
 | 
			
		||||
 | 
			
		||||
  *) Correct util/mkdef.pl to be selective about disabled algorithms.
 | 
			
		||||
     Previously, it would create entries for disableed algorithms no
 | 
			
		||||
     matter what.
 | 
			
		||||
     [Richard Levitte]
 | 
			
		||||
 | 
			
		||||
 Changes between 0.9.5a and 0.9.6  [24 Sep 2000]
 | 
			
		||||
 | 
			
		||||
  *) In ssl23_get_client_hello, generate an error message when faced
 | 
			
		||||
     with an initial SSL 3.0/TLS record that is too small to contain the
 | 
			
		||||
     first two bytes of the ClientHello message, i.e. client_version.
 | 
			
		||||
     (Note that this is a pathologic case that probably has never happened
 | 
			
		||||
     in real life.)  The previous approach was to use the version number
 | 
			
		||||
     from the record header as a substitute; but our protocol choice
 | 
			
		||||
     should not depend on that one because it is not authenticated
 | 
			
		||||
     by the Finished messages.
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) More robust randomness gathering functions for Windows.
 | 
			
		||||
     [Jeffrey Altman <jaltman@columbia.edu>]
 | 
			
		||||
 | 
			
		||||
  *) For compatibility reasons if the flag X509_V_FLAG_ISSUER_CHECK is
 | 
			
		||||
     not set then we don't setup the error code for issuer check errors
 | 
			
		||||
     to avoid possibly overwriting other errors which the callback does
 | 
			
		||||
     handle. If an application does set the flag then we assume it knows
 | 
			
		||||
     what it is doing and can handle the new informational codes
 | 
			
		||||
     appropriately.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Fix for a nasty bug in ASN1_TYPE handling. ASN1_TYPE is used for
 | 
			
		||||
     a general "ANY" type, as such it should be able to decode anything
 | 
			
		||||
     including tagged types. However it didn't check the class so it would
 | 
			
		||||
     wrongly interpret tagged types in the same way as their universal
 | 
			
		||||
     counterpart and unknown types were just rejected. Changed so that the
 | 
			
		||||
     tagged and unknown types are handled in the same way as a SEQUENCE:
 | 
			
		||||
     that is the encoding is stored intact. There is also a new type
 | 
			
		||||
     "V_ASN1_OTHER" which is used when the class is not universal, in this
 | 
			
		||||
     case we have no idea what the actual type is so we just lump them all
 | 
			
		||||
     together.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) On VMS, stdout may very well lead to a file that is written to
 | 
			
		||||
     in a record-oriented fashion.  That means that every write() will
 | 
			
		||||
     write a separate record, which will be read separately by the
 | 
			
		||||
     programs trying to read from it.  This can be very confusing.
 | 
			
		||||
 | 
			
		||||
     The solution is to put a BIO filter in the way that will buffer
 | 
			
		||||
     text until a linefeed is reached, and then write everything a
 | 
			
		||||
     line at a time, so every record written will be an actual line,
 | 
			
		||||
     not chunks of lines and not (usually doesn't happen, but I've
 | 
			
		||||
     seen it once) several lines in one record.  BIO_f_linebuffer() is
 | 
			
		||||
     the answer.
 | 
			
		||||
 | 
			
		||||
     Currently, it's a VMS-only method, because that's where it has
 | 
			
		||||
     been tested well enough.
 | 
			
		||||
     [Richard Levitte]
 | 
			
		||||
 | 
			
		||||
  *) Remove 'optimized' squaring variant in BN_mod_mul_montgomery,
 | 
			
		||||
     it can return incorrect results.
 | 
			
		||||
     (Note: The buggy variant was not enabled in OpenSSL 0.9.5a,
 | 
			
		||||
     but it was in 0.9.6-beta[12].)
 | 
			
		||||
     [Bodo Moeller]
 | 
			
		||||
 | 
			
		||||
  *) Disable the check for content being present when verifying detached
 | 
			
		||||
     signatures in pk7_smime.c. Some versions of Netscape (wrongly)
 | 
			
		||||
     include zero length content when signing messages.
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 | 
			
		||||
 | 
			
		||||
  *) New BIO_shutdown_wr macro, which invokes the BIO_C_SHUTDOWN_WR
 | 
			
		||||
     BIO_ctrl (for BIO pairs).
 | 
			
		||||
     [Bodo M<>ller]
 | 
			
		||||
 | 
			
		||||
  *) Add DSO method for VMS.
 | 
			
		||||
     [Richard Levitte]
 | 
			
		||||
@@ -325,7 +239,7 @@
 | 
			
		||||
     [Steve Henson]
 | 
			
		||||
 | 
			
		||||
  *) Changes needed for Tandem NSK.
 | 
			
		||||
     [Scott Uroff <scott@xypro.com>]
 | 
			
		||||
     [Scott Uroff scott@xypro.com]
 | 
			
		||||
 | 
			
		||||
  *) Fix SSL 2.0 rollback checking: Due to an off-by-one error in
 | 
			
		||||
     RSA_padding_check_SSLv23(), special padding was never detected
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								Configure
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								Configure
									
									
									
									
									
								
							@@ -216,16 +216,16 @@ my %table=(
 | 
			
		||||
# Since there is mention of this in shlib/hpux10-cc.sh
 | 
			
		||||
"hpux-parisc-cc-o4","cc:-Ae +O4 +ESlit -z -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY:::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl",
 | 
			
		||||
"hpux-parisc-gcc","gcc:-O3 -DB_ENDIAN -DBN_DIV2W:::-ldld:BN_LLONG DES_PTR DES_UNROLL DES_RISC1::::::::::dl",
 | 
			
		||||
"hpux64-parisc-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dlfcn",
 | 
			
		||||
"hpux64-parisc-cc","cc:-Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldld:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl",
 | 
			
		||||
 | 
			
		||||
# More attempts at unified 10.X and 11.X targets for HP C compiler.
 | 
			
		||||
#
 | 
			
		||||
# Chris Ruemmler <ruemmler@cup.hp.com>
 | 
			
		||||
# Kevin Steves <ks@hp.se>
 | 
			
		||||
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT:-ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl",
 | 
			
		||||
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldld:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2.o:::::::::dl",
 | 
			
		||||
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dlfcn",
 | 
			
		||||
"hpux-parisc1_1-cc","cc:+DA1.1 +DS1.1 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldld:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl",
 | 
			
		||||
"hpux-parisc-cc","cc:+O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY::-D_REENTRANT:-ldl:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl",
 | 
			
		||||
"hpux-parisc2-cc","cc:+DA2.0 +DS2.0 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldl:SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2.o:::::::::dl",
 | 
			
		||||
"hpux64-parisc2-cc","cc:+DD64 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldl:SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT:asm/pa-risc2W.o:::::::::dl",
 | 
			
		||||
"hpux-parisc1_1-cc","cc:+DA1.1 +DS1.1 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY::-D_REENTRANT:-ldl:MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT::::::::::dl",
 | 
			
		||||
 | 
			
		||||
# HPUX 9.X config.
 | 
			
		||||
# Don't use the bundled cc.  It is broken.  Use HP ANSI C if possible, or
 | 
			
		||||
@@ -256,16 +256,13 @@ my %table=(
 | 
			
		||||
#"hpux11-64bit-cc","cc:+DA2.0W -g -D_HPUX_SOURCE -Aa -Ae +ESlit::-D_REENTRANT::SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT :::",
 | 
			
		||||
# Use unified settings above instead.
 | 
			
		||||
 | 
			
		||||
#### HP MPE/iX http://jazz.external.hp.com/src/openssl/
 | 
			
		||||
"MPE/iX-gcc", "gcc:-D_ENDIAN -DBN_DIV2W -O3 -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB::(unknown):-L/SYSLOG/PUB -lsyslog -lsocket -lcurses:BN_LLONG DES_PTR DES_UNROLL DES_RISC1:::",
 | 
			
		||||
 | 
			
		||||
# Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
 | 
			
		||||
# the new compiler
 | 
			
		||||
# For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
 | 
			
		||||
"alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:asm/alpha.o:::::::::dlfcn:true64-shared",
 | 
			
		||||
"alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn:true64-shared",
 | 
			
		||||
"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn:true64-shared",
 | 
			
		||||
"FreeBSD-alpha","gcc:-DTERMIOS -O -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2:::",
 | 
			
		||||
"FreeBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2:::",
 | 
			
		||||
 | 
			
		||||
#### Alpha Linux with GNU C and Compaq C setups
 | 
			
		||||
# Special notes:
 | 
			
		||||
@@ -280,8 +277,8 @@ my %table=(
 | 
			
		||||
#
 | 
			
		||||
#					<appro@fy.chalmers.se>
 | 
			
		||||
#
 | 
			
		||||
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o:dlfcn:linux-shared:-fPIC",
 | 
			
		||||
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT:-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o:dlfcn:linux-shared:-fPIC",
 | 
			
		||||
"linux-alpha-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
 | 
			
		||||
"linux-alpha+bwx-gcc","gcc:-O3 -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:asm/alpha.o::",
 | 
			
		||||
"linux-alpha-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
 | 
			
		||||
"linux-alpha+bwx-ccc","ccc:-fast -readonly_strings -DL_ENDIAN -DTERMIO::-D_REENTRANT::SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL:asm/alpha.o::",
 | 
			
		||||
 | 
			
		||||
@@ -719,10 +716,6 @@ if ($shared_cflag ne "")
 | 
			
		||||
		$shared_mark2 = ".shlib.";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
else
 | 
			
		||||
	{
 | 
			
		||||
	$no_shared = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#my ($bn1)=split(/\s+/,$bn_obj);
 | 
			
		||||
#$bn1 = "" unless defined $bn1;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								FAQ
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								FAQ
									
									
									
									
									
								
							@@ -32,7 +32,7 @@ OpenSSL  -  Frequently Asked Questions
 | 
			
		||||
* Which is the current version of OpenSSL?
 | 
			
		||||
 | 
			
		||||
The current version is available from <URL: http://www.openssl.org>.
 | 
			
		||||
OpenSSL 0.9.6 was released on September 24th, 2000.
 | 
			
		||||
OpenSSL 0.9.5a was released on April 1st, 2000.
 | 
			
		||||
 | 
			
		||||
In addition to the current stable release, you can also access daily
 | 
			
		||||
snapshots of the OpenSSL development version at <URL:
 | 
			
		||||
@@ -135,7 +135,7 @@ installing the SUNski package from Sun patch 105710-01 (Sparc) which
 | 
			
		||||
adds a /dev/random device and make sure it gets used, usually through
 | 
			
		||||
$RANDFILE.  There are probably similar patches for the other Solaris
 | 
			
		||||
versions.  However, be warned that /dev/random is usually a blocking
 | 
			
		||||
device, which may have some effects on OpenSSL.
 | 
			
		||||
device, which may have som effects on OpenSSL.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
* Why does the linker complain about undefined symbols?
 | 
			
		||||
@@ -194,7 +194,7 @@ unsigned char *buf, *p;
 | 
			
		||||
int len;
 | 
			
		||||
 | 
			
		||||
len = i2d_PKCS7(p7, NULL);
 | 
			
		||||
buf = OPENSSL_malloc(len); /* or Malloc, error checking omitted */
 | 
			
		||||
buf = OPENSSL_Malloc(len); /* or Malloc, error checking omitted */
 | 
			
		||||
p = buf;
 | 
			
		||||
i2d_PKCS7(p7, &p);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -108,8 +108,8 @@
 | 
			
		||||
 | 
			
		||||
 * Compiler installation:
 | 
			
		||||
 | 
			
		||||
   Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/
 | 
			
		||||
   gnu-win32/mingw32/gcc-2.95.2/gcc-2.95.2-msvcrt.exe>. GNU make is at
 | 
			
		||||
   Mingw32 is available from <ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/
 | 
			
		||||
   mingw32/egcs-1.1.2/egcs-1.1.2-mingw32.zip>. GNU make is at
 | 
			
		||||
   <ftp://agnes.dida.physik.uni-essen.de/home/janjaap/mingw32/binaries/
 | 
			
		||||
   make-3.76.1.zip>. Install both of them in C:\egcs-1.1.2 and run
 | 
			
		||||
   C:\egcs-1.1.2\mingw32.bat to set the PATH.
 | 
			
		||||
 
 | 
			
		||||
@@ -62,7 +62,7 @@ AR=ar r
 | 
			
		||||
RANLIB= ranlib
 | 
			
		||||
PERL= perl
 | 
			
		||||
TAR= tar
 | 
			
		||||
TARFLAGS= --no-recursion
 | 
			
		||||
TARFLAGS= --norecurse
 | 
			
		||||
 | 
			
		||||
# Set BN_ASM to bn_asm.o if you want to use the C version
 | 
			
		||||
BN_ASM= bn_asm.o
 | 
			
		||||
@@ -462,8 +462,7 @@ install: all install_docs
 | 
			
		||||
		if [ -f "$$i" ]; then \
 | 
			
		||||
		(       echo installing $$i; \
 | 
			
		||||
			cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
 | 
			
		||||
			(echo $$i | grep '\\.a$$' > /dev/null 2>&1) \
 | 
			
		||||
			&& $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
 | 
			
		||||
			$(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
 | 
			
		||||
			chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
 | 
			
		||||
		fi \
 | 
			
		||||
	done
 | 
			
		||||
@@ -474,19 +473,19 @@ install_docs:
 | 
			
		||||
		$(INSTALL_PREFIX)$(MANDIR)/man3 \
 | 
			
		||||
		$(INSTALL_PREFIX)$(MANDIR)/man5 \
 | 
			
		||||
		$(INSTALL_PREFIX)$(MANDIR)/man7
 | 
			
		||||
	@echo installing man 1 and man 5
 | 
			
		||||
	@for i in doc/apps/*.pod; do \
 | 
			
		||||
		fn=`basename $$i .pod`; \
 | 
			
		||||
		sec=`[ "$$fn" = "config" ] && echo 5 || echo 1`; \
 | 
			
		||||
		echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
 | 
			
		||||
		(cd `dirname $$i`; \
 | 
			
		||||
		$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
 | 
			
		||||
			 --release=$(VERSION) `basename $$i`) \
 | 
			
		||||
			>  $(INSTALL_PREFIX)$(MANDIR)/man$$sec/`basename $$i .pod`.$$sec; \
 | 
			
		||||
	done
 | 
			
		||||
	@echo installing man 3 and man 7
 | 
			
		||||
	@for i in doc/crypto/*.pod doc/ssl/*.pod; do \
 | 
			
		||||
		fn=`basename $$i .pod`; \
 | 
			
		||||
		sec=`[ "$$fn" = "des_modes" ] && echo 7 || echo 3`; \
 | 
			
		||||
		echo "installing man$$sec/`basename $$i .pod`.$$sec"; \
 | 
			
		||||
		(cd `dirname $$i`; \
 | 
			
		||||
		$(PERL) ../../util/pod2man.pl --section=$$sec --center=OpenSSL \
 | 
			
		||||
			--release=$(VERSION) `basename $$i`) \
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								NEWS
									
									
									
									
									
								
							@@ -5,21 +5,6 @@
 | 
			
		||||
  This file gives a brief overview of the major changes between each OpenSSL
 | 
			
		||||
  release. For more details please read the CHANGES file.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.5a and OpenSSL 0.9.6:
 | 
			
		||||
 | 
			
		||||
      o Some documentation for BIO and SSL libraries.
 | 
			
		||||
      o Enhanced chain verification using key identifiers.
 | 
			
		||||
      o New sign and verify options to 'dgst' application.
 | 
			
		||||
      o Support for DER and PEM encoded messages in 'smime' application.
 | 
			
		||||
      o New 'rsautl' application, low level RSA utility.
 | 
			
		||||
      o MD4 now included.
 | 
			
		||||
      o Bugfix for SSL rollback padding check.
 | 
			
		||||
      o Support for external crypto devices [1].
 | 
			
		||||
      o Enhanced EVP interface.
 | 
			
		||||
 | 
			
		||||
    [1] The support for external crypto devices is currently a separate
 | 
			
		||||
        distribution.  See the file README.ENGINE.
 | 
			
		||||
 | 
			
		||||
  Major changes between OpenSSL 0.9.5 and OpenSSL 0.9.5a:
 | 
			
		||||
 | 
			
		||||
      o Bug fixes for Win32, SuSE Linux, NeXTSTEP and FreeBSD 2.2.8 
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								README
									
									
									
									
									
								
							@@ -1,5 +1,5 @@
 | 
			
		||||
 | 
			
		||||
 OpenSSL 0.9.7-dev 24 Sep 2000
 | 
			
		||||
 OpenSSL 0.9.6-beta2 17 Sep 2000
 | 
			
		||||
 | 
			
		||||
 Copyright (c) 1998-2000 The OpenSSL Project
 | 
			
		||||
 Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
 | 
			
		||||
@@ -163,9 +163,6 @@
 | 
			
		||||
 the string "[PATCH]" in the subject. Please be sure to include a
 | 
			
		||||
 textual explanation of what your patch does.
 | 
			
		||||
 | 
			
		||||
 Note: For legal reasons, contributions from the US can be accepted only
 | 
			
		||||
 if a copy of the patch is sent to crypt@bxa.doc.gov
 | 
			
		||||
 | 
			
		||||
 The preferred format for changes is "diff -u" output. You might
 | 
			
		||||
 generate it like this:
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,63 +0,0 @@
 | 
			
		||||
 | 
			
		||||
  ENGINE
 | 
			
		||||
  ======
 | 
			
		||||
 | 
			
		||||
  With OpenSSL 0.9.6, a new component has been added to support external 
 | 
			
		||||
  crypto devices, for example accelerator cards.  The component is called
 | 
			
		||||
  ENGINE, and has still a pretty experimental status and almost no
 | 
			
		||||
  documentation.  It's designed to be faily easily extensible by the
 | 
			
		||||
  calling programs.
 | 
			
		||||
 | 
			
		||||
  There's currently built-in support for the following crypto devices:
 | 
			
		||||
 | 
			
		||||
      o CryptoSwift
 | 
			
		||||
      o Compaq Atalla
 | 
			
		||||
      o nCipher CHIL
 | 
			
		||||
 | 
			
		||||
  A number of things are still needed and are being worked on:
 | 
			
		||||
 | 
			
		||||
      o An openssl utility command to handle or at least check available
 | 
			
		||||
        engines.
 | 
			
		||||
      o A better way of handling the methods that are handled by the
 | 
			
		||||
        engines.
 | 
			
		||||
      o Documentation!
 | 
			
		||||
 | 
			
		||||
  What already exists is fairly stable as far as it has been tested, but
 | 
			
		||||
  the test base has been a bit small most of the time.
 | 
			
		||||
 | 
			
		||||
  Because of this experimental status and what's lacking, the ENGINE
 | 
			
		||||
  component is not yet part of the default OpenSSL distribution.  However,
 | 
			
		||||
  we have made a separate kit for those who want to try this out, to be
 | 
			
		||||
  found in the same places as the default OpenSSL distribution, but with
 | 
			
		||||
  "-engine-" being part of the kit file name.  For example, version 0.9.6
 | 
			
		||||
  is distributed in the following two files:
 | 
			
		||||
 | 
			
		||||
      openssl-0.9.6.tar.gz
 | 
			
		||||
      openssl-engine-0.9.6.tar.gz
 | 
			
		||||
 | 
			
		||||
  NOTES
 | 
			
		||||
  =====
 | 
			
		||||
 | 
			
		||||
  openssl-engine-0.9.6.tar.gz does not depend on openssl-0.9.6.tar, you do
 | 
			
		||||
  not need to download both.
 | 
			
		||||
 | 
			
		||||
  openssl-engine-0.9.6.tar.gz is usable even if you don't have an external
 | 
			
		||||
  crypto device.  The internal OpenSSL functions are contained in the
 | 
			
		||||
  engine "openssl", and will be used by default.
 | 
			
		||||
 | 
			
		||||
  No external crypto device is chosen unless you say so.  You have actively
 | 
			
		||||
  tell the openssl utility commands to use it through a new command line
 | 
			
		||||
  switch called "-engine".  And if you want to use the ENGINE library to
 | 
			
		||||
  do something similar, you must also explicitely choose an external crypto
 | 
			
		||||
  device, or the built-in crypto routines will be used, just as in the
 | 
			
		||||
  default OpenSSL distribution.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  PROBLEMS
 | 
			
		||||
  ========
 | 
			
		||||
 | 
			
		||||
  It seems like the ENGINE part doesn't work too well with Cryptoswift on
 | 
			
		||||
  Win32.  A quick test done right before the release showed that trying
 | 
			
		||||
  "openssl speed -engine cswift" generated errors.  If the DSO gets enabled,
 | 
			
		||||
  an attempt is made to write at memory address 0x00000002.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										51
									
								
								STATUS
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								STATUS
									
									
									
									
									
								
							@@ -1,18 +1,49 @@
 | 
			
		||||
 | 
			
		||||
  OpenSSL STATUS                           Last modified at
 | 
			
		||||
  ______________                           $Date: 2000/09/24 17:31:36 $
 | 
			
		||||
  ______________                           $Date: 2000/09/17 11:56:53 $
 | 
			
		||||
 | 
			
		||||
  DEVELOPMENT STATE
 | 
			
		||||
 | 
			
		||||
    o  OpenSSL 0.9.7:  Under development...
 | 
			
		||||
    o  OpenSSL 0.9.6:  Released on September 24th, 2000
 | 
			
		||||
    o  OpenSSL 0.9.5a: Released on April      1st, 2000
 | 
			
		||||
    o  OpenSSL 0.9.5:  Released on February  28th, 2000
 | 
			
		||||
    o  OpenSSL 0.9.4:  Released on August    09th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.3a: Released on May       29th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.3:  Released on May       25th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.2b: Released on March     22th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.1c: Released on December  23th, 1998
 | 
			
		||||
    o  OpenSSL 0.9.6:  Under development (in release cycle)...
 | 
			
		||||
                       Proposed release date September 24, 2000
 | 
			
		||||
                       0.9.6-beta1 is available:
 | 
			
		||||
			OpenBSD-x86 2.7			- failed
 | 
			
		||||
				ftime not supported [FIXED]
 | 
			
		||||
			hpux-parisc-cc 10.20		- passed
 | 
			
		||||
			hpux-parisc-gcc 10.20		- passed
 | 
			
		||||
			hpux-parisc-gcc 11.00		- passed
 | 
			
		||||
			hpux-gcc			- passed
 | 
			
		||||
			hpux-brokengcc			- failed
 | 
			
		||||
				BN_sqr fails in test
 | 
			
		||||
			linux-elf			- passed
 | 
			
		||||
			linux-sparcv7			- passed
 | 
			
		||||
			linux-ppc			- passed
 | 
			
		||||
			Solaris [engine]		- failed
 | 
			
		||||
				speed cswift gives odd errors [FIXED]
 | 
			
		||||
			solaris-sparcv8-gcc		- passed
 | 
			
		||||
			solaris-sparcv9-gcc		- passed
 | 
			
		||||
			solaris-sparcv9-cc		- passed
 | 
			
		||||
			solaris64-sparcv9-cc		- passed
 | 
			
		||||
			sco5-gcc			- passed
 | 
			
		||||
			sco5-cc				- passed
 | 
			
		||||
			FreeBSD				- passed
 | 
			
		||||
			Win32 VC++			- failed
 | 
			
		||||
				PCURSORINFO not defined unless Win2000 [FIXED]
 | 
			
		||||
				RAND_poll() problem on Win2000 [FIXED]
 | 
			
		||||
				DSO method always DSO_METHOD_null [FIXED]
 | 
			
		||||
			CygWin32			- test failed
 | 
			
		||||
			MingW32				- failed
 | 
			
		||||
				thelp32.h
 | 
			
		||||
			aix-gcc (AIX 4.3.2)		- passed
 | 
			
		||||
			VMS/Alpha			- failed
 | 
			
		||||
				Some things were missing [FIXED]
 | 
			
		||||
    o  OpenSSL 0.9.5a: Released on April     1st, 2000
 | 
			
		||||
    o  OpenSSL 0.9.5:  Released on February 28th, 2000
 | 
			
		||||
    o  OpenSSL 0.9.4:  Released on August   09th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.3a: Released on May      29th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.3:  Released on May      25th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.2b: Released on March    22th, 1999
 | 
			
		||||
    o  OpenSSL 0.9.1c: Released on December 23th, 1998
 | 
			
		||||
 | 
			
		||||
  RELEASE SHOWSTOPPERS
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										34
									
								
								TABLE
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								TABLE
									
									
									
									
									
								
							@@ -102,7 +102,7 @@ $shared_cflag =
 | 
			
		||||
 | 
			
		||||
*** FreeBSD-alpha
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DTERMIOS -O -fomit-frame-pointer
 | 
			
		||||
$cflags       = -DTERMIOS -O3 -fomit-frame-pointer
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$lflags       = 
 | 
			
		||||
@@ -140,26 +140,6 @@ $dso_scheme   =
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
 | 
			
		||||
*** MPE/iX-gcc
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -D_ENDIAN -DBN_DIV2W -O3 -DMPE -D_POSIX_SOURCE -D_SOCKET_SOURCE -I/SYSLOG/PUB
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = (unknown)
 | 
			
		||||
$lflags       = -L/SYSLOG/PUB -lsyslog -lsocket -lcurses
 | 
			
		||||
$bn_ops       = BN_LLONG DES_PTR DES_UNROLL DES_RISC1
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
$bf_obj       = 
 | 
			
		||||
$md5_obj      = 
 | 
			
		||||
$sha1_obj     = 
 | 
			
		||||
$cast_obj     = 
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = 
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
 | 
			
		||||
*** Mingw32
 | 
			
		||||
$cc           = gcc
 | 
			
		||||
$cflags       = -DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall
 | 
			
		||||
@@ -1185,7 +1165,7 @@ $cc           = cc
 | 
			
		||||
$cflags       = +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DBN_DIV2W -DMD32_XARRAY
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$lflags       = -ldld
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$bn_ops       = MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
@@ -1245,7 +1225,7 @@ $cc           = cc
 | 
			
		||||
$cflags       = +DA1.1 +DS1.1 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$lflags       = -ldld
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$bn_ops       = MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
@@ -1265,7 +1245,7 @@ $cc           = cc
 | 
			
		||||
$cflags       = +DA2.0 +DS2.0 +O3 +Optrs_strongly_typed +Olibcalls -Ae +ESlit -DB_ENDIAN -DMD32_XARRAY
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$lflags       = -ldld
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT
 | 
			
		||||
$bn_obj       = asm/pa-risc2.o
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
@@ -1365,7 +1345,7 @@ $cc           = cc
 | 
			
		||||
$cflags       = -Ae +DD64 +O3 +ESlit -z -DB_ENDIAN -DMD32_XARRAY
 | 
			
		||||
$unistd       = 
 | 
			
		||||
$thread_cflag = -D_REENTRANT
 | 
			
		||||
$lflags       = -ldl
 | 
			
		||||
$lflags       = -ldld
 | 
			
		||||
$bn_ops       = SIXTY_FOUR_BIT_LONG MD2_CHAR RC4_INDEX RC4_CHAR DES_UNROLL DES_RISC1 DES_INT
 | 
			
		||||
$bn_obj       = 
 | 
			
		||||
$des_obj      = 
 | 
			
		||||
@@ -1376,7 +1356,7 @@ $cast_obj     =
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = dlfcn
 | 
			
		||||
$dso_scheme   = dl
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
 | 
			
		||||
@@ -1396,7 +1376,7 @@ $cast_obj     =
 | 
			
		||||
$rc4_obj      = 
 | 
			
		||||
$rmd160_obj   = 
 | 
			
		||||
$rc5_obj      = 
 | 
			
		||||
$dso_scheme   = dlfcn
 | 
			
		||||
$dso_scheme   = dl
 | 
			
		||||
$shared_target= 
 | 
			
		||||
$shared_cflag = 
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										57
									
								
								apps/apps.c
									
									
									
									
									
								
							
							
						
						
									
										57
									
								
								apps/apps.c
									
									
									
									
									
								
							@@ -74,14 +74,6 @@
 | 
			
		||||
#  include "bss_file.c"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
	char *name;
 | 
			
		||||
	unsigned long flag;
 | 
			
		||||
	unsigned long mask;
 | 
			
		||||
} NAME_EX_TBL;
 | 
			
		||||
 | 
			
		||||
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
 | 
			
		||||
 | 
			
		||||
int app_init(long mesgwin);
 | 
			
		||||
#ifdef undef /* never finished - probably never will be :-) */
 | 
			
		||||
int args_from_file(char *file, int *argc, char **argv[])
 | 
			
		||||
@@ -702,43 +694,16 @@ end:
 | 
			
		||||
	return(othercerts);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define X509V3_EXT_UNKNOWN_MASK		(0xfL << 16)
 | 
			
		||||
/* Return error for unknown extensions */
 | 
			
		||||
#define X509V3_EXT_DEFAULT		0
 | 
			
		||||
/* Print error for unknown extensions */
 | 
			
		||||
#define X509V3_EXT_ERROR_UNKNOWN	(1L << 16)
 | 
			
		||||
/* ASN1 parse unknown extensions */
 | 
			
		||||
#define X509V3_EXT_PARSE_UNKNOWN	(2L << 16)
 | 
			
		||||
/* BIO_dump unknown extensions */
 | 
			
		||||
#define X509V3_EXT_DUMP_UNKNOWN		(3L << 16)
 | 
			
		||||
 | 
			
		||||
int set_cert_ex(unsigned long *flags, const char *arg)
 | 
			
		||||
{
 | 
			
		||||
	static const NAME_EX_TBL cert_tbl[] = {
 | 
			
		||||
		{ "compatible", X509_FLAG_COMPAT, 0xffffffffl},
 | 
			
		||||
		{ "no_header", X509_FLAG_NO_HEADER, 0},
 | 
			
		||||
		{ "no_version", X509_FLAG_NO_VERSION, 0},
 | 
			
		||||
		{ "no_serial", X509_FLAG_NO_SERIAL, 0},
 | 
			
		||||
		{ "no_signame", X509_FLAG_NO_SIGNAME, 0},
 | 
			
		||||
		{ "no_validity", X509_FLAG_NO_VALIDITY, 0},
 | 
			
		||||
		{ "no_subject", X509_FLAG_NO_SUBJECT, 0},
 | 
			
		||||
		{ "no_pubkey", X509_FLAG_NO_PUBKEY, 0},
 | 
			
		||||
		{ "no_extensions", X509_FLAG_NO_EXTENSIONS, 0},
 | 
			
		||||
		{ "no_sigdump", X509_FLAG_NO_SIGDUMP, 0},
 | 
			
		||||
		{ "no_aux", X509_FLAG_NO_AUX, 0},
 | 
			
		||||
		{ "ext_default", X509V3_EXT_DEFAULT, X509V3_EXT_UNKNOWN_MASK},
 | 
			
		||||
		{ "ext_error", X509V3_EXT_ERROR_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
			
		||||
		{ "ext_parse", X509V3_EXT_PARSE_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
			
		||||
		{ "ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
 | 
			
		||||
		{ NULL, 0, 0}
 | 
			
		||||
	};
 | 
			
		||||
	return set_table_opts(flags, arg, cert_tbl);
 | 
			
		||||
}
 | 
			
		||||
typedef struct {
 | 
			
		||||
	char *name;
 | 
			
		||||
	unsigned long flag;
 | 
			
		||||
	unsigned long mask;
 | 
			
		||||
} NAME_EX_TBL;
 | 
			
		||||
 | 
			
		||||
int set_name_ex(unsigned long *flags, const char *arg)
 | 
			
		||||
{
 | 
			
		||||
	static const NAME_EX_TBL ex_tbl[] = {
 | 
			
		||||
	char c;
 | 
			
		||||
	const NAME_EX_TBL *ptbl, ex_tbl[] = {
 | 
			
		||||
		{ "esc_2253", ASN1_STRFLGS_ESC_2253, 0},
 | 
			
		||||
		{ "esc_ctrl", ASN1_STRFLGS_ESC_CTRL, 0},
 | 
			
		||||
		{ "esc_msb", ASN1_STRFLGS_ESC_MSB, 0},
 | 
			
		||||
@@ -766,13 +731,7 @@ int set_name_ex(unsigned long *flags, const char *arg)
 | 
			
		||||
		{ "multiline", XN_FLAG_MULTILINE, 0xffffffffL},
 | 
			
		||||
		{ NULL, 0, 0}
 | 
			
		||||
	};
 | 
			
		||||
	return set_table_opts(flags, arg, ex_tbl);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
 | 
			
		||||
{
 | 
			
		||||
	char c;
 | 
			
		||||
	const NAME_EX_TBL *ptbl;
 | 
			
		||||
	c = arg[0];
 | 
			
		||||
 | 
			
		||||
	if(c == '-') {
 | 
			
		||||
@@ -783,7 +742,7 @@ static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_T
 | 
			
		||||
		arg++;
 | 
			
		||||
	} else c = 1;
 | 
			
		||||
 | 
			
		||||
	for(ptbl = in_tbl; ptbl->name; ptbl++) {
 | 
			
		||||
	for(ptbl = ex_tbl; ptbl->name; ptbl++) {
 | 
			
		||||
		if(!strcmp(arg, ptbl->name)) {
 | 
			
		||||
			*flags &= ~ptbl->mask;
 | 
			
		||||
			if(c) *flags |= ptbl->flag;
 | 
			
		||||
 
 | 
			
		||||
@@ -147,7 +147,6 @@ int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]);
 | 
			
		||||
int dump_cert_text(BIO *out, X509 *x);
 | 
			
		||||
void print_name(BIO *out, char *title, X509_NAME *nm, unsigned long lflags);
 | 
			
		||||
#endif
 | 
			
		||||
int set_cert_ex(unsigned long *flags, const char *arg);
 | 
			
		||||
int set_name_ex(unsigned long *flags, const char *arg);
 | 
			
		||||
int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
 | 
			
		||||
int add_oid_section(BIO *err, LHASH *conf);
 | 
			
		||||
 
 | 
			
		||||
@@ -206,12 +206,6 @@ bad:
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
	BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
	{
 | 
			
		||||
	BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
	out = BIO_push(tmpbio, out);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (oidfile != NULL)
 | 
			
		||||
		{
 | 
			
		||||
@@ -321,7 +315,7 @@ bad:
 | 
			
		||||
end:
 | 
			
		||||
	BIO_free(derout);
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (b64 != NULL) BIO_free(b64);
 | 
			
		||||
	if (ret != 0)
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								apps/ca.c
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								apps/ca.c
									
									
									
									
									
								
							@@ -690,12 +690,6 @@ bad:
 | 
			
		||||
	if (verbose)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); /* cannot fail */
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		TXT_DB_write(out,db);
 | 
			
		||||
		BIO_printf(bio_err,"%d entries loaded from the database\n",
 | 
			
		||||
			db->data->num);
 | 
			
		||||
@@ -730,15 +724,7 @@ bad:
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			BIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			Sout = BIO_push(tmpbio, Sout);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (req)
 | 
			
		||||
@@ -1034,7 +1020,7 @@ bad:
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
			BIO_free(in);
 | 
			
		||||
			BIO_free_all(out);
 | 
			
		||||
			BIO_free(out);
 | 
			
		||||
			in=NULL;
 | 
			
		||||
			out=NULL;
 | 
			
		||||
			if (rename(serialfile,buf[2]) < 0)
 | 
			
		||||
@@ -1251,9 +1237,9 @@ bad:
 | 
			
		||||
	ret=0;
 | 
			
		||||
err:
 | 
			
		||||
	BIO_free(hex);
 | 
			
		||||
	BIO_free_all(Cout);
 | 
			
		||||
	BIO_free_all(Sout);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(Cout);
 | 
			
		||||
	BIO_free(Sout);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
 | 
			
		||||
	sk_X509_pop_free(cert_sk,X509_free);
 | 
			
		||||
@@ -1368,7 +1354,7 @@ static int save_serial(char *serialfile, BIGNUM *serial)
 | 
			
		||||
	BIO_puts(out,"\n");
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (ai != NULL) ASN1_INTEGER_free(ai);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -108,12 +108,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
			
		||||
	STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
	{
 | 
			
		||||
	BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
	STDout = BIO_push(tmpbio, STDout);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	argc--;
 | 
			
		||||
	argv++;
 | 
			
		||||
@@ -201,7 +195,7 @@ err:
 | 
			
		||||
end:
 | 
			
		||||
	if (ctx != NULL) SSL_CTX_free(ctx);
 | 
			
		||||
	if (ssl != NULL) SSL_free(ssl);
 | 
			
		||||
	if (STDout != NULL) BIO_free_all(STDout);
 | 
			
		||||
	if (STDout != NULL) BIO_free(STDout);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								apps/crl.c
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								apps/crl.c
									
									
									
									
									
								
							@@ -122,15 +122,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
 | 
			
		||||
	if (bio_out == NULL)
 | 
			
		||||
		if ((bio_out=BIO_new(BIO_s_file())) != NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_set_fp(bio_out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			bio_out = BIO_push(tmpbio, bio_out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
	informat=FORMAT_PEM;
 | 
			
		||||
	outformat=FORMAT_PEM;
 | 
			
		||||
@@ -322,15 +314,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -356,8 +340,8 @@ bad:
 | 
			
		||||
	if (!i) { BIO_printf(bio_err,"unable to write CRL\n"); goto end; }
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free_all(bio_out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	BIO_free(bio_out);
 | 
			
		||||
	bio_out=NULL;
 | 
			
		||||
	X509_CRL_free(x);
 | 
			
		||||
	if(store) {
 | 
			
		||||
 
 | 
			
		||||
@@ -239,15 +239,7 @@ bad:
 | 
			
		||||
	sk_free(certflst);
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -274,7 +266,7 @@ bad:
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (p7 != NULL) PKCS7_free(p7);
 | 
			
		||||
	if (crl != NULL) X509_CRL_free(crl);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								apps/dgst.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								apps/dgst.c
									
									
									
									
									
								
							@@ -74,7 +74,7 @@
 | 
			
		||||
#define PROG	dgst_main
 | 
			
		||||
 | 
			
		||||
void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout,
 | 
			
		||||
		EVP_PKEY *key, unsigned char *sigin, int siglen);
 | 
			
		||||
		EVP_PKEY *key, unsigned char *sigin, unsigned int siglen);
 | 
			
		||||
 | 
			
		||||
int MAIN(int, char **);
 | 
			
		||||
 | 
			
		||||
@@ -96,7 +96,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char out_bin = -1, want_pub = 0, do_verify = 0;
 | 
			
		||||
	EVP_PKEY *sigkey = NULL;
 | 
			
		||||
	unsigned char *sigbuf = NULL;
 | 
			
		||||
	int siglen = 0;
 | 
			
		||||
	unsigned int siglen = 0;
 | 
			
		||||
 | 
			
		||||
	apps_startup();
 | 
			
		||||
 | 
			
		||||
@@ -236,15 +236,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		if(out_bin)
 | 
			
		||||
			out = BIO_new_file(outfile, "wb");
 | 
			
		||||
		else    out = BIO_new_file(outfile, "w");
 | 
			
		||||
	} else {
 | 
			
		||||
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	} else out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if(!out) {
 | 
			
		||||
		BIO_printf(bio_err, "Error opening output file %s\n", 
 | 
			
		||||
@@ -288,7 +280,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
		siglen = BIO_read(sigbio, sigbuf, siglen);
 | 
			
		||||
		BIO_free(sigbio);
 | 
			
		||||
		if(siglen <= 0) {
 | 
			
		||||
		if(siglen == 0) {
 | 
			
		||||
			BIO_printf(bio_err, "Error reading signature file %s\n",
 | 
			
		||||
								sigfile);
 | 
			
		||||
			ERR_print_errors(bio_err);
 | 
			
		||||
@@ -331,7 +323,7 @@ end:
 | 
			
		||||
		OPENSSL_free(buf);
 | 
			
		||||
		}
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	EVP_PKEY_free(sigkey);
 | 
			
		||||
	if(sigbuf) OPENSSL_free(sigbuf);
 | 
			
		||||
	if (bmd != NULL) BIO_free(bmd);
 | 
			
		||||
@@ -339,7 +331,7 @@ end:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout,
 | 
			
		||||
			EVP_PKEY *key, unsigned char *sigin, int siglen)
 | 
			
		||||
			EVP_PKEY *key, unsigned char *sigin, unsigned int siglen)
 | 
			
		||||
	{
 | 
			
		||||
	int len;
 | 
			
		||||
	int i;
 | 
			
		||||
@@ -353,7 +345,7 @@ void do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, char binout,
 | 
			
		||||
		{
 | 
			
		||||
		EVP_MD_CTX *ctx;
 | 
			
		||||
		BIO_get_md_ctx(bp, &ctx);
 | 
			
		||||
		i = EVP_VerifyFinal(ctx, sigin, (unsigned int)siglen, key); 
 | 
			
		||||
		i = EVP_VerifyFinal(ctx, sigin, siglen, key); 
 | 
			
		||||
		if(i > 0) BIO_printf(out, "Verified OK\n");
 | 
			
		||||
		else if(i == 0) BIO_printf(out, "Verification Failure\n");
 | 
			
		||||
		else
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/dh.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/dh.c
									
									
									
									
									
								
							@@ -184,15 +184,7 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -317,7 +309,7 @@ bad:
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (dh != NULL) DH_free(dh);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -391,15 +391,7 @@ bad:
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -504,7 +496,7 @@ bad:
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (dh != NULL) DH_free(dh);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/dsa.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/dsa.c
									
									
									
									
									
								
							@@ -233,15 +233,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -289,7 +281,7 @@ bad:
 | 
			
		||||
		ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if(in != NULL) BIO_free(in);
 | 
			
		||||
	if(out != NULL) BIO_free_all(out);
 | 
			
		||||
	if(out != NULL) BIO_free(out);
 | 
			
		||||
	if(dsa != NULL) DSA_free(dsa);
 | 
			
		||||
	if(passin) OPENSSL_free(passin);
 | 
			
		||||
	if(passout) OPENSSL_free(passout);
 | 
			
		||||
 
 | 
			
		||||
@@ -205,15 +205,7 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -355,7 +347,7 @@ bad:
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (dsa != NULL) DSA_free(dsa);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/enc.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/enc.c
									
									
									
									
									
								
							@@ -416,15 +416,7 @@ bad:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	if (outf == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outf) <= 0)
 | 
			
		||||
@@ -592,7 +584,7 @@ end:
 | 
			
		||||
	if (strbuf != NULL) OPENSSL_free(strbuf);
 | 
			
		||||
	if (buff != NULL) OPENSSL_free(buff);
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (benc != NULL) BIO_free(benc);
 | 
			
		||||
	if (b64 != NULL) BIO_free(b64);
 | 
			
		||||
	if(pass) OPENSSL_free(pass);
 | 
			
		||||
 
 | 
			
		||||
@@ -91,18 +91,12 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		out=BIO_new(BIO_s_file());
 | 
			
		||||
		if ((out != NULL) && BIO_set_fp(out,stdout,BIO_NOCLOSE))
 | 
			
		||||
			{
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			lh_node_stats_bio((LHASH *)ERR_get_string_table(),out);
 | 
			
		||||
			lh_stats_bio((LHASH *)ERR_get_string_table(),out);
 | 
			
		||||
			lh_node_usage_stats_bio((LHASH *)
 | 
			
		||||
				ERR_get_string_table(),out);
 | 
			
		||||
			}
 | 
			
		||||
		if (out != NULL) BIO_free_all(out);
 | 
			
		||||
		if (out != NULL) BIO_free(out);
 | 
			
		||||
		argc--;
 | 
			
		||||
		argv++;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/gendh.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/gendh.c
									
									
									
									
									
								
							@@ -142,15 +142,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -182,7 +174,7 @@ bad:
 | 
			
		||||
end:
 | 
			
		||||
	if (ret != 0)
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (dh != NULL) DH_free(dh);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -178,15 +178,7 @@ bad:
 | 
			
		||||
	if (out == NULL) goto end;
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -217,7 +209,7 @@ end:
 | 
			
		||||
	if (ret != 0)
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (dsa != NULL) DSA_free(dsa);
 | 
			
		||||
	if(passout) OPENSSL_free(passout);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
 
 | 
			
		||||
@@ -168,15 +168,7 @@ bad:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -220,7 +212,7 @@ bad:
 | 
			
		||||
	ret=0;
 | 
			
		||||
err:
 | 
			
		||||
	if (rsa != NULL) RSA_free(rsa);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if(passout) OPENSSL_free(passout);
 | 
			
		||||
	if (ret != 0)
 | 
			
		||||
		ERR_print_errors(bio_err);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								apps/nseq.c
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								apps/nseq.c
									
									
									
									
									
								
							@@ -119,15 +119,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				 "Can't open output file %s\n", outfile);
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	} else out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if (toseq) {
 | 
			
		||||
		seq = NETSCAPE_CERT_SEQUENCE_new();
 | 
			
		||||
		seq->certs = sk_X509_new_null();
 | 
			
		||||
@@ -159,7 +152,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	ret = 0;
 | 
			
		||||
end:
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	NETSCAPE_CERT_SEQUENCE_free(seq);
 | 
			
		||||
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
 
 | 
			
		||||
@@ -238,19 +238,13 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
 | 
			
		||||
	else if ((strncmp(argv[0],"no-",3)) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO *bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		bio_stdout = BIO_push(tmpbio, bio_stdout);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		f.name=argv[0]+3;
 | 
			
		||||
		ret = (lh_retrieve(prog,&f) != NULL);
 | 
			
		||||
		if (!ret)
 | 
			
		||||
			BIO_printf(bio_stdout, "%s\n", argv[0]);
 | 
			
		||||
		else
 | 
			
		||||
			BIO_printf(bio_stdout, "%s\n", argv[0]+3);
 | 
			
		||||
		BIO_free_all(bio_stdout);
 | 
			
		||||
		BIO_free(bio_stdout);
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
	else if ((strcmp(argv[0],"quit") == 0) ||
 | 
			
		||||
@@ -275,17 +269,11 @@ static int do_cmd(LHASH *prog, int argc, char *argv[])
 | 
			
		||||
		else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */
 | 
			
		||||
			list_type = FUNC_TYPE_CIPHER;
 | 
			
		||||
		bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		bio_stdout = BIO_push(tmpbio, bio_stdout);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		
 | 
			
		||||
		for (fp=functions; fp->name != NULL; fp++)
 | 
			
		||||
			if (fp->type == list_type)
 | 
			
		||||
				BIO_printf(bio_stdout, "%s\n", fp->name);
 | 
			
		||||
		BIO_free_all(bio_stdout);
 | 
			
		||||
		BIO_free(bio_stdout);
 | 
			
		||||
		ret=0;
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -81,12 +81,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (out == NULL)
 | 
			
		||||
		goto err;
 | 
			
		||||
	BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
	{
 | 
			
		||||
	BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
	out = BIO_push(tmpbio, out);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	badopt = 0, opt_done = 0;
 | 
			
		||||
	i = 0;
 | 
			
		||||
@@ -282,7 +276,7 @@ err:
 | 
			
		||||
	if (in)
 | 
			
		||||
		BIO_free(in);
 | 
			
		||||
	if (out)
 | 
			
		||||
		BIO_free_all(out);
 | 
			
		||||
		BIO_free(out);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -350,15 +350,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
    CRYPTO_push_info("write files");
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if (!outfile) {
 | 
			
		||||
	out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
	{
 | 
			
		||||
	    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
	    out = BIO_push(tmpbio, out);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
    } else out = BIO_new_file(outfile, "wb");
 | 
			
		||||
    if (!outfile) out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
    else out = BIO_new_file(outfile, "wb");
 | 
			
		||||
    if (!out) {
 | 
			
		||||
	BIO_printf(bio_err, "Error opening output file %s\n",
 | 
			
		||||
						outfile ? outfile : "<stdout>");
 | 
			
		||||
@@ -664,7 +657,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
    CRYPTO_remove_all_info();
 | 
			
		||||
#endif
 | 
			
		||||
    BIO_free(in);
 | 
			
		||||
    BIO_free_all(out);
 | 
			
		||||
    BIO_free(out);
 | 
			
		||||
    if (canames) sk_free(canames);
 | 
			
		||||
    if(passin) OPENSSL_free(passin);
 | 
			
		||||
    if(passout) OPENSSL_free(passout);
 | 
			
		||||
@@ -887,14 +880,14 @@ int print_attribs (BIO *out, STACK_OF(X509_ATTRIBUTE) *attrlst, char *name)
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
				case V_ASN1_OCTET_STRING:
 | 
			
		||||
				hex_prin(out, av->value.octet_string->data,
 | 
			
		||||
					av->value.octet_string->length);
 | 
			
		||||
				hex_prin(out, av->value.bit_string->data,
 | 
			
		||||
					av->value.bit_string->length);
 | 
			
		||||
				BIO_printf(out, "\n");	
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
				case V_ASN1_BIT_STRING:
 | 
			
		||||
				hex_prin(out, av->value.bit_string->data,
 | 
			
		||||
					av->value.bit_string->length);
 | 
			
		||||
				hex_prin(out, av->value.octet_string->data,
 | 
			
		||||
					av->value.octet_string->length);
 | 
			
		||||
				BIO_printf(out, "\n");	
 | 
			
		||||
				break;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/pkcs7.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/pkcs7.c
									
									
									
									
									
								
							@@ -196,15 +196,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -288,6 +280,6 @@ bad:
 | 
			
		||||
end:
 | 
			
		||||
	if (p7 != NULL) PKCS7_free(p7);
 | 
			
		||||
	if (in != NULL) BIO_free(in);
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								apps/pkcs8.c
									
									
									
									
									
								
							@@ -194,15 +194,8 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				 "Can't open output file %s\n", outfile);
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out = BIO_new_fp (stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	} else out = BIO_new_fp (stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if (topk8) {
 | 
			
		||||
		if(informat == FORMAT_PEM)
 | 
			
		||||
			pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);
 | 
			
		||||
@@ -260,7 +253,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
		}
 | 
			
		||||
		PKCS8_PRIV_KEY_INFO_free (p8inf);
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
		BIO_free_all(out);
 | 
			
		||||
		BIO_free(out);
 | 
			
		||||
		if(passin) OPENSSL_free(passin);
 | 
			
		||||
		if(passout) OPENSSL_free(passout);
 | 
			
		||||
		return (0);
 | 
			
		||||
@@ -343,7 +336,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	if(passin) OPENSSL_free(passin);
 | 
			
		||||
	if(passout) OPENSSL_free(passout);
 | 
			
		||||
 
 | 
			
		||||
@@ -101,15 +101,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (outfile != NULL)
 | 
			
		||||
		r = BIO_write_filename(out, outfile);
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		r = BIO_set_fp(out, stdout, BIO_NOCLOSE | BIO_FP_TEXT);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	if (r <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								apps/req.c
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								apps/req.c
									
									
									
									
									
								
							@@ -143,7 +143,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
#ifndef NO_DSA
 | 
			
		||||
	DSA *dsa_params=NULL;
 | 
			
		||||
#endif
 | 
			
		||||
	unsigned long nmflag = 0;
 | 
			
		||||
	int ex=1,x509=0,days=30;
 | 
			
		||||
	X509 *x509ss=NULL;
 | 
			
		||||
	X509_REQ *req=NULL;
 | 
			
		||||
@@ -151,7 +150,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	int i,badops=0,newreq=0,newkey= -1,pkey_type=0;
 | 
			
		||||
	BIO *in=NULL,*out=NULL;
 | 
			
		||||
	int informat,outformat,verify=0,noout=0,text=0,keyform=FORMAT_PEM;
 | 
			
		||||
	int nodes=0,kludge=0,newhdr=0,subject=0;
 | 
			
		||||
	int nodes=0,kludge=0,newhdr=0;
 | 
			
		||||
	char *infile,*outfile,*prog,*keyfile=NULL,*template=NULL,*keyout=NULL;
 | 
			
		||||
	char *extensions = NULL;
 | 
			
		||||
	char *req_exts = NULL;
 | 
			
		||||
@@ -323,13 +322,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			nodes=1;
 | 
			
		||||
		else if (strcmp(*argv,"-noout") == 0)
 | 
			
		||||
			noout=1;
 | 
			
		||||
		else if (strcmp(*argv,"-nameopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			if (!set_name_ex(&nmflag, *(++argv))) goto bad;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-subject") == 0)
 | 
			
		||||
			subject=1;
 | 
			
		||||
		else if (strcmp(*argv,"-text") == 0)
 | 
			
		||||
			text=1;
 | 
			
		||||
		else if (strcmp(*argv,"-x509") == 0)
 | 
			
		||||
@@ -617,12 +609,6 @@ bad:
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bio_err,"writing new private key to stdout\n");
 | 
			
		||||
			BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
@@ -811,22 +797,14 @@ loop:
 | 
			
		||||
			BIO_printf(bio_err,"verify OK\n");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (noout && !text && !modulus && !subject)
 | 
			
		||||
	if (noout && !text && !modulus)
 | 
			
		||||
		{
 | 
			
		||||
		ex=0;
 | 
			
		||||
		goto end;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if ((keyout != NULL) && (strcmp(outfile,keyout) == 0))
 | 
			
		||||
@@ -848,14 +826,6 @@ loop:
 | 
			
		||||
			X509_REQ_print(out,req);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(subject) 
 | 
			
		||||
		{
 | 
			
		||||
		if(x509)
 | 
			
		||||
			print_name(out, "subject=", X509_get_subject_name(x509ss), nmflag);
 | 
			
		||||
		else
 | 
			
		||||
			print_name(out, "subject=", X509_REQ_get_subject_name(req), nmflag);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (modulus)
 | 
			
		||||
		{
 | 
			
		||||
		EVP_PKEY *pubkey;
 | 
			
		||||
@@ -920,7 +890,7 @@ end:
 | 
			
		||||
		}
 | 
			
		||||
	if ((req_conf != NULL) && (req_conf != config)) CONF_free(req_conf);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	X509_REQ_free(req);
 | 
			
		||||
	X509_free(x509ss);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								apps/rsa.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								apps/rsa.c
									
									
									
									
									
								
							@@ -278,15 +278,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (outfile == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -385,7 +377,7 @@ bad:
 | 
			
		||||
		ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if(in != NULL) BIO_free(in);
 | 
			
		||||
	if(out != NULL) BIO_free_all(out);
 | 
			
		||||
	if(out != NULL) BIO_free(out);
 | 
			
		||||
	if(rsa != NULL) RSA_free(rsa);
 | 
			
		||||
	if(passin) OPENSSL_free(passin);
 | 
			
		||||
	if(passout) OPENSSL_free(passout);
 | 
			
		||||
 
 | 
			
		||||
@@ -198,15 +198,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			ERR_print_errors(bio_err);	
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		    out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	} else out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	keysize = RSA_size(rsa);
 | 
			
		||||
 | 
			
		||||
@@ -263,7 +255,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	end:
 | 
			
		||||
	RSA_free(rsa);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	if(rsa_in) OPENSSL_free(rsa_in);
 | 
			
		||||
	if(rsa_out) OPENSSL_free(rsa_out);
 | 
			
		||||
	return ret;
 | 
			
		||||
 
 | 
			
		||||
@@ -209,11 +209,9 @@ static int init_client_ip(int *sock, unsigned char ip[4], int port)
 | 
			
		||||
	s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
 | 
			
		||||
	if (s == INVALID_SOCKET) { perror("socket"); return(0); }
 | 
			
		||||
 | 
			
		||||
#ifndef MPE
 | 
			
		||||
	i=0;
 | 
			
		||||
	i=setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
 | 
			
		||||
	if (i < 0) { perror("keepalive"); return(0); }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (connect(s,(struct sockaddr *)&them,sizeof(them)) == -1)
 | 
			
		||||
		{ close(s); perror("connect"); return(0); }
 | 
			
		||||
 
 | 
			
		||||
@@ -206,15 +206,7 @@ bad:
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (outfile == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -270,7 +262,7 @@ bad:
 | 
			
		||||
		}
 | 
			
		||||
	ret=0;
 | 
			
		||||
end:
 | 
			
		||||
	if (out != NULL) BIO_free_all(out);
 | 
			
		||||
	if (out != NULL) BIO_free(out);
 | 
			
		||||
	if (x != NULL) SSL_SESSION_free(x);
 | 
			
		||||
	EXIT(ret);
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								apps/smime.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								apps/smime.c
									
									
									
									
									
								
							@@ -393,15 +393,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
				 "Can't open output file %s\n", outfile);
 | 
			
		||||
			goto end;
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		    out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	} else out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if(operation == SMIME_VERIFY) {
 | 
			
		||||
		if(!(store = setup_verify(CAfile, CApath))) goto end;
 | 
			
		||||
@@ -498,7 +490,7 @@ end:
 | 
			
		||||
	PKCS7_free(p7);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	BIO_free(indata);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	if(passin) OPENSSL_free(passin);
 | 
			
		||||
	return (ret);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@
 | 
			
		||||
#elif !defined(MSDOS) && (!defined(VMS) || defined(__DECC))
 | 
			
		||||
# define TIMES
 | 
			
		||||
#endif
 | 
			
		||||
#if !defined(_UNICOS) && !defined(__OpenBSD__) && !defined(sgi) && !defined(__FreeBSD__) && !(defined(__bsdi) || defined(__bsdi__)) && !defined(_AIX) && !defined(MPE)
 | 
			
		||||
#if !defined(_UNICOS) && !defined(__OpenBSD__)
 | 
			
		||||
# define TIMEB
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -115,7 +115,7 @@
 | 
			
		||||
#include <sys/timeb.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if !defined(TIMES) && !defined(TIMEB) && !defined(USE_TOD)
 | 
			
		||||
#if !defined(TIMES) && !defined(TIMEB)
 | 
			
		||||
#error "It seems neither struct tms nor struct timeb is supported in this platform!"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										22
									
								
								apps/spkac.c
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								apps/spkac.c
									
									
									
									
									
								
							@@ -192,15 +192,7 @@ bad:
 | 
			
		||||
		spkstr = NETSCAPE_SPKI_b64_encode(spki);
 | 
			
		||||
 | 
			
		||||
		if (outfile) out = BIO_new_file(outfile, "w");
 | 
			
		||||
		else {
 | 
			
		||||
			out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			    out = BIO_push(tmpbio, out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
		else out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
		if(!out) {
 | 
			
		||||
			BIO_printf(bio_err, "Error opening output file\n");
 | 
			
		||||
@@ -249,15 +241,7 @@ bad:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (outfile) out = BIO_new_file(outfile, "w");
 | 
			
		||||
	else {
 | 
			
		||||
		out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
		{
 | 
			
		||||
		    BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
		    out = BIO_push(tmpbio, out);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
	else out = BIO_new_fp(stdout, BIO_NOCLOSE);
 | 
			
		||||
 | 
			
		||||
	if(!out) {
 | 
			
		||||
		BIO_printf(bio_err, "Error opening output file\n");
 | 
			
		||||
@@ -284,7 +268,7 @@ end:
 | 
			
		||||
	CONF_free(conf);
 | 
			
		||||
	NETSCAPE_SPKI_free(spki);
 | 
			
		||||
	BIO_free(in);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	BIO_free(key);
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
	if(passin) OPENSSL_free(passin);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										28
									
								
								apps/x509.c
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								apps/x509.c
									
									
									
									
									
								
							@@ -129,7 +129,6 @@ static char *x509_usage[]={
 | 
			
		||||
" -extensions     - section from config file with X509V3 extensions to add\n",
 | 
			
		||||
" -clrext         - delete extensions before signing and input certificate\n",
 | 
			
		||||
" -nameopt arg    - various certificate name options\n",
 | 
			
		||||
" -certopt arg    - various certificate text options\n",
 | 
			
		||||
NULL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -175,7 +174,7 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
 | 
			
		||||
	int need_rand = 0;
 | 
			
		||||
	int checkend=0,checkoffset=0;
 | 
			
		||||
	unsigned long nmflag = 0, certflag = 0;
 | 
			
		||||
	unsigned long nmflag = 0;
 | 
			
		||||
 | 
			
		||||
	reqfile=0;
 | 
			
		||||
 | 
			
		||||
@@ -184,12 +183,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
	if (bio_err == NULL)
 | 
			
		||||
		bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
 | 
			
		||||
	STDout=BIO_new_fp(stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
	{
 | 
			
		||||
	BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
	STDout = BIO_push(tmpbio, STDout);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	informat=FORMAT_PEM;
 | 
			
		||||
	outformat=FORMAT_PEM;
 | 
			
		||||
@@ -327,11 +320,6 @@ int MAIN(int argc, char **argv)
 | 
			
		||||
			alias= *(++argv);
 | 
			
		||||
			trustout = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-certopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
			if (!set_cert_ex(&certflag, *(++argv))) goto bad;
 | 
			
		||||
			}
 | 
			
		||||
		else if (strcmp(*argv,"-nameopt") == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (--argc < 1) goto bad;
 | 
			
		||||
@@ -588,15 +576,7 @@ bad:
 | 
			
		||||
			goto end;
 | 
			
		||||
			}
 | 
			
		||||
		if (outfile == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_set_fp(out,stdout,BIO_NOCLOSE);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
			{
 | 
			
		||||
			BIO *tmpbio = BIO_new(BIO_f_linebuffer());
 | 
			
		||||
			out = BIO_push(tmpbio, out);
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			if (BIO_write_filename(out,outfile) <= 0)
 | 
			
		||||
@@ -780,7 +760,7 @@ bad:
 | 
			
		||||
				}
 | 
			
		||||
			else if (text == i)
 | 
			
		||||
				{
 | 
			
		||||
				X509_print_ex(out,x,nmflag, certflag);
 | 
			
		||||
				X509_print(out,x);
 | 
			
		||||
				}
 | 
			
		||||
			else if (startdate == i)
 | 
			
		||||
				{
 | 
			
		||||
@@ -953,8 +933,8 @@ end:
 | 
			
		||||
		app_RAND_write_file(NULL, bio_err);
 | 
			
		||||
	OBJ_cleanup();
 | 
			
		||||
	CONF_free(extconf);
 | 
			
		||||
	BIO_free_all(out);
 | 
			
		||||
	BIO_free_all(STDout);
 | 
			
		||||
	BIO_free(out);
 | 
			
		||||
	BIO_free(STDout);
 | 
			
		||||
	X509_STORE_free(ctx);
 | 
			
		||||
	X509_REQ_free(req);
 | 
			
		||||
	X509_free(x);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								config
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								config
									
									
									
									
									
								
							@@ -71,10 +71,6 @@ fi
 | 
			
		||||
# Now we simply scan though... In most cases, the SYSTEM info is enough
 | 
			
		||||
#
 | 
			
		||||
case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 | 
			
		||||
    MPE/iX:*)
 | 
			
		||||
	MACHINE=`echo "$MACHINE" | sed -e 's/-/_/g'`
 | 
			
		||||
	echo "parisc-hp-MPE/iX"; exit 0
 | 
			
		||||
	;;
 | 
			
		||||
    A/UX:*)
 | 
			
		||||
	echo "m68k-apple-aux3"; exit 0
 | 
			
		||||
	;;
 | 
			
		||||
 
 | 
			
		||||
@@ -90,8 +90,7 @@ links:
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
libs:
 | 
			
		||||
 
 | 
			
		||||
@@ -75,8 +75,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -491,24 +491,12 @@ static int do_name_ex(char_io *io_ch, void *arg, X509_NAME *n,
 | 
			
		||||
 | 
			
		||||
int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags)
 | 
			
		||||
{
 | 
			
		||||
	if(flags == XN_FLAG_COMPAT)
 | 
			
		||||
		return X509_NAME_print(out, nm, indent);
 | 
			
		||||
	return do_name_ex(send_bio_chars, out, nm, indent, flags);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags)
 | 
			
		||||
{
 | 
			
		||||
	if(flags == XN_FLAG_COMPAT)
 | 
			
		||||
		{
 | 
			
		||||
		BIO *btmp;
 | 
			
		||||
		int ret;
 | 
			
		||||
		btmp = BIO_new_fp(fp, BIO_NOCLOSE);
 | 
			
		||||
		if(!btmp) return -1;
 | 
			
		||||
		ret = X509_NAME_print(btmp, nm, indent);
 | 
			
		||||
		BIO_free(btmp);
 | 
			
		||||
		return ret;
 | 
			
		||||
		}
 | 
			
		||||
	return do_name_ex(send_fp_chars, fp, nm, indent, flags);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -133,7 +133,7 @@ ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out, const unsigned char *in,
 | 
			
		||||
	if(tbl) {
 | 
			
		||||
		mask = tbl->mask;
 | 
			
		||||
		if(!(tbl->flags & STABLE_NO_MASK)) mask &= global_mask;
 | 
			
		||||
		ret = ASN1_mbstring_ncopy(out, in, inlen, inform, mask,
 | 
			
		||||
		ret = ASN1_mbstring_ncopy(out, in, inlen, inform, tbl->mask,
 | 
			
		||||
					tbl->minsize, tbl->maxsize);
 | 
			
		||||
	} else ret = ASN1_mbstring_copy(out, in, inlen, inform, DIRSTRING_TYPE & global_mask);
 | 
			
		||||
	if(ret <= 0) return NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -123,8 +123,6 @@ int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **pp)
 | 
			
		||||
		break;
 | 
			
		||||
	case V_ASN1_SET:
 | 
			
		||||
	case V_ASN1_SEQUENCE:
 | 
			
		||||
	case V_ASN1_OTHER:
 | 
			
		||||
	default:
 | 
			
		||||
		if (a->value.set == NULL)
 | 
			
		||||
			r=0;
 | 
			
		||||
		else
 | 
			
		||||
@@ -161,8 +159,6 @@ ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, unsigned char **pp, long length)
 | 
			
		||||
 | 
			
		||||
	inf=ASN1_get_object(&q,&len,&tag,&xclass,length);
 | 
			
		||||
	if (inf & 0x80) goto err;
 | 
			
		||||
	/* If not universal tag we've no idea what it is */
 | 
			
		||||
	if(xclass != V_ASN1_UNIVERSAL) tag = V_ASN1_OTHER;
 | 
			
		||||
	
 | 
			
		||||
	ASN1_TYPE_component_free(ret);
 | 
			
		||||
 | 
			
		||||
@@ -249,8 +245,6 @@ ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, unsigned char **pp, long length)
 | 
			
		||||
		break;
 | 
			
		||||
	case V_ASN1_SET:
 | 
			
		||||
	case V_ASN1_SEQUENCE:
 | 
			
		||||
	case V_ASN1_OTHER:
 | 
			
		||||
	default:
 | 
			
		||||
		/* Sets and sequences are left complete */
 | 
			
		||||
		if ((ret->value.set=ASN1_STRING_new()) == NULL) goto err;
 | 
			
		||||
		ret->value.set->type=tag;
 | 
			
		||||
@@ -258,6 +252,9 @@ ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, unsigned char **pp, long length)
 | 
			
		||||
		if (!ASN1_STRING_set(ret->value.set,p,(int)len)) goto err;
 | 
			
		||||
		p+=len;
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		ASN1err(ASN1_F_D2I_ASN1_TYPE,ASN1_R_BAD_TYPE);
 | 
			
		||||
		goto err;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	ret->type=tag;
 | 
			
		||||
@@ -315,8 +312,6 @@ static void ASN1_TYPE_component_free(ASN1_TYPE *a)
 | 
			
		||||
		case V_ASN1_OBJECT:
 | 
			
		||||
			ASN1_OBJECT_free(a->value.object);
 | 
			
		||||
			break;
 | 
			
		||||
		case V_ASN1_NULL:
 | 
			
		||||
			break;
 | 
			
		||||
		case V_ASN1_INTEGER:
 | 
			
		||||
		case V_ASN1_NEG_INTEGER:
 | 
			
		||||
		case V_ASN1_ENUMERATED:
 | 
			
		||||
@@ -338,10 +333,11 @@ static void ASN1_TYPE_component_free(ASN1_TYPE *a)
 | 
			
		||||
		case V_ASN1_UNIVERSALSTRING:
 | 
			
		||||
		case V_ASN1_BMPSTRING:
 | 
			
		||||
		case V_ASN1_UTF8STRING:
 | 
			
		||||
		case V_ASN1_OTHER:
 | 
			
		||||
		default:
 | 
			
		||||
			ASN1_STRING_free((ASN1_STRING *)a->value.ptr);
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			/* MEMORY LEAK */
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		a->type=0;
 | 
			
		||||
		a->value.ptr=NULL;
 | 
			
		||||
 
 | 
			
		||||
@@ -83,7 +83,6 @@ extern "C" {
 | 
			
		||||
#define V_ASN1_PRIMATIVE_TAG		0x1f
 | 
			
		||||
 | 
			
		||||
#define V_ASN1_APP_CHOOSE		-2	/* let the recipient choose */
 | 
			
		||||
#define V_ASN1_OTHER			-3	/* used in ASN1_TYPE */
 | 
			
		||||
 | 
			
		||||
#define V_ASN1_NEG			0x100	/* negative flag */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -72,11 +72,6 @@
 | 
			
		||||
 | 
			
		||||
#ifndef NO_FP_API
 | 
			
		||||
int X509_print_fp(FILE *fp, X509 *x)
 | 
			
		||||
	{
 | 
			
		||||
	return X509_print_ex_fp(fp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cflag)
 | 
			
		||||
        {
 | 
			
		||||
        BIO *b;
 | 
			
		||||
        int ret;
 | 
			
		||||
@@ -87,23 +82,17 @@ int X509_print_ex_fp(FILE *fp, X509 *x, unsigned long nmflag, unsigned long cfla
 | 
			
		||||
                return(0);
 | 
			
		||||
		}
 | 
			
		||||
        BIO_set_fp(b,fp,BIO_NOCLOSE);
 | 
			
		||||
        ret=X509_print_ex(b, x, nmflag, cflag);
 | 
			
		||||
        ret=X509_print(b, x);
 | 
			
		||||
        BIO_free(b);
 | 
			
		||||
        return(ret);
 | 
			
		||||
        }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
int X509_print(BIO *bp, X509 *x)
 | 
			
		||||
{
 | 
			
		||||
	return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
 | 
			
		||||
	{
 | 
			
		||||
	long l;
 | 
			
		||||
	int ret=0,i,j,n;
 | 
			
		||||
	char *m=NULL,*s, mlch = ' ';
 | 
			
		||||
	int nmindent = 0;
 | 
			
		||||
	char *m=NULL,*s;
 | 
			
		||||
	X509_CINF *ci;
 | 
			
		||||
	ASN1_INTEGER *bs;
 | 
			
		||||
	EVP_PKEY *pkey=NULL;
 | 
			
		||||
@@ -111,127 +100,89 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
 | 
			
		||||
	X509_EXTENSION *ex;
 | 
			
		||||
	ASN1_STRING *str=NULL;
 | 
			
		||||
 | 
			
		||||
	if((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
 | 
			
		||||
			mlch = '\n';
 | 
			
		||||
			nmindent = 16;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(nmflags == X509_FLAG_COMPAT)
 | 
			
		||||
		nmindent = 16;
 | 
			
		||||
 | 
			
		||||
	ci=x->cert_info;
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_HEADER))
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write(bp,"Certificate:\n",13) <= 0) goto err;
 | 
			
		||||
		if (BIO_write(bp,"    Data:\n",10) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_VERSION))
 | 
			
		||||
		{
 | 
			
		||||
		l=X509_get_version(x);
 | 
			
		||||
		if (BIO_printf(bp,"%8sVersion: %lu (0x%lx)\n","",l+1,l) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_SERIAL))
 | 
			
		||||
		{
 | 
			
		||||
	if (BIO_write(bp,"Certificate:\n",13) <= 0) goto err;
 | 
			
		||||
	if (BIO_write(bp,"    Data:\n",10) <= 0) goto err;
 | 
			
		||||
	l=X509_get_version(x);
 | 
			
		||||
	if (BIO_printf(bp,"%8sVersion: %lu (0x%lx)\n","",l+1,l) <= 0) goto err;
 | 
			
		||||
	if (BIO_write(bp,"        Serial Number:",22) <= 0) goto err;
 | 
			
		||||
 | 
			
		||||
		if (BIO_write(bp,"        Serial Number:",22) <= 0) goto err;
 | 
			
		||||
 | 
			
		||||
		bs=X509_get_serialNumber(x);
 | 
			
		||||
		if (bs->length <= 4)
 | 
			
		||||
	bs=X509_get_serialNumber(x);
 | 
			
		||||
	if (bs->length <= 4)
 | 
			
		||||
		{
 | 
			
		||||
		l=ASN1_INTEGER_get(bs);
 | 
			
		||||
		if (l < 0)
 | 
			
		||||
			{
 | 
			
		||||
			l=ASN1_INTEGER_get(bs);
 | 
			
		||||
			if (l < 0)
 | 
			
		||||
				{
 | 
			
		||||
				l= -l;
 | 
			
		||||
				neg="-";
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				neg="";
 | 
			
		||||
			if (BIO_printf(bp," %s%lu (%s0x%lx)\n",neg,l,neg,l) <= 0)
 | 
			
		||||
			l= -l;
 | 
			
		||||
			neg="-";
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			neg="";
 | 
			
		||||
		if (BIO_printf(bp," %s%lu (%s0x%lx)\n",neg,l,neg,l) <= 0)
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
		neg=(bs->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";
 | 
			
		||||
		if (BIO_printf(bp,"\n%12s%s","",neg) <= 0) goto err;
 | 
			
		||||
 | 
			
		||||
		for (i=0; i<bs->length; i++)
 | 
			
		||||
			{
 | 
			
		||||
			if (BIO_printf(bp,"%02x%c",bs->data[i],
 | 
			
		||||
				((i+1 == bs->length)?'\n':':')) <= 0)
 | 
			
		||||
				goto err;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			{
 | 
			
		||||
			neg=(bs->type == V_ASN1_NEG_INTEGER)?" (Negative)":"";
 | 
			
		||||
			if (BIO_printf(bp,"\n%12s%s","",neg) <= 0) goto err;
 | 
			
		||||
 | 
			
		||||
			for (i=0; i<bs->length; i++)
 | 
			
		||||
				{
 | 
			
		||||
				if (BIO_printf(bp,"%02x%c",bs->data[i],
 | 
			
		||||
					((i+1 == bs->length)?'\n':':')) <= 0)
 | 
			
		||||
					goto err;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_SIGNAME))
 | 
			
		||||
		{
 | 
			
		||||
		i=OBJ_obj2nid(ci->signature->algorithm);
 | 
			
		||||
		if (BIO_printf(bp,"%8sSignature Algorithm: %s\n","",
 | 
			
		||||
			(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0)
 | 
			
		||||
			goto err;
 | 
			
		||||
		}
 | 
			
		||||
	i=OBJ_obj2nid(ci->signature->algorithm);
 | 
			
		||||
	if (BIO_printf(bp,"%8sSignature Algorithm: %s\n","",
 | 
			
		||||
		(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_ISSUER))
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_printf(bp,"        Issuer:%c",mlch) <= 0) goto err;
 | 
			
		||||
		if (!X509_NAME_print_ex(bp,X509_get_issuer_name(x),nmindent, nmflags)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_VALIDITY))
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write(bp,"\n        Validity\n",18) <= 0) goto err;
 | 
			
		||||
		if (BIO_write(bp,"            Not Before: ",24) <= 0) goto err;
 | 
			
		||||
		if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
 | 
			
		||||
		if (BIO_write(bp,"\n            Not After : ",25) <= 0) goto err;
 | 
			
		||||
		if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
 | 
			
		||||
		if (BIO_write(bp,"\n",1) <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_SUBJECT))
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_printf(bp,"        Subject:%c",mlch) <= 0) goto err;
 | 
			
		||||
		if (!X509_NAME_print_ex(bp,X509_get_subject_name(x),nmindent, nmflags)) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_PUBKEY))
 | 
			
		||||
		{
 | 
			
		||||
		if (BIO_write(bp,"\n        Subject Public Key Info:\n",34) <= 0)
 | 
			
		||||
			goto err;
 | 
			
		||||
		i=OBJ_obj2nid(ci->key->algor->algorithm);
 | 
			
		||||
		if (BIO_printf(bp,"%12sPublic Key Algorithm: %s\n","",
 | 
			
		||||
			(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
 | 
			
		||||
	if (BIO_write(bp,"        Issuer: ",16) <= 0) goto err;
 | 
			
		||||
	if (!X509_NAME_print(bp,X509_get_issuer_name(x),16)) goto err;
 | 
			
		||||
	if (BIO_write(bp,"\n        Validity\n",18) <= 0) goto err;
 | 
			
		||||
	if (BIO_write(bp,"            Not Before: ",24) <= 0) goto err;
 | 
			
		||||
	if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err;
 | 
			
		||||
	if (BIO_write(bp,"\n            Not After : ",25) <= 0) goto err;
 | 
			
		||||
	if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err;
 | 
			
		||||
	if (BIO_write(bp,"\n        Subject: ",18) <= 0) goto err;
 | 
			
		||||
	if (!X509_NAME_print(bp,X509_get_subject_name(x),16)) goto err;
 | 
			
		||||
	if (BIO_write(bp,"\n        Subject Public Key Info:\n",34) <= 0)
 | 
			
		||||
		goto err;
 | 
			
		||||
	i=OBJ_obj2nid(ci->key->algor->algorithm);
 | 
			
		||||
	if (BIO_printf(bp,"%12sPublic Key Algorithm: %s\n","",
 | 
			
		||||
		(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
 | 
			
		||||
 | 
			
		||||
		pkey=X509_get_pubkey(x);
 | 
			
		||||
		if (pkey == NULL)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bp,"%12sUnable to load Public Key\n","");
 | 
			
		||||
			ERR_print_errors(bp);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
	pkey=X509_get_pubkey(x);
 | 
			
		||||
	if (pkey == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bp,"%12sUnable to load Public Key\n","");
 | 
			
		||||
		ERR_print_errors(bp);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
#ifndef NO_RSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_RSA)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
 | 
			
		||||
			BN_num_bits(pkey->pkey.rsa->n));
 | 
			
		||||
			RSA_print(bp,pkey->pkey.rsa,16);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
	if (pkey->type == EVP_PKEY_RSA)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","",
 | 
			
		||||
		BN_num_bits(pkey->pkey.rsa->n));
 | 
			
		||||
		RSA_print(bp,pkey->pkey.rsa,16);
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_DSA
 | 
			
		||||
		if (pkey->type == EVP_PKEY_DSA)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_printf(bp,"%12sDSA Public Key:\n","");
 | 
			
		||||
			DSA_print(bp,pkey->pkey.dsa,16);
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
#endif
 | 
			
		||||
			BIO_printf(bp,"%12sUnknown Public Key:\n","");
 | 
			
		||||
 | 
			
		||||
		EVP_PKEY_free(pkey);
 | 
			
		||||
	if (pkey->type == EVP_PKEY_DSA)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bp,"%12sDSA Public Key:\n","");
 | 
			
		||||
		DSA_print(bp,pkey->pkey.dsa,16);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (cflag & X509_FLAG_NO_EXTENSIONS)
 | 
			
		||||
		n = 0;
 | 
			
		||||
	else
 | 
			
		||||
		n=X509_get_ext_count(x);
 | 
			
		||||
#endif
 | 
			
		||||
		BIO_printf(bp,"%12sUnknown Public Key:\n","");
 | 
			
		||||
 | 
			
		||||
	EVP_PKEY_free(pkey);
 | 
			
		||||
 | 
			
		||||
	n=X509_get_ext_count(x);
 | 
			
		||||
	if (n > 0)
 | 
			
		||||
		{
 | 
			
		||||
		BIO_printf(bp,"%8sX509v3 extensions:\n","");
 | 
			
		||||
@@ -245,7 +196,7 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
 | 
			
		||||
			j=X509_EXTENSION_get_critical(ex);
 | 
			
		||||
			if (BIO_printf(bp,": %s\n",j?"critical":"","") <= 0)
 | 
			
		||||
				goto err;
 | 
			
		||||
			if(!X509V3_EXT_print(bp, ex, cflag, 16))
 | 
			
		||||
			if(!X509V3_EXT_print(bp, ex, 0, 16))
 | 
			
		||||
				{
 | 
			
		||||
				BIO_printf(bp, "%16s", "");
 | 
			
		||||
				M_ASN1_OCTET_STRING_print(bp,ex->value);
 | 
			
		||||
@@ -254,27 +205,21 @@ int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_SIGDUMP))
 | 
			
		||||
		{
 | 
			
		||||
		i=OBJ_obj2nid(x->sig_alg->algorithm);
 | 
			
		||||
		if (BIO_printf(bp,"%4sSignature Algorithm: %s","",
 | 
			
		||||
			(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
 | 
			
		||||
	i=OBJ_obj2nid(x->sig_alg->algorithm);
 | 
			
		||||
	if (BIO_printf(bp,"%4sSignature Algorithm: %s","",
 | 
			
		||||
		(i == NID_undef)?"UNKNOWN":OBJ_nid2ln(i)) <= 0) goto err;
 | 
			
		||||
 | 
			
		||||
		n=x->signature->length;
 | 
			
		||||
		s=(char *)x->signature->data;
 | 
			
		||||
		for (i=0; i<n; i++)
 | 
			
		||||
			{
 | 
			
		||||
			if ((i%18) == 0)
 | 
			
		||||
				if (BIO_write(bp,"\n        ",9) <= 0) goto err;
 | 
			
		||||
			if (BIO_printf(bp,"%02x%s",(unsigned char)s[i],
 | 
			
		||||
				((i+1) == n)?"":":") <= 0) goto err;
 | 
			
		||||
			}
 | 
			
		||||
		if (BIO_write(bp,"\n",1) != 1) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if(!(cflag & X509_FLAG_NO_AUX))
 | 
			
		||||
	n=x->signature->length;
 | 
			
		||||
	s=(char *)x->signature->data;
 | 
			
		||||
	for (i=0; i<n; i++)
 | 
			
		||||
		{
 | 
			
		||||
		if (!X509_CERT_AUX_print(bp, x->aux, 0)) goto err;
 | 
			
		||||
		if ((i%18) == 0)
 | 
			
		||||
			if (BIO_write(bp,"\n        ",9) <= 0) goto err;
 | 
			
		||||
		if (BIO_printf(bp,"%02x%s",(unsigned char)s[i],
 | 
			
		||||
			((i+1) == n)?"":":") <= 0) goto err;
 | 
			
		||||
		}
 | 
			
		||||
	if (BIO_write(bp,"\n",1) != 1) goto err;
 | 
			
		||||
	if (!X509_CERT_AUX_print(bp, x->aux, 0)) goto err;
 | 
			
		||||
	ret=1;
 | 
			
		||||
err:
 | 
			
		||||
	if (str != NULL) ASN1_STRING_free(str);
 | 
			
		||||
 
 | 
			
		||||
@@ -44,8 +44,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
# elf
 | 
			
		||||
 
 | 
			
		||||
@@ -27,13 +27,11 @@ LIBSRC= bio_lib.c bio_cb.c bio_err.c \
 | 
			
		||||
	bss_file.c bss_sock.c bss_conn.c \
 | 
			
		||||
	bf_null.c bf_buff.c b_print.c b_dump.c \
 | 
			
		||||
	b_sock.c bss_acpt.c bf_nbio.c bss_log.c bss_bio.c
 | 
			
		||||
#	bf_lbuf.c
 | 
			
		||||
LIBOBJ= bio_lib.o bio_cb.o bio_err.o \
 | 
			
		||||
	bss_mem.o bss_null.o bss_fd.o \
 | 
			
		||||
	bss_file.o bss_sock.o bss_conn.o \
 | 
			
		||||
	bf_null.o bf_buff.o b_print.o b_dump.o \
 | 
			
		||||
	b_sock.o bss_acpt.o bf_nbio.o bss_log.o bss_bio.o
 | 
			
		||||
#	bf_lbuf.o
 | 
			
		||||
 | 
			
		||||
SRC= $(LIBSRC)
 | 
			
		||||
 | 
			
		||||
@@ -49,8 +47,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -113,8 +113,8 @@ int BIO_get_host_ip(const char *str, unsigned char *ip)
 | 
			
		||||
 | 
			
		||||
	/* At this point, we have something that is most probably correct
 | 
			
		||||
	   in some way, so let's init the socket. */
 | 
			
		||||
	if (BIO_sock_init() != 1)
 | 
			
		||||
		return 0; /* don't generate another error code here */
 | 
			
		||||
	if (!BIO_sock_init())
 | 
			
		||||
		return(0); /* don't generate another error code here */
 | 
			
		||||
 | 
			
		||||
	/* If the string actually contained an IP address, we need not do
 | 
			
		||||
	   anything more */
 | 
			
		||||
@@ -527,7 +527,7 @@ int BIO_get_accept_socket(char *host, int bind_mode)
 | 
			
		||||
	unsigned long l;
 | 
			
		||||
	int err_num;
 | 
			
		||||
 | 
			
		||||
	if (BIO_sock_init() != 1) return(INVALID_SOCKET);
 | 
			
		||||
	if (!BIO_sock_init()) return(INVALID_SOCKET);
 | 
			
		||||
 | 
			
		||||
	if ((str=BUF_strdup(host)) == NULL) return(INVALID_SOCKET);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,397 +0,0 @@
 | 
			
		||||
/* crypto/bio/bf_buff.c */
 | 
			
		||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
 | 
			
		||||
 * All rights reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * This package is an SSL implementation written
 | 
			
		||||
 * by Eric Young (eay@cryptsoft.com).
 | 
			
		||||
 * The implementation was written so as to conform with Netscapes SSL.
 | 
			
		||||
 * 
 | 
			
		||||
 * This library is free for commercial and non-commercial use as long as
 | 
			
		||||
 * the following conditions are aheared to.  The following conditions
 | 
			
		||||
 * apply to all code found in this distribution, be it the RC4, RSA,
 | 
			
		||||
 * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
 | 
			
		||||
 * included with this distribution is covered by the same copyright terms
 | 
			
		||||
 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
 | 
			
		||||
 * 
 | 
			
		||||
 * Copyright remains Eric Young's, and as such any Copyright notices in
 | 
			
		||||
 * the code are not to be removed.
 | 
			
		||||
 * If this package is used in a product, Eric Young should be given attribution
 | 
			
		||||
 * as the author of the parts of the library 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 cryptographic software written by
 | 
			
		||||
 *     Eric Young (eay@cryptsoft.com)"
 | 
			
		||||
 *    The word 'cryptographic' can be left out if the rouines from the library
 | 
			
		||||
 *    being used are not cryptographic related :-).
 | 
			
		||||
 * 4. If you include any Windows specific code (or a derivative thereof) from 
 | 
			
		||||
 *    the apps directory (application code) you must include an acknowledgement:
 | 
			
		||||
 *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
 | 
			
		||||
 * 
 | 
			
		||||
 * 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 <stdio.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include "cryptlib.h"
 | 
			
		||||
#include <openssl/bio.h>
 | 
			
		||||
#include <openssl/evp.h>
 | 
			
		||||
 | 
			
		||||
static int linebuffer_write(BIO *h, const char *buf,int num);
 | 
			
		||||
static int linebuffer_read(BIO *h, char *buf, int size);
 | 
			
		||||
static int linebuffer_puts(BIO *h, const char *str);
 | 
			
		||||
static int linebuffer_gets(BIO *h, char *str, int size);
 | 
			
		||||
static long linebuffer_ctrl(BIO *h, int cmd, long arg1, void *arg2);
 | 
			
		||||
static int linebuffer_new(BIO *h);
 | 
			
		||||
static int linebuffer_free(BIO *data);
 | 
			
		||||
static long linebuffer_callback_ctrl(BIO *h, int cmd, bio_info_cb *fp);
 | 
			
		||||
 | 
			
		||||
/* A 10k maximum should be enough for most purposes */
 | 
			
		||||
#define DEFAULT_LINEBUFFER_SIZE	1024*10
 | 
			
		||||
 | 
			
		||||
/* #define DEBUG */
 | 
			
		||||
 | 
			
		||||
static BIO_METHOD methods_linebuffer=
 | 
			
		||||
	{
 | 
			
		||||
	BIO_TYPE_LINEBUFFER,
 | 
			
		||||
	"linebuffer",
 | 
			
		||||
	linebuffer_write,
 | 
			
		||||
	linebuffer_read,
 | 
			
		||||
	linebuffer_puts,
 | 
			
		||||
	linebuffer_gets,
 | 
			
		||||
	linebuffer_ctrl,
 | 
			
		||||
	linebuffer_new,
 | 
			
		||||
	linebuffer_free,
 | 
			
		||||
	linebuffer_callback_ctrl,
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
BIO_METHOD *BIO_f_linebuffer(void)
 | 
			
		||||
	{
 | 
			
		||||
	return(&methods_linebuffer);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
typedef struct bio_linebuffer_ctx_struct
 | 
			
		||||
	{
 | 
			
		||||
	char *obuf;		/* the output char array */
 | 
			
		||||
	int obuf_size;		/* how big is the output buffer */
 | 
			
		||||
	int obuf_len;		/* how many bytes are in it */
 | 
			
		||||
	} BIO_LINEBUFFER_CTX;
 | 
			
		||||
 | 
			
		||||
static int linebuffer_new(BIO *bi)
 | 
			
		||||
	{
 | 
			
		||||
	BIO_LINEBUFFER_CTX *ctx;
 | 
			
		||||
 | 
			
		||||
	ctx=(BIO_LINEBUFFER_CTX *)OPENSSL_malloc(sizeof(BIO_LINEBUFFER_CTX));
 | 
			
		||||
	if (ctx == NULL) return(0);
 | 
			
		||||
	ctx->obuf=(char *)OPENSSL_malloc(DEFAULT_LINEBUFFER_SIZE);
 | 
			
		||||
	if (ctx->obuf == NULL) { OPENSSL_free(ctx); return(0); }
 | 
			
		||||
	ctx->obuf_size=DEFAULT_LINEBUFFER_SIZE;
 | 
			
		||||
	ctx->obuf_len=0;
 | 
			
		||||
 | 
			
		||||
	bi->init=1;
 | 
			
		||||
	bi->ptr=(char *)ctx;
 | 
			
		||||
	bi->flags=0;
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int linebuffer_free(BIO *a)
 | 
			
		||||
	{
 | 
			
		||||
	BIO_LINEBUFFER_CTX *b;
 | 
			
		||||
 | 
			
		||||
	if (a == NULL) return(0);
 | 
			
		||||
	b=(BIO_LINEBUFFER_CTX *)a->ptr;
 | 
			
		||||
	if (b->obuf != NULL) OPENSSL_free(b->obuf);
 | 
			
		||||
	OPENSSL_free(a->ptr);
 | 
			
		||||
	a->ptr=NULL;
 | 
			
		||||
	a->init=0;
 | 
			
		||||
	a->flags=0;
 | 
			
		||||
	return(1);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
static int linebuffer_read(BIO *b, char *out, int outl)
 | 
			
		||||
	{
 | 
			
		||||
	int ret=0;
 | 
			
		||||
 
 | 
			
		||||
	if (out == NULL) return(0);
 | 
			
		||||
	if (b->next_bio == NULL) return(0);
 | 
			
		||||
	ret=BIO_read(b->next_bio,out,outl);
 | 
			
		||||
	BIO_clear_retry_flags(b);
 | 
			
		||||
	BIO_copy_next_retry(b);
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int linebuffer_write(BIO *b, const char *in, int inl)
 | 
			
		||||
	{
 | 
			
		||||
	int i,num=0,foundnl;
 | 
			
		||||
	BIO_LINEBUFFER_CTX *ctx;
 | 
			
		||||
 | 
			
		||||
	if ((in == NULL) || (inl <= 0)) return(0);
 | 
			
		||||
	ctx=(BIO_LINEBUFFER_CTX *)b->ptr;
 | 
			
		||||
	if ((ctx == NULL) || (b->next_bio == NULL)) return(0);
 | 
			
		||||
 | 
			
		||||
	BIO_clear_retry_flags(b);
 | 
			
		||||
 | 
			
		||||
	do
 | 
			
		||||
		{
 | 
			
		||||
		const char *p;
 | 
			
		||||
 | 
			
		||||
		for(p = in; p < in + inl && *p != '\n'; p++)
 | 
			
		||||
			;
 | 
			
		||||
		if (*p == '\n')
 | 
			
		||||
			{
 | 
			
		||||
			p++;
 | 
			
		||||
			foundnl = 1;
 | 
			
		||||
			}
 | 
			
		||||
		else
 | 
			
		||||
			foundnl = 0;
 | 
			
		||||
 | 
			
		||||
		/* If a NL was found and we already have text in the save
 | 
			
		||||
		   buffer, concatenate them and write */
 | 
			
		||||
		while ((foundnl || p - in > ctx->obuf_size - ctx->obuf_len)
 | 
			
		||||
			&& ctx->obuf_len > 0)
 | 
			
		||||
			{
 | 
			
		||||
			int orig_olen = ctx->obuf_len;
 | 
			
		||||
			
 | 
			
		||||
			i = ctx->obuf_size - ctx->obuf_len;
 | 
			
		||||
			if (p - in > 0)
 | 
			
		||||
				{
 | 
			
		||||
				if (i >= p - in)
 | 
			
		||||
					{
 | 
			
		||||
					memcpy(&(ctx->obuf[ctx->obuf_len]),
 | 
			
		||||
						in,p - in);
 | 
			
		||||
					ctx->obuf_len += p - in;
 | 
			
		||||
					inl -= p - in;
 | 
			
		||||
					num += p - in;
 | 
			
		||||
					in = p;
 | 
			
		||||
					}
 | 
			
		||||
				else
 | 
			
		||||
					{
 | 
			
		||||
					memcpy(&(ctx->obuf[ctx->obuf_len]),
 | 
			
		||||
						in,i);
 | 
			
		||||
					ctx->obuf_len += i;
 | 
			
		||||
					inl -= i;
 | 
			
		||||
					in += i;
 | 
			
		||||
					num += i;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
BIO_write(b->next_bio, "<*<", 3);
 | 
			
		||||
#endif
 | 
			
		||||
			i=BIO_write(b->next_bio,
 | 
			
		||||
				ctx->obuf, ctx->obuf_len);
 | 
			
		||||
			if (i <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				ctx->obuf_len = orig_olen;
 | 
			
		||||
				BIO_copy_next_retry(b);
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
BIO_write(b->next_bio, ">*>", 3);
 | 
			
		||||
#endif
 | 
			
		||||
				if (i < 0) return((num > 0)?num:i);
 | 
			
		||||
				if (i == 0) return(num);
 | 
			
		||||
				}
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
BIO_write(b->next_bio, ">*>", 3);
 | 
			
		||||
#endif
 | 
			
		||||
			if (i < ctx->obuf_len)
 | 
			
		||||
				memmove(ctx->obuf, ctx->obuf + i,
 | 
			
		||||
					ctx->obuf_len - i);
 | 
			
		||||
			ctx->obuf_len-=i;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		/* Now that the save buffer is emptied, let's write the input
 | 
			
		||||
		   buffer if a NL was found and there is anything to write. */
 | 
			
		||||
		if ((foundnl || p - in > ctx->obuf_size) && p - in > 0)
 | 
			
		||||
			{
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
BIO_write(b->next_bio, "<*<", 3);
 | 
			
		||||
#endif
 | 
			
		||||
			i=BIO_write(b->next_bio,in,p - in);
 | 
			
		||||
			if (i <= 0)
 | 
			
		||||
				{
 | 
			
		||||
				BIO_copy_next_retry(b);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
BIO_write(b->next_bio, ">*>", 3);
 | 
			
		||||
#endif
 | 
			
		||||
				if (i < 0) return((num > 0)?num:i);
 | 
			
		||||
				if (i == 0) return(num);
 | 
			
		||||
				}
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
BIO_write(b->next_bio, ">*>", 3);
 | 
			
		||||
#endif
 | 
			
		||||
			num+=i;
 | 
			
		||||
			in+=i;
 | 
			
		||||
			inl-=i;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	while(foundnl && inl > 0);
 | 
			
		||||
	/* We've written as much as we can.  The rest of the input buffer, if
 | 
			
		||||
	   any, is text that doesn't and with a NL and therefore needs to be
 | 
			
		||||
	   saved for the next trip. */
 | 
			
		||||
	if (inl > 0)
 | 
			
		||||
		{
 | 
			
		||||
		memcpy(&(ctx->obuf[ctx->obuf_len]), in, inl);
 | 
			
		||||
		ctx->obuf_len += inl;
 | 
			
		||||
		num += inl;
 | 
			
		||||
		}
 | 
			
		||||
	return num;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long linebuffer_ctrl(BIO *b, int cmd, long num, void *ptr)
 | 
			
		||||
	{
 | 
			
		||||
	BIO *dbio;
 | 
			
		||||
	BIO_LINEBUFFER_CTX *ctx;
 | 
			
		||||
	long ret=1;
 | 
			
		||||
	char *p;
 | 
			
		||||
	int r;
 | 
			
		||||
	int obs;
 | 
			
		||||
 | 
			
		||||
	ctx=(BIO_LINEBUFFER_CTX *)b->ptr;
 | 
			
		||||
 | 
			
		||||
	switch (cmd)
 | 
			
		||||
		{
 | 
			
		||||
	case BIO_CTRL_RESET:
 | 
			
		||||
		ctx->obuf_len=0;
 | 
			
		||||
		if (b->next_bio == NULL) return(0);
 | 
			
		||||
		ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_INFO:
 | 
			
		||||
		ret=(long)ctx->obuf_len;
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_WPENDING:
 | 
			
		||||
		ret=(long)ctx->obuf_len;
 | 
			
		||||
		if (ret == 0)
 | 
			
		||||
			{
 | 
			
		||||
			if (b->next_bio == NULL) return(0);
 | 
			
		||||
			ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_SET_BUFF_SIZE:
 | 
			
		||||
		obs=(int)num;
 | 
			
		||||
		p=ctx->obuf;
 | 
			
		||||
		if ((obs > DEFAULT_LINEBUFFER_SIZE) && (obs != ctx->obuf_size))
 | 
			
		||||
			{
 | 
			
		||||
			p=(char *)OPENSSL_malloc((int)num);
 | 
			
		||||
			if (p == NULL)
 | 
			
		||||
				goto malloc_error;
 | 
			
		||||
			}
 | 
			
		||||
		if (ctx->obuf != p)
 | 
			
		||||
			{
 | 
			
		||||
			if (ctx->obuf_len > obs)
 | 
			
		||||
				{
 | 
			
		||||
				ctx->obuf_len = obs;
 | 
			
		||||
				}
 | 
			
		||||
			memcpy(p, ctx->obuf, ctx->obuf_len);
 | 
			
		||||
			OPENSSL_free(ctx->obuf);
 | 
			
		||||
			ctx->obuf=p;
 | 
			
		||||
			ctx->obuf_size=obs;
 | 
			
		||||
			}
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_C_DO_STATE_MACHINE:
 | 
			
		||||
		if (b->next_bio == NULL) return(0);
 | 
			
		||||
		BIO_clear_retry_flags(b);
 | 
			
		||||
		ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		BIO_copy_next_retry(b);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case BIO_CTRL_FLUSH:
 | 
			
		||||
		if (b->next_bio == NULL) return(0);
 | 
			
		||||
		if (ctx->obuf_len <= 0)
 | 
			
		||||
			{
 | 
			
		||||
			ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		for (;;)
 | 
			
		||||
			{
 | 
			
		||||
			BIO_clear_retry_flags(b);
 | 
			
		||||
			if (ctx->obuf_len > 0)
 | 
			
		||||
				{
 | 
			
		||||
				r=BIO_write(b->next_bio,
 | 
			
		||||
					ctx->obuf, ctx->obuf_len);
 | 
			
		||||
#if 0
 | 
			
		||||
fprintf(stderr,"FLUSH %3d -> %3d\n",ctx->obuf_len,r);
 | 
			
		||||
#endif
 | 
			
		||||
				BIO_copy_next_retry(b);
 | 
			
		||||
				if (r <= 0) return((long)r);
 | 
			
		||||
				if (r < ctx->obuf_len)
 | 
			
		||||
					memmove(ctx->obuf, ctx->obuf + r,
 | 
			
		||||
						ctx->obuf_len - r);
 | 
			
		||||
				ctx->obuf_len-=r;
 | 
			
		||||
				}
 | 
			
		||||
			else
 | 
			
		||||
				{
 | 
			
		||||
				ctx->obuf_len=0;
 | 
			
		||||
				ret=1;
 | 
			
		||||
				break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		break;
 | 
			
		||||
	case BIO_CTRL_DUP:
 | 
			
		||||
		dbio=(BIO *)ptr;
 | 
			
		||||
		if (	!BIO_set_write_buffer_size(dbio,ctx->obuf_size))
 | 
			
		||||
			ret=0;
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		if (b->next_bio == NULL) return(0);
 | 
			
		||||
		ret=BIO_ctrl(b->next_bio,cmd,num,ptr);
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
	return(ret);
 | 
			
		||||
malloc_error:
 | 
			
		||||
	BIOerr(BIO_F_LINEBUFFER_CTRL,ERR_R_MALLOC_FAILURE);
 | 
			
		||||
	return(0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long linebuffer_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
 | 
			
		||||
	{
 | 
			
		||||
	long ret=1;
 | 
			
		||||
 | 
			
		||||
	if (b->next_bio == NULL) return(0);
 | 
			
		||||
	switch (cmd)
 | 
			
		||||
		{
 | 
			
		||||
	default:
 | 
			
		||||
		ret=BIO_callback_ctrl(b->next_bio,cmd,fp);
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
	return(ret);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int linebuffer_gets(BIO *b, char *buf, int size)
 | 
			
		||||
	{
 | 
			
		||||
	if (b->next_bio == NULL) return(0);
 | 
			
		||||
	return(BIO_gets(b->next_bio,buf,size));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int linebuffer_puts(BIO *b, const char *str)
 | 
			
		||||
	{
 | 
			
		||||
	return(linebuffer_write(b,str,strlen(str)));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -91,7 +91,6 @@ extern "C" {
 | 
			
		||||
#define BIO_TYPE_NULL_FILTER	(17|0x0200)
 | 
			
		||||
#define BIO_TYPE_BER		(18|0x0200)		/* BER -> bin filter */
 | 
			
		||||
#define BIO_TYPE_BIO		(19|0x0400)		/* (half a) BIO pair */
 | 
			
		||||
#define BIO_TYPE_LINEBUFFER	(20|0x0200)		/* filter */
 | 
			
		||||
 | 
			
		||||
#define BIO_TYPE_DESCRIPTOR	0x0100	/* socket, fd, connect or accept */
 | 
			
		||||
#define BIO_TYPE_FILTER		0x0200
 | 
			
		||||
@@ -555,9 +554,6 @@ BIO_METHOD *BIO_s_bio(void);
 | 
			
		||||
BIO_METHOD *BIO_s_null(void);
 | 
			
		||||
BIO_METHOD *BIO_f_null(void);
 | 
			
		||||
BIO_METHOD *BIO_f_buffer(void);
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
BIO_METHOD *BIO_f_linebuffer(void);
 | 
			
		||||
#endif
 | 
			
		||||
BIO_METHOD *BIO_f_nbio_test(void);
 | 
			
		||||
/* BIO_METHOD *BIO_f_ber(void); */
 | 
			
		||||
 | 
			
		||||
@@ -644,7 +640,6 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
 | 
			
		||||
#define BIO_F_CONN_CTRL					 127
 | 
			
		||||
#define BIO_F_CONN_STATE				 115
 | 
			
		||||
#define BIO_F_FILE_CTRL					 116
 | 
			
		||||
#define BIO_F_LINEBUFFER_CTRL				 129
 | 
			
		||||
#define BIO_F_MEM_READ					 128
 | 
			
		||||
#define BIO_F_MEM_WRITE					 117
 | 
			
		||||
#define BIO_F_SSL_NEW					 118
 | 
			
		||||
 
 | 
			
		||||
@@ -91,7 +91,6 @@ static ERR_STRING_DATA BIO_str_functs[]=
 | 
			
		||||
{ERR_PACK(0,BIO_F_CONN_CTRL,0),	"CONN_CTRL"},
 | 
			
		||||
{ERR_PACK(0,BIO_F_CONN_STATE,0),	"CONN_STATE"},
 | 
			
		||||
{ERR_PACK(0,BIO_F_FILE_CTRL,0),	"FILE_CTRL"},
 | 
			
		||||
{ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0),	"LINEBUFFER_CTRL"},
 | 
			
		||||
{ERR_PACK(0,BIO_F_MEM_READ,0),	"MEM_READ"},
 | 
			
		||||
{ERR_PACK(0,BIO_F_MEM_WRITE,0),	"MEM_WRITE"},
 | 
			
		||||
{ERR_PACK(0,BIO_F_SSL_NEW,0),	"SSL_new"},
 | 
			
		||||
 
 | 
			
		||||
@@ -236,7 +236,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
 | 
			
		||||
				}
 | 
			
		||||
			c->state=BIO_CONN_S_CONNECT;
 | 
			
		||||
 | 
			
		||||
#if defined(SO_KEEPALIVE) && !defined(MPE)
 | 
			
		||||
#ifdef SO_KEEPALIVE
 | 
			
		||||
			i=1;
 | 
			
		||||
			i=setsockopt(b->num,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
 | 
			
		||||
			if (i < 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -68,8 +68,7 @@ bnbug: bnbug.c ../../libcrypto.a top
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
# elf
 | 
			
		||||
 
 | 
			
		||||
@@ -1611,7 +1611,7 @@ bn_mul_comba4
 | 
			
		||||
	.IMPORT	$global$,DATA
 | 
			
		||||
	.SPACE	$TEXT$
 | 
			
		||||
	.SUBSPA	$CODE$
 | 
			
		||||
	.SUBSPA	$LIT$,ACCESS=0x2c
 | 
			
		||||
	.SUBSPA	$LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16
 | 
			
		||||
C$7
 | 
			
		||||
	.ALIGN	8
 | 
			
		||||
	.STRINGZ	"Division would overflow (%d)\n"
 | 
			
		||||
 
 | 
			
		||||
@@ -1598,7 +1598,7 @@ bn_mul_comba4
 | 
			
		||||
	.IMPORT	$global$,DATA
 | 
			
		||||
	.SPACE	$TEXT$
 | 
			
		||||
	.SUBSPA	$CODE$
 | 
			
		||||
	.SUBSPA	$LIT$,ACCESS=0x2c
 | 
			
		||||
	.SUBSPA	$LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16
 | 
			
		||||
C$4
 | 
			
		||||
	.ALIGN	8
 | 
			
		||||
	.STRINGZ	"Division would overflow (%d)\n"
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,16 @@ int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b,
 | 
			
		||||
 | 
			
		||||
	if (a == b)
 | 
			
		||||
		{
 | 
			
		||||
#if 1 
 | 
			
		||||
		bn_wexpand(tmp,a->top*2);
 | 
			
		||||
		bn_wexpand(tmp2,a->top*4);
 | 
			
		||||
		bn_sqr_recursive(tmp->d,a->d,a->top,tmp2->d);
 | 
			
		||||
		tmp->top=a->top*2;
 | 
			
		||||
		if (tmp->top > 0 && tmp->d[tmp->top-1] == 0)
 | 
			
		||||
			tmp->top--;
 | 
			
		||||
#else
 | 
			
		||||
		if (!BN_sqr(tmp,a,ctx)) goto err;
 | 
			
		||||
#endif
 | 
			
		||||
		}
 | 
			
		||||
	else
 | 
			
		||||
		{
 | 
			
		||||
 
 | 
			
		||||
@@ -188,7 +188,7 @@ void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp)
 | 
			
		||||
 | 
			
		||||
#ifdef BN_RECURSION
 | 
			
		||||
/* r is 2*n words in size,
 | 
			
		||||
 * a and b are both n words in size.    (There's not actually a 'b' here ...)
 | 
			
		||||
 * a and b are both n words in size.
 | 
			
		||||
 * n must be a power of 2.
 | 
			
		||||
 * We multiply and return the result.
 | 
			
		||||
 * t must be 2*n words in size
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -47,8 +47,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
# elf
 | 
			
		||||
 
 | 
			
		||||
@@ -42,8 +42,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -40,8 +40,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -211,8 +211,7 @@ $ LIB_BIO = "bio_lib,bio_cb,bio_err,"+ -
 | 
			
		||||
	"bss_mem,bss_null,bss_fd,"+ -
 | 
			
		||||
	"bss_file,bss_sock,bss_conn,"+ -
 | 
			
		||||
	"bf_null,bf_buff,b_print,b_dump,"+ -
 | 
			
		||||
	"b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log,"+ -
 | 
			
		||||
	"bf_lbuf"
 | 
			
		||||
	"b_sock,bss_acpt,bf_nbio,bss_rtcp,bss_bio,bss_log"
 | 
			
		||||
$ LIB_STACK = "stack"
 | 
			
		||||
$ LIB_LHASH = "lhash,lh_stats"
 | 
			
		||||
$ LIB_RAND = "md_rand,randfile,rand_lib,rand_err,rand_egd,rand_win"
 | 
			
		||||
 
 | 
			
		||||
@@ -57,8 +57,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
des: des.o cbc3_enc.o lib
 | 
			
		||||
 
 | 
			
		||||
@@ -271,9 +271,7 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt,
 | 
			
		||||
#elif defined(MAC_OS_pre_X)
 | 
			
		||||
	tty=stdin;
 | 
			
		||||
#else
 | 
			
		||||
#ifndef MPE
 | 
			
		||||
	if ((tty=fopen("/dev/tty","r")) == NULL)
 | 
			
		||||
#endif
 | 
			
		||||
		tty=stdin;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@@ -314,12 +312,8 @@ int des_read_pw(char *buf, char *buff, int size, const char *prompt,
 | 
			
		||||
 | 
			
		||||
#if defined(TTY_set) && !defined(VMS)
 | 
			
		||||
	if (is_a_tty && (TTY_set(fileno(tty),&tty_new) == -1))
 | 
			
		||||
#ifdef MPE 
 | 
			
		||||
		; /* MPE lies -- echo really has been disabled */
 | 
			
		||||
#else
 | 
			
		||||
		return(-1);
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef VMS
 | 
			
		||||
	tty_new[0] = tty_orig[0];
 | 
			
		||||
	tty_new[1] = tty_orig[1] | TT$M_NOECHO;
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -41,8 +41,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -206,35 +206,40 @@ void ERR_load_DSO_strings(void);
 | 
			
		||||
/* Function codes. */
 | 
			
		||||
#define DSO_F_DLFCN_BIND_FUNC				 100
 | 
			
		||||
#define DSO_F_DLFCN_BIND_VAR				 101
 | 
			
		||||
#define DSO_F_DLFCN_LOAD				 102
 | 
			
		||||
#define DSO_F_DLFCN_UNLOAD				 103
 | 
			
		||||
#define DSO_F_DL_BIND_FUNC				 104
 | 
			
		||||
#define DSO_F_DL_BIND_VAR				 105
 | 
			
		||||
#define DSO_F_DL_LOAD					 106
 | 
			
		||||
#define DSO_F_DL_UNLOAD					 107
 | 
			
		||||
#define DSO_F_DSO_BIND_FUNC				 108
 | 
			
		||||
#define DSO_F_DSO_BIND_VAR				 109
 | 
			
		||||
#define DSO_F_DSO_CTRL					 110
 | 
			
		||||
#define DSO_F_DSO_FREE					 111
 | 
			
		||||
#define DSO_F_DSO_LOAD					 112
 | 
			
		||||
#define DSO_F_DSO_NEW_METHOD				 113
 | 
			
		||||
#define DSO_F_DSO_UP					 114
 | 
			
		||||
#define DSO_F_VMS_BIND_VAR				 115
 | 
			
		||||
#define DSO_F_VMS_LOAD					 116
 | 
			
		||||
#define DSO_F_VMS_UNLOAD				 117
 | 
			
		||||
#define DSO_F_WIN32_BIND_FUNC				 118
 | 
			
		||||
#define DSO_F_WIN32_BIND_VAR				 119
 | 
			
		||||
#define DSO_F_DLFCN_CTRL				 102
 | 
			
		||||
#define DSO_F_DLFCN_LOAD				 103
 | 
			
		||||
#define DSO_F_DLFCN_UNLOAD				 104
 | 
			
		||||
#define DSO_F_DL_BIND_FUNC				 105
 | 
			
		||||
#define DSO_F_DL_BIND_VAR				 106
 | 
			
		||||
#define DSO_F_DL_CTRL					 107
 | 
			
		||||
#define DSO_F_DL_LOAD					 108
 | 
			
		||||
#define DSO_F_DL_UNLOAD					 109
 | 
			
		||||
#define DSO_F_DSO_BIND_FUNC				 110
 | 
			
		||||
#define DSO_F_DSO_BIND_VAR				 111
 | 
			
		||||
#define DSO_F_DSO_CTRL					 112
 | 
			
		||||
#define DSO_F_DSO_FREE					 113
 | 
			
		||||
#define DSO_F_DSO_LOAD					 114
 | 
			
		||||
#define DSO_F_DSO_NEW_METHOD				 115
 | 
			
		||||
#define DSO_F_DSO_UP					 116
 | 
			
		||||
#define DSO_F_VMS_BIND_VAR				 122
 | 
			
		||||
#define DSO_F_VMS_CTRL					 123
 | 
			
		||||
#define DSO_F_VMS_LOAD					 124
 | 
			
		||||
#define DSO_F_VMS_UNLOAD				 125
 | 
			
		||||
#define DSO_F_WIN32_BIND_FUNC				 117
 | 
			
		||||
#define DSO_F_WIN32_BIND_VAR				 118
 | 
			
		||||
#define DSO_F_WIN32_CTRL				 119
 | 
			
		||||
#define DSO_F_WIN32_LOAD				 120
 | 
			
		||||
#define DSO_F_WIN32_UNLOAD				 121
 | 
			
		||||
 | 
			
		||||
/* Reason codes. */
 | 
			
		||||
#define DSO_R_CTRL_FAILED				 100
 | 
			
		||||
#define DSO_R_FILENAME_TOO_BIG				 101
 | 
			
		||||
#define DSO_R_FINISH_FAILED				 102
 | 
			
		||||
#define DSO_R_LOAD_FAILED				 103
 | 
			
		||||
#define DSO_R_NULL_HANDLE				 104
 | 
			
		||||
#define DSO_R_STACK_ERROR				 105
 | 
			
		||||
#define DSO_R_SYM_FAILURE				 106
 | 
			
		||||
#define DSO_R_FILENAME_TOO_BIG				 109
 | 
			
		||||
#define DSO_R_FINISH_FAILED				 101
 | 
			
		||||
#define DSO_R_LOAD_FAILED				 102
 | 
			
		||||
#define DSO_R_NULL_HANDLE				 103
 | 
			
		||||
#define DSO_R_STACK_ERROR				 104
 | 
			
		||||
#define DSO_R_SYM_FAILURE				 105
 | 
			
		||||
#define DSO_R_UNKNOWN_COMMAND				 106
 | 
			
		||||
#define DSO_R_UNLOAD_FAILED				 107
 | 
			
		||||
#define DSO_R_UNSUPPORTED				 108
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -81,8 +81,8 @@ static int dl_unbind_var(DSO *dso, char *symname, void *symptr);
 | 
			
		||||
static int dl_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
 | 
			
		||||
static int dl_init(DSO *dso);
 | 
			
		||||
static int dl_finish(DSO *dso);
 | 
			
		||||
static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
#endif
 | 
			
		||||
static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
 | 
			
		||||
static DSO_METHOD dso_meth_dl = {
 | 
			
		||||
	"OpenSSL 'dl' shared library method",
 | 
			
		||||
@@ -95,7 +95,7 @@ static DSO_METHOD dso_meth_dl = {
 | 
			
		||||
	NULL, /* unbind_var */
 | 
			
		||||
	NULL, /* unbind_func */
 | 
			
		||||
#endif
 | 
			
		||||
	NULL, /* ctrl */
 | 
			
		||||
	dl_ctrl,
 | 
			
		||||
	NULL, /* init */
 | 
			
		||||
	NULL  /* finish */
 | 
			
		||||
	};
 | 
			
		||||
@@ -224,4 +224,28 @@ static DSO_FUNC_TYPE dl_bind_func(DSO *dso, const char *symname)
 | 
			
		||||
	return((DSO_FUNC_TYPE)sym);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static int dl_ctrl(DSO *dso, int cmd, long larg, void *parg)
 | 
			
		||||
	{
 | 
			
		||||
	if(dso == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DSOerr(DSO_F_DL_CTRL,ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
		return(-1);
 | 
			
		||||
		}
 | 
			
		||||
	switch(cmd)
 | 
			
		||||
		{
 | 
			
		||||
	case DSO_CTRL_GET_FLAGS:
 | 
			
		||||
		return dso->flags;
 | 
			
		||||
	case DSO_CTRL_SET_FLAGS:
 | 
			
		||||
		dso->flags = (int)larg;
 | 
			
		||||
		return(0);
 | 
			
		||||
	case DSO_CTRL_OR_FLAGS:
 | 
			
		||||
		dso->flags |= (int)larg;
 | 
			
		||||
		return(0);
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
	DSOerr(DSO_F_DL_CTRL,DSO_R_UNKNOWN_COMMAND);
 | 
			
		||||
	return(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif /* DSO_DL */
 | 
			
		||||
 
 | 
			
		||||
@@ -82,8 +82,8 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname);
 | 
			
		||||
static int dlfcn_unbind(DSO *dso, char *symname, void *symptr);
 | 
			
		||||
static int dlfcn_init(DSO *dso);
 | 
			
		||||
static int dlfcn_finish(DSO *dso);
 | 
			
		||||
static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
#endif
 | 
			
		||||
static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
 | 
			
		||||
static DSO_METHOD dso_meth_dlfcn = {
 | 
			
		||||
	"OpenSSL 'dlfcn' shared library method",
 | 
			
		||||
@@ -96,7 +96,7 @@ static DSO_METHOD dso_meth_dlfcn = {
 | 
			
		||||
	NULL, /* unbind_var */
 | 
			
		||||
	NULL, /* unbind_func */
 | 
			
		||||
#endif
 | 
			
		||||
	NULL, /* ctrl */
 | 
			
		||||
	dlfcn_ctrl,
 | 
			
		||||
	NULL, /* init */
 | 
			
		||||
	NULL  /* finish */
 | 
			
		||||
	};
 | 
			
		||||
@@ -249,4 +249,28 @@ static DSO_FUNC_TYPE dlfcn_bind_func(DSO *dso, const char *symname)
 | 
			
		||||
	return(sym);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long dlfcn_ctrl(DSO *dso, int cmd, long larg, void *parg)
 | 
			
		||||
	{
 | 
			
		||||
	if(dso == NULL)
 | 
			
		||||
		{
 | 
			
		||||
		DSOerr(DSO_F_DLFCN_CTRL,ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
		return(-1);
 | 
			
		||||
		}
 | 
			
		||||
	switch(cmd)
 | 
			
		||||
		{
 | 
			
		||||
	case DSO_CTRL_GET_FLAGS:
 | 
			
		||||
		return dso->flags;
 | 
			
		||||
	case DSO_CTRL_SET_FLAGS:
 | 
			
		||||
		dso->flags = (int)larg;
 | 
			
		||||
		return(0);
 | 
			
		||||
	case DSO_CTRL_OR_FLAGS:
 | 
			
		||||
		dso->flags |= (int)larg;
 | 
			
		||||
		return(0);
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
	DSOerr(DSO_F_DLFCN_CTRL,DSO_R_UNKNOWN_COMMAND);
 | 
			
		||||
	return(-1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#endif /* DSO_DLFCN */
 | 
			
		||||
 
 | 
			
		||||
@@ -68,10 +68,12 @@ static ERR_STRING_DATA DSO_str_functs[]=
 | 
			
		||||
	{
 | 
			
		||||
{ERR_PACK(0,DSO_F_DLFCN_BIND_FUNC,0),	"DLFCN_BIND_FUNC"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DLFCN_BIND_VAR,0),	"DLFCN_BIND_VAR"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DLFCN_CTRL,0),	"DLFCN_CTRL"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DLFCN_LOAD,0),	"DLFCN_LOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DLFCN_UNLOAD,0),	"DLFCN_UNLOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DL_BIND_FUNC,0),	"DL_BIND_FUNC"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DL_BIND_VAR,0),	"DL_BIND_VAR"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DL_CTRL,0),	"DL_CTRL"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DL_LOAD,0),	"DL_LOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DL_UNLOAD,0),	"DL_UNLOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DSO_BIND_FUNC,0),	"DSO_bind_func"},
 | 
			
		||||
@@ -82,10 +84,12 @@ static ERR_STRING_DATA DSO_str_functs[]=
 | 
			
		||||
{ERR_PACK(0,DSO_F_DSO_NEW_METHOD,0),	"DSO_new_method"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_DSO_UP,0),	"DSO_up"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_VMS_BIND_VAR,0),	"VMS_BIND_VAR"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_VMS_CTRL,0),	"VMS_CTRL"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_VMS_LOAD,0),	"VMS_LOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_VMS_UNLOAD,0),	"VMS_UNLOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_WIN32_BIND_FUNC,0),	"WIN32_BIND_FUNC"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_WIN32_BIND_VAR,0),	"WIN32_BIND_VAR"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_WIN32_CTRL,0),	"WIN32_CTRL"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_WIN32_LOAD,0),	"WIN32_LOAD"},
 | 
			
		||||
{ERR_PACK(0,DSO_F_WIN32_UNLOAD,0),	"WIN32_UNLOAD"},
 | 
			
		||||
{0,NULL}
 | 
			
		||||
@@ -100,6 +104,7 @@ static ERR_STRING_DATA DSO_str_reasons[]=
 | 
			
		||||
{DSO_R_NULL_HANDLE                       ,"a null shared library handle was used"},
 | 
			
		||||
{DSO_R_STACK_ERROR                       ,"the meth_data stack is corrupt"},
 | 
			
		||||
{DSO_R_SYM_FAILURE                       ,"could not bind to the requested symbol name"},
 | 
			
		||||
{DSO_R_UNKNOWN_COMMAND                   ,"unknown control command"},
 | 
			
		||||
{DSO_R_UNLOAD_FAILED                     ,"could not unload the shared library"},
 | 
			
		||||
{DSO_R_UNSUPPORTED                       ,"functionality not supported"},
 | 
			
		||||
{0,NULL}
 | 
			
		||||
 
 | 
			
		||||
@@ -297,22 +297,6 @@ long DSO_ctrl(DSO *dso, int cmd, long larg, void *parg)
 | 
			
		||||
		DSOerr(DSO_F_DSO_CTRL,ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
		return(-1);
 | 
			
		||||
		}
 | 
			
		||||
	/* We should intercept certain generic commands and only pass control
 | 
			
		||||
	 * to the method-specific ctrl() function if it's something we don't
 | 
			
		||||
	 * handle. */
 | 
			
		||||
	switch(cmd)
 | 
			
		||||
		{
 | 
			
		||||
	case DSO_CTRL_GET_FLAGS:
 | 
			
		||||
		return dso->flags;
 | 
			
		||||
	case DSO_CTRL_SET_FLAGS:
 | 
			
		||||
		dso->flags = (int)larg;
 | 
			
		||||
		return(0);
 | 
			
		||||
	case DSO_CTRL_OR_FLAGS:
 | 
			
		||||
		dso->flags |= (int)larg;
 | 
			
		||||
		return(0);
 | 
			
		||||
	default:
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
	if((dso->meth == NULL) || (dso->meth->dso_ctrl == NULL))
 | 
			
		||||
		{
 | 
			
		||||
		DSOerr(DSO_F_DSO_CTRL,DSO_R_UNSUPPORTED);
 | 
			
		||||
 
 | 
			
		||||
@@ -87,8 +87,8 @@ static int vms_unbind_var(DSO *dso, char *symname, void *symptr);
 | 
			
		||||
static int vms_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
 | 
			
		||||
static int vms_init(DSO *dso);
 | 
			
		||||
static int vms_finish(DSO *dso);
 | 
			
		||||
static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
#endif
 | 
			
		||||
static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
 | 
			
		||||
static DSO_METHOD dso_meth_vms = {
 | 
			
		||||
	"OpenSSL 'VMS' shared library method",
 | 
			
		||||
@@ -101,7 +101,7 @@ static DSO_METHOD dso_meth_vms = {
 | 
			
		||||
	NULL, /* unbind_var */
 | 
			
		||||
	NULL, /* unbind_func */
 | 
			
		||||
#endif
 | 
			
		||||
	NULL, /* ctrl */
 | 
			
		||||
	vms_ctrl,
 | 
			
		||||
	NULL, /* init */
 | 
			
		||||
	NULL  /* finish */
 | 
			
		||||
	};
 | 
			
		||||
@@ -340,8 +340,32 @@ static void *vms_bind_var(DSO *dso, const char *symname)
 | 
			
		||||
static DSO_FUNC_TYPE vms_bind_func(DSO *dso, const char *symname)
 | 
			
		||||
	{
 | 
			
		||||
	DSO_FUNC_TYPE sym = 0;
 | 
			
		||||
	vms_bind_sym(dso, symname, (void **)&sym);
 | 
			
		||||
	vms_bind_sym(dso, symname, &sym);
 | 
			
		||||
	return sym;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long vms_ctrl(DSO *dso, int cmd, long larg, void *parg)
 | 
			
		||||
        {
 | 
			
		||||
        if(dso == NULL)
 | 
			
		||||
                {
 | 
			
		||||
                DSOerr(DSO_F_VMS_CTRL,ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
                return(-1);
 | 
			
		||||
                }
 | 
			
		||||
        switch(cmd)
 | 
			
		||||
                {
 | 
			
		||||
        case DSO_CTRL_GET_FLAGS:
 | 
			
		||||
                return dso->flags;
 | 
			
		||||
        case DSO_CTRL_SET_FLAGS:
 | 
			
		||||
                dso->flags = (int)larg;
 | 
			
		||||
                return(0);
 | 
			
		||||
        case DSO_CTRL_OR_FLAGS:
 | 
			
		||||
                dso->flags |= (int)larg;
 | 
			
		||||
                return(0);
 | 
			
		||||
        default:
 | 
			
		||||
                break;
 | 
			
		||||
                }
 | 
			
		||||
        DSOerr(DSO_F_VMS_CTRL,DSO_R_UNKNOWN_COMMAND);
 | 
			
		||||
        return(-1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#endif /* VMS */
 | 
			
		||||
 
 | 
			
		||||
@@ -80,8 +80,8 @@ static int win32_unbind_var(DSO *dso, char *symname, void *symptr);
 | 
			
		||||
static int win32_unbind_func(DSO *dso, char *symname, DSO_FUNC_TYPE symptr);
 | 
			
		||||
static int win32_init(DSO *dso);
 | 
			
		||||
static int win32_finish(DSO *dso);
 | 
			
		||||
static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
#endif
 | 
			
		||||
static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg);
 | 
			
		||||
 | 
			
		||||
static DSO_METHOD dso_meth_win32 = {
 | 
			
		||||
	"OpenSSL 'win32' shared library method",
 | 
			
		||||
@@ -94,7 +94,7 @@ static DSO_METHOD dso_meth_win32 = {
 | 
			
		||||
	NULL, /* unbind_var */
 | 
			
		||||
	NULL, /* unbind_func */
 | 
			
		||||
#endif
 | 
			
		||||
	NULL, /* ctrl */
 | 
			
		||||
	win32_ctrl,
 | 
			
		||||
	NULL, /* init */
 | 
			
		||||
	NULL  /* finish */
 | 
			
		||||
	};
 | 
			
		||||
@@ -246,4 +246,28 @@ static DSO_FUNC_TYPE win32_bind_func(DSO *dso, const char *symname)
 | 
			
		||||
	return((DSO_FUNC_TYPE)sym);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
static long win32_ctrl(DSO *dso, int cmd, long larg, void *parg)
 | 
			
		||||
        {
 | 
			
		||||
        if(dso == NULL)
 | 
			
		||||
                {
 | 
			
		||||
                DSOerr(DSO_F_WIN32_CTRL,ERR_R_PASSED_NULL_PARAMETER);
 | 
			
		||||
                return(-1);
 | 
			
		||||
                }
 | 
			
		||||
        switch(cmd)
 | 
			
		||||
                {
 | 
			
		||||
        case DSO_CTRL_GET_FLAGS:
 | 
			
		||||
                return dso->flags;
 | 
			
		||||
        case DSO_CTRL_SET_FLAGS:
 | 
			
		||||
                dso->flags = (int)larg;
 | 
			
		||||
                return(0);
 | 
			
		||||
        case DSO_CTRL_OR_FLAGS:
 | 
			
		||||
                dso->flags |= (int)larg;
 | 
			
		||||
                return(0);
 | 
			
		||||
        default:
 | 
			
		||||
                break;
 | 
			
		||||
                }
 | 
			
		||||
        DSOerr(DSO_F_WIN32_CTRL,DSO_R_UNKNOWN_COMMAND);
 | 
			
		||||
        return(-1);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
#endif /* WIN32 */
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -58,8 +58,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -463,20 +463,12 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
 | 
			
		||||
		ASN1_TYPE *param, EVP_CIPHER *cipher,
 | 
			
		||||
                EVP_MD *md, int en_de);
 | 
			
		||||
 | 
			
		||||
#ifndef NO_RSA
 | 
			
		||||
#define EVP_PKEY_assign_RSA(pkey,rsa) EVP_PKEY_assign((pkey),EVP_PKEY_RSA,\
 | 
			
		||||
					(char *)(rsa))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef NO_DSA
 | 
			
		||||
#define EVP_PKEY_assign_DSA(pkey,dsa) EVP_PKEY_assign((pkey),EVP_PKEY_DSA,\
 | 
			
		||||
					(char *)(dsa))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef NO_DH
 | 
			
		||||
#define EVP_PKEY_assign_DH(pkey,dh) EVP_PKEY_assign((pkey),EVP_PKEY_DH,\
 | 
			
		||||
					(char *)(dh))
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/* Add some extra combinations */
 | 
			
		||||
#define EVP_get_digestbynid(a) EVP_get_digestbyname(OBJ_nid2sn(a))
 | 
			
		||||
@@ -620,29 +612,17 @@ void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,unsigned char *k,
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
EVP_MD *EVP_md_null(void);
 | 
			
		||||
#ifndef NO_MD2
 | 
			
		||||
EVP_MD *EVP_md2(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_MD4
 | 
			
		||||
EVP_MD *EVP_md4(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_MD5
 | 
			
		||||
EVP_MD *EVP_md5(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_SHA
 | 
			
		||||
EVP_MD *EVP_sha(void);
 | 
			
		||||
EVP_MD *EVP_sha1(void);
 | 
			
		||||
EVP_MD *EVP_dss(void);
 | 
			
		||||
EVP_MD *EVP_dss1(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_MDC2
 | 
			
		||||
EVP_MD *EVP_mdc2(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_RIPEMD
 | 
			
		||||
EVP_MD *EVP_ripemd160(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
EVP_CIPHER *EVP_enc_null(void);		/* does nothing :-) */
 | 
			
		||||
#ifndef NO_DES
 | 
			
		||||
EVP_CIPHER *EVP_des_ecb(void);
 | 
			
		||||
EVP_CIPHER *EVP_des_ede(void);
 | 
			
		||||
EVP_CIPHER *EVP_des_ede3(void);
 | 
			
		||||
@@ -656,43 +636,31 @@ EVP_CIPHER *EVP_des_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_des_ede_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_des_ede3_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_desx_cbc(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_RC4
 | 
			
		||||
EVP_CIPHER *EVP_rc4(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc4_40(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_IDEA
 | 
			
		||||
EVP_CIPHER *EVP_idea_ecb(void);
 | 
			
		||||
EVP_CIPHER *EVP_idea_cfb(void);
 | 
			
		||||
EVP_CIPHER *EVP_idea_ofb(void);
 | 
			
		||||
EVP_CIPHER *EVP_idea_cbc(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_RC2
 | 
			
		||||
EVP_CIPHER *EVP_rc2_ecb(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc2_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc2_40_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc2_64_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc2_cfb(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc2_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_BF
 | 
			
		||||
EVP_CIPHER *EVP_bf_ecb(void);
 | 
			
		||||
EVP_CIPHER *EVP_bf_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_bf_cfb(void);
 | 
			
		||||
EVP_CIPHER *EVP_bf_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_CAST
 | 
			
		||||
EVP_CIPHER *EVP_cast5_ecb(void);
 | 
			
		||||
EVP_CIPHER *EVP_cast5_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_cast5_cfb(void);
 | 
			
		||||
EVP_CIPHER *EVP_cast5_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef NO_RC5
 | 
			
		||||
EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc5_32_12_16_cfb(void);
 | 
			
		||||
EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void OpenSSL_add_all_algorithms(void);
 | 
			
		||||
void OpenSSL_add_all_ciphers(void);
 | 
			
		||||
void OpenSSL_add_all_digests(void);
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ $	IF F$PARSE("WRK_SSLINCLUDE:") .EQS. "" THEN -
 | 
			
		||||
$
 | 
			
		||||
$	SDIRS := ,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,-
 | 
			
		||||
		 DES,RC2,RC4,RC5,IDEA,BF,CAST,-
 | 
			
		||||
		 BN,RSA,DSA,DH,DSO,-
 | 
			
		||||
		 BN,RSA,DSA,DH,DSO,ENGINE,-
 | 
			
		||||
		 BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,-
 | 
			
		||||
		 EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP
 | 
			
		||||
$	EXHEADER_ := crypto.h,tmdiff.h,opensslv.h,opensslconf.h,ebcdic.h,symhacks.h
 | 
			
		||||
@@ -57,6 +57,7 @@ $	EXHEADER_RSA := rsa.h
 | 
			
		||||
$	EXHEADER_DSA := dsa.h
 | 
			
		||||
$	EXHEADER_DH := dh.h
 | 
			
		||||
$	EXHEADER_DSO := dso.h
 | 
			
		||||
$	EXHEADER_ENGINE := engine.h
 | 
			
		||||
$	EXHEADER_BUFFER := buffer.h
 | 
			
		||||
$	EXHEADER_BIO := bio.h
 | 
			
		||||
$	EXHEADER_STACK := stack.h,safestack.h
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -40,8 +40,7 @@ all:    lib
 | 
			
		||||
 | 
			
		||||
lib:    $(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -50,8 +50,7 @@ all:    lib
 | 
			
		||||
 | 
			
		||||
lib:    $(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
# elf
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	obj_dat.h lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -25,8 +25,8 @@
 | 
			
		||||
 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
 | 
			
		||||
 *  major minor fix final patch/beta)
 | 
			
		||||
 */
 | 
			
		||||
#define OPENSSL_VERSION_NUMBER	0x00907000L
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.7-dev 24 Sep 2000"
 | 
			
		||||
#define OPENSSL_VERSION_NUMBER	0x00906002L
 | 
			
		||||
#define OPENSSL_VERSION_TEXT	"OpenSSL 0.9.6-beta2 17 Sep 2000"
 | 
			
		||||
#define OPENSSL_VERSION_PTEXT	" part of " OPENSSL_VERSION_TEXT
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -40,8 +40,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -45,8 +45,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -58,8 +58,7 @@ verify: verify.o example.o lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -172,17 +172,12 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
 | 
			
		||||
		PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_NO_CONTENT);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
#if 0
 | 
			
		||||
	/* NB: this test commented out because some versions of Netscape
 | 
			
		||||
	 * illegally include zero length content when signing data.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	/* Check for data and content: two sets of data */
 | 
			
		||||
	if(!PKCS7_get_detached(p7) && indata) {
 | 
			
		||||
				PKCS7err(PKCS7_F_PKCS7_VERIFY,PKCS7_R_CONTENT_AND_DATA_PRESENT);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	sinfos = PKCS7_get_signer_info(p7);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
@@ -171,16 +171,9 @@ typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
 | 
			
		||||
 | 
			
		||||
#include <lmcons.h>
 | 
			
		||||
#include <lmstats.h>
 | 
			
		||||
#if 1 /* The NET API is Unicode only.  It requires the use of the UNICODE
 | 
			
		||||
       * macro.  When UNICODE is defined LPTSTR becomes LPWSTR.  LMSTR was
 | 
			
		||||
       * was added to the Platform SDK to allow the NET API to be used in
 | 
			
		||||
       * non-Unicode applications provided that Unicode strings were still
 | 
			
		||||
       * used for input.  LMSTR is defined as LPWSTR.
 | 
			
		||||
       */
 | 
			
		||||
typedef NET_API_STATUS (NET_API_FUNCTION * NETSTATGET)
 | 
			
		||||
        (LPWSTR, LPWSTR, DWORD, DWORD, LPBYTE*);
 | 
			
		||||
        (LMSTR, LMSTR, DWORD, DWORD, LPBYTE*);
 | 
			
		||||
typedef NET_API_STATUS (NET_API_FUNCTION * NETFREE)(LPBYTE);
 | 
			
		||||
#endif /* 1 */
 | 
			
		||||
 | 
			
		||||
int RAND_poll(void)
 | 
			
		||||
{
 | 
			
		||||
@@ -191,34 +184,18 @@ int RAND_poll(void)
 | 
			
		||||
	HWND h;
 | 
			
		||||
 | 
			
		||||
	HMODULE advapi, kernel, user, netapi;
 | 
			
		||||
	CRYPTACQUIRECONTEXT acquire = 0;
 | 
			
		||||
	CRYPTGENRANDOM gen = 0;
 | 
			
		||||
	CRYPTRELEASECONTEXT release = 0;
 | 
			
		||||
#if 1 /* There was previously a problem with NETSTATGET.  Currently, this
 | 
			
		||||
       * section is still experimental, but if all goes well, this conditional
 | 
			
		||||
       * will be removed
 | 
			
		||||
       */
 | 
			
		||||
	NETSTATGET netstatget = 0;
 | 
			
		||||
	NETFREE netfree = 0;
 | 
			
		||||
#endif /* 1 */
 | 
			
		||||
 | 
			
		||||
	/* Determine the OS version we are on so we can turn off things 
 | 
			
		||||
	 * that do not work properly.
 | 
			
		||||
	 */
 | 
			
		||||
        OSVERSIONINFO osverinfo ;
 | 
			
		||||
        osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
 | 
			
		||||
        GetVersionEx( &osverinfo ) ;
 | 
			
		||||
	CRYPTACQUIRECONTEXT acquire;
 | 
			
		||||
	CRYPTGENRANDOM gen;
 | 
			
		||||
	CRYPTRELEASECONTEXT release;
 | 
			
		||||
	NETSTATGET netstatget;
 | 
			
		||||
	NETFREE netfree;
 | 
			
		||||
 | 
			
		||||
	/* load functions dynamically - not available on all systems */
 | 
			
		||||
	advapi = LoadLibrary("ADVAPI32.DLL");
 | 
			
		||||
	kernel = LoadLibrary("KERNEL32.DLL");
 | 
			
		||||
	user = LoadLibrary("USER32.DLL");
 | 
			
		||||
	netapi = LoadLibrary("NETAPI32.DLL");
 | 
			
		||||
	advapi = GetModuleHandle("ADVAPI32.DLL");
 | 
			
		||||
	kernel = GetModuleHandle("KERNEL32.DLL");
 | 
			
		||||
	user = GetModuleHandle("USER32.DLL");
 | 
			
		||||
	netapi = GetModuleHandle("NETAPI32.DLL");
 | 
			
		||||
 | 
			
		||||
#if 1 /* There was previously a problem with NETSTATGET.  Currently, this
 | 
			
		||||
       * section is still experimental, but if all goes well, this conditional
 | 
			
		||||
       * will be removed
 | 
			
		||||
       */
 | 
			
		||||
	if (netapi)
 | 
			
		||||
		{
 | 
			
		||||
		netstatget = (NETSTATGET) GetProcAddress(netapi,"NetStatisticsGet");
 | 
			
		||||
@@ -228,68 +205,49 @@ int RAND_poll(void)
 | 
			
		||||
	if (netstatget && netfree)
 | 
			
		||||
		{
 | 
			
		||||
		LPBYTE outbuf;
 | 
			
		||||
		/* NetStatisticsGet() is a Unicode only function
 | 
			
		||||
 		 * STAT_WORKSTATION_0 contains 45 fields and STAT_SERVER_0
 | 
			
		||||
		 * contains 17 fields.  We treat each field as a source of
 | 
			
		||||
		 * one byte of entropy.
 | 
			
		||||
                 */
 | 
			
		||||
 | 
			
		||||
		/* NetStatisticsGet() is a Unicode only function */
 | 
			
		||||
		if (netstatget(NULL, L"LanmanWorkstation", 0, 0, &outbuf) == 0)
 | 
			
		||||
			{
 | 
			
		||||
			RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 45);
 | 
			
		||||
			RAND_add(outbuf, sizeof(STAT_WORKSTATION_0), 0);
 | 
			
		||||
			netfree(outbuf);
 | 
			
		||||
			}
 | 
			
		||||
		if (netstatget(NULL, L"LanmanServer", 0, 0, &outbuf) == 0)
 | 
			
		||||
			{
 | 
			
		||||
			RAND_add(outbuf, sizeof(STAT_SERVER_0), 17);
 | 
			
		||||
			RAND_add(outbuf, sizeof(STAT_SERVER_0), 0);
 | 
			
		||||
			netfree(outbuf);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	if (netapi)
 | 
			
		||||
		FreeLibrary(netapi);
 | 
			
		||||
#endif /* 1 */
 | 
			
		||||
 
 | 
			
		||||
        /* It appears like this can cause an exception deep within ADVAPI32.DLL
 | 
			
		||||
         * at random times on Windows 2000.  Reported by Jeffrey Altman.  
 | 
			
		||||
         * Only use it on NT.
 | 
			
		||||
	 */
 | 
			
		||||
        if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
 | 
			
		||||
		osverinfo.dwMajorVersion < 5)
 | 
			
		||||
	/* Read Performance Statistics from NT/2000 registry */
 | 
			
		||||
	/* The size of the performance data can vary from call to call */
 | 
			
		||||
	/* so we must guess the size of the buffer to use and increase */
 | 
			
		||||
	/* its size if we get an ERROR_MORE_DATA return instead of     */
 | 
			
		||||
	/* ERROR_SUCCESS.                                              */
 | 
			
		||||
	{
 | 
			
		||||
	LONG   rc=ERROR_MORE_DATA;
 | 
			
		||||
	char * buf=NULL;
 | 
			
		||||
	DWORD bufsz=0;
 | 
			
		||||
	DWORD length;
 | 
			
		||||
 | 
			
		||||
	while (rc == ERROR_MORE_DATA)
 | 
			
		||||
		{
 | 
			
		||||
		/* Read Performance Statistics from NT/2000 registry
 | 
			
		||||
		 * The size of the performance data can vary from call
 | 
			
		||||
		 * to call so we must guess the size of the buffer to use
 | 
			
		||||
		 * and increase its size if we get an ERROR_MORE_DATA
 | 
			
		||||
		 * return instead of ERROR_SUCCESS.
 | 
			
		||||
		 */
 | 
			
		||||
		LONG   rc=ERROR_MORE_DATA;
 | 
			
		||||
		char * buf=NULL;
 | 
			
		||||
		DWORD bufsz=0;
 | 
			
		||||
		DWORD length;
 | 
			
		||||
		buf = realloc(buf,bufsz+8192);
 | 
			
		||||
		if (!buf)
 | 
			
		||||
			break;
 | 
			
		||||
		bufsz += 8192;
 | 
			
		||||
 | 
			
		||||
		while (rc == ERROR_MORE_DATA)
 | 
			
		||||
			{
 | 
			
		||||
			buf = realloc(buf,bufsz+8192);
 | 
			
		||||
			if (!buf)
 | 
			
		||||
				break;
 | 
			
		||||
			bufsz += 8192;
 | 
			
		||||
 | 
			
		||||
			length = bufsz;
 | 
			
		||||
			rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global",
 | 
			
		||||
				NULL, NULL, buf, &length);
 | 
			
		||||
			}
 | 
			
		||||
		if (rc == ERROR_SUCCESS)
 | 
			
		||||
			{
 | 
			
		||||
                        /* For entropy count assume only least significant
 | 
			
		||||
			 * byte of each DWORD is random.
 | 
			
		||||
                         */
 | 
			
		||||
			RAND_add(&length, sizeof(length), 0);
 | 
			
		||||
			RAND_add(buf, length, length / 4.0);
 | 
			
		||||
			}
 | 
			
		||||
		if (buf)
 | 
			
		||||
			free(buf);
 | 
			
		||||
		length = bufsz;
 | 
			
		||||
		rc = RegQueryValueEx(HKEY_PERFORMANCE_DATA, "Global",
 | 
			
		||||
			NULL, NULL, buf, &length);
 | 
			
		||||
		}
 | 
			
		||||
	if (rc == ERROR_SUCCESS)
 | 
			
		||||
		{
 | 
			
		||||
		RAND_add(&length, sizeof(length), 0);
 | 
			
		||||
		RAND_add(buf, length, 0);
 | 
			
		||||
		}
 | 
			
		||||
	if ( buf )
 | 
			
		||||
		free(buf);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (advapi)
 | 
			
		||||
		{
 | 
			
		||||
@@ -304,13 +262,12 @@ int RAND_poll(void)
 | 
			
		||||
	if (acquire && gen && release)
 | 
			
		||||
		{
 | 
			
		||||
		/* poll the CryptoAPI PRNG */
 | 
			
		||||
                /* The CryptoAPI returns sizeof(buf) bytes of randomness */
 | 
			
		||||
		if (acquire(&hProvider, 0, 0, PROV_RSA_FULL,
 | 
			
		||||
			CRYPT_VERIFYCONTEXT))
 | 
			
		||||
			{
 | 
			
		||||
			if (gen(hProvider, sizeof(buf), buf) != 0)
 | 
			
		||||
				{
 | 
			
		||||
				RAND_add(buf, sizeof(buf), sizeof(buf));
 | 
			
		||||
				RAND_add(buf, sizeof(buf), 0);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
				printf("randomness from PROV_RSA_FULL\n");
 | 
			
		||||
#endif
 | 
			
		||||
@@ -323,7 +280,7 @@ int RAND_poll(void)
 | 
			
		||||
			{
 | 
			
		||||
			if (gen(hProvider, sizeof(buf), buf) != 0)
 | 
			
		||||
				{
 | 
			
		||||
				RAND_add(buf, sizeof(buf), sizeof(buf));
 | 
			
		||||
				RAND_add(buf, sizeof(buf), 0);
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
				printf("randomness from PROV_INTEL_SEC\n");
 | 
			
		||||
#endif
 | 
			
		||||
@@ -332,9 +289,6 @@ int RAND_poll(void)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
        if (advapi)
 | 
			
		||||
		FreeLibrary(advapi);
 | 
			
		||||
 | 
			
		||||
	/* timer data */
 | 
			
		||||
	readtimer();
 | 
			
		||||
	
 | 
			
		||||
@@ -344,7 +298,7 @@ int RAND_poll(void)
 | 
			
		||||
 | 
			
		||||
	/* process ID */
 | 
			
		||||
	w = GetCurrentProcessId();
 | 
			
		||||
	RAND_add(&w, sizeof(w), 1);
 | 
			
		||||
	RAND_add(&w, sizeof(w), 0);
 | 
			
		||||
 | 
			
		||||
	if (user)
 | 
			
		||||
		{
 | 
			
		||||
@@ -357,40 +311,42 @@ int RAND_poll(void)
 | 
			
		||||
		queue = (GETQUEUESTATUS) GetProcAddress(user, "GetQueueStatus");
 | 
			
		||||
 | 
			
		||||
		if (win)
 | 
			
		||||
			{
 | 
			
		||||
		{
 | 
			
		||||
			/* window handle */
 | 
			
		||||
			h = win();
 | 
			
		||||
			RAND_add(&h, sizeof(h), 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (cursor)
 | 
			
		||||
			{
 | 
			
		||||
			/* unfortunately, its not safe to call GetCursorInfo()
 | 
			
		||||
			 * on NT4 even though it exists in SP3 (or SP6) and
 | 
			
		||||
			 * higher.
 | 
			
		||||
			 */
 | 
			
		||||
			OSVERSIONINFO osverinfo ;
 | 
			
		||||
			osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
 | 
			
		||||
			GetVersionEx( &osverinfo ) ;
 | 
			
		||||
 | 
			
		||||
			if ( osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT &&
 | 
			
		||||
				osverinfo.dwMajorVersion < 5)
 | 
			
		||||
				cursor = 0;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (cursor)
 | 
			
		||||
			{
 | 
			
		||||
			/* cursor position */
 | 
			
		||||
                        /* assume 2 bytes of entropy */
 | 
			
		||||
			CURSORINFO ci;
 | 
			
		||||
			ci.cbSize = sizeof(CURSORINFO);
 | 
			
		||||
			if (cursor(&ci))
 | 
			
		||||
				RAND_add(&ci, ci.cbSize, 2);
 | 
			
		||||
				RAND_add(&ci, ci.cbSize, 0);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		if (queue)
 | 
			
		||||
			{
 | 
			
		||||
			/* message queue status */
 | 
			
		||||
                        /* assume 1 byte of entropy */
 | 
			
		||||
			w = queue(QS_ALLEVENTS);
 | 
			
		||||
			RAND_add(&w, sizeof(w), 1);
 | 
			
		||||
			RAND_add(&w, sizeof(w), 0);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		FreeLibrary(user);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	/* Toolhelp32 snapshot: enumerate processes, threads, modules and heap
 | 
			
		||||
@@ -425,7 +381,7 @@ int RAND_poll(void)
 | 
			
		||||
		MODULEENTRY32 m;
 | 
			
		||||
 | 
			
		||||
		snap = (CREATETOOLHELP32SNAPSHOT)
 | 
			
		||||
			GetProcAddress(kernel, "CreateToolhelp32Snapshot");
 | 
			
		||||
		  GetProcAddress(kernel, "CreateToolhelp32Snapshot");
 | 
			
		||||
		heap_first = (HEAP32FIRST) GetProcAddress(kernel, "Heap32First");
 | 
			
		||||
		heap_next = (HEAP32NEXT) GetProcAddress(kernel, "Heap32Next");
 | 
			
		||||
		heaplist_first = (HEAP32LIST) GetProcAddress(kernel, "Heap32ListFirst");
 | 
			
		||||
@@ -444,18 +400,11 @@ int RAND_poll(void)
 | 
			
		||||
			!= NULL)
 | 
			
		||||
			{
 | 
			
		||||
			/* heap list and heap walking */
 | 
			
		||||
                        /* HEAPLIST32 contains 3 fields that will change with
 | 
			
		||||
                         * each entry.  Consider each field a source of 1 byte
 | 
			
		||||
                         * of entropy.
 | 
			
		||||
                         * HEAPENTRY32 contains 5 fields that will change with 
 | 
			
		||||
                         * each entry.  Consider each field a source of 1 byte
 | 
			
		||||
                         * of entropy.
 | 
			
		||||
                         */
 | 
			
		||||
			hlist.dwSize = sizeof(HEAPLIST32);		
 | 
			
		||||
			if (heaplist_first(handle, &hlist))
 | 
			
		||||
				do
 | 
			
		||||
					{
 | 
			
		||||
					RAND_add(&hlist, hlist.dwSize, 3);
 | 
			
		||||
					RAND_add(&hlist, hlist.dwSize, 0);
 | 
			
		||||
					hentry.dwSize = sizeof(HEAPENTRY32);
 | 
			
		||||
					if (heap_first(&hentry,
 | 
			
		||||
						hlist.th32ProcessID,
 | 
			
		||||
@@ -464,50 +413,36 @@ int RAND_poll(void)
 | 
			
		||||
						int entrycnt = 50;
 | 
			
		||||
						do
 | 
			
		||||
							RAND_add(&hentry,
 | 
			
		||||
								hentry.dwSize, 5);
 | 
			
		||||
								hentry.dwSize, 0);
 | 
			
		||||
						while (heap_next(&hentry)
 | 
			
		||||
							&& --entrycnt > 0);
 | 
			
		||||
						}
 | 
			
		||||
					} while (heaplist_next(handle,
 | 
			
		||||
						&hlist));
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
			/* process walking */
 | 
			
		||||
                        /* PROCESSENTRY32 contains 9 fields that will change
 | 
			
		||||
                         * with each entry.  Consider each field a source of
 | 
			
		||||
                         * 1 byte of entropy.
 | 
			
		||||
                         */
 | 
			
		||||
			p.dwSize = sizeof(PROCESSENTRY32);
 | 
			
		||||
			if (process_first(handle, &p))
 | 
			
		||||
				do
 | 
			
		||||
					RAND_add(&p, p.dwSize, 9);
 | 
			
		||||
					RAND_add(&p, p.dwSize, 0);
 | 
			
		||||
				while (process_next(handle, &p));
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
			/* thread walking */
 | 
			
		||||
                        /* THREADENTRY32 contains 6 fields that will change
 | 
			
		||||
                         * with each entry.  Consider each field a source of
 | 
			
		||||
                         * 1 byte of entropy.
 | 
			
		||||
                         */
 | 
			
		||||
			t.dwSize = sizeof(THREADENTRY32);
 | 
			
		||||
			if (thread_first(handle, &t))
 | 
			
		||||
				do
 | 
			
		||||
					RAND_add(&t, t.dwSize, 6);
 | 
			
		||||
					RAND_add(&t, t.dwSize, 0);
 | 
			
		||||
				while (thread_next(handle, &t));
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
			/* module walking */
 | 
			
		||||
                        /* MODULEENTRY32 contains 9 fields that will change
 | 
			
		||||
                         * with each entry.  Consider each field a source of
 | 
			
		||||
                         * 1 byte of entropy.
 | 
			
		||||
                         */
 | 
			
		||||
			m.dwSize = sizeof(MODULEENTRY32);
 | 
			
		||||
			if (module_first(handle, &m))
 | 
			
		||||
				do
 | 
			
		||||
					RAND_add(&m, m.dwSize, 9);
 | 
			
		||||
					RAND_add(&m, m.dwSize, 1);
 | 
			
		||||
				while (module_next(handle, &m));
 | 
			
		||||
 | 
			
		||||
			
 | 
			
		||||
			CloseHandle(handle);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		FreeLibrary(kernel);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
@@ -567,12 +502,11 @@ void RAND_screen(void) /* function available for backward compatibility */
 | 
			
		||||
/* feed timing information to the PRNG */
 | 
			
		||||
static void readtimer(void)
 | 
			
		||||
{
 | 
			
		||||
	DWORD w;
 | 
			
		||||
	DWORD w, cyclecount;
 | 
			
		||||
	LARGE_INTEGER l;
 | 
			
		||||
	static int have_perfc = 1;
 | 
			
		||||
#ifndef __GNUC__
 | 
			
		||||
	static int have_tsc = 1;
 | 
			
		||||
	DWORD cyclecount;
 | 
			
		||||
 | 
			
		||||
	if (have_tsc) {
 | 
			
		||||
	  __try {
 | 
			
		||||
 
 | 
			
		||||
@@ -39,8 +39,7 @@ all:	lib
 | 
			
		||||
 | 
			
		||||
lib:	$(LIBOBJ)
 | 
			
		||||
	$(AR) $(LIB) $(LIBOBJ)
 | 
			
		||||
	@echo You may get an error following this line.  Please ignore.
 | 
			
		||||
	- $(RANLIB) $(LIB)
 | 
			
		||||
	$(RANLIB) $(LIB)
 | 
			
		||||
	@touch lib
 | 
			
		||||
 | 
			
		||||
files:
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user