提交 58964a49 编写于 作者: R Ralf S. Engelschall

Import of old SSLeay release: SSLeay 0.9.0b

上级 d02b48c6
......@@ -62,3 +62,4 @@ The reason behind this being stated in this direct manner is past
experience in code simply being copied and the attribution removed
from it and then being distributed as part of other packages. This
implementation was a non-trivial and unpaid effort.
......@@ -21,18 +21,22 @@
# This is used on the DEC Alpha where long is 8 bytes
# and int is 4
# BN_LLONG use the type 'long long' in crypto/bn/bn.h
# MD2_CHAR use 'char' instead of 'int' for MD2_INT in crypto/md/md2.h
# MD2_LONG use 'long' instead of 'int' for MD2_INT in crypto/md/md2.h
# MD2_CHAR use 'char' instead of 'int' for MD2_INT in crypto/md2/md2.h
# MD2_LONG use 'long' instead of 'int' for MD2_INT in crypto/md2/md2.h
# IDEA_SHORT use 'short' instead of 'int' for IDEA_INT in crypto/idea/idea.h
# IDEA_LONG use 'long' instead of 'int' for IDEA_INT in crypto/idea/idea.h
# RC2_SHORT use 'short' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
# RC2_LONG use 'long' instead of 'int' for RC2_INT in crypto/rc2/rc2.h
# RC4_CHAR use 'char' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
# RC4_LONG use 'long' instead of 'int' for RC4_INT in crypto/rc4/rc4.h
# RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_enc.c. This turns on
# RC4_INDEX define RC4_INDEX in crypto/rc4/rc4_locl.h. This turns on
# array lookups instead of pointer use.
# BF_PTR use 'pointer arithmatic' for Blowfish (unsafe on Alpha).
# BF_PTR2 use a pentium/intel specific version.
# MD5_ASM use some extra md5 assember,
# SHA1_ASM use some extra sha1 assember, must define L_ENDIAN for x86
# RMD160_ASM use some extra ripemd160 assember,
# BN_ASM use some extra bn assember,
$x86_gcc_des="DES_PTR DES_RISC1 DES_UNROLL";
......@@ -51,7 +55,13 @@ $tlib="-lnsl -lsocket";
$bits1="THIRTY_TWO_BIT ";
$bits2="SIXTY_FOUR_BIT ";
# -DB_ENDIAN slows things down on a sparc
$x86_sol_asm="asm/bn86-sol.o:asm/dx86-sol.o asm/yx86-sol.o:asm/bx86-sol.o:asm/mx86-sol.o:asm/sx86-sol.o:asm/cx86-sol.o:asm/rx86-sol.o:asm/rm86-sol.o:asm/r586-sol.o";
$x86_elf_asm="asm/bn86-elf.o:asm/dx86-elf.o asm/yx86-elf.o:asm/bx86-elf.o:asm/mx86-elf.o:asm/sx86-elf.o:asm/cx86-elf.o:asm/rx86-elf.o:asm/rm86-elf.o:asm/r586-elf.o";
$x86_out_asm="asm/bn86-out.o:asm/dx86-out.o asm/yx86-out.o:asm/bx86-out.o:asm/mx86-out.o:asm/sx86-out.o:asm/cx86-out.o:asm/rx86-out.o:asm/rm86-out.o:asm/r586-out.o";
$x86_bsdi_asm="asm/bn86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:asm/bx86bsdi.o:asm/mx86bsdi.o:asm/sx86bsdi.o:asm/cx86bsdi.o:asm/rx86bsdi.o:asm/rm86bsdi.o:asm/r586bsdi.o";
# -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
# So the md5_locl.h file has an undef B_ENDIAN if sun is defined
#config-string CC : CFLAGS : LDFLAGS : special header file mods:bn_asm \
# des_asm:bf_asm
......@@ -63,18 +73,17 @@ $bits2="SIXTY_FOUR_BIT ";
# A few of my development configs
"purify", "purify gcc:-g -DPURIFY -Wall:-lsocket -lnsl::::",
"debug", "gcc:-DREF_CHECK -DCRYPTO_MDEBUG -g -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::::",
"debug", "gcc:-DREF_CHECK -DCRYPTO_MDEBUG -ggdb -g2 -Wformat -Wshadow -Wmissing-prototypes -Wmissing-declarations -Werror:::::",
"dist", "cc:-O -DNOPROTO::::",
# Basic configs that should work on any box
"gcc", "gcc:-O3::BN_LLONG:::",
"cc", "cc:-O -DNOPROTO -DNOCONST:::::",
# My solaris setups
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN:\
-lsocket -lnsl:BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-sol.o:asm/dx86-sol.o asm/cx86-sol.o:asm/bx86-sol.o",
"solaris-sparc-gcc","gcc:-O3 -fomit-frame-pointer -mv8 -Wall:\
-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:::",
"solaris-x86-gcc","gcc:-O3 -fomit-frame-pointer -m486 -Wall -DL_ENDIAN -DBN_ASM:-lsocket -lnsl:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_sol_asm:",
"solaris-sparc-gcc","gcc:-O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN:-lsocket -lnsl:BN_LLONG RC4_CHAR DES_UNROLL BF_PTR:::",
# DO NOT use /xO[34] on sparc with SC3.0.
# It is broken, and will not pass the tests
"solaris-sparc-cc","cc:-fast -O -Xa -DB_ENDIAN:\
......@@ -116,30 +125,44 @@ $bits2="SIXTY_FOUR_BIT ";
"alpha400-cc", "cc:-arch host -tune host -fast -std -O4 -inline speed::SIXTY_FOUR_BIT_LONG:asm/alpha.o::",
# The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
# x86-lnx.o file file since it is hand tweaked assembler.
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized::BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-lnx.o:asm/dx86-elf.o asm/cx86-elf.o:asm/bx86-elf.o",
"debug-linux-elf","gcc:-DREF_CHECK -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall:-lefence:BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-lnx.o:asm/dx86-elf.o asm/cx86-elf.o:asm/bx86-elf.o",
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-lnxa.o:asm/dx86-out.o asm/cx86-out.o:asm/bx86-out.o",
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
"NetBSD-x86", "gcc:-DTERMIOS -D_ANSI_SOURCE -O3 -fomit-frame-pointer -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-lnxa.o:asm/dx86-out.o asm/cx86-out.o:asm/bx86-out.o",
"FreeBSD", "gcc:-DTERMIOS -D_ANSI_SOURCE -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-lnxa.o:asm/dx86-out.o asm/cx86-out.o:asm/bx86-out.o",
#"bsdi-gcc", "shlicc2:-O3 -ffast-math-m486::RSA_LLONG $x86_gcc_des $x86_gcc_opts:::",
#"bsdi-gcc", "gcc:-O3 -ffast-math -DPERL5 -m486::RSA_LLONG $x86_gc_des $x86_gcc_opts:asm/x86-bsdi.o:asm/dx86bsdi.o asm/cx86bsdi.o:asm/bx86bsdi.o",
"bsdi-gcc", "gcc:-O3 -ffast-math -DPERL5 -m486::RSA_LLONG $x86_gc_des $x86_gcc_opts:::",
"nextstep", "cc:-O3 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:::",
# bn86-elf.o file file since it is hand tweaked assembler.
"linux-elf", "gcc:-DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"debug-linux-elf","gcc:-DREF_CHECK -DBN_ASM -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall:-lefence:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
"linux-aout", "gcc:-DL_ENDIAN -DTERMIO -DBN_ASM -O3 -fomit-frame-pointer -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
"NetBSD-sparc", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -mv8 -Wall -DB_ENDIAN::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
"NetBSD-m86", "gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall -DB_ENDIAN::BN_LLONG MD2_CHAR RC4_INDEX DES_UNROLL:::",
"NetBSD-x86", "gcc:-DTERMIOS -DBN_ASM -D_ANSI_SOURCE -O3 -fomit-frame-pointer -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:",
"FreeBSD", "gcc:-DTERMIOS -DBN_ASM -DL_ENDIAN -D_ANSI_SOURCE -fomit-frame-pointer -O3 -m486 -Wall::BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_out_asm",
#"bsdi-gcc", "gcc:-O3 -ffast-math -DBN_ASM -DL_ENDIAN -DPERL5 -m486::RSA_LLONG $x86_gc_des $x86_gcc_opts:$x86_bsdi_asm",
"nextstep", "cc:-O3 -Wall -DBN_ASM::BN_LLONG $x86_gcc_des $x86_gcc_opts:::",
# NCR MP-RAS UNIX ver 02.03.01
"ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw:-lsocket -lnsl:$x86_gcc_des $x86_gcc_opts:::",
# UnixWare 2.0
"unixware-2.0","cc:-O:-lsocket -lnsl:$x86_gcc_des $x86_gcc_opts:::",
"unixware-2.0-pentium","cc:-O -Kpentium -Kthread:-lsocket -lnsl:MD2_CHAR RC4_INDEX $x86_des_des::",
"unixware-2.0","cc:-O -DFILIO_H:-lsocket -lnsl:$x86_gcc_des $x86_gcc_opts:::",
"unixware-2.0-pentium","cc:-O -DFILIO_H -Kpentium -Kthread:-lsocket -lnsl:MD2_CHAR RC4_INDEX $x86_des_des::",
# IBM's AIX.
"aix-cc", "cc:-O -DAIX -DB_ENDIAN::BN_LLONG RC4_CHAR:::",
"aix-gcc", "gcc:-O2 -DAIX -DB_ENDIAN::BN_LLONG RC4_CHAR:::",
#
# Cray T90 (SDSC)
# It's Big-endian, but the algorithms work properly when B_ENDIAN is NOT
# defined. The T90 ints and longs are 8 bytes long, and apparently the
# B_ENDIAN code assumes 4 byte ints. Fortunately, the non-B_ENDIAN and
# non L_ENDIAN code aligns the bytes in each word correctly.
#
# The BIT_FIELD_LIMITS define is to avoid two fatal compiler errors:
#'Taking the address of a bit field is not allowed. '
#'An expression with bit field exists as the operand of "sizeof" '
# (written by Wayne Schroeder <schroede@SDSC.EDU>)
"cray-t90-cc", "cc: -DBIT_FIELD_LIMITS -DTERMIOS::SIXTY_FOUR_BIT_LONG DES_INT:::",
# DGUX, 88100.
"dgux-R3-gcc", "gcc:-O3 -fomit-frame-pointer::RC4_INDEX DES_UNROLL:::",
"dgux-R4-gcc", "gcc:-O3 -fomit-frame-pointer:-lnsl -lsocket:RC4_INDEX:RC4_INDEX DES_UNROLL:::",
"dgux-R4-x86-gcc", "gcc:-O3 -fomit-frame-pointer -DL_ENDIAN:-lnsl -lsocket:BN_LLONG $x86_gcc_des $x86_gcc_opts:asm/x86-lnx.o:asm/dx86-elf.o asm/cx86-elf.o:asm/bx86-elf.o",
"dgux-R4-x86-gcc", "gcc:-O3 -DBN_ASM -fomit-frame-pointer -DL_ENDIAN:-lnsl -lsocket:BN_LLONG $x86_gcc_des $x86_gcc_opts:$x86_elf_asm",
# SCO 5
"sco5-cc", "cc:-O:-lsocket:$x86_gcc_des $x86_gcc_opts:::", # des options?
......@@ -167,15 +190,21 @@ $Makefile="Makefile.ssl";
$des_locl="crypto/des/des_locl.h";
$des ="crypto/des/des.h";
$bn ="crypto/bn/bn.h";
$md2 ="crypto/md/md2.h";
$md2 ="crypto/md2/md2.h";
$rc4 ="crypto/rc4/rc4.h";
$rc4_enc="crypto/rc4/rc4_enc.c";
$rc4_locl="crypto/rc4/rc4_locl.h";
$idea ="crypto/idea/idea.h";
$rc2 ="crypto/rc2/rc2.h";
$bf ="crypto/bf/bf_locl.h";
$bn_mulw="bn_mulw.o";
$des_enc="des_enc.o fcrypt_b.o";
$bf_enc ="bf_enc.o";
$cast_enc="c_enc.o";
$rc4_enc="rc4_enc.o";
$rc5_enc="rc5_enc.o";
$md5_obj="";
$sha1_obj="";
$rmd160_obj="";
if ($#ARGV < 0)
{
......@@ -219,14 +248,33 @@ if (!defined($table{$target}))
exit(1);
}
($cc,$cflags,$lflags,$bn_ops,$bn_obj,$des_obj,$bf_obj)=
($cc,$cflags,$lflags,$bn_ops,$bn_obj,$des_obj,$bf_obj,$md5_obj,$sha1_obj,
$cast_obj,$rc4_obj,$rmd160_obj,$rc5_obj)=
split(/\s*:\s*/,$table{$target});
$cflags="$flags$cflags" if ($flags ne "");
$lflags="$libs$lflags"if ($libs ne "");
$bn_obj=$bn_mulw unless ($bn_obj =~ /\.o$/);
$des_obj=$des_enc unless ($des_obj =~ /\.o$/);
$bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/);
$bn_obj=$bn_mulw unless ($bn_obj =~ /\.o$/);
$des_obj=$des_enc unless ($des_obj =~ /\.o$/);
$bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/);
$cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/);
$rc4_obj=$rc4_enc unless ($rc4_obj =~ /\.o$/);
$rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/);
if ($sha1_obj =~ /\.o$/)
{
# $sha1_obj=$sha1_enc;
$cflags.=" -DSHA1_ASM";
}
if ($md5_obj =~ /\.o$/)
{
# $md5_obj=$md5_enc;
$cflags.=" -DMD5_ASM";
}
if ($rmd160_obj =~ /\.o$/)
{
# $rmd160_obj=$rmd160_enc;
$cflags.=" -DRMD160_ASM";
}
$n=&file_new($Makefile);
open(IN,"<".$Makefile) || die "unable to read $Makefile:$!\n";
......@@ -240,18 +288,30 @@ while (<IN>)
s/^BN_MULW=.*$/BN_MULW= $bn_obj/;
s/^DES_ENC=.*$/DES_ENC= $des_obj/;
s/^BF_ENC=.*$/BF_ENC= $bf_obj/;
s/^CAST_ENC=.*$/CAST_ENC= $cast_obj/;
s/^RC4_ENC=.*$/RC4_ENC= $rc4_obj/;
s/^RC5_ENC=.*$/RC5_ENC= $rc5_obj/;
s/^MD5_ASM_OBJ=.*$/MD5_ASM_OBJ= $md5_obj/;
s/^SHA1_ASM_OBJ=.*$/SHA1_ASM_OBJ= $sha1_obj/;
s/^RMD160_ASM_OBJ=.*$/RMD160_ASM_OBJ= $rmd160_obj/;
print OUT $_."\n";
}
close(IN);
close(OUT);
&Rename($Makefile,&file_old($Makefile));
&Rename($n,$Makefile);
print "CC =$cc\n";
print "CFLAG =$cflags\n";
print "EX_LIBS=$lflags\n";
print "BN_MULW=$bn_obj\n";
print "DES_ENC=$des_obj\n";
print "BF_ENC =$bf_obj\n";
print "CC =$cc\n";
print "CFLAG =$cflags\n";
print "EX_LIBS =$lflags\n";
print "BN_MULW =$bn_obj\n";
print "DES_ENC =$des_obj\n";
print "BF_ENC =$bf_obj\n";
print "CAST_ENC =$cast_obj\n";
print "RC4_ENC =$rc4_obj\n";
print "RC5_ENC =$rc5_obj\n";
print "MD5_OBJ_ASM =$md5_obj\n";
print "SHA1_OBJ_ASM =$sha1_obj\n";
print "RMD160_OBJ_ASM=$rmd160_obj\n";
$des_ptr=0;
$des_risc1=0;
......@@ -287,8 +347,8 @@ foreach (sort split(/\s+/,$bn_ops))
$rc2_int=3 if /RC2_LONG/;
$bf_ptr=1 if $_ eq "BF_PTR";
$bf_ptr=2 if $_ eq "BF_PTR2";
($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
($b64l,$b64,$b32,$b16,$b8)=(0,1,0,0,0) if /SIXTY_FOUR_BIT/;
($b64l,$b64,$b32,$b16,$b8)=(1,0,0,0,0) if /SIXTY_FOUR_BIT_LONG/;
($b64l,$b64,$b32,$b16,$b8)=(0,0,1,0,0) if /THIRTY_TWO_BIT/;
($b64l,$b64,$b32,$b16,$b8)=(0,0,0,1,0) if /SIXTEEN_BIT/;
($b64l,$b64,$b32,$b16,$b8)=(0,0,0,0,1) if /EIGHT_BIT/;
......@@ -375,9 +435,9 @@ close(OUT);
&Rename($rc4,&file_old($rc4));
&Rename($n,$rc4);
(($in=$rc4_enc) =~ s/\.([^.]+)/.$postfix/);
$n=&file_new($rc4_enc);
open(IN,"<".$in) || die "unable to read $rc4_enc:$!\n";
(($in=$rc4_locl) =~ s/\.([^.]+)/.$postfix/);
$n=&file_new($rc4_locl);
open(IN,"<".$in) || die "unable to read $rc4_locl:$!\n";
open(OUT,">$n") || die "unable to read $n:$!\n";
while (<IN>)
{
......@@ -388,8 +448,8 @@ while (<IN>)
}
close(IN);
close(OUT);
&Rename($rc4_enc,&file_old($rc4_enc));
&Rename($n,$rc4_enc);
&Rename($rc4_locl,&file_old($rc4_locl));
&Rename($n,$rc4_locl);
(($in=$md2) =~ s/\.([^.]+)/.$postfix/);
$n=&file_new($md2);
......
16-Mar-98
- Patch for Cray T90 from Wayne Schroeder <schroede@SDSC.EDU>
- Lots and lots of changes
29-Jan-98
- ASN1_BIT_STRING_set_bit()/ASN1_BIT_STRING_get_bit() from
Goetz Babin-Ebell <babinebell@trustcenter.de>.
- SSL_version() now returns SSL2_VERSION, SSL3_VERSION or
TLS1_VERSION.
7-Jan-98
- Finally reworked the cipher string to ciphers again, so it
works correctly
- All the app_data stuff is now ex_data with funcion calls to access.
The index is supplied by a function and 'methods' can be setup
for the types that are called on XXX_new/XXX_free. This lets
applications get notified on creation and destruction. Some of
the RSA methods could be implemented this way and I may do so.
- Oh yes, SSL under perl5 is working at the basic level.
15-Dec-97
- Warning - the gethostbyname cache is not fully thread safe,
but it should work well enough.
- Major internal reworking of the app_data stuff. More functions
but if you were accessing ->app_data directly, things will
stop working.
- The perlv5 stuff is working. Currently on message digests,
ciphers and the bignum library.
9-Dec-97
- Modified re-negotiation so that server initated re-neg
will cause a SSL_read() to return -1 should retry.
The danger otherwise was that the server and the
client could end up both trying to read when using non-blocking
sockets.
4-Dec-97
- Lots of small changes
- Fix for binaray mode in Windows for the FILE BIO, thanks to
Bob Denny <rdenny@dc3.com>
17-Nov-97
- Quite a few internal cleanups, (removal of errno, and using macros
defined in e_os.h).
- A bug in ca.c, pointed out by yasuyuki-ito@d-cruise.co.jp, where
the automactic naming out output files was being stuffed up.
29-Oct-97
- The Cast5 cipher has been added. MD5 and SHA-1 are now in assember
for x86.
21-Oct-97
- Fixed a bug in the BIO_gethostbyname() cache.
15-Oct-97
- cbc mode for blowfish/des/3des is now in assember. Blowfish asm
has also been improved. At this point in time, on the pentium,
md5 is %80 faster, the unoptimesed sha-1 is %79 faster,
des-cbc is %28 faster, des-ede3-cbc is %9 faster and blowfish-cbc
is %62 faster.
12-Oct-97
- MEM_BUF_grow() has been fixed so that it always sets the buf->length
to the value we are 'growing' to. Think of MEM_BUF_grow() as the
way to set the length value correctly.
10-Oct-97
- I now hash for certificate lookup on the raw DER encoded RDN (md5).
This breaks things again :-(. This is efficent since I cache
the DER encoding of the RDN.
- The text DN now puts in the numeric OID instead of UNKNOWN.
- req can now process arbitary OIDs in the config file.
- I've been implementing md5 in x86 asm, much faster :-).
- Started sha1 in x86 asm, needs more work.
- Quite a few speedups in the BN stuff. RSA public operation
has been made faster by caching the BN_MONT_CTX structure.
The calulating of the Ai where A*Ai === 1 mod m was rather
expensive. Basically a 40-50% speedup on public operations.
The RSA speedup is now 15% on pentiums and %20 on pentium
pro.
30-Sep-97
- After doing some profiling, I added x86 adm for bn_add_words(),
which just adds 2 arrays of longs together. A %10 speedup
for 512 and 1024 bit RSA on the pentium pro.
29-Sep-97
- Converted the x86 bignum assembler to us the perl scripts
for generation.
23-Sep-97
- If SSL_set_session() is passed a NULL session, it now clears the
current session-id.
22-Sep-97
- Added a '-ss_cert file' to apps/ca.c. This will sign selfsigned
certificates.
- Bug in crypto/evp/encode.c where by decoding of 65 base64
encoded lines, one line at a time (via a memory BIO) would report
EOF after the first line was decoded.
- Fix in X509_find_by_issuer_and_serial() from
Dr Stephen Henson <shenson@bigfoot.com>
19-Sep-97
- NO_FP_API and NO_STDIO added.
- Put in sh config command. It auto runs Configure with the correct
parameters.
18-Sep-97
- Fix x509.c so if a DSA cert has different parameters to its parent,
they are left in place. Not tested yet.
16-Sep-97
- ssl_create_cipher_list() had some bugs, fixes from
Patrick Eisenacher <eisenach@stud.uni-frankfurt.de>
- Fixed a bug in the Base64 BIO, where it would return 1 instead
of -1 when end of input was encountered but should retry.
Basically a Base64/Memory BIO interaction problem.
- Added a HMAC set of functions in preporarion for TLS work.
15-Sep-97
- Top level makefile tweak - Cameron Simpson <cs@zip.com.au>
- Prime generation spead up %25 (512 bit prime, pentium pro linux)
by using montgomery multiplication in the prime number test.
11-Sep-97
- Ugly bug in ssl3_write_bytes(). Basically if application land
does a SSL_write(ssl,buf,len) where len > 16k, the SSLv3 write code
did not check the size and tried to copy the entire buffer.
This would tend to cause memory overwrites since SSLv3 has
a maximum packet size of 16k. If your program uses
buffers <= 16k, you would probably never see this problem.
- Fixed a new errors that were cause by malloc() not returning
0 initialised memory..
- SSL_OP_NETSCAPE_CA_DN_BUG was being switched on when using
SSL_CTX_set_options(ssl_ctx,SSL_OP_ALL); which was a bad thing
since this flags stops SSLeay being able to handle client
cert requests correctly.
08-Sep-97
- SSL_SESS_CACHE_NO_INTERNAL_LOOKUP option added. When switched
on, the SSL server routines will not use a SSL_SESSION that is
held in it's cache. This in intended to be used with the session-id
callbacks so that while the session-ids are still stored in the
cache, the decision to use them and how to look them up can be
done by the callbacks. The are the 'new', 'get' and 'remove'
callbacks. This can be used to determine the session-id
to use depending on information like which port/host the connection
is coming from. Since the are also SSL_SESSION_set_app_data() and
SSL_SESSION_get_app_data() functions, the application can hold
information against the session-id as well.
03-Sep-97
- Added lookup of CRLs to the by_dir method,
X509_load_crl_file() also added. Basically it means you can
lookup CRLs via the same system used to lookup certificates.
- Changed things so that the X509_NAME structure can contain
ASN.1 BIT_STRINGS which is required for the unique
identifier OID.
- Fixed some problems with the auto flushing of the session-id
cache. It was not occuring on the server side.
02-Sep-97
- Added SSL_CTX_sess_cache_size(SSL_CTX *ctx,unsigned long size)
which is the maximum number of entries allowed in the
session-id cache. This is enforced with a simple FIFO list.
The default size is 20*1024 entries which is rather large :-).
The Timeout code is still always operating.
01-Sep-97
- Added an argument to all the 'generate private key/prime`
callbacks. It is the last parameter so this should not
break existing code but it is needed for C++.
- Added the BIO_FLAGS_BASE64_NO_NL flag for the BIO_f_base64()
BIO. This lets the BIO read and write base64 encoded data
without inserting or looking for '\n' characters. The '-A'
flag turns this on when using apps/enc.c.
- RSA_NO_PADDING added to help BSAFE functionality. This is a
very dangerous thing to use, since RSA private key
operations without random padding bytes (as PKCS#1 adds) can
be attacked such that the private key can be revealed.
- ASN.1 bug and rc2-40-cbc and rc4-40 added by
Dr Stephen Henson <shenson@bigfoot.com>
31-Aug-97 (stuff added while I was away)
- Linux pthreads by Tim Hudson (tjh@cryptsoft.com).
- RSA_flags() added allowing bypass of pub/priv match check
in ssl/ssl_rsa.c - Tim Hudson.
- A few minor bugs.
SSLeay 0.8.1 released.
19-Jul-97
......
......@@ -38,7 +38,7 @@ make -f Makefile.ssl links
Makefile.ssl CC CFLAG EX_LIBS BN_MULW
crypto/des/des.h DES_LONG
crypto/des/des_locl.h DES_PTR
crypto/md/md2.h MD2_INT
crypto/md2/md2.h MD2_INT
crypto/rc4/rc4.h RC4_INT
crypto/rc4/rc4_enc.c RC4_INDEX
crypto/rc2/rc2.h RC2_INT
......
此差异已折叠。
#
# Makefile for all the SSL related library routines and utilities
VERSION = 0.8.1a
VERSION = 0.9.0a
#
# make install will install:
# libraries into $INSTALLTOP/lib
......@@ -21,9 +21,9 @@ VERSION = 0.8.1a
#
# If you must get hold of people directly (we much prefer the above
# lists to be used if the question is of general interest!):
# Eric Young <eay@cryptsoft.com>
# Tim Hudson <tjh@cryptsoft.com>
# or both <ssleay@cryptsoft.com>
# Eric Young <eay@cryptsoft.com>
# Tim Hudson <tjh@cryptsoft.com>
# or both <ssleay@cryptsoft.com>
#
# The primary distribution of SSLeay is from
# ftp://ftp.psy.uq.oz.au/pub/Crypto/SSL
......@@ -35,71 +35,124 @@ VERSION = 0.8.1a
# NO_RC4 - Define to build without the RC4 algorithm
# NO_RC2 - Define to build without the RC2 algorithm
# THREADS - Define when building with threads, you will probably also need any
# system defines as well, i.e. _REENTERANT for Solaris 2.[34]
# system defines as well, i.e. _REENTERANT for Solaris 2.[34]
# TERMIO - Define the termio terminal subsystem, needed if sgtty is missing.
# TERMIOS - Define the termios terminal subsystem, Silicon Graphics.
# LONGCRYPT - Define to use HPUX 10.x's long password modification to crypt(3).
# DEVRANDOM - Give this the value of the 'random device' if your OS supports
# one. 32 bytes will be read from this when the random
# number generator is initalised.
# one. 32 bytes will be read from this when the random
# number generator is initalised.
# SSL_ALLOW_ADH - define if you want the server to be able to use the
# SSLv3 anon-DH ciphers.
# SSLv3 anon-DH ciphers.
# SSL_ALLOW_ENULL - define if you want the server to be able to use the
# NULL encryption ciphers.
# NULL encryption ciphers.
#
# LOCK_DEBUG - turns on lots of lock debug output :-)
# REF_CHECK - turn on some xyz_free() assertions.
# REF_PRINT - prints some stuff on structure free.
# CRYPTO_MDEBUG - turns on my 'memory leak' detecting stuff
# MFUNC - Make all Malloc/Free/Realloc calls call
# CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
# call application defined callbacks via CRYPTO_set_mem_functions()
# CRYPTO_malloc/CRYPTO_free/CRYPTO_realloc which can be setup to
# call application defined callbacks via CRYPTO_set_mem_functions()
# MD5_ASM needs to be defined to use the x86 assembler for MD5
# SHA1_ASM needs to be defined to use the x86 assembler for SHA1
# RMD160_ASM needs to be defined to use the x86 assembler for RIPEMD160
CC= cc
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized -DMD5_ASM -DSHA1_ASM -DRMD160_ASM
CFLAG= -O -DNOPROTO
#CFLAG= -DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall -Wuninitialized
PEX_LIBS= -L. -L.. -L../.. -L../../..
EX_LIBS=
#EX_LIBS= #-lRSAglue -lrsaref -lnsl -lsocket
AR=ar r
# Set BN_MULW to bn_mulw.o if you want to use the C version
#BN_MULW= asm/x86-lnx.o
BN_MULW= bn_mulw.o
#BN_MULW= asm/x86-lnx.o # elf
#BN_MULW= asm/x86-sol.o # solaris
#BN_MULW= asm/x86-lnxa.o # a.out, FreeBSD
#BN_MULW= asm/x86-bsdi.o # bsdi
#BN_MULW= asm/alpha.o # DEC Alpha
#BN_MULW= asm/pa-risc2.o # HP-UX PA-RISC
#BN_MULW= asm/r3000.o # SGI MIPS cpu
#BN_MULW= asm/sparc.o # Sun solaris/SunOS
#BN_MULW= asm/x86nt32.o # Windows 95/NT
#BN_MULW= asm/x86w16.o # 16 bit code for Windows 3.1/DOS
#BN_MULW= asm/x86w32.o # 32 bit code for Windows 3.1
#BN_MULW= bn_mulw.o
#BN_MULW= asm/bn86-elf.o # elf, linux-elf
#BN_MULW= asm/bn86-sol.o # solaris
#BN_MULW= asm/bn86-out.o # a.out, FreeBSD
#BN_MULW= asm/bn86bsdi.o # bsdi
#BN_MULW= asm/alpha.o # DEC Alpha
#BN_MULW= asm/pa-risc2.o # HP-UX PA-RISC
#BN_MULW= asm/r3000.o # SGI MIPS cpu
#BN_MULW= asm/sparc.o # Sun solaris/SunOS
#BN_MULW= asm/bn-win32.o # Windows 95/NT
#BN_MULW= asm/x86w16.o # 16 bit code for Windows 3.1/DOS
#BN_MULW= asm/x86w32.o # 32 bit code for Windows 3.1
# Set DES_ENC to des_enc.o if you want to use the C version
#There are 4 x86 assember options.
DES_ENC= des_enc.o fcrypt_b.o
#DES_ENC= des_enc.o fcrypt_b.o # C
#DES_ENC= asm/dx86-elf.o asm/cx86-elf.o # elf
#DES_ENC= asm/dx86-sol.o asm/cx86-sol.o # solaris
#DES_ENC= asm/dx86-out.o asm/cx86-out.o # a.out, FreeBSD
#DES_ENC= asm/dx86bsdi.o asm/cx86bsdi.o # bsdi
#DES_ENC= des_enc.o fcrypt_b.o # C
#DES_ENC= asm/dx86-elf.o asm/yx86-elf.o # elf
#DES_ENC= asm/dx86-sol.o asm/yx86-sol.o # solaris
#DES_ENC= asm/dx86-out.o asm/yx86-out.o # a.out, FreeBSD
#DES_ENC= asm/dx86bsdi.o asm/yx86bsdi.o # bsdi
# Set BF_ENC to bf_enc.o if you want to use the C version
#There are 4 x86 assember options.
BF_ENC= bf_enc.o
#BF_ENC= bf_enc.o # C
#BF_ENC= bf_enc.o
#BF_ENC= asm/bx86-elf.o # elf
#BF_ENC= asm/bx86-sol.o # solaris
#BF_ENC= asm/bx86-out.o # a.out, FreeBSD
#BF_ENC= asm/bx86bsdi.o # bsdi
#BF_ENC= asm/bx86-sol.o # solaris
#BF_ENC= asm/bx86-out.o # a.out, FreeBSD
#BF_ENC= asm/bx86bsdi.o # bsdi
DIRS= crypto ssl rsaref apps test tools
# Set CAST_ENC to c_enc.o if you want to use the C version
#There are 4 x86 assember options.
CAST_ENC= c_enc.o
#CAST_ENC= c_enc.o
#CAST_ENC= asm/cx86-elf.o # elf
#CAST_ENC= asm/cx86-sol.o # solaris
#CAST_ENC= asm/cx86-out.o # a.out, FreeBSD
#CAST_ENC= asm/cx86bsdi.o # bsdi
# Set RC4_ENC to rc4_enc.o if you want to use the C version
#There are 4 x86 assember options.
RC4_ENC= rc4_enc.o
#RC4_ENC= rc4_enc.o
#RC4_ENC= asm/rx86-elf.o # elf
#RC4_ENC= asm/rx86-sol.o # solaris
#RC4_ENC= asm/rx86-out.o # a.out, FreeBSD
#RC4_ENC= asm/rx86bsdi.o # bsdi
# Set RC5_ENC to rc5_enc.o if you want to use the C version
#There are 4 x86 assember options.
RC5_ENC= rc5_enc.o
#RC5_ENC= rc5_enc.o
#RC5_ENC= asm/r586-elf.o # elf
#RC5_ENC= asm/r586-sol.o # solaris
#RC5_ENC= asm/r586-out.o # a.out, FreeBSD
#RC5_ENC= asm/r586bsdi.o # bsdi
# Also need MD5_ASM defined
MD5_ASM_OBJ=
#MD5_ASM_OBJ= asm/mx86-elf.o # elf
#MD5_ASM_OBJ= asm/mx86-sol.o # solaris
#MD5_ASM_OBJ= asm/mx86-out.o # a.out, FreeBSD
#MD5_ASM_OBJ= asm/mx86bsdi.o # bsdi
# Also need SHA1_ASM defined
SHA1_ASM_OBJ=
#SHA1_ASM_OBJ= asm/sx86-elf.o # elf
#SHA1_ASM_OBJ= asm/sx86-sol.o # solaris
#SHA1_ASM_OBJ= asm/sx86-out.o # a.out, FreeBSD
#SHA1_ASM_OBJ= asm/sx86bsdi.o # bsdi
# Also need RMD160_ASM defined
RMD160_ASM_OBJ=
#RMD160_ASM_OBJ= asm/rm86-elf.o # elf
#RMD160_ASM_OBJ= asm/rm86-sol.o # solaris
#RMD160_ASM_OBJ= asm/rm86-out.o # a.out, FreeBSD
#RMD160_ASM_OBJ= asm/rm86bsdi.o # bsdi
DIRS= crypto ssl rsaref apps test tools
# dirs in crypto to build
SDIRS= \
md sha mdc2 des rc4 rc2 idea bf bn rsa dsa dh \
md2 md5 sha mdc2 hmac ripemd \
des rc2 rc4 rc5 idea bf cast \
bn rsa dsa dh \
buffer bio stack lhash rand err objects \
evp pem asn1 x509 conf txt_db pkcs7
......@@ -108,46 +161,46 @@ SDIRS= \
INSTALLTOP=/usr/local/ssl
MAKEFILE= Makefile.ssl
MAKE= make -f Makefile.ssl
MAKE= make -f Makefile.ssl
MAN1=1
MAN3=3
SHELL=/bin/sh
TOP= .
TOP= .
ONEDIRS=out tmp
EDIRS= times doc bugs util include certs ms shlib mt demos
MISC= COPYRIGHT Configure HISTORY.066 INSTALL Makefile.ssl Makefile \
README TODO HISTORY README.066 README.080 \
EDIRS= times doc bugs util include certs ms shlib mt demos perl dep
MISC= COPYRIGHT Configure HISTORY.066 INSTALL Makefile.ssl Makefile \
README TODO HISTORY README.066 README.080 README.090 \
VERSION PROBLEMS MINFO makefile.one e_os.h \
MICROSOFT makevms.com
WDIRS= windows
LIBS= libcrypto.a libssl.a
GENERAL= Makefile
BASENAME= SSLeay
NAME= $(BASENAME)-$(VERSION)
TARFILE= $(NAME).tar
WTARFILE= $(NAME)-win.tar
EX_HEADER=
HEADER= e_os.h
MICROSOFT makevms.com config PATENTS
WDIRS= windows
LIBS= libcrypto.a libssl.a
GENERAL= Makefile
BASENAME= SSLeay
NAME= $(BASENAME)-$(VERSION)
TARFILE= $(NAME).tar
WTARFILE= $(NAME)-win.tar
EXHEADER= e_os.h
HEADER= e_os.h
all:
@for i in $(DIRS) ;\
do \
(cd $$i; echo "making $$i..."; \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' SDIRS='${SDIRS}' AR='${AR}' all ); \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' all ); \
done;
sub_all:
@for i in $(DIRS) ;\
do \
(cd $$i; echo "making $$i..."; \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' AR='${AR}' all ); \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' all ); \
done;
clean:
/bin/rm -f *.o core a.out fluff *.map
/bin/rm -f shlib/*.o *.o core a.out fluff *.map
@for i in $(DIRS) ;\
do \
(cd $$i; echo "cleaning $$i..."; \
......@@ -158,14 +211,14 @@ clean:
/bin/rm -f $(TARFILE)
@for i in $(ONEDIRS) ;\
do \
/bin/rm -f $$i/*; \
/bin/rm -fr $$i/*; \
done
makefile.one: files
perl util/mk1mf.pl >makefile.one; \
sh util/do_ms.sh
files: MINFO
files: MINFO
perl $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
@for i in $(DIRS) ;\
do \
......@@ -176,13 +229,14 @@ files: MINFO
links:
/bin/rm -f Makefile;
./util/point.sh Makefile.ssl Makefile;
$(TOP)/util/mklink.sh include $(EXHEADER) ;
@for i in $(DIRS) ;\
do \
(cd $$i; echo "making links in $$i..."; \
$(MAKE) SDIRS='${SDIRS}' links ); \
done;
# @(cd apps; sh ./mklinks)
sh tools/c_rehash certs
@( SSLEAY="`pwd`/apps/ssleay"; export SSLEAY; sh tools/c_rehash certs )
dclean:
/bin/rm -f *.bak
......@@ -195,11 +249,11 @@ dclean:
rehash:
@(PATH="`pwd`/apps:${PATH}"; sh tools/c_rehash certs)
test: tests
test: tests
tests:
(cd test; echo "testing $$i..."; \
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' SDIRS='${SDIRS}' AR='${AR}' tests );
$(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SDIRS='${SDIRS}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' tests );
@apps/ssleay version -a
depend:
......@@ -242,8 +296,9 @@ tar:
mv $(NAME) $(BASENAME) )
gzip -f $(TARFILE)
dist:
dist:
perl Configure dist
perl util/up_ver.pl ${VERSION}
@$(MAKE) dist_pem_h
@$(MAKE) SDIRS='${SDIRS}' clean
@$(MAKE) SDIRS='${SDIRS}' dclean
......@@ -267,7 +322,7 @@ install: all
done
@for i in $(LIBS) ;\
do \
( echo installing $$i; \
( echo installing $$i; \
cp $$i $(INSTALLTOP)/lib; \
sh util/ranlib.sh $(INSTALLTOP)/lib/$$i; \
chmod 644 $(INSTALLTOP)/lib/$$i ); \
......
RSA Data Security holds software patents on the RSA and RC5 algorithms.
If there ciphers are used used inside the USA (and Japan?), you must contact
RSA Data Security for licencing conditions.
The IDEA algorithm is patented by XXXX and they should be contacted if that
algorithm is to be used.
RC4 is a trademark of RSA Data Security, so use of this label should perhaps
only me used with RSA Data Security's permission.
SSLeay 0.8.1b 29-Jun-1998
SSLeay 0.9.0b 29-Jun-1998
Copyright (c) 1997, Eric Young
All rights reserved.
......
10-Apr-1998
I said the next version would go out at easter, and so it shall.
I expect a 0.9.1 will follow with portability fixes in the next few weeks.
This is a quick, meet the deadline. Look to ssl-users for comments on what
is new etc.
The state of play
- TLSv1 - I need to do some explaining about how the methods interact.
The bad news is that SSLeay 0.8.x application will not roll back to
SSLv3, I suffed up. 0.8.x is rather pedantic about the '3.0' version
number. Look at the 'no-tls' options in applications in the apps directory.
- The perl5 stuff is very rough. The SSL part does not work due to
reference count hassles in the BIO stuff. I just have not had time to
look at it. The cipher, digest and bignum stuff works though. I just
need to clean up the API.
- Lots of x86 assember. I now have it for des, 3des, rc4, rc5, blowfish,
cast, md5, sha1 and ripemd160. It has been tested on win32, linux (elf)
and FreeBSD (a.out).
- As mentioned above, cast, rc5 and ripemd160 have been added.
- A simple HMAC set of functions.
- EX_DATA strucutre, which can be used by applications or other libraries
to tack arbitarty data against strucutures that include it.
You will probably have to see examples to see how to use it, and I will
elaberate on the ssl-users mailing list
- RSA blinding. If you fear timing attacks on RSA, you can turn on
blinding which defeats it.
- From Tim Hudson, try running 'sh config' instead of 'perl Configure'.
I makes an educated guess as to what you are and then runs 'perl Configure'
- The error stuff has been modified so arbitary strings can be taged
against an error message. It is used in a few places to elaberate on
parameters that caused the error.
Areas of work
- The 16bit big-num assember needs a routine added. The WIN16 and
WIN32 stuff is ok, but MS-DOS or 286 builds need the update.
- Most of the bignum assember will not work. There will be a function
missing, bn_add_words(). I need people to send me the C compiler output
for platforms I don't already have. Currently, the assember is correct for
x86, win32, win16(386+), linux elf, FreeBSD a.out and sparc.
- PKCS7, I have delusions of s/MIME. I need to do a BIO interface.
- perl5, it needs finishing
- X509v3 extension. I have some ideas, I just need to
implement them :-)
- Public key methods. I need to clean up the library internally so
public key methods are loaded is a similar way to symetric ciphers
and digests. I also need to seperate out the digests from public
key methods. This stuff is needed to support sortware patents, smaller
code size and hardware tokens.
Anyway, this release gets out the bug fixes and TLS, but be warned, until
all those old SSLeay 0.8.x based server get upgraded, you will need to
connect with SSLv3 if TLSv1 fails.
eric (about to go bushwalking for the 4 day easter break :-)
PS Common problems
- For Win32 build, use /MD to specify your libraries, or build SSLeay with
the same flags as your application. Visual C stuffs up the malloc routines
if memory allocated by one memory model is freed by another. FILE pointers
are a major cause of these problem.
- If you are trying to use non-blocking IO and it is not working,
try 'ssleay s_client -help' and see if the -nbio option is listed.
For unixware, it has the non-block IO define in 'differnt' header file
and SSLeay will silently build without non-blocking IO calls (but for
unixware, the special header has been included).
- -DL_ENDIAN. For the message digests, some code needs to be turned off
in the C code when assember is used. For x86, this means the L_ENDIAN
needs to defined when x86 -DSHA1_ASM is defined. The reasons this is
not automagically done is because non-x86 assember could be bigendian.
For pure C code builds, the B_ENDIAN/L_ENDIAN flags are optional.
......@@ -31,7 +31,7 @@ SCRIPTS=CA.sh der_chop
EXE= $(SSLEAY)
E_EXE= verify asn1pars req dgst dh enc gendh gendsa errstr ca crl \
E_EXE= verify asn1pars req dgst dh enc gendh errstr ca crl \
rsa dsa dsaparam \
x509 genrsa s_server s_client speed \
s_time version pkcs7 crl2pkcs7 sess_id ciphers
......@@ -44,7 +44,7 @@ S_OBJ= s_cb.o s_socket.o
S_SRC= s_cb.c s_socket.c
E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o \
gendsa.o pkcs7.o crl2p7.o crl.o \
pkcs7.o crl2p7.o crl.o \
rsa.o dsa.o dsaparam.o \
x509.o genrsa.o s_server.o s_client.o speed.o \
s_time.o $(A_OBJ) $(S_OBJ) version.o sess_id.o \
......@@ -53,7 +53,7 @@ E_OBJ= verify.o asn1pars.o req.o dgst.o dh.o enc.o gendh.o errstr.o ca.o \
# pem_mail.o
E_SRC= verify.c asn1pars.c req.c dgst.c dh.c enc.c gendh.c errstr.c ca.c \
gendsa.c pkcs7.c crl2p7.c crl.c \
pkcs7.c crl2p7.c crl.c \
rsa.c dsa.c dsaparam.c \
x509.c genrsa.c s_server.c s_client.c speed.c \
s_time.c $(A_SRC) $(S_SRC) version.c sess_id.c \
......
/* apps/apps.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -65,13 +65,8 @@
#include "apps.h"
#undef NON_MAIN
#ifdef WIN16
#define APPS_WIN16
#ifdef FLAT_BUILD
#include "bss_file.c"
#else
#include "../crypto/bio/bss_file.c"
#endif
#ifdef WINDOWS
# include "bss_file.c"
#endif
#ifndef NOPROTO
......
/* apps/apps.h */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -59,18 +59,14 @@
#ifndef HEADER_APPS_H
#define HEADER_APPS_H
#ifdef FLAT_INC
#include "e_os.h"
#else
#include "../e_os.h"
#endif
#include "buffer.h"
#include "bio.h"
#include "crypto.h"
#include "progs.h"
#ifdef WIN16
#ifdef NO_STDIO
BIO_METHOD *BIO_s_file();
#endif
......
/* apps/asn1pars.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -75,6 +75,7 @@
* -i - indent the details by depth
* -offset - where in the file to start
* -length - how many bytes to use
* -oid file - extra oid decription file
*/
#undef PROG
......@@ -89,17 +90,16 @@ char **argv;
long num;
BIO *in=NULL,*out=NULL,*b64=NULL;
int informat,indent=0;
char *infile,*str=NULL,*prog;
char *infile=NULL,*str=NULL,*prog,*oidfile=NULL;
BUF_MEM *buf=NULL;
infile=NULL;
informat=FORMAT_PEM;
apps_startup();
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
prog=argv[0];
argc--;
......@@ -120,6 +120,11 @@ char **argv;
{
indent=1;
}
else if (strcmp(*argv,"-oid") == 0)
{
if (--argc < 1) goto bad;
oidfile= *(++argv);
}
else if (strcmp(*argv,"-offset") == 0)
{
if (--argc < 1) goto bad;
......@@ -151,6 +156,7 @@ bad:
BIO_printf(bio_err," -offset arg offset into file\n");
BIO_printf(bio_err," -length arg lenth of section in file\n");
BIO_printf(bio_err," -i indent entries\n");
BIO_printf(bio_err," -oid file file of extra oid definitions\n");
goto end;
}
......@@ -163,7 +169,19 @@ bad:
ERR_print_errors(bio_err);
goto end;
}
BIO_set_fp(out,stdout,BIO_NOCLOSE);
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
if (oidfile != NULL)
{
if (BIO_read_filename(in,oidfile) <= 0)
{
BIO_printf(bio_err,"problems opening %s\n",oidfile);
ERR_print_errors(bio_err);
goto end;
}
OBJ_create_objects(in);
}
if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE);
else
......@@ -214,6 +232,7 @@ end:
if (ret != 0)
ERR_print_errors(bio_err);
if (buf != NULL) BUF_MEM_free(buf);
OBJ_cleanup();
EXIT(ret);
}
/* apps/ca.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -97,6 +97,7 @@
#define ENV_PRIVATE_KEY "private_key"
#define ENV_RANDFILE "RANDFILE"
#define ENV_DEFAULT_DAYS "default_days"
#define ENV_DEFAULT_STARTDATE "default_startdate"
#define ENV_DEFAULT_CRL_DAYS "default_crl_days"
#define ENV_DEFAULT_CRL_HOURS "default_crl_hours"
#define ENV_DEFAULT_MD "default_md"
......@@ -139,6 +140,7 @@ static char *ca_usage[]={
" -outdir dir - Where to put output certificates\n",
" -infiles .... - The last argument, requests to process\n",
" -spkac file - File contains DN and signed public key and challenge\n",
" -ss_cert file - File contains a self signed cert to sign\n",
" -preserveDN - Don't re-order the DN\n",
" -batch - Don't ask questions\n",
" -msie_hack - msie modifications to handle all thos universal strings\n",
......@@ -163,16 +165,19 @@ static int index_name_cmp(char **a,char **b);
static BIGNUM *load_serial(char *serialfile);
static int save_serial(char *serialfile, BIGNUM *serial);
static int certify(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
EVP_MD *dgst,STACK *policy,TXT_DB *db,BIGNUM *serial,int days,
int batch, STACK *extensions,int verbose);
EVP_MD *dgst,STACK *policy,TXT_DB *db,BIGNUM *serial,char *startdate,
int days, int batch, STACK *extensions,int verbose);
static int certify_cert(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
EVP_MD *dgst,STACK *policy,TXT_DB *db,BIGNUM *serial,char *startdate,
int days,int batch,STACK *extensions,int verbose);
static int certify_spkac(X509 **xret, char *infile,EVP_PKEY *pkey,X509 *x509,
EVP_MD *dgst,STACK *policy,TXT_DB *db,BIGNUM *serial,int days,
STACK *extensions,int verbose);
EVP_MD *dgst,STACK *policy,TXT_DB *db,BIGNUM *serial,char *startdate,
int days,STACK *extensions,int verbose);
static int fix_data(int nid, int *type);
static void write_new_certificate(BIO *bp, X509 *x, int output_der);
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, EVP_MD *dgst,
STACK *policy, TXT_DB *db, BIGNUM *serial, int days, int batch,
int verbose, X509_REQ *req, STACK *extensions);
STACK *policy, TXT_DB *db, BIGNUM *serial, char *startdate,
int days, int batch, int verbose, X509_REQ *req, STACK *extensions);
static int check_time_format(char *str);
#else
static STACK *load_extensions();
......@@ -187,6 +192,7 @@ static int fix_data();
static BIGNUM *load_serial();
static int save_serial();
static int certify();
static int certify_cert();
static int certify_spkac();
static void write_new_certificate();
static int do_body();
......@@ -221,6 +227,7 @@ char **argv;
char *certfile=NULL;
char *infile=NULL;
char *spkac_file=NULL;
char *ss_cert_file=NULL;
EVP_PKEY *pkey=NULL;
int output_der = 0;
char *outfile=NULL;
......@@ -228,6 +235,7 @@ char **argv;
char *serialfile=NULL;
char *extensions=NULL;
BIGNUM *serial=NULL;
char *startdate=NULL;
int days=0;
int batch=0;
X509 *x509=NULL;
......@@ -263,7 +271,7 @@ EF_ALIGNMENT=0;
preserve=0;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
argc--;
argv++;
......@@ -281,6 +289,11 @@ EF_ALIGNMENT=0;
if (--argc < 1) goto bad;
section= *(++argv);
}
else if (strcmp(*argv,"-startdate") == 0)
{
if (--argc < 1) goto bad;
startdate= *(++argv);
}
else if (strcmp(*argv,"-days") == 0)
{
if (--argc < 1) goto bad;
......@@ -352,6 +365,12 @@ EF_ALIGNMENT=0;
req=1;
break;
}
else if (strcmp(*argv, "-ss_cert") == 0)
{
if (--argc < 1) goto bad;
ss_cert_file = *(++argv);
req=1;
}
else if (strcmp(*argv, "-spkac") == 0)
{
if (--argc < 1) goto bad;
......@@ -570,7 +589,7 @@ bad:
}
if (verbose)
{
BIO_set_fp(out,stdout,BIO_NOCLOSE); /* cannot fail */
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT); /* cannot fail */
TXT_DB_write(out,db);
BIO_printf(bio_err,"%d entries loaded from the database\n",
db->data->num);
......@@ -605,7 +624,7 @@ bad:
}
}
else
BIO_set_fp(Sout,stdout,BIO_NOCLOSE);
BIO_set_fp(Sout,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
}
if (req)
......@@ -647,6 +666,22 @@ bad:
goto err;
}
if (startdate == NULL)
{
startdate=(char *)CONF_get_string(conf,section,
ENV_DEFAULT_STARTDATE);
if (startdate == NULL)
startdate="today";
else
{
if (!ASN1_UTCTIME_set_string(NULL,startdate))
{
BIO_printf(bio_err,"start date is invalid, it should be YYMMDDHHMMSS\n");
goto err;
}
}
}
if (days == 0)
{
days=(int)CONF_get_number(conf,section,
......@@ -685,7 +720,7 @@ bad:
{
total++;
j=certify_spkac(&x,spkac_file,pkey,x509,dgst,attribs,db,
serial,days,extensions_sk,verbose);
serial,startdate,days,extensions_sk,verbose);
if (j < 0) goto err;
if (j > 0)
{
......@@ -704,11 +739,31 @@ bad:
}
}
}
if (ss_cert_file != NULL)
{
total++;
j=certify_cert(&x,ss_cert_file,pkey,x509,dgst,attribs,
db,serial,startdate,days,batch,
extensions_sk,verbose);
if (j < 0) goto err;
if (j > 0)
{
total_done++;
BIO_printf(bio_err,"\n");
if (!BN_add_word(serial,1)) goto err;
if (!sk_push(cert_sk,(char *)x))
{
BIO_printf(bio_err,"Malloc failure\n");
goto err;
}
}
}
if (infile != NULL)
{
total++;
j=certify(&x,infile,pkey,x509,dgst,attribs,db,
serial,days,batch,extensions_sk,verbose);
serial,startdate,days,batch,
extensions_sk,verbose);
if (j < 0) goto err;
if (j > 0)
{
......@@ -726,7 +781,8 @@ bad:
{
total++;
j=certify(&x,argv[i],pkey,x509,dgst,attribs,db,
serial,days,batch,extensions_sk,verbose);
serial,startdate,days,batch,
extensions_sk,verbose);
if (j < 0) goto err;
if (j > 0)
{
......@@ -798,7 +854,7 @@ bad:
{
for (k=0; k<j; k++)
{
sprintf((char *)n,"%02X",*(p++));
sprintf((char *)n,"%02X",(unsigned char)*(p++));
n+=2;
}
}
......@@ -893,6 +949,8 @@ bad:
if (ci->issuer == NULL) goto err;
X509_gmtime_adj(ci->lastUpdate,0);
if (ci->nextUpdate == NULL)
ci->nextUpdate=ASN1_UTCTIME_new();
X509_gmtime_adj(ci->nextUpdate,(crldays*24+crlhours)*60*60);
for (i=0; i<sk_num(db->data); i++)
......@@ -1092,7 +1150,7 @@ err:
return(ret);
}
static int certify(xret,infile,pkey,x509,dgst,policy,db,serial,days,
static int certify(xret,infile,pkey,x509,dgst,policy,db,serial,startdate,days,
batch,extensions,verbose)
X509 **xret;
char *infile;
......@@ -1102,6 +1160,7 @@ EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
int batch;
STACK *extensions;
......@@ -1130,15 +1189,6 @@ int verbose;
BIO_printf(bio_err,"Check that the request matches the signature\n");
if ( (req->req_info == NULL) ||
(req->req_info->pubkey == NULL) ||
(req->req_info->pubkey->public_key == NULL) ||
(req->req_info->pubkey->public_key->data == NULL))
{
BIO_printf(bio_err,"The certificate request appears to corrupted\n");
BIO_printf(bio_err,"It does not contain a public key\n");
goto err;
}
if ((pktmp=X509_REQ_get_pubkey(req)) == NULL)
{
BIO_printf(bio_err,"error unpacking public key\n");
......@@ -1160,8 +1210,8 @@ int verbose;
else
BIO_printf(bio_err,"Signature ok\n");
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,days,batch,verbose,req,
extensions);
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,
days,batch,verbose,req,extensions);
err:
if (req != NULL) X509_REQ_free(req);
......@@ -1169,15 +1219,89 @@ err:
return(ok);
}
static int do_body(xret,pkey,x509,dgst,policy,db,serial,days,batch,verbose,req,
extensions)
static int certify_cert(xret,infile,pkey,x509,dgst,policy,db,serial,startdate,
days, batch,extensions,verbose)
X509 **xret;
char *infile;
EVP_PKEY *pkey;
X509 *x509;
EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
int batch;
STACK *extensions;
int verbose;
{
X509 *req=NULL;
X509_REQ *rreq=NULL;
BIO *in=NULL;
EVP_PKEY *pktmp=NULL;
int ok= -1,i;
in=BIO_new(BIO_s_file());
if (BIO_read_filename(in,infile) <= 0)
{
perror(infile);
goto err;
}
if ((req=PEM_read_bio_X509(in,NULL,NULL)) == NULL)
{
BIO_printf(bio_err,"Error reading self signed certificate in %s\n",infile);
goto err;
}
if (verbose)
X509_print(bio_err,req);
BIO_printf(bio_err,"Check that the request matches the signature\n");
if ((pktmp=X509_get_pubkey(req)) == NULL)
{
BIO_printf(bio_err,"error unpacking public key\n");
goto err;
}
i=X509_verify(req,pktmp);
if (i < 0)
{
ok=0;
BIO_printf(bio_err,"Signature verification problems....\n");
goto err;
}
if (i == 0)
{
ok=0;
BIO_printf(bio_err,"Signature did not match the certificate request\n");
goto err;
}
else
BIO_printf(bio_err,"Signature ok\n");
if ((rreq=X509_to_X509_REQ(req,NULL,EVP_md5())) == NULL)
goto err;
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,days,
batch,verbose,rreq,extensions);
err:
if (rreq != NULL) X509_REQ_free(rreq);
if (req != NULL) X509_free(req);
if (in != NULL) BIO_free(in);
return(ok);
}
static int do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,days,
batch,verbose,req, extensions)
X509 **xret;
EVP_PKEY *pkey;
X509 *x509;
EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
int batch;
int verbose;
......@@ -1185,7 +1309,7 @@ X509_REQ *req;
STACK *extensions;
{
X509_NAME *name=NULL,*CAname=NULL,*subject=NULL;
ASN1_UTCTIME *tm;
ASN1_UTCTIME *tm,*tmptm;
ASN1_STRING *str,*str2;
ASN1_OBJECT *obj;
X509 *ret=NULL;
......@@ -1200,6 +1324,13 @@ STACK *extensions;
char *row[DB_NUMBER],**rrow,**irow=NULL;
char buf[25],*pbuf;
tmptm=ASN1_UTCTIME_new();
if (tmptm == NULL)
{
BIO_printf(bio_err,"malloc error\n");
return(0);
}
for (i=0; i<DB_NUMBER; i++)
row[i]=NULL;
......@@ -1471,8 +1602,16 @@ again2:
goto err;
BIO_printf(bio_err,"Certificate is to be certified until ");
X509_gmtime_adj(X509_get_notBefore(ret),0);
X509_gmtime_adj(X509_get_notAfter(ret),(long)60*60*24*days);
if (strcmp(startdate,"today") == 0)
{
X509_gmtime_adj(X509_get_notBefore(ret),0);
X509_gmtime_adj(X509_get_notAfter(ret),(long)60*60*24*days);
}
else
{
/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/
ASN1_UTCTIME_set_string(X509_get_notBefore(ret),startdate);
}
ASN1_UTCTIME_print(bio_err,X509_get_notAfter(ret));
BIO_printf(bio_err," (%d days)\n",days);
......@@ -1623,8 +1762,8 @@ int output_der;
BIO_puts(bp,"\n");
}
static int certify_spkac(xret,infile,pkey,x509,dgst,policy,db,serial,days,
extensions,verbose)
static int certify_spkac(xret,infile,pkey,x509,dgst,policy,db,serial,
startdate,days,extensions,verbose)
X509 **xret;
char *infile;
EVP_PKEY *pkey;
......@@ -1633,6 +1772,7 @@ EVP_MD *dgst;
STACK *policy;
TXT_DB *db;
BIGNUM *serial;
char *startdate;
int days;
STACK *extensions;
int verbose;
......@@ -1778,8 +1918,8 @@ int verbose;
BIO_printf(bio_err,"Signature ok\n");
X509_REQ_set_pubkey(req,pktmp);
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,days,1,verbose,req,
extensions);
ok=do_body(xret,pkey,x509,dgst,policy,db,serial,startdate,
days,1,verbose,req,extensions);
err:
if (req != NULL) X509_REQ_free(req);
if (parms != NULL) CONF_free(parms);
......
-----BEGIN CERTIFICATE-----
MIIBoDCCAUoCAQAwDQYJKoZIhvcNAQEEBQAwYzELMAkGA1UEBhMCQVUxEzARBgNV
BAgTClF1ZWVuc2xhbmQxGjAYBgNVBAoTEUNyeXB0U29mdCBQdHkgTHRkMSMwIQYD
VQQDExpTZXJ2ZXIgdGVzdCBjZXJ0ICg1MTIgYml0KTAeFw05NzA5MDkwMzQxMjZa
Fw05NzEwMDkwMzQxMjZaMF4xCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0
YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxFzAVBgNVBAMT
DkVyaWMgdGhlIFlvdW5nMFEwCQYFKw4DAgwFAANEAAJBALVEqPODnpI4rShlY8S7
tB713JNvabvn6Gned7zylwLLiXQAo/PAT6mfdWPTyCX9RlId/Aroh1ou893BA32Q
sggwDQYJKoZIhvcNAQEEBQADQQCU5SSgapJSdRXJoX+CpCvFy+JVh9HpSjCpSNKO
19raHv98hKAUJuP9HyM+SUsffO6mAIgitUaqW8/wDMePhEC3
-----END CERTIFICATE-----
/* apps/ciphers.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -59,7 +59,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "apps.h"
......
/* apps/crl.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -109,7 +109,6 @@ char **argv;
BIO *out=NULL;
int informat,outformat;
char *infile=NULL,*outfile=NULL;
char *str=NULL;
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0;
char **pp,buf[256];
......@@ -117,7 +116,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
if (bio_out == NULL)
if ((bio_out=BIO_new(BIO_s_file())) != NULL)
......@@ -209,7 +208,7 @@ bad:
if (issuer == i)
{
X509_NAME_oneline(x->crl->issuer,buf,256);
fprintf(stdout,"issuer= %s\n",str);
fprintf(stdout,"issuer= %s\n",buf);
}
if (hash == i)
......@@ -226,7 +225,10 @@ bad:
if (nextupdate == i)
{
fprintf(stdout,"nextUpdate=");
ASN1_UTCTIME_print(bio_out,x->crl->nextUpdate);
if (x->crl->nextUpdate != NULL)
ASN1_UTCTIME_print(bio_out,x->crl->nextUpdate);
else
fprintf(stdout,"NONE");
fprintf(stdout,"\n");
}
}
......@@ -259,8 +261,10 @@ bad:
else if (outformat == FORMAT_TEXT)
{
X509_REVOKED *r;
STACK *sk;
while ((r=(X509_REVOKED *)sk_pop(x->crl->revoked)) != NULL)
sk=sk_dup(x->crl->revoked);
while ((r=(X509_REVOKED *)sk_pop(sk)) != NULL)
{
fprintf(stdout,"revoked: serialNumber=");
i2a_ASN1_INTEGER(out,r->serialNumber);
......@@ -268,6 +272,7 @@ bad:
ASN1_UTCTIME_print(bio_out,r->revocationDate);
fprintf(stdout,"\n");
}
sk_free(sk);
i=1;
}
else
......
/* apps/crl2p7.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -106,7 +106,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......
/* apps/dgst.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -103,7 +103,7 @@ char **argv;
}
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
/* first check the program name */
program_name(argv[0],pname,PROG_NAME_SIZE);
......@@ -135,16 +135,16 @@ char **argv;
BIO_printf(bio_err,"unknown option '%s'\n",*argv);
BIO_printf(bio_err,"options are\n");
BIO_printf(bio_err,"-c to output the digest with separating colons\n");
BIO_printf(bio_err,"-c to output debug info\n");
BIO_printf(bio_err,"-%3s to use the %s message digest alogorithm (default)\n",
BIO_printf(bio_err,"-d to output debug info\n");
BIO_printf(bio_err,"-%3s to use the %s message digest algorithm (default)\n",
LN_md5,LN_md5);
BIO_printf(bio_err,"-%3s to use the %s message digest alogorithm\n",
BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
LN_md2,LN_md2);
BIO_printf(bio_err,"-%3s to use the %s message digest alogorithm\n",
BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
LN_sha1,LN_sha1);
BIO_printf(bio_err,"-%3s to use the %s message digest alogorithm\n",
BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
LN_sha,LN_sha);
BIO_printf(bio_err,"-%3s to use the %s message digest alogorithm\n",
BIO_printf(bio_err,"-%3s to use the %s message digest algorithm\n",
LN_mdc2,LN_mdc2);
err=1;
goto end;
......
/* apps/dh.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -95,7 +95,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......
/* apps/dsa.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -99,7 +99,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......
-----BEGIN DSA PARAMETERS-----
MIGcAkEA+ZiKEvZmc9MtnaFZh4NiZ3oZS4J1PHvPrm9MXj5ntVheDPkdmBDTncya
GAJcMjwsyB/GvLDGd6yGCw/8eF+09wIVAK3VagOxGd/Q4Af5NbxR5FB7CXEjAkA2
t/q7HgVLi0KeKvcDG8BRl3wuy7bCvpjgtWiJc/tpvcuzeuAayH89UofjAGueKjXD
ADiRffvSdhrNw5dkqdql
-----END DSA PARAMETERS-----
/* apps/dsaparam.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -83,7 +83,7 @@
*/
#ifndef NOPROTO
static void MS_CALLBACK dsa_cb(int p, int n);
static void MS_CALLBACK dsa_cb(int p, int n, char *arg);
#else
static void MS_CALLBACK dsa_cb();
#endif
......@@ -104,7 +104,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......@@ -217,7 +217,8 @@ bad:
BIO_printf(bio_err,"Generating DSA parameters, %d bit long prime\n",num);
BIO_printf(bio_err,"This could take some time\n");
dsa=DSA_generate_parameters(num,NULL,0,NULL,NULL,dsa_cb);
dsa=DSA_generate_parameters(num,NULL,0,NULL,NULL,
dsa_cb,(char *)bio_err);
}
else if (informat == FORMAT_ASN1)
dsa=d2i_DSAparams_bio(in,NULL);
......@@ -322,9 +323,10 @@ end:
EXIT(ret);
}
static void MS_CALLBACK dsa_cb(p, n)
static void MS_CALLBACK dsa_cb(p, n, arg)
int p;
int n;
char *arg;
{
char c='*';
......@@ -332,8 +334,8 @@ int n;
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
BIO_write(bio_err,&c,1);
BIO_flush(bio_err);
BIO_write((BIO *)arg,&c,1);
BIO_flush((BIO *)arg);
#ifdef LINT
p=n;
#endif
......
/* apps/eay.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
/* apps/enc.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -96,7 +96,7 @@ char **argv;
char *str=NULL;
char *hkey=NULL,*hiv=NULL;
int enc=1,printkey=0,i,base64=0;
int debug=0;
int debug=0,olb64=0;
EVP_CIPHER *cipher=NULL,*c;
char *inf=NULL,*outf=NULL;
BIO *in=NULL,*out=NULL,*b64=NULL,*benc=NULL,*rbio=NULL,*wbio=NULL;
......@@ -107,7 +107,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
/* first check the program name */
program_name(argv[0],pname,PROG_NAME_SIZE);
......@@ -148,6 +148,8 @@ char **argv;
debug=1;
else if (strcmp(*argv,"-P") == 0)
printkey=2;
else if (strcmp(*argv,"-A") == 0)
olb64=1;
else if (strcmp(*argv,"-a") == 0)
base64=1;
else if (strcmp(*argv,"-base64") == 0)
......@@ -280,6 +282,18 @@ bad:
LN_bf_ecb, LN_bf_cbc,
LN_bf_cfb64, LN_bf_ofb64);
BIO_printf(bio_err," -%-4s (%s)\n","bf", LN_bf_cbc);
#endif
#ifndef NO_BLOWFISH
BIO_printf(bio_err," -%-12s -%-12s -%-12s -%-12s",
LN_cast5_ecb, LN_cast5_cbc,
LN_cast5_cfb64, LN_cast5_ofb64);
BIO_printf(bio_err," -%-4s (%s)\n","cast", LN_cast5_cbc);
#endif
#ifndef NO_BLOWFISH
BIO_printf(bio_err," -%-12s -%-12s -%-12s -%-12s",
LN_rc5_ecb, LN_rc5_cbc,
LN_rc5_cfb64, LN_rc5_ofb64);
BIO_printf(bio_err," -%-4s (%s)\n","rc5", LN_rc5_cbc);
#endif
goto end;
}
......@@ -463,6 +477,8 @@ bad:
BIO_set_callback(b64,BIO_debug_callback);
BIO_set_callback_arg(b64,bio_err);
}
if (olb64)
BIO_set_flags(b64,BIO_FLAGS_BASE64_NO_NL);
if (enc)
wbio=BIO_push(b64,wbio);
else
......
/* apps/errstr.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -80,7 +80,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
SSL_load_error_strings();
......
2.99999.3 SET.ex3 SET x509v3 extension 3
......@@ -57,14 +57,16 @@ foreach ("md2","md5","sha","sha1","mdc2")
foreach (
"base64",
"des", "des3", "desx", "idea", "rc4", "rc2","bf",
"des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5",
"des-ecb", "des-ede", "des-ede3",
"des-cbc", "des-ede-cbc","des-ede3-cbc",
"des-cfb", "des-ede-cfb","des-ede3-cfb",
"des-ofb", "des-ede-ofb","des-ede3-ofb",
"idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
"rc2-cbc", "rc2-ecb", "rc2-cfb", "rc2-ofb",
"bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb")
"bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
"cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb")
{
push(@files,$_);
......@@ -74,6 +76,8 @@ foreach (
elsif ($_ =~ /rc4/) { $t="#ifndef NO_RC4\n${t}#endif\n"; }
elsif ($_ =~ /rc2/) { $t="#ifndef NO_RC2\n${t}#endif\n"; }
elsif ($_ =~ /bf/) { $t="#ifndef NO_BLOWFISH\n${t}#endif\n"; }
elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
elsif ($_ =~ /rc5/) { $t="#ifndef NO_RC5\n${t}#endif\n"; }
print $t;
}
......
/* apps/gendh.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -74,7 +74,7 @@
#define PROG gendh_main
#ifndef NOPROTO
static void MS_CALLBACK dh_cb(int p, int n);
static void MS_CALLBACK dh_cb(int p, int n, char *arg);
static long dh_load_rand(char *names);
#else
static void MS_CALLBACK dh_cb();
......@@ -97,7 +97,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
argv++;
argc--;
......@@ -171,7 +171,7 @@ bad:
BIO_printf(bio_err,"Generating DH parameters, %d bit long strong prime, generator of %d\n",num,g);
BIO_printf(bio_err,"This is going to take a long time\n");
dh=DH_generate_parameters(num,g,dh_cb);
dh=DH_generate_parameters(num,g,dh_cb,(char *)bio_err);
if (dh == NULL) goto end;
......@@ -191,9 +191,10 @@ end:
EXIT(ret);
}
static void MS_CALLBACK dh_cb(p, n)
static void MS_CALLBACK dh_cb(p,n,arg)
int p;
int n;
char *arg;
{
char c='*';
......@@ -201,8 +202,8 @@ int n;
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
BIO_write(bio_err,&c,1);
BIO_flush(bio_err);
BIO_write((BIO *)arg,&c,1);
BIO_flush((BIO *)arg);
#ifdef LINT
p=n;
#endif
......
/* apps/gendsa.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -94,7 +94,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
argv++;
argc--;
......@@ -135,7 +135,7 @@ bad:
}
in=BIO_new(BIO_s_file());
if (!(BIO_read_filename(in,"r")))
if (!(BIO_read_filename(in,"dsaparams")))
{
perror(dsaparams);
goto end;
......
/* apps/genrsa.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -75,7 +75,7 @@
#define PROG genrsa_main
#ifndef NOPROTO
static void MS_CALLBACK genrsa_cb(int p, int n);
static void MS_CALLBACK genrsa_cb(int p, int n, char *arg);
static long gr_load_rand(char *names);
#else
static void MS_CALLBACK genrsa_cb();
......@@ -101,7 +101,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
if ((out=BIO_new(BIO_s_file())) == NULL)
{
BIO_printf(bio_err,"unable to creat BIO for output\n");
......@@ -201,7 +201,7 @@ bad:
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
num);
rsa=RSA_generate_key(num,f4,genrsa_cb);
rsa=RSA_generate_key(num,f4,genrsa_cb,(char *)bio_err);
if (randfile == NULL)
BIO_printf(bio_err,"unable to write 'random state'\n");
......@@ -234,9 +234,10 @@ err:
EXIT(ret);
}
static void MS_CALLBACK genrsa_cb(p, n)
static void MS_CALLBACK genrsa_cb(p, n, arg)
int p;
int n;
char *arg;
{
char c='*';
......@@ -244,8 +245,8 @@ int n;
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
BIO_write(bio_err,&c,1);
BIO_flush(bio_err);
BIO_write((BIO *)arg,&c,1);
BIO_flush((BIO *)arg);
#ifdef LINT
p=n;
#endif
......
#!/bin/sh
for i in verify asn1parse req dgst dh enc gendh gendsa errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers md2 md5 sha sha1 mdc2 base64 des des3 desx idea rc4 rc2 bf des-ecb des-ede des-ede3 des-cbc des-ede-cbc des-ede3-cbc des-cfb des-ede-cfb des-ede3-cfb des-ofb des-ede-ofb des-ede3-ofb idea-cbc idea-ecb idea-cfb idea-ofb rc2-cbc rc2-ecb rc2-cfb rc2-ofb bf-cbc bf-ecb bf-cfb bf-ofb
for i in verify asn1parse req dgst dh enc gendh errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers md2 md5 sha sha1 mdc2 base64 des des3 desx idea rc4 rc2 bf cast rc5 des-ecb des-ede des-ede3 des-cbc des-ede-cbc des-ede3-cbc des-cfb des-ede-cfb des-ede3-cfb des-ofb des-ede-ofb des-ede3-ofb idea-cbc idea-ecb idea-cfb idea-ofb rc2-cbc rc2-ecb rc2-cfb rc2-ofb bf-cbc bf-ecb bf-cfb bf-ofb cast5-cbc cast5-ecb cast5-cfb cast5-ofb cast-cbc rc5-cbc rc5-ecb rc5-cfb rc5-ofb
do
echo making symlink for $i
/bin/rm -f $i
......
/* apps/ssleay.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -56,14 +56,13 @@
* [including the GNU Public Licence.]
*/
#define DEBUG
#ifndef DEBUG
#undef DEBUG
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef WIN16
#define APPS_WIN16
#endif
#include "bio.h"
#include "crypto.h"
#include "lhash.h"
......@@ -78,19 +77,22 @@
#include "s_apps.h"
#include "err.h"
/*
#ifdef WINDOWS
#include "bss_file.c"
#endif
*/
#ifndef NOPROTO
static unsigned long MS_CALLBACK hash(FUNCTION *a);
static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b);
static LHASH *prog_init(void );
static int do_cmd(LHASH *prog,int argc,char *argv[]);
static void sig_stop(int i);
#else
static unsigned long MS_CALLBACK hash();
static int MS_CALLBACK cmp();
static LHASH *prog_init();
static int do_cmd();
static void sig_stop();
#endif
LHASH *config=NULL;
......@@ -143,7 +145,7 @@ char *Argv[];
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
......@@ -224,6 +226,7 @@ char *Argv[];
}
if (ret != 0)
BIO_printf(bio_err,"error in %s\n",argv[0]);
BIO_flush(bio_err);
}
BIO_printf(bio_err,"bad exit\n");
ret=1;
......
/* apps/pem_mail.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
/* apps/pkcs7.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -87,7 +87,9 @@ char **argv;
{
PKCS7 *p7=NULL;
int i,badops=0;
#if !defined(NO_DES) || !defined(NO_IDEA)
EVP_CIPHER *enc=NULL;
#endif
BIO *in=NULL,*out=NULL;
int informat,outformat;
char *infile,*outfile,*prog,buf[256];
......@@ -98,7 +100,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......
-----BEGIN DSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,2221AF3DAA41AB24
DEK-Info: DES-EDE3-CBC,1BF8E9CE60B9941C
IOx3ubYOV2SETDSWiuG4bsioEl7jA2CulYKAJvIfy8z5GI+08NwptNOUqbMhDV1s
156KhUvBvG48uz9mxcOyHjZRD0HNixGNMXDaFJSajINFoGtmYZRc20DEoY6buzsi
E76GK95cJHsjJsdNrdggIJRTaiLayLzsMFVDrKhmaJVTKlBpcdnFM4BEKSyD2H5N
OllrfK6GgmlH+WVXU9AlXoy5Jm0YXT7i5bPCB5eDDL/GkTISFHZsnEYpHCrMARsw
5V15dYEwFc6NA/psBGk1qS2CHVIOYNcfCfndR90+UCos+rMBkcQDfvxI95+L8dbS
ONJJrUqiCHV/zYSE+aXZN001mJJLvHOW65YbgdwSOfiowcv7HPbFrGdwOOJvSEx2
d571YvqfsaDojwR5KLgfFDSwVBwzo/mfcFeVrT9Q8LwPL4/dwwoElWTmYbSaW0uZ
Ov73xRUbVGa5LTJoGbFVMvjpmEO2qtBsx7vq9AT8v8gDzYSuEafyC7d0h85EIfTJ
wPlIN3xKTiqFpp/eFCkdKqNn826NoC1TgQuoCBIrJ8gZsIr1l8R+iAuGxKGPASoF
cyqnpcqGgaaTrxnk9cX4dQ==
JuhgIvVRrxCRedTTC9ABlIByMsq6IcpqyDZwOPS4rxTtVWvjj1BMHtoCebK7CKMZ
dLsvztfSkdAYmTGK62C73RwlmnMxB4JXhTLaoAX2eL9iylojTWRg+/0Y4rbIKmUe
hrmwrHld7vnfE9XHL8OoaFp6aJ8BB9B8HIfdJMnrNcTWJSGS6gYPTWPdm7ZCykEV
2fFEX6IqWjBjaRm36Esj5mHLRVhBbi2n/jy5IhZeqjEsQ8adYGUulzPSe5xc2JZa
+OO4ch/RRqWTFP59eNPfdke3UE7uNlUhPnYDAOXhSdMJBzI+T9RQXU2y/tMOrYYK
3+jNQcQ9q1Xy1s5dz/BOvw==
-----END DSA PRIVATE KEY-----
......@@ -6,7 +6,6 @@ extern int dgst_main(int argc,char *argv[]);
extern int dh_main(int argc,char *argv[]);
extern int enc_main(int argc,char *argv[]);
extern int gendh_main(int argc,char *argv[]);
extern int gendsa_main(int argc,char *argv[]);
extern int errstr_main(int argc,char *argv[]);
extern int ca_main(int argc,char *argv[]);
extern int crl_main(int argc,char *argv[]);
......@@ -32,7 +31,6 @@ extern int dgst_main();
extern int dh_main();
extern int enc_main();
extern int gendh_main();
extern int gendsa_main();
extern int errstr_main();
extern int ca_main();
extern int crl_main();
......@@ -77,9 +75,6 @@ FUNCTION functions[] = {
{FUNC_TYPE_GENERAL,"enc",enc_main},
#ifndef NO_DH
{FUNC_TYPE_GENERAL,"gendh",gendh_main},
#endif
#ifndef NO_DSA
{FUNC_TYPE_GENERAL,"gendsa",gendsa_main},
#endif
{FUNC_TYPE_GENERAL,"errstr",errstr_main},
#ifndef NO_RSA
......@@ -145,6 +140,12 @@ FUNCTION functions[] = {
#ifndef NO_BLOWFISH
{FUNC_TYPE_CIPHER,"bf",enc_main},
#endif
#ifndef NO_CAST
{FUNC_TYPE_CIPHER,"cast",enc_main},
#endif
#ifndef NO_RC5
{FUNC_TYPE_CIPHER,"rc5",enc_main},
#endif
#ifndef NO_DES
{FUNC_TYPE_CIPHER,"des-ecb",enc_main},
#endif
......@@ -216,6 +217,33 @@ FUNCTION functions[] = {
#endif
#ifndef NO_BLOWFISH
{FUNC_TYPE_CIPHER,"bf-ofb",enc_main},
#endif
#ifndef NO_CAST
{FUNC_TYPE_CIPHER,"cast5-cbc",enc_main},
#endif
#ifndef NO_CAST
{FUNC_TYPE_CIPHER,"cast5-ecb",enc_main},
#endif
#ifndef NO_CAST
{FUNC_TYPE_CIPHER,"cast5-cfb",enc_main},
#endif
#ifndef NO_CAST
{FUNC_TYPE_CIPHER,"cast5-ofb",enc_main},
#endif
#ifndef NO_CAST
{FUNC_TYPE_CIPHER,"cast-cbc",enc_main},
#endif
#ifndef NO_RC5
{FUNC_TYPE_CIPHER,"rc5-cbc",enc_main},
#endif
#ifndef NO_RC5
{FUNC_TYPE_CIPHER,"rc5-ecb",enc_main},
#endif
#ifndef NO_RC5
{FUNC_TYPE_CIPHER,"rc5-cfb",enc_main},
#endif
#ifndef NO_RC5
{FUNC_TYPE_CIPHER,"rc5-ofb",enc_main},
#endif
{0,NULL,NULL}
};
......
......@@ -57,14 +57,16 @@ foreach ("md2","md5","sha","sha1","mdc2")
foreach (
"base64",
"des", "des3", "desx", "idea", "rc4", "rc2","bf",
"des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5",
"des-ecb", "des-ede", "des-ede3",
"des-cbc", "des-ede-cbc","des-ede3-cbc",
"des-cfb", "des-ede-cfb","des-ede3-cfb",
"des-ofb", "des-ede-ofb","des-ede3-ofb",
"idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
"rc2-cbc", "rc2-ecb", "rc2-cfb", "rc2-ofb",
"bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb")
"bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
"cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb")
{
push(@files,$_);
......@@ -74,6 +76,8 @@ foreach (
elsif ($_ =~ /rc4/) { $t="#ifndef NO_RC4\n${t}#endif\n"; }
elsif ($_ =~ /rc2/) { $t="#ifndef NO_RC2\n${t}#endif\n"; }
elsif ($_ =~ /bf/) { $t="#ifndef NO_BLOWFISH\n${t}#endif\n"; }
elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
elsif ($_ =~ /rc5/) { $t="#ifndef NO_RC5\n${t}#endif\n"; }
print $t;
}
......
/* apps/req.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -60,7 +60,7 @@
#include <stdlib.h>
#include <time.h>
#include <string.h>
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "apps.h"
......@@ -111,7 +111,7 @@ static int add_attribute_object(STACK *n, char *text, char *def,
char *value, int nid,int min,int max);
static int add_DN_object(X509_NAME *n, char *text, char *def, char *value,
int nid,int min,int max);
static void MS_CALLBACK req_cb(int p,int n);
static void MS_CALLBACK req_cb(int p,int n,char *arg);
static int req_fix_data(int nid,int *type,int len,int min,int max);
#else
static int make_REQ();
......@@ -135,7 +135,9 @@ int MAIN(argc, argv)
int argc;
char **argv;
{
#ifndef NO_DSA
DSA *dsa_params=NULL;
#endif
int ex=1,x509=0,days=30;
X509 *x509ss=NULL;
X509_REQ *req=NULL;
......@@ -160,7 +162,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......@@ -228,7 +230,9 @@ char **argv;
p+=4;
newkey= atoi(p);
}
else if (strncmp("dsa:",p,4) == 0)
else
#ifndef NO_DSA
if (strncmp("dsa:",p,4) == 0)
{
X509 *xtmp=NULL;
EVP_PKEY *dtmp;
......@@ -249,6 +253,9 @@ char **argv;
BIO_printf(bio_err,"unable to load DSA parameters from file\n");
goto end;
}
/* This will 'disapear'
* when we free xtmp */
dtmp=X509_get_pubkey(xtmp);
if (dtmp->type == EVP_PKEY_DSA)
dsa_params=DSAparams_dup(dtmp->pkey.dsa);
......@@ -258,18 +265,21 @@ char **argv;
BIO_printf(bio_err,"Certificate does not contain DSA parameters\n");
goto end;
}
}
BIO_free(in);
newkey=BN_num_bits(dsa_params->p);
in=NULL;
}
else if (strncmp("dh:",p,4) == 0)
else
#endif
#ifndef NO_DH
if (strncmp("dh:",p,4) == 0)
{
pkey_type=TYPE_DH;
p+=3;
}
else
#endif
pkey_type=TYPE_RSA;
newreq=1;
......@@ -463,7 +473,8 @@ bad:
if (pkey_type == TYPE_RSA)
{
if (!EVP_PKEY_assign_RSA(pkey,
RSA_generate_key(newkey,0x10001,req_cb)))
RSA_generate_key(newkey,0x10001,
req_cb,(char *)bio_err)))
goto end;
}
else
......@@ -559,8 +570,10 @@ loop:
if (newreq || x509)
{
#ifndef NO_DSA
if (pkey->type == EVP_PKEY_DSA)
digest=EVP_dss1();
#endif
if (pkey == NULL)
{
......@@ -733,7 +746,9 @@ end:
if (pkey != NULL) EVP_PKEY_free(pkey);
if (req != NULL) X509_REQ_free(req);
if (x509ss != NULL) X509_free(x509ss);
#ifndef NO_DSA
if (dsa_params != NULL) DSA_free(dsa_params);
#endif
EXIT(ex);
}
......@@ -743,7 +758,7 @@ EVP_PKEY *pkey;
int attribs;
{
int ret=0,i,j;
unsigned char *p;
unsigned char *p,*q;
X509_REQ_INFO *ri;
char buf[100];
int nid,min,max;
......@@ -800,19 +815,43 @@ start: for (;;)
if ((int)sk_num(sk) <= i) break;
v=(CONF_VALUE *)sk_value(sk,i);
p=NULL;
p=q=NULL;
type=v->name;
/* Allow for raw OIDs */
/* [n.mm.ooo.ppp] */
for (j=0; type[j] != '\0'; j++)
{
if ( (type[j] == ':') ||
(type[j] == ',') ||
(type[j] == '.'))
p= (unsigned char *)&(type[j+1]);
p=(unsigned char *)&(type[j+1]);
if (type[j] == '[')
{
p=(unsigned char *)&(type[j+1]);
for (j++; type[j] != '\0'; j++)
if (type[j] == ']')
{
q=(unsigned char *)&(type[j]);
break;
}
break;
}
}
if (p != NULL)
type=(char *)p;
if ((nid=OBJ_txt2nid(type)) == NID_undef)
goto start;
{
/* Add a new one if possible */
if ((p != NULL) && (q != NULL) && (*q == ']'))
{
*q='\0';
nid=OBJ_create((char *)p,NULL,NULL);
*q=']';
if (nid == NID_undef) goto start;
}
else
goto start;
}
sprintf(buf,"%s_default",v->name);
if ((def=CONF_get_string(req_conf,tmp,buf)) == NULL)
......@@ -1044,9 +1083,10 @@ err:
return(0);
}
static void MS_CALLBACK req_cb(p, n)
static void MS_CALLBACK req_cb(p,n,arg)
int p;
int n;
char *arg;
{
char c='*';
......@@ -1054,8 +1094,8 @@ int n;
if (p == 1) c='+';
if (p == 2) c='*';
if (p == 3) c='\n';
BIO_write(bio_err,&c,1);
BIO_flush(bio_err);
BIO_write((BIO *)arg,&c,1);
BIO_flush((BIO *)arg);
#ifdef LINT
p=n;
#endif
......
-----BEGIN CERTIFICATE REQUEST-----
MIIBlzCCAVcCAQAwXjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUx
ITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMORXJp
YyB0aGUgWW91bmcwge8wgaYGBSsOAwIMMIGcAkEA+ZiKEvZmc9MtnaFZh4NiZ3oZ
S4J1PHvPrm9MXj5ntVheDPkdmBDTncyaGAJcMjwsyB/GvLDGd6yGCw/8eF+09wIV
AK3VagOxGd/Q4Af5NbxR5FB7CXEjAkA2t/q7HgVLi0KeKvcDG8BRl3wuy7bCvpjg
tWiJc/tpvcuzeuAayH89UofjAGueKjXDADiRffvSdhrNw5dkqdqlA0QAAkEAtUSo
84OekjitKGVjxLu0HvXck29pu+foad53vPKXAsuJdACj88BPqZ91Y9PIJf1GUh38
CuiHWi7z3cEDfZCyCKAAMAkGBSsOAwIbBQADLwAwLAIUTg8amKVBE9oqC5B75dDQ
Chy3LdQCFHKodGEj3LjuTzdm/RTe2KZL9Uzf
-----END CERTIFICATE REQUEST-----
#!/bin/sh
for i in verify asn1parse req dgst dh enc gendh gendsa errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers md2 md5 sha sha1 mdc2 base64 des des3 desx idea rc4 rc2 bf des-ecb des-ede des-ede3 des-cbc des-ede-cbc des-ede3-cbc des-cfb des-ede-cfb des-ede3-cfb des-ofb des-ede-ofb des-ede3-ofb idea-cbc idea-ecb idea-cfb idea-ofb rc2-cbc rc2-ecb rc2-cfb rc2-ofb bf-cbc bf-ecb bf-cfb bf-ofb
for i in verify asn1parse req dgst dh enc gendh errstr ca crl rsa dsa dsaparam x509 genrsa s_server s_client speed s_time version pkcs7 crl2pkcs7 sess_id ciphers md2 md5 sha sha1 mdc2 base64 des des3 desx idea rc4 rc2 bf cast rc5 des-ecb des-ede des-ede3 des-cbc des-ede-cbc des-ede3-cbc des-cfb des-ede-cfb des-ede3-cfb des-ofb des-ede-ofb des-ede3-ofb idea-cbc idea-ecb idea-cfb idea-ofb rc2-cbc rc2-ecb rc2-cfb rc2-ofb bf-cbc bf-ecb bf-cfb bf-ofb cast5-cbc cast5-ecb cast5-cfb cast5-ofb cast-cbc rc5-cbc rc5-ecb rc5-cfb rc5-ofb
do
echo removing $i
/bin/rm -f $i
......
/* apps/rsa.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -99,7 +99,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
infile=NULL;
outfile=NULL;
......
/* apps/s_apps.h */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -79,9 +79,8 @@ int nbio_init_client_ip(int *sock,unsigned char ip[4], int port);
int nbio_sock_error(int sock);
int spawn(int argc, char **argv, int *in, int *out);
int init_server(int *sock, int port);
int init_server_long(int *sock, int port,char *ip);
int should_retry(int i);
int sock_err(void );
int socket_ioctl(int, long,unsigned long *);
void sock_cleanup(void );
int extract_port(char *str, short *port_ptr);
int extract_host_port(char *str,char **host_ptr,unsigned char *ip,short *p);
......@@ -108,8 +107,6 @@ int nbio_sock_error();
int spawn();
int init_server();
int should_retry();
int sock_err();
int socket_ioctl();
void sock_cleanup();
int extract_port();
int extract_host_port();
......
/* apps/s_cb.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -71,7 +71,6 @@
int verify_depth=0;
int verify_error=X509_V_OK;
/* should be X509 * but we can just have them as char *. */
int MS_CALLBACK verify_callback(ok, ctx)
int ok;
X509_STORE_CTX *ctx;
......@@ -137,7 +136,7 @@ char *key_file;
if (SSL_CTX_use_certificate_file(ctx,cert_file,
SSL_FILETYPE_PEM) <= 0)
{
BIO_printf(bio_err,"unable to set certificate file\n");
BIO_printf(bio_err,"unable to get certificate from '%s'\n",cert_file);
ERR_print_errors(bio_err);
return(0);
}
......@@ -145,7 +144,7 @@ char *key_file;
if (SSL_CTX_use_PrivateKey_file(ctx,key_file,
SSL_FILETYPE_PEM) <= 0)
{
BIO_printf(bio_err,"unable to set public key file\n");
BIO_printf(bio_err,"unable to get private key from '%s'\n",key_file);
ERR_print_errors(bio_err);
return(0);
}
......
/* apps/s_client.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -60,7 +60,7 @@
#include <stdlib.h>
#include <string.h>
#define USE_SOCKETS
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "apps.h"
......@@ -127,6 +127,8 @@ static void sc_usage()
BIO_printf(bio_err," -quiet - no s_client output\n");
BIO_printf(bio_err," -ssl2 - just use SSLv2\n");
BIO_printf(bio_err," -ssl3 - just use SSLv3\n");
BIO_printf(bio_err," -tls1 - just use TLSv1\n");
BIO_printf(bio_err," -no_tls1/-no_ssl3/-no_ssl2 - turn off that protocol\n");
BIO_printf(bio_err," -bugs - Switch on all SSL implementation bug workarounds\n");
BIO_printf(bio_err," -cipher - prefered cipher to use, use the 'ssleay ciphers'\n");
BIO_printf(bio_err," command to se what is available\n");
......@@ -137,6 +139,7 @@ int MAIN(argc, argv)
int argc;
char **argv;
{
int off=0;
SSL *con=NULL,*con2=NULL;
int s,k,width,state=0;
char *cbuf=NULL,*sbuf=NULL;
......@@ -165,6 +168,7 @@ char **argv;
#endif
apps_startup();
c_Pause=0;
c_quiet=0;
c_debug=0;
......@@ -234,6 +238,10 @@ char **argv;
#ifndef NO_SSL3
else if (strcmp(*argv,"-ssl3") == 0)
meth=SSLv3_client_method();
#endif
#ifndef NO_TLS1
else if (strcmp(*argv,"-tls1") == 0)
meth=TLSv1_client_method();
#endif
else if (strcmp(*argv,"-bugs") == 0)
bugs=1;
......@@ -256,6 +264,12 @@ char **argv;
if (--argc < 1) goto bad;
CAfile= *(++argv);
}
else if (strcmp(*argv,"-no_tls1") == 0)
off|=SSL_OP_NO_TLSv1;
else if (strcmp(*argv,"-no_ssl3") == 0)
off|=SSL_OP_NO_SSLv3;
else if (strcmp(*argv,"-no_ssl2") == 0)
off|=SSL_OP_NO_SSLv2;
else if (strcmp(*argv,"-cipher") == 0)
{
if (--argc < 1) goto bad;
......@@ -302,7 +316,10 @@ bad:
goto end;
}
if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
if (bugs)
SSL_CTX_set_options(ctx,SSL_OP_ALL|off);
else
SSL_CTX_set_options(ctx,off);
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
if (cipher != NULL)
......@@ -319,20 +336,21 @@ bad:
if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(ctx)))
{
BIO_printf(bio_err,"error seting default verify locations\n");
/* BIO_printf(bio_err,"error seting default verify locations\n"); */
ERR_print_errors(bio_err);
goto end;
/* goto end; */
}
SSL_load_error_strings();
con=(SSL *)SSL_new(ctx);
/* SSL_set_cipher_list(con,"RC4-MD5"); */
re_start:
if (init_client(&s,host,port) == 0)
{
BIO_printf(bio_err,"connect:errno=%d\n",errno);
BIO_printf(bio_err,"connect:errno=%d\n",get_last_socket_error());
SHUTDOWN(s);
goto end;
}
......@@ -343,7 +361,11 @@ re_start:
{
unsigned long l=1;
BIO_printf(bio_c_out,"turning on non blocking io\n");
socket_ioctl(s,FIONBIO,&l);
if (BIO_socket_ioctl(s,FIONBIO,&l) < 0)
{
ERR_print_errors(bio_err);
goto end;
}
}
#endif
if (c_Pause & 0x01) con->debug=1;
......@@ -386,7 +408,7 @@ re_start:
FD_ZERO(&readfds);
FD_ZERO(&writefds);
if (SSL_in_init(con))
if (SSL_in_init(con) && !SSL_total_renegotiations(con))
{
in_init=1;
tty_on=0;
......@@ -427,11 +449,11 @@ re_start:
/* printf("mode tty(%d %d%d) ssl(%d%d)\n",
tty_on,read_tty,write_tty,read_ssl,write_ssl);*/
/* printf("pending=%d\n",SSL_pending(con)); */
i=select(width,&readfds,&writefds,NULL,NULL);
if ( i < 0)
{
BIO_printf(bio_err,"bad select %d\n",sock_err());
BIO_printf(bio_err,"bad select %d\n",
get_last_socket_error());
goto shut;
/* goto end; */
}
......@@ -489,7 +511,7 @@ re_start:
if ((k != 0) || (cbuf_len != 0))
{
BIO_printf(bio_err,"write:errno=%d\n",
errno);
get_last_socket_error());
goto shut;
}
else
......@@ -526,7 +548,10 @@ re_start:
#endif
else if (FD_ISSET(SSL_get_fd(con),&readfds))
{
k=SSL_read(con,sbuf,BUFSIZZ);
#ifdef RENEG
{ static int iiii; if (++iiii == 52) { SSL_renegotiate(con); iiii=0; } }
#endif
k=SSL_read(con,sbuf,1024 /* BUFSIZZ */ );
switch (SSL_get_error(con,k))
{
......@@ -555,7 +580,7 @@ re_start:
BIO_printf(bio_c_out,"read X BLOCK\n");
break;
case SSL_ERROR_SYSCALL:
BIO_printf(bio_err,"read:errno=%d\n",errno);
BIO_printf(bio_err,"read:errno=%d\n",get_last_socket_error());
goto shut;
case SSL_ERROR_ZERO_RETURN:
BIO_printf(bio_c_out,"closed\n");
......@@ -619,7 +644,7 @@ BIO *bio;
SSL *s;
int full;
{
X509 *peer;
X509 *peer=NULL;
char *p;
static char *space=" ";
char buf[BUFSIZ];
......@@ -657,7 +682,6 @@ int full;
X509_NAME_oneline(X509_get_issuer_name(peer),
buf,BUFSIZ);
BIO_printf(bio,"issuer=%s\n",buf);
X509_free(peer);
}
else
BIO_printf(bio,"no peer certificate available\n");
......@@ -687,7 +711,7 @@ int full;
{
if (*p == ':')
{
BIO_write(bio,space,15-j);
BIO_write(bio,space,15-j%25);
i++;
j=0;
BIO_write(bio,((i%3)?" ":"\n"),1);
......@@ -711,7 +735,12 @@ int full;
BIO_printf(bio,"%s, Cipher is %s\n",
SSL_CIPHER_get_version(c),
SSL_CIPHER_get_name(c));
if (peer != NULL)
BIO_printf(bio,"Server public key is %d bit\n",
EVP_PKEY_bits(X509_get_pubkey(peer)));
SSL_SESSION_print(bio,SSL_get_session(s));
BIO_printf(bio,"---\n");
if (peer != NULL)
X509_free(peer);
}
/* apps/s_server.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -61,7 +61,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "lhash.h"
......@@ -82,8 +82,11 @@ static void close_accept_socket(void );
static void sv_usage(void);
static int init_ssl_connection(SSL *s);
static void print_stats(BIO *bp,SSL_CTX *ctx);
#ifndef NO_DH
static DH *load_dh_param(void );
static DH *get_dh512(void);
#endif
/* static void s_server_init(void);*/
#else
static RSA MS_CALLBACK *tmp_rsa_cb();
static int sv_body();
......@@ -92,15 +95,19 @@ static void close_accept_socket();
static void sv_usage();
static int init_ssl_connection();
static void print_stats();
#ifndef NO_DH
static DH *load_dh_param();
static DH *get_dh512();
#endif
/* static void s_server_init(); */
#endif
#ifndef S_ISDIR
#define S_ISDIR(a) (((a) & _S_IFMT) == _S_IFDIR)
#endif
#ifndef NO_DH
static unsigned char dh512_p[]={
0xDA,0x58,0x3C,0x16,0xD9,0x85,0x22,0x89,0xD0,0xE4,0xAF,0x75,
0x6F,0x4C,0xCA,0x92,0xDD,0x4B,0xE5,0x33,0xB8,0x04,0xFB,0x0F,
......@@ -117,15 +124,14 @@ static DH *get_dh512()
{
DH *dh=NULL;
#ifndef NO_DH
if ((dh=DH_new()) == NULL) return(NULL);
dh->p=BN_bin2bn(dh512_p,sizeof(dh512_p),NULL);
dh->g=BN_bin2bn(dh512_g,sizeof(dh512_g),NULL);
if ((dh->p == NULL) || (dh->g == NULL))
return(NULL);
#endif
return(dh);
}
#endif
/* static int load_CA(SSL_CTX *ctx, char *file);*/
......@@ -142,8 +148,9 @@ static int accept_socket= -1;
extern int verify_depth;
static char *cipher=NULL;
int verify=SSL_VERIFY_NONE;
char *s_cert_file=TEST_CERT,*s_key_file=NULL;
static int s_server_verify=SSL_VERIFY_NONE;
static char *s_cert_file=TEST_CERT,*s_key_file=NULL;
static char *s_dcert_file=NULL,*s_dkey_file=NULL;
#ifdef FIONBIO
static int s_nbio=0;
#endif
......@@ -155,11 +162,33 @@ static BIO *bio_s_out=NULL;
static int s_debug=0;
static int s_quiet=0;
#if 0
static void s_server_init()
{
cipher=NULL;
s_server_verify=SSL_VERIFY_NONE;
s_dcert_file=NULL;
s_dkey_file=NULL;
s_cert_file=TEST_CERT;
s_key_file=NULL;
#ifdef FIONBIO
s_nbio=0;
#endif
s_nbio_test=0;
ctx=NULL;
www=0;
bio_s_out=NULL;
s_debug=0;
s_quiet=0;
}
#endif
static void sv_usage()
{
BIO_printf(bio_err,"usage: s_server [args ...]\n");
BIO_printf(bio_err,"\n");
BIO_printf(bio_err," -accpet arg - port to accept on (default is %d\n",PORT);
BIO_printf(bio_err," -accept arg - port to accept on (default is %d\n",PORT);
BIO_printf(bio_err," -verify arg - turn on peer certificate verification\n");
BIO_printf(bio_err," -Verify arg - turn on peer certificate verification, must have a cert.\n");
BIO_printf(bio_err," -cert arg - certificate file to use, PEM format assumed\n");
......@@ -180,14 +209,18 @@ static void sv_usage()
BIO_printf(bio_err," -no_tmp_rsa - Do not generate a tmp RSA key\n");
BIO_printf(bio_err," -ssl2 - Just talk SSLv2\n");
BIO_printf(bio_err," -ssl3 - Just talk SSLv3\n");
BIO_printf(bio_err," -tls1 - Just talk TLSv1\n");
BIO_printf(bio_err," -no_ssl2 - Just disable SSLv2\n");
BIO_printf(bio_err," -no_ssl3 - Just disable SSLv3\n");
BIO_printf(bio_err," -no_tls1 - Just disable TLSv1\n");
BIO_printf(bio_err," -bugs - Turn on SSL bug compatability\n");
BIO_printf(bio_err," -www - Respond to a 'GET /' with a status page\n");
BIO_printf(bio_err," -WWW - Returns requested page from to a 'GET <path> HTTP/1.0'\n");
}
static int local_argc;
static int local_argc=0;
static char **local_argv;
static int hack;
static int hack=0;
int MAIN(argc, argv)
int argc;
......@@ -197,10 +230,13 @@ char *argv[];
char *CApath=NULL,*CAfile=NULL;
int badop=0,bugs=0;
int ret=1;
int off=0;
int no_tmp_rsa=0,nocert=0;
int state=0;
SSL_METHOD *meth=NULL;
#ifndef NO_DH
DH *dh=NULL;
#endif
#if !defined(NO_SSL2) && !defined(NO_SSL3)
meth=SSLv23_server_method();
......@@ -240,14 +276,14 @@ char *argv[];
}
else if (strcmp(*argv,"-verify") == 0)
{
verify=SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE;
s_server_verify=SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE;
if (--argc < 1) goto bad;
verify_depth=atoi(*(++argv));
BIO_printf(bio_err,"verify depth is %d\n",verify_depth);
}
else if (strcmp(*argv,"-Verify") == 0)
{
verify=SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT|
s_server_verify=SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT|
SSL_VERIFY_CLIENT_ONCE;
if (--argc < 1) goto bad;
verify_depth=atoi(*(++argv));
......@@ -263,6 +299,16 @@ char *argv[];
if (--argc < 1) goto bad;
s_key_file= *(++argv);
}
else if (strcmp(*argv,"-dcert") == 0)
{
if (--argc < 1) goto bad;
s_dcert_file= *(++argv);
}
else if (strcmp(*argv,"-dkey") == 0)
{
if (--argc < 1) goto bad;
s_dkey_file= *(++argv);
}
else if (strcmp(*argv,"-nocert") == 0)
{
nocert=1;
......@@ -309,6 +355,12 @@ char *argv[];
{ www=1; }
else if (strcmp(*argv,"-WWW") == 0)
{ www=2; }
else if (strcmp(*argv,"-no_ssl2") == 0)
{ off|=SSL_OP_NO_SSLv2; }
else if (strcmp(*argv,"-no_ssl3") == 0)
{ off|=SSL_OP_NO_SSLv3; }
else if (strcmp(*argv,"-no_tls1") == 0)
{ off|=SSL_OP_NO_TLSv1; }
#ifndef NO_SSL2
else if (strcmp(*argv,"-ssl2") == 0)
{ meth=SSLv2_server_method(); }
......@@ -316,6 +368,10 @@ char *argv[];
#ifndef NO_SSL3
else if (strcmp(*argv,"-ssl3") == 0)
{ meth=SSLv3_server_method(); }
#endif
#ifndef NO_TLS1
else if (strcmp(*argv,"-tls1") == 0)
{ meth=TLSv1_server_method(); }
#endif
else
{
......@@ -352,6 +408,8 @@ bad:
{
s_cert_file=NULL;
s_key_file=NULL;
s_dcert_file=NULL;
s_dkey_file=NULL;
}
SSL_load_error_strings();
......@@ -364,12 +422,16 @@ bad:
goto end;
}
SSL_CTX_set_quiet_shutdown(ctx,1);
if (bugs) SSL_CTX_set_options(ctx,SSL_OP_ALL);
if (hack) SSL_CTX_set_options(ctx,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
SSL_CTX_set_options(ctx,off);
if (hack) SSL_CTX_set_options(ctx,SSL_OP_NON_EXPORT_FIRST);
if (state) SSL_CTX_set_info_callback(ctx,apps_ssl_info_callback);
SSL_CTX_sess_set_cache_size(ctx,128);
#if 0
if (cipher == NULL) cipher=getenv("SSL_CIPHER");
#endif
......@@ -385,9 +447,9 @@ bad:
if ((!SSL_CTX_load_verify_locations(ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(ctx)))
{
BIO_printf(bio_err,"X509_load_verify_locations\n");
/* BIO_printf(bio_err,"X509_load_verify_locations\n"); */
ERR_print_errors(bio_err);
goto end;
/* goto end; */
}
#ifndef NO_DH
......@@ -410,6 +472,11 @@ bad:
if (!set_cert_stuff(ctx,s_cert_file,s_key_file))
goto end;
if (s_dcert_file != NULL)
{
if (!set_cert_stuff(ctx,s_dcert_file,s_dkey_file))
goto end;
}
#if 1
SSL_CTX_set_tmp_rsa_callback(ctx,tmp_rsa_cb);
......@@ -435,7 +502,7 @@ bad:
if (cipher != NULL)
SSL_CTX_set_cipher_list(ctx,cipher);
SSL_CTX_set_verify(ctx,verify,verify_callback);
SSL_CTX_set_verify(ctx,s_server_verify,verify_callback);
SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(s_cert_file));
......@@ -464,16 +531,23 @@ SSL_CTX *ssl_ctx;
SSL_CTX_sess_number(ssl_ctx));
BIO_printf(bio,"%4d client connects (SSL_connect())\n",
SSL_CTX_sess_connect(ssl_ctx));
BIO_printf(bio,"%4d client renegotiates (SSL_connect())\n",
SSL_CTX_sess_connect_renegotiate(ssl_ctx));
BIO_printf(bio,"%4d client connects that finished\n",
SSL_CTX_sess_connect_good(ssl_ctx));
BIO_printf(bio,"%4d server accepts (SSL_accept())\n",
SSL_CTX_sess_accept(ssl_ctx));
BIO_printf(bio,"%4d server renegotiates (SSL_accept())\n",
SSL_CTX_sess_accept_renegotiate(ssl_ctx));
BIO_printf(bio,"%4d server accepts that finished\n",
SSL_CTX_sess_accept_good(ssl_ctx));
BIO_printf(bio,"%4d session cache hits\n",SSL_CTX_sess_hits(ssl_ctx));
BIO_printf(bio,"%4d session cache misses\n",SSL_CTX_sess_misses(ssl_ctx));
BIO_printf(bio,"%4d session cache timeouts\n",SSL_CTX_sess_timeouts(ssl_ctx));
BIO_printf(bio,"%4d callback cache hits\n",SSL_CTX_sess_cb_hits(ssl_ctx));
BIO_printf(bio,"%4d cache full overflows (%d allowed)\n",
SSL_CTX_sess_cache_full(ssl_ctx),
SSL_CTX_sess_get_cache_size(ssl_ctx));
}
static int sv_body(hostname, s)
......@@ -500,7 +574,8 @@ int s;
if (!s_quiet)
BIO_printf(bio_err,"turning on non blocking io\n");
socket_ioctl(s,FIONBIO,&sl);
if (BIO_socket_ioctl(s,FIONBIO,&sl) < 0)
ERR_print_errors(bio_err);
}
#endif
......@@ -539,7 +614,7 @@ int s;
if (i <= 0) continue;
if (FD_ISSET(fileno(stdin),&readfds))
{
i=read(fileno(stdin),buf,BUFSIZZ);
i=read(fileno(stdin),buf,128/*BUFSIZZ*/);
if (!s_quiet)
{
if ((i <= 0) || (buf[0] == 'Q'))
......@@ -558,18 +633,24 @@ int s;
ret= -11;*/
goto err;
}
if (buf[0] == 'r')
if ((buf[0] == 'r') &&
((buf[1] == '\n') || (buf[1] == '\r')))
{
SSL_renegotiate(con);
i=SSL_do_handshake(con);
printf("SSL_do_handshake -> %d\n",i);
i=0; /*13; */
continue;
strcpy(buf,"server side RE-NEGOTIATE\n");
}
if (buf[0] == 'R')
if ((buf[0] == 'R') &&
((buf[1] == '\0') || (buf[1] == '\r')))
{
SSL_set_verify(con,
SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,NULL);
SSL_renegotiate(con);
i=SSL_do_handshake(con);
printf("SSL_do_handshake -> %d\n",i);
i=0; /* 13; */
continue;
strcpy(buf,"server side RE-NEGOTIATE asking for client cert\n");
......@@ -588,19 +669,27 @@ int s;
for (;;)
{
/* should do a select for the write */
k=SSL_write(con,&(buf[l]),(unsigned int)i);
if (
#ifdef FIONBIO
s_nbio &&
#ifdef RENEG
{ static count=0; if (++count == 100) { count=0; SSL_renegotiate(con); } }
#endif
BIO_sock_should_retry(k))
k=SSL_write(con,&(buf[l]),(unsigned int)i);
switch (SSL_get_error(con,k))
{
case SSL_ERROR_NONE:
break;
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_X509_LOOKUP:
BIO_printf(bio_s_out,"Write BLOCK\n");
continue;
}
if (k <= 0)
{
break;
case SSL_ERROR_SYSCALL:
case SSL_ERROR_SSL:
BIO_printf(bio_s_out,"ERROR\n");
ERR_print_errors(bio_err);
ret=1;
goto err;
break;
case SSL_ERROR_ZERO_RETURN:
BIO_printf(bio_s_out,"DONE\n");
ret=1;
goto err;
......@@ -629,25 +718,29 @@ int s;
}
else
{
i=SSL_read(con,(char *)buf,BUFSIZZ);
if ((i <= 0) &&
#ifdef FIONBIO
s_nbio &&
#endif
BIO_sock_should_retry(i))
i=SSL_read(con,(char *)buf,128 /*BUFSIZZ */);
switch (SSL_get_error(con,i))
{
case SSL_ERROR_NONE:
write(fileno(stdout),buf,
(unsigned int)i);
break;
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_X509_LOOKUP:
BIO_printf(bio_s_out,"Read BLOCK\n");
}
else if (i <= 0)
{
break;
case SSL_ERROR_SYSCALL:
case SSL_ERROR_SSL:
BIO_printf(bio_s_out,"ERROR\n");
ERR_print_errors(bio_err);
ret=1;
goto err;
case SSL_ERROR_ZERO_RETURN:
BIO_printf(bio_s_out,"DONE\n");
ret=1;
goto err;
}
else
write(fileno(stdout),buf,
(unsigned int)i);
}
}
}
......@@ -685,7 +778,7 @@ SSL *con;
int i;
char *str;
X509 *peer;
int verify_error;
long verify_error;
MS_STATIC char buf[BUFSIZ];
if ((i=SSL_accept(con)) <= 0)
......@@ -730,20 +823,20 @@ SSL *con;
return(1);
}
#ifndef NO_DH
static DH *load_dh_param()
{
DH *ret=NULL;
BIO *bio;
#ifndef NO_DH
if ((bio=BIO_new_file(DH_PARAM,"r")) == NULL)
goto err;
ret=PEM_read_bio_DHparams(bio,NULL,NULL);
err:
if (bio != NULL) BIO_free(bio);
#endif
return(ret);
}
#endif
#if 0
static int load_CA(ctx,file)
......@@ -779,6 +872,7 @@ int s;
SSL *con;
SSL_CIPHER *c;
BIO *io,*ssl_bio,*sbio;
long total_bytes;
io=BIO_new(BIO_f_buffer());
ssl_bio=BIO_new(BIO_f_ssl());
......@@ -787,16 +881,17 @@ int s;
#ifdef FIONBIO
if (s_nbio)
{
unsigned int long sl=1;
unsigned long sl=1;
if (!s_quiet)
BIO_printf(bio_err,"turning on non blocking io\n");
socket_ioctl(s,FIONBIO,&sl);
if (BIO_socket_ioctl(s,FIONBIO,&sl) < 0)
ERR_print_errors(bio_err);
}
#endif
/* lets make the output buffer a reasonable size */
if (!BIO_set_write_buffer_size(io,16*1024)) goto err;
if (!BIO_set_write_buffer_size(io,253 /*16*1024*/)) goto err;
if ((con=(SSL *)SSL_new(ctx)) == NULL) goto err;
......@@ -875,14 +970,15 @@ int s;
/* else we have data */
if ( ((www == 1) && (strncmp("GET ",buf,4) == 0)) ||
((www == 2) && (strncmp("GET stats ",buf,10) == 0)))
((www == 2) && (strncmp("GET /stats ",buf,10) == 0)))
{
char *p;
X509 *peer;
STACK *sk;
static char *space=" ";
static char *space=" ";
BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n");
BIO_puts(io,"<HTML><BODY BGCOLOR=ffffff>\n");
BIO_puts(io,"<pre>\n");
/* BIO_puts(io,SSLeay_version(SSLEAY_VERSION));*/
BIO_puts(io,"\n");
......@@ -901,10 +997,10 @@ int s;
for (i=0; i<j; i++)
{
c=(SSL_CIPHER *)sk_value(sk,i);
BIO_printf(io,"%s:%-25s",
BIO_printf(io,"%-11s:%-25s",
SSL_CIPHER_get_version(c),
SSL_CIPHER_get_name(c));
if ((((i+1)%3) == 0) && (i+1 != j))
if ((((i+1)%2) == 0) && (i+1 != j))
BIO_puts(io,"\n");
}
BIO_puts(io,"\n");
......@@ -917,7 +1013,7 @@ int s;
{
if (*p == ':')
{
BIO_write(io,space,15-j);
BIO_write(io,space,26-j);
i++;
j=0;
BIO_write(io,((i%3)?" ":"\n"),1);
......@@ -935,7 +1031,7 @@ int s;
?"---\nReused, "
:"---\nNew, "));
c=SSL_get_current_cipher(con);
BIO_printf(io,"SSLv%d, Cipher is %s\n",
BIO_printf(io,"%s, Cipher is %s\n",
SSL_CIPHER_get_version(c),
SSL_CIPHER_get_name(c));
SSL_SESSION_print(io,SSL_get_session(con));
......@@ -951,6 +1047,7 @@ int s;
}
else
BIO_puts(io,"no client certificate available\n");
BIO_puts(io,"</BODY></HTML>\r\n\r\n");
break;
}
else if ((www == 2) && (strncmp("GET ",buf,4) == 0))
......@@ -969,6 +1066,7 @@ int s;
(strncmp(&(e[-1]),"/../",4) == 0))
dot=1;
}
if (*e == '\0')
{
......@@ -1028,18 +1126,31 @@ int s;
else
BIO_puts(io,"HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n");
/* send the file */
total_bytes=0;
for (;;)
{
i=BIO_read(file,buf,1024);
if (i <= 0) break;
total_bytes+=i;
fprintf(stderr,"%d\n",i);
if (total_bytes > 3*1024)
{
total_bytes=0;
fprintf(stderr,"RENEGOTIATE\n");
SSL_renegotiate(con);
}
for (j=0; j<i; )
{
#ifdef RENEG
{ static count=0; if (++count == 13) { SSL_renegotiate(con); } }
#endif
k=BIO_write(io,&(buf[j]),i-j);
if (k <= 0)
{
if (!BIO_should_retry(io))
break;
goto write_error;
else
{
BIO_printf(bio_s_out,"rwrite W BLOCK\n");
......@@ -1051,6 +1162,7 @@ int s;
}
}
}
write_error:
BIO_free(file);
break;
}
......@@ -1068,12 +1180,13 @@ int s;
break;
}
end:
#if 0
#if 1
/* make sure we re-use sessions */
SSL_set_shutdown(con,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
#else
/* This kills performace */
SSL_shutdown(con);
/* SSL_shutdown(con); A shutdown gets sent in the
* BIO_free_all(io) procession */
#endif
err:
......@@ -1082,7 +1195,7 @@ err:
BIO_printf(bio_s_out,"ACCEPT\n");
if (io != NULL) BIO_free_all(io);
/* if (ssl_bio != NULL) BIO_free(ssl_bio); */
/* if (ssl_bio != NULL) BIO_free(ssl_bio);*/
return(ret);
}
......@@ -1100,7 +1213,7 @@ int export;
BIO_flush(bio_err);
}
#ifndef NO_RSA
rsa_tmp=RSA_generate_key(512,RSA_F4,NULL);
rsa_tmp=RSA_generate_key(512,RSA_F4,NULL,NULL);
#endif
if (!s_quiet)
{
......
/* apps/s_socket.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -262,7 +262,7 @@ int port;
*sock=s;
#ifdef FIONBIO
socket_ioctl(s,FIONBIO,&l);
BIO_socket_ioctl(s,FIONBIO,&l);
#endif
}
else
......@@ -306,18 +306,19 @@ int (*cb)();
}
i=(*cb)(name,sock);
if (name != NULL) Free(name);
SHUTDOWN(sock);
SHUTDOWN2(sock);
if (i < 0)
{
SHUTDOWN(accept_socket);
SHUTDOWN2(accept_socket);
return(i);
}
}
}
int init_server(sock, port)
int init_server_long(sock, port, ip)
int *sock;
int port;
char *ip;
{
int ret=0;
struct sockaddr_in server;
......@@ -328,7 +329,10 @@ int port;
memset((char *)&server,0,sizeof(server));
server.sin_family=AF_INET;
server.sin_port=htons((unsigned short)port);
server.sin_addr.s_addr=INADDR_ANY;
if (ip == NULL)
server.sin_addr.s_addr=INADDR_ANY;
else
memcpy(&server.sin_addr.s_addr,ip,4);
s=socket(AF_INET,SOCK_STREAM,SOCKET_PROTOCOL);
if (s == INVALID_SOCKET) goto err;
......@@ -339,7 +343,8 @@ int port;
#endif
goto err;
}
if (listen(s,5) == -1) goto err;
/* Make it 128 for linux */
if (listen(s,128) == -1) goto err;
i=0;
*sock=s;
ret=1;
......@@ -351,6 +356,13 @@ err:
return(ret);
}
int init_server(sock,port)
int *sock;
int port;
{
return(init_server_long(sock, port, NULL));
}
int do_accept(acc_sock, sock, host)
int acc_sock;
int *sock;
......@@ -399,9 +411,14 @@ redoit:
*/
if (host == NULL) goto end;
#ifndef BIT_FIELD_LIMITS
/* I should use WSAAsyncGetHostByName() under windows */
h1=gethostbyaddr((char *)&from.sin_addr.s_addr,
sizeof(from.sin_addr.s_addr),AF_INET);
#else
h1=gethostbyaddr((char *)&from.sin_addr,
sizeof(struct in_addr),AF_INET);
#endif
if (h1 == NULL)
{
BIO_printf(bio_err,"bad gethostbyaddr\n");
......@@ -435,38 +452,6 @@ end:
return(1);
}
int socket_ioctl(fd,type,arg)
int fd;
long type;
unsigned long *arg;
{
int i,err;
#ifdef WINDOWS
i=ioctlsocket(fd,type,arg);
#else
i=ioctl(fd,type,arg);
#endif
if (i < 0)
{
#ifdef WINDOWS
err=WSAGetLastError();
#else
err=errno;
#endif
BIO_printf(bio_err,"ioctl on socket failed:error %d\n",err);
}
return(i);
}
int sock_err()
{
#ifdef WINDOWS
return(WSAGetLastError());
#else
return(errno);
#endif
}
int extract_host_port(str,host_ptr,ip,port_ptr)
char *str;
char **host_ptr;
......
/* apps/s_time.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
#undef NO_SHUTDOWN
#define NO_SHUTDOWN
/*-----------------------------------------
cntime - SSL client connection timer program
......@@ -67,7 +67,7 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "x509.h"
......@@ -154,10 +154,12 @@ extern int verify_error;
static void s_time_usage(void);
static int parseArgs( int argc, char **argv );
static SSL *doConnection( SSL *scon );
static void s_time_init(void);
#else
static void s_time_usage();
static int parseArgs();
static SSL *doConnection();
static void s_time_init();
#endif
......@@ -180,15 +182,38 @@ static char *s_www_path=NULL;
static long bytes_read=0;
static int st_bugs=0;
static int perform=0;
#ifdef FIONBIO
static int t_nbio=0;
#endif
#ifdef WIN32
static int exitNow = 0; /* Set when it's time to exit main */
#endif
static void s_time_init()
{
host=SSL_CONNECT_NAME;
t_cert_file=NULL;
t_key_file=NULL;
CApath=NULL;
CAfile=NULL;
tm_cipher=NULL;
tm_verify = SSL_VERIFY_NONE;
maxTime = SECONDS;
tm_ctx=NULL;
s_time_meth=NULL;
s_www_path=NULL;
bytes_read=0;
st_bugs=0;
perform=0;
#ifdef FIONBIO
t_nbio=0;
#endif
#ifdef WIN32
exitNow = 0; /* Set when it's time to exit main */
#endif
}
/***********************************************************************
* usage - display usage message
*/
......@@ -237,6 +262,7 @@ char **argv;
#endif
apps_startup();
s_time_init();
if (bio_err == NULL)
bio_err=BIO_new_fp(stderr,BIO_NOCLOSE);
......@@ -396,6 +422,7 @@ char **argv;
long finishtime=0;
int ret=1,i;
MS_STATIC char buf[1024*8];
int ver;
#if !defined(NO_SSL2) && !defined(NO_SSL3)
s_time_meth=SSLv23_client_method();
......@@ -412,6 +439,8 @@ char **argv;
SSLeay_add_ssl_algorithms();
if ((tm_ctx=SSL_CTX_new(s_time_meth)) == NULL) return(1);
SSL_CTX_set_quiet_shutdown(tm_ctx,1);
if (st_bugs) SSL_CTX_set_options(tm_ctx,SSL_OP_ALL);
SSL_CTX_set_cipher_list(tm_ctx,tm_cipher);
if(!set_cert_stuff(tm_ctx,t_cert_file,t_key_file))
......@@ -422,9 +451,9 @@ char **argv;
if ((!SSL_CTX_load_verify_locations(tm_ctx,CAfile,CApath)) ||
(!SSL_CTX_set_default_verify_paths(tm_ctx)))
{
BIO_printf(bio_err,"error seting default verify locations\n");
/* BIO_printf(bio_err,"error seting default verify locations\n"); */
ERR_print_errors(bio_err);
goto end;
/* goto end; */
}
if (tm_cipher == NULL)
......@@ -471,11 +500,24 @@ char **argv;
#else
SSL_shutdown(scon);
#endif
SHUTDOWN(SSL_get_fd(scon));
SHUTDOWN2(SSL_get_fd(scon));
nConn += 1;
fputc(SSL_session_reused(scon)?'r':
(SSL_version(scon))+'0', stdout );
if (SSL_session_reused(scon))
ver='r';
else
{
ver=SSL_version(scon);
if (ver == TLS1_VERSION)
ver='t';
else if (ver == SSL3_VERSION)
ver='3';
else if (ver == SSL2_VERSION)
ver='2';
else
ver='*';
}
fputc(ver,stdout);
fflush(stdout);
SSL_free( scon );
......@@ -512,7 +554,7 @@ next:
#else
SSL_shutdown(scon);
#endif
SHUTDOWN(SSL_get_fd(scon));
SHUTDOWN2(SSL_get_fd(scon));
nConn = 0;
totalTime = 0.0;
......@@ -551,11 +593,24 @@ next:
#else
SSL_shutdown(scon);
#endif
SHUTDOWN(SSL_get_fd(scon));
SHUTDOWN2(SSL_get_fd(scon));
nConn += 1;
fputc(SSL_session_reused(scon)?'r':
(SSL_version(scon))+'0', stdout );
if (SSL_session_reused(scon))
ver='r';
else
{
ver=SSL_version(scon);
if (ver == TLS1_VERSION)
ver='t';
else if (ver == SSL3_VERSION)
ver='3';
else if (ver == SSL2_VERSION)
ver='2';
else
ver='*';
}
fputc(ver,stdout);
fflush(stdout);
}
totalTime += tm_Time_F(STOP); /* Add the time for this iteration*/
......@@ -595,8 +650,8 @@ SSL *scon;
if ((conn=BIO_new(BIO_s_connect())) == NULL)
return(NULL);
/* BIO_set_port(conn,port);*/
BIO_set_hostname(conn,host);
/* BIO_set_conn_port(conn,port);*/
BIO_set_conn_hostname(conn,host);
if (scon == NULL)
serverCon=(SSL *)SSL_new(tm_ctx);
......
/* apps/sess_id.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -109,7 +109,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
informat=FORMAT_PEM;
outformat=FORMAT_PEM;
......
/* apps/speed.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -73,8 +73,9 @@
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <math.h>
#include "apps.h"
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "crypto.h"
......@@ -122,13 +123,21 @@ struct tms {
#endif
#ifndef NO_MD5
#include "md5.h"
#include "hmac.h"
#include "evp.h"
#endif
#if !defined(NO_SHA) && !defined(NO_SHA1)
#ifndef NO_SHA1
#include "sha.h"
#endif
#ifndef NO_RMD160
#include "ripemd.h"
#endif
#ifndef NO_RC4
#include "rc4.h"
#endif
#ifndef NO_RC5
#include "rc5.h"
#endif
#ifndef NO_RC2
#include "rc2.h"
#endif
......@@ -138,6 +147,9 @@ struct tms {
#ifndef NO_BLOWFISH
#include "blowfish.h"
#endif
#ifndef NO_CAST
#include "cast.h"
#endif
#ifndef NO_RSA
#include "rsa.h"
#endif
......@@ -165,7 +177,7 @@ struct tms {
#endif
#undef BUFSIZE
#define BUFSIZE ((long)1024*8)
#define BUFSIZE ((long)1024*8+1)
int run=0;
#ifndef NOPROTO
......@@ -248,13 +260,12 @@ char **argv;
{
unsigned char *buf=NULL,*buf2=NULL;
int ret=1;
#define ALGOR_NUM 11
#define ALGOR_NUM 14
#define SIZE_NUM 5
#define RSA_NUM 4
#define DSA_NUM 3
long count,rsa_count;
int i,j,k,rsa_num,rsa_num2;
unsigned int kk;
#ifndef NO_MD2
unsigned char md2[MD2_DIGEST_LENGTH];
#endif
......@@ -263,13 +274,20 @@ char **argv;
#endif
#ifndef NO_MD5
unsigned char md5[MD5_DIGEST_LENGTH];
unsigned char hmac[MD5_DIGEST_LENGTH];
#endif
#if !defined(NO_SHA) || !defined(NO_SHA1)
#ifndef NO_SHA1
unsigned char sha[SHA_DIGEST_LENGTH];
#endif
#ifndef NO_RMD160
unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
#endif
#ifndef NO_RC4
RC4_KEY rc4_ks;
#endif
#ifndef NO_RC5
RC5_32_KEY rc5_ks;
#endif
#ifndef NO_RC2
RC2_KEY rc2_ks;
#endif
......@@ -278,6 +296,9 @@ char **argv;
#endif
#ifndef NO_BLOWFISH
BF_KEY bf_ks;
#endif
#ifndef NO_CAST
CAST_KEY cast_ks;
#endif
static unsigned char key16[16]=
{0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
......@@ -292,21 +313,24 @@ char **argv;
#define D_MD2 0
#define D_MDC2 1
#define D_MD5 2
#define D_SHA 3
#define D_HMAC 3
#define D_SHA1 4
#define D_RC4 5
#define D_CBC_DES 6
#define D_EDE3_DES 7
#define D_CBC_IDEA 8
#define D_CBC_RC2 9
#define D_CBC_BF 10
#define D_RMD160 5
#define D_RC4 6
#define D_CBC_DES 7
#define D_EDE3_DES 8
#define D_CBC_IDEA 9
#define D_CBC_RC2 10
#define D_CBC_RC5 11
#define D_CBC_BF 12
#define D_CBC_CAST 13
double d,results[ALGOR_NUM][SIZE_NUM];
static int lengths[SIZE_NUM]={8,64,256,1024,8*1024};
long c[ALGOR_NUM][SIZE_NUM];
static char *names[ALGOR_NUM]={
"md2","mdc2","md5","sha","sha1","rc4",
"md2","mdc2","md5","hmac(md5)","sha1","rmd160","rc4",
"des cbc","des ede3","idea cbc",
"rc2 cbc","blowfish cbc"};
"rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc"};
#define R_DSA_512 0
#define R_DSA_1024 1
#define R_DSA_2048 2
......@@ -315,32 +339,32 @@ char **argv;
#define R_RSA_2048 2
#define R_RSA_4096 3
RSA *rsa_key[RSA_NUM];
DSA *dsa_key[DSA_NUM];
long rsa_c[RSA_NUM][2];
long dsa_c[DSA_NUM][2];
#ifndef NO_RSA
double rsa_results[RSA_NUM][2];
#endif
#ifndef NO_DSA
double dsa_results[DSA_NUM][2];
#endif
static unsigned int rsa_bits[RSA_NUM]={512,1024,2048,4096};
static unsigned int dsa_bits[DSA_NUM]={512,1024,2048};
static unsigned char *rsa_data[RSA_NUM]=
{test512,test1024,test2048,test4096};
static int rsa_data_length[RSA_NUM]={
sizeof(test512),sizeof(test1024),
sizeof(test2048),sizeof(test4096)};
int doit[ALGOR_NUM];
#endif
#ifndef NO_DSA
DSA *dsa_key[DSA_NUM];
long dsa_c[DSA_NUM][2];
double dsa_results[DSA_NUM][2];
static unsigned int dsa_bits[DSA_NUM]={512,1024,2048};
#endif
int rsa_doit[RSA_NUM];
int dsa_doit[DSA_NUM];
int doit[ALGOR_NUM];
int pr_header=0;
apps_startup();
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
for (i=0; i<RSA_NUM; i++)
rsa_key[i]=NULL;
......@@ -383,13 +407,23 @@ char **argv;
if (strcmp(*argv,"md5") == 0) doit[D_MD5]=1;
else
#endif
#ifndef NO_SHA
if (strcmp(*argv,"sha") == 0) doit[D_SHA]=1;
#ifndef NO_MD5
if (strcmp(*argv,"hmac") == 0) doit[D_HMAC]=1;
else
#endif
#ifndef NO_SHA1
if (strcmp(*argv,"sha1") == 0) doit[D_SHA1]=1;
else
if (strcmp(*argv,"sha") == 0) doit[D_SHA1]=1;
else
#endif
#ifndef NO_RMD160
if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;
else
if (strcmp(*argv,"rmd160") == 0) doit[D_RMD160]=1;
else
if (strcmp(*argv,"ripemd160") == 0) doit[D_RMD160]=1;
else
#endif
#ifndef NO_RC4
if (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1;
......@@ -429,6 +463,11 @@ char **argv;
else if (strcmp(*argv,"rc2") == 0) doit[D_CBC_RC2]=1;
else
#endif
#ifndef NO_RC5
if (strcmp(*argv,"rc5-cbc") == 0) doit[D_CBC_RC5]=1;
else if (strcmp(*argv,"rc5") == 0) doit[D_CBC_RC5]=1;
else
#endif
#ifndef NO_IDEA
if (strcmp(*argv,"idea-cbc") == 0) doit[D_CBC_IDEA]=1;
else if (strcmp(*argv,"idea") == 0) doit[D_CBC_IDEA]=1;
......@@ -437,6 +476,13 @@ char **argv;
#ifndef NO_BLOWFISH
if (strcmp(*argv,"bf-cbc") == 0) doit[D_CBC_BF]=1;
else if (strcmp(*argv,"blowfish") == 0) doit[D_CBC_BF]=1;
else if (strcmp(*argv,"bf") == 0) doit[D_CBC_BF]=1;
else
#endif
#ifndef NO_CAST
if (strcmp(*argv,"cast-cbc") == 0) doit[D_CBC_CAST]=1;
else if (strcmp(*argv,"cast") == 0) doit[D_CBC_CAST]=1;
else if (strcmp(*argv,"cast5") == 0) doit[D_CBC_CAST]=1;
else
#endif
#ifndef NO_DES
......@@ -467,17 +513,20 @@ char **argv;
#endif
{
BIO_printf(bio_err,"bad value, pick one of\n");
BIO_printf(bio_err,"md2 mdc2 md5 sha sha1\n");
BIO_printf(bio_err,"md2 mdc2 md5 hmac sha1 rmd160\n");
#ifndef NO_IDEA
BIO_printf(bio_err,"idea-cbc ");
#endif
#ifndef NO_RC2
BIO_printf(bio_err,"rc2-cbc ");
#endif
#ifndef NO_RC2
#ifndef NO_RC5
BIO_printf(bio_err,"rc5-cbc ");
#endif
#ifndef NO_BLOWFISH
BIO_printf(bio_err,"bf-cbc");
#endif
#if !defined(NO_IDEA) && !defined(NO_RC2) && !defined(NO_BLOWFISH)
#if !defined(NO_IDEA) && !defined(NO_RC2) && !defined(NO_BLOWFISH) && !defined(NO_RC5)
BIO_printf(bio_err,"\n");
#endif
BIO_printf(bio_err,"des-cbc des-ede3 ");
......@@ -527,6 +576,14 @@ char **argv;
BIO_printf(bio_err,"internal error loading RSA key number %d\n",i);
goto end;
}
#if 0
else
{
BIO_printf(bio_err,"Loaded RSA key, %d bit modulus and e= 0x",BN_num_bits(rsa_key[i]->n));
BN_print(bio_err,rsa_key[i]->e);
BIO_printf(bio_err,"\n");
}
#endif
}
#endif
......@@ -550,9 +607,15 @@ char **argv;
#ifndef NO_RC2
RC2_set_key(&rc2_ks,16,key16,128);
#endif
#ifndef NO_RC5
RC5_32_set_key(&rc5_ks,16,key16,12);
#endif
#ifndef NO_BLOWFISH
BF_set_key(&bf_ks,16,key16);
#endif
#ifndef NO_CAST
CAST_set_key(&cast_ks,16,key16);
#endif
memset(rsa_c,0,sizeof(rsa_c));
#ifndef SIGALRM
......@@ -570,22 +633,26 @@ char **argv;
c[D_MD2][0]=count/10;
c[D_MDC2][0]=count/10;
c[D_MD5][0]=count;
c[D_SHA][0]=count;
c[D_HMAC][0]=count;
c[D_SHA1][0]=count;
c[D_RMD160][0]=count;
c[D_RC4][0]=count*5;
c[D_CBC_DES][0]=count;
c[D_EDE3_DES][0]=count/3;
c[D_CBC_IDEA][0]=count;
c[D_CBC_RC2][0]=count;
c[D_CBC_RC5][0]=count;
c[D_CBC_BF][0]=count;
c[D_CBC_CAST][0]=count;
for (i=1; i<SIZE_NUM; i++)
{
c[D_MD2][i]=c[D_MD2][0]*4*lengths[0]/lengths[i];
c[D_MDC2][i]=c[D_MDC2][0]*4*lengths[0]/lengths[i];
c[D_MD5][i]=c[D_MD5][0]*4*lengths[0]/lengths[i];
c[D_SHA][i]=c[D_SHA][0]*4*lengths[0]/lengths[i];
c[D_HMAC][i]=c[D_HMAC][0]*4*lengths[0]/lengths[i];
c[D_SHA1][i]=c[D_SHA1][0]*4*lengths[0]/lengths[i];
c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i];
}
for (i=1; i<SIZE_NUM; i++)
{
......@@ -598,7 +665,9 @@ char **argv;
c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1;
c[D_CBC_IDEA][i]=c[D_CBC_IDEA][i-1]*l0/l1;
c[D_CBC_RC2][i]=c[D_CBC_RC2][i-1]*l0/l1;
c[D_CBC_RC5][i]=c[D_CBC_RC5][i-1]*l0/l1;
c[D_CBC_BF][i]=c[D_CBC_BF][i-1]*l0/l1;
c[D_CBC_CAST][i]=c[D_CBC_CAST][i-1]*l0/l1;
}
rsa_c[R_RSA_512][0]=count/2000;
rsa_c[R_RSA_512][1]=count/400;
......@@ -636,7 +705,7 @@ char **argv;
}
}
#define COND(d) (count != (d))
#define COND(d) (count < (d))
#define COUNT(d) (d)
#else
#define COND(c) (run)
......@@ -685,7 +754,7 @@ char **argv;
print_message(names[D_MD5],c[D_MD5][j],lengths[j]);
Time_F(START);
for (count=0,run=1; COND(c[D_MD5][j]); count++)
MD5(buf,(unsigned long)lengths[j],&(md5[0]));
MD5(&(buf[0]),(unsigned long)lengths[j],&(md5[0]));
d=Time_F(STOP);
BIO_printf(bio_err,"%ld %s's in %.2fs\n",
count,names[D_MD5],d);
......@@ -694,19 +763,27 @@ char **argv;
}
#endif
#ifndef NO_SHA
if (doit[D_SHA])
#ifndef NO_MD5
if (doit[D_HMAC])
{
HMAC_CTX hctx;
HMAC_Init(&hctx,(unsigned char *)"This is a key...",
16,EVP_md5());
for (j=0; j<SIZE_NUM; j++)
{
print_message(names[D_SHA],c[D_SHA][j],lengths[j]);
print_message(names[D_HMAC],c[D_HMAC][j],lengths[j]);
Time_F(START);
for (count=0,run=1; COND(c[D_SHA][j]); count++)
SHA(buf,(unsigned long)lengths[j],&(sha[0]));
for (count=0,run=1; COND(c[D_HMAC][j]); count++)
{
HMAC_Init(&hctx,NULL,0,NULL);
HMAC_Update(&hctx,buf,lengths[j]);
HMAC_Final(&hctx,&(hmac[0]),NULL);
}
d=Time_F(STOP);
BIO_printf(bio_err,"%ld %s's in %.2fs\n",
count,names[D_SHA],d);
results[D_SHA][j]=((double)count)/d*lengths[j];
count,names[D_HMAC],d);
results[D_HMAC][j]=((double)count)/d*lengths[j];
}
}
#endif
......@@ -726,6 +803,22 @@ char **argv;
}
}
#endif
#ifndef NO_RMD160
if (doit[D_RMD160])
{
for (j=0; j<SIZE_NUM; j++)
{
print_message(names[D_RMD160],c[D_RMD160][j],lengths[j]);
Time_F(START);
for (count=0,run=1; COND(c[D_RMD160][j]); count++)
RIPEMD160(buf,(unsigned long)lengths[j],&(rmd160[0]));
d=Time_F(STOP);
BIO_printf(bio_err,"%ld %s's in %.2fs\n",
count,names[D_RMD160],d);
results[D_RMD160][j]=((double)count)/d*lengths[j];
}
}
#endif
#ifndef NO_RC4
if (doit[D_RC4])
{
......@@ -816,6 +909,24 @@ char **argv;
}
}
#endif
#ifndef NO_RC5
if (doit[D_CBC_RC5])
{
for (j=0; j<SIZE_NUM; j++)
{
print_message(names[D_CBC_RC5],c[D_CBC_RC5][j],lengths[j]);
Time_F(START);
for (count=0,run=1; COND(c[D_CBC_RC5][j]); count++)
RC5_32_cbc_encrypt(buf,buf,
(unsigned long)lengths[j],&rc5_ks,
(unsigned char *)&(iv[0]),RC5_ENCRYPT);
d=Time_F(STOP);
BIO_printf(bio_err,"%ld %s's in %.2fs\n",
count,names[D_CBC_RC5],d);
results[D_CBC_RC5][j]=((double)count)/d*lengths[j];
}
}
#endif
#ifndef NO_BLOWFISH
if (doit[D_CBC_BF])
{
......@@ -834,6 +945,24 @@ char **argv;
}
}
#endif
#ifndef NO_CAST
if (doit[D_CBC_CAST])
{
for (j=0; j<SIZE_NUM; j++)
{
print_message(names[D_CBC_CAST],c[D_CBC_CAST][j],lengths[j]);
Time_F(START);
for (count=0,run=1; COND(c[D_CBC_CAST][j]); count++)
CAST_cbc_encrypt(buf,buf,
(unsigned long)lengths[j],&cast_ks,
(unsigned char *)&(iv[0]),CAST_ENCRYPT);
d=Time_F(STOP);
BIO_printf(bio_err,"%ld %s's in %.2fs\n",
count,names[D_CBC_CAST],d);
results[D_CBC_CAST][j]=((double)count)/d*lengths[j];
}
}
#endif
RAND_bytes(buf,30);
#ifndef NO_RSA
......@@ -842,6 +971,7 @@ char **argv;
if (!rsa_doit[j]) continue;
pkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j],
RSA_SECONDS);
/* RSA_blinding_on(rsa_key[j],NULL); */
Time_F(START);
for (count=0,run=1; COND(rsa_c[j][0]); count++)
{
......@@ -861,6 +991,7 @@ char **argv;
rsa_results[j][0]=d/(double)count;
rsa_count=count;
#if 1
pkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j],
RSA_SECONDS);
Time_F(START);
......@@ -880,6 +1011,7 @@ char **argv;
BIO_printf(bio_err,"%ld %d bit public RSA's in %.2fs\n",
count,rsa_bits[j],d);
rsa_results[j][1]=d/(double)count;
#endif
if (rsa_count <= 1)
{
......@@ -894,6 +1026,8 @@ char **argv;
#ifndef NO_DSA
for (j=0; j<DSA_NUM; j++)
{
unsigned int kk;
if (!dsa_doit[j]) continue;
DSA_generate_key(dsa_key[j]);
/* DSA_sign_setup(dsa_key[j],NULL); */
......@@ -966,7 +1100,7 @@ char **argv;
#ifndef NO_BLOWFISH
printf("%s ",BF_options());
#endif
fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_CFLAGS));
fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS));
if (pr_header)
{
......@@ -980,7 +1114,7 @@ char **argv;
for (k=0; k<ALGOR_NUM; k++)
{
if (!doit[k]) continue;
fprintf(stdout,"%-12s",names[k]);
fprintf(stdout,"%-13s",names[k]);
for (j=0; j<SIZE_NUM; j++)
{
if (results[k][j] > 10000)
......@@ -995,9 +1129,14 @@ char **argv;
for (k=0; k<RSA_NUM; k++)
{
if (!rsa_doit[k]) continue;
if (j) { printf("%18ssign verify\n"," "); j=0; }
fprintf(stdout,"rsa %4d bits %8.4fs %8.4fs",
rsa_bits[k],rsa_results[k][0],rsa_results[k][1]);
if (j)
{
printf("%18ssign verify sign/s verify/s\n"," ");
j=0;
}
fprintf(stdout,"rsa %4d bits %8.4fs %8.4fs %8.1f %8.1f",
rsa_bits[k],rsa_results[k][0],rsa_results[k][1],
1.0/rsa_results[k][0],1.0/rsa_results[k][1]);
fprintf(stdout,"\n");
}
#endif
......@@ -1006,9 +1145,13 @@ char **argv;
for (k=0; k<DSA_NUM; k++)
{
if (!dsa_doit[k]) continue;
if (j) { printf("%18ssign verify\n"," "); j=0; }
fprintf(stdout,"dsa %4d bits %8.4fs %8.4fs",
dsa_bits[k],dsa_results[k][0],dsa_results[k][1]);
if (j) {
printf("%18ssign verify sign/s verify/s\n"," ");
j=0;
}
fprintf(stdout,"dsa %4d bits %8.4fs %8.4fs %8.1f %8.1f",
dsa_bits[k],dsa_results[k][0],dsa_results[k][1],
1.0/dsa_results[k][0],1.0/dsa_results[k][1]);
fprintf(stdout,"\n");
}
#endif
......@@ -1066,3 +1209,4 @@ int tm;
num=num;
#endif
}
/* apps/ssleay.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -56,14 +56,13 @@
* [including the GNU Public Licence.]
*/
#define DEBUG
#ifndef DEBUG
#undef DEBUG
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#ifdef WIN16
#define APPS_WIN16
#endif
#include "bio.h"
#include "crypto.h"
#include "lhash.h"
......@@ -78,19 +77,22 @@
#include "s_apps.h"
#include "err.h"
/*
#ifdef WINDOWS
#include "bss_file.c"
#endif
*/
#ifndef NOPROTO
static unsigned long MS_CALLBACK hash(FUNCTION *a);
static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b);
static LHASH *prog_init(void );
static int do_cmd(LHASH *prog,int argc,char *argv[]);
static void sig_stop(int i);
#else
static unsigned long MS_CALLBACK hash();
static int MS_CALLBACK cmp();
static LHASH *prog_init();
static int do_cmd();
static void sig_stop();
#endif
LHASH *config=NULL;
......@@ -143,7 +145,7 @@ char *Argv[];
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
......@@ -224,6 +226,7 @@ char *Argv[];
}
if (ret != 0)
BIO_printf(bio_err,"error in %s\n",argv[0]);
BIO_flush(bio_err);
}
BIO_printf(bio_err,"bad exit\n");
ret=1;
......
此差异已折叠。
/* apps/verify.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -97,7 +97,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
argc--;
argv++;
......
/* apps/version.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -77,7 +77,7 @@ char **argv;
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE);
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
if (argc == 1) version=1;
for (i=1; i<argc; i++)
......@@ -121,6 +121,7 @@ char **argv;
#ifndef NO_BLOWFISH
printf("%s ",BF_options());
#endif
printf("\n");
}
if (cflags) printf("%s\n",SSLeay_version(SSLEAY_CFLAGS));
end:
......
/* apps/x509.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -59,7 +59,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef WIN16
#ifdef NO_STDIO
#define APPS_WIN16
#endif
#include "apps.h"
......@@ -344,7 +344,7 @@ bad:
}
if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE);
BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT);
else
{
if (BIO_read_filename(in,infile) <= 0)
......@@ -416,7 +416,7 @@ bad:
if (!noout || text)
{
OBJ_create_and_add_object("2.99999.3",
OBJ_create("2.99999.3",
"SET.ex3","SET x509v3 extension 3");
out=BIO_new(BIO_s_file());
......@@ -625,7 +625,7 @@ bad:
BIO_printf(bio_err,"Generating certificate request\n");
rq=X509_to_X509_REQ(x,pk);
rq=X509_to_X509_REQ(x,pk,EVP_md5());
EVP_PKEY_free(pk);
if (rq == NULL)
{
......@@ -812,9 +812,11 @@ int days;
if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
goto end;
/* don't save DSA parameters in child if parent has them. */
/* don't save DSA parameters in child if parent has them
* and the parents and the childs are the same. */
upkey=X509_get_pubkey(x);
if (!EVP_PKEY_missing_parameters(pkey))
if (!EVP_PKEY_missing_parameters(pkey) &&
(EVP_PKEY_cmp_parameters(pkey,upkey) == 0))
{
EVP_PKEY_save_parameters(upkey,0);
/* Force a re-write */
......
/* bugs/alpha.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
/* bugs/stream.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: md5WithRSAEncryption
Issuer: O=European ICE-TEL project, OU=V3-Certification Authority
Validity
Not Before: Apr 2 17:35:53 1997 GMT
Not After : Apr 2 17:35:53 1998 GMT
Subject: O=European ICE-TEL project, OU=V3-Certification Authority, L=Darmstadt
Subject Public Key Info:
Public Key Algorithm: rsa
RSA Public Key: (512 bit)
Modulus (512 bit):
00:82:75:ba:f6:d1:60:b5:f9:15:b3:6a:dd:29:8f:
8b:a4:6f:1a:88:e0:50:43:40:0b:79:41:d5:d3:16:
44:7d:74:65:17:42:06:52:0b:e9:50:c8:10:cd:24:
e2:ae:8d:22:30:73:e6:b4:b7:93:1f:e5:6e:a2:ae:
49:11:a5:c9:45
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Authority Key Identifier:
0.........z.."p......e..
X509v3 Subject Key Identifier:
..~r..:..B.44fu......3
X509v3 Key Usage: critical
....
X509v3 Certificate Policies: critical
0.0...*...
X509v3 Subject Alternative Name:
0!..secude-support@darmstadt.gmd.de
X509v3 Issuer Alternative Name:
0I..ice-tel-ca@darmstadt.gmd.de.*http://www.darmstadt.gmd.de/ice-tel/euroca
X509v3 Basic Constraints: critical
0....
X509v3 CRL Distribution Points:
0200...,.*http://www.darmstadt.gmd.de/ice-tel/euroca
Signature Algorithm: md5WithRSAEncryption
17:a2:88:b7:99:5a:05:41:e4:13:34:67:e6:1f:3e:26:ec:4b:
69:f9:3e:28:22:be:9d:1c:ab:41:6f:0c:00:85:fe:45:74:f6:
98:f0:ce:9b:65:53:4a:50:42:c7:d4:92:bd:d7:a2:a8:3d:98:
88:73:cd:60:28:79:a3:fc:48:7a
-----BEGIN CERTIFICATE-----
MIICzDCCAnagAwIBAgIBATANBgkqhkiG9w0BAQQFADBIMSEwHwYDVQQKExhFdXJv
cGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24g
QXV0aG9yaXR5MB4XDTk3MDQwMjE3MzU1M1oXDTk4MDQwMjE3MzU1M1owXDEhMB8G
A1UEChMYRXVyb3BlYW4gSUNFLVRFTCBwcm9qZWN0MSMwIQYDVQQLExpWMy1DZXJ0
aWZpY2F0aW9uIEF1dGhvcml0eTESMBAGA1UEBxMJRGFybXN0YWR0MFkwCgYEVQgB
AQICAgADSwAwSAJBAIJ1uvbRYLX5FbNq3SmPi6RvGojgUENAC3lB1dMWRH10ZRdC
BlIL6VDIEM0k4q6NIjBz5rS3kx/lbqKuSRGlyUUCAwEAAaOCATgwggE0MB8GA1Ud
IwQYMBaAFIr3yNUOx3ro1yJw4AuJ1bbsZbzPMB0GA1UdDgQWBBR+cvL4OoacQog0
NGZ1w9T80aIRMzAOBgNVHQ8BAf8EBAMCAfYwFAYDVR0gAQH/BAowCDAGBgQqAwQF
MCoGA1UdEQQjMCGBH3NlY3VkZS1zdXBwb3J0QGRhcm1zdGFkdC5nbWQuZGUwUgYD
VR0SBEswSYEbaWNlLXRlbC1jYUBkYXJtc3RhZHQuZ21kLmRlhipodHRwOi8vd3d3
LmRhcm1zdGFkdC5nbWQuZGUvaWNlLXRlbC9ldXJvY2EwDwYDVR0TAQH/BAUwAwEB
/zA7BgNVHR8ENDAyMDCgLqAshipodHRwOi8vd3d3LmRhcm1zdGFkdC5nbWQuZGUv
aWNlLXRlbC9ldXJvY2EwDQYJKoZIhvcNAQEEBQADQQAXooi3mVoFQeQTNGfmHz4m
7Etp+T4oIr6dHKtBbwwAhf5FdPaY8M6bZVNKUELH1JK916KoPZiIc81gKHmj/Eh6
-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 0 (0x0)
Signature Algorithm: md5WithRSAEncryption
Issuer: O=European ICE-TEL project, OU=V3-Certification Authority
Validity
Not Before: Apr 2 17:33:36 1997 GMT
Not After : Apr 2 17:33:36 1998 GMT
Subject: O=European ICE-TEL project, OU=V3-Certification Authority
Subject Public Key Info:
Public Key Algorithm: rsa
RSA Public Key: (512 bit)
Modulus (512 bit):
00:80:3e:eb:ae:47:a9:fe:10:54:0b:81:8b:9c:2b:
82:ab:3a:61:36:65:8b:f3:73:9f:ac:ac:7a:15:a7:
13:8f:b4:c4:ba:a3:0f:bc:a5:58:8d:cc:b1:93:31:
9e:81:9e:8c:19:61:86:fa:52:73:54:d1:97:76:22:
e7:c7:9f:41:cd
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
........z.."p......e..
X509v3 Key Usage: critical
....
X509v3 Subject Alternative Name:
0I.*http://www.darmstadt.gmd.de/ice-tel/euroca..ice-tel-ca@darmstadt.gmd.de
X509v3 Basic Constraints: critical
0....
Signature Algorithm: md5WithRSAEncryption
76:69:61:db:b7:cf:8b:06:9e:d8:8c:96:53:d2:4d:a8:23:a6:
03:44:e8:8f:24:a5:c0:84:a8:4b:77:d4:2d:2b:7d:37:91:67:
f2:2c:ce:02:31:4c:6b:cc:ce:f2:68:a6:11:11:ab:7d:88:b8:
7e:22:9f:25:06:60:bd:79:30:3d
-----BEGIN CERTIFICATE-----
MIICFjCCAcCgAwIBAgIBADANBgkqhkiG9w0BAQQFADBIMSEwHwYDVQQKExhFdXJv
cGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24g
QXV0aG9yaXR5MB4XDTk3MDQwMjE3MzMzNloXDTk4MDQwMjE3MzMzNlowSDEhMB8G
A1UEChMYRXVyb3BlYW4gSUNFLVRFTCBwcm9qZWN0MSMwIQYDVQQLExpWMy1DZXJ0
aWZpY2F0aW9uIEF1dGhvcml0eTBZMAoGBFUIAQECAgIAA0sAMEgCQQCAPuuuR6n+
EFQLgYucK4KrOmE2ZYvzc5+srHoVpxOPtMS6ow+8pViNzLGTMZ6BnowZYYb6UnNU
0Zd2IufHn0HNAgMBAAGjgZcwgZQwHQYDVR0OBBYEFIr3yNUOx3ro1yJw4AuJ1bbs
ZbzPMA4GA1UdDwEB/wQEAwIB9jBSBgNVHREESzBJhipodHRwOi8vd3d3LmRhcm1z
dGFkdC5nbWQuZGUvaWNlLXRlbC9ldXJvY2GBG2ljZS10ZWwtY2FAZGFybXN0YWR0
LmdtZC5kZTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBBAUAA0EAdmlh27fP
iwae2IyWU9JNqCOmA0TojySlwISoS3fULSt9N5Fn8izOAjFMa8zO8mimERGrfYi4
fiKfJQZgvXkwPQ==
-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: md5WithRSAEncryption
Issuer: O=European ICE-TEL project, OU=V3-Certification Authority, L=Darmstadt
Validity
Not Before: Apr 2 17:35:59 1997 GMT
Not After : Apr 2 17:35:59 1998 GMT
Subject: O=European ICE-TEL project, OU=V3-Certification Authority, L=Darmstadt, CN=USER
Subject Public Key Info:
Public Key Algorithm: rsa
RSA Public Key: (512 bit)
Modulus (512 bit):
00:a8:a8:53:63:49:1b:93:c3:c3:0b:6c:88:11:55:
de:7e:6a:e2:f9:52:a0:dc:69:25:c4:c8:bf:55:e1:
31:a8:ce:e4:a9:29:85:99:8a:15:9a:de:f6:2f:e1:
b4:50:5f:5e:04:75:a6:f4:76:dc:3c:0e:39:dc:3a:
be:3e:a4:61:8b
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Authority Key Identifier:
0...~r..:..B.44fu......3
X509v3 Subject Key Identifier:
...... .*...1.*.......
X509v3 Key Usage: critical
....
X509v3 Certificate Policies: critical
0.0...*...0.......
X509v3 Subject Alternative Name:
0:..user@darmstadt.gmd.de.!http://www.darmstadt.gmd.de/~user
X509v3 Issuer Alternative Name:
0....gmdca@gmd.de..http://www.gmd.de..saturn.darmstadt.gmd.de.\1!0...U.
..European ICE-TEL project1#0!..U....V3-Certification Authority1.0...U....Darmstadt..141.12.62.26
X509v3 Basic Constraints: critical
0.
X509v3 CRL Distribution Points:
0.0.......gmdca@gmd.de
Signature Algorithm: md5WithRSAEncryption
69:0c:e1:b7:a7:f2:d8:fb:e8:69:c0:13:cd:37:ad:21:06:22:
4d:e8:c6:db:f1:04:0b:b7:e0:b3:d6:0c:81:03:ce:c3:6a:3e:
c7:e7:24:24:a4:92:64:c2:83:83:06:42:53:0e:6f:09:1e:84:
9a:f7:6f:63:9b:94:99:83:d6:a4
-----BEGIN CERTIFICATE-----
MIIDTzCCAvmgAwIBAgIBATANBgkqhkiG9w0BAQQFADBcMSEwHwYDVQQKExhFdXJv
cGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24g
QXV0aG9yaXR5MRIwEAYDVQQHEwlEYXJtc3RhZHQwHhcNOTcwNDAyMTczNTU5WhcN
OTgwNDAyMTczNTU5WjBrMSEwHwYDVQQKExhFdXJvcGVhbiBJQ0UtVEVMIHByb2pl
Y3QxIzAhBgNVBAsTGlYzLUNlcnRpZmljYXRpb24gQXV0aG9yaXR5MRIwEAYDVQQH
EwlEYXJtc3RhZHQxDTALBgNVBAMTBFVTRVIwWTAKBgRVCAEBAgICAANLADBIAkEA
qKhTY0kbk8PDC2yIEVXefmri+VKg3GklxMi/VeExqM7kqSmFmYoVmt72L+G0UF9e
BHWm9HbcPA453Dq+PqRhiwIDAQABo4IBmDCCAZQwHwYDVR0jBBgwFoAUfnLy+DqG
nEKINDRmdcPU/NGiETMwHQYDVR0OBBYEFJfc4B8gjSoRmLUx4Sq/ucIYiMrPMA4G
A1UdDwEB/wQEAwIB8DAcBgNVHSABAf8EEjAQMAYGBCoDBAUwBgYECQgHBjBDBgNV
HREEPDA6gRV1c2VyQGRhcm1zdGFkdC5nbWQuZGWGIWh0dHA6Ly93d3cuZGFybXN0
YWR0LmdtZC5kZS9+dXNlcjCBsQYDVR0SBIGpMIGmgQxnbWRjYUBnbWQuZGWGEWh0
dHA6Ly93d3cuZ21kLmRlghdzYXR1cm4uZGFybXN0YWR0LmdtZC5kZaRcMSEwHwYD
VQQKExhFdXJvcGVhbiBJQ0UtVEVMIHByb2plY3QxIzAhBgNVBAsTGlYzLUNlcnRp
ZmljYXRpb24gQXV0aG9yaXR5MRIwEAYDVQQHEwlEYXJtc3RhZHSHDDE0MS4xMi42
Mi4yNjAMBgNVHRMBAf8EAjAAMB0GA1UdHwQWMBQwEqAQoA6BDGdtZGNhQGdtZC5k
ZTANBgkqhkiG9w0BAQQFAANBAGkM4ben8tj76GnAE803rSEGIk3oxtvxBAu34LPW
DIEDzsNqPsfnJCSkkmTCg4MGQlMObwkehJr3b2OblJmD1qQ=
-----END CERTIFICATE-----
-----BEGIN X509 CRL-----
MIIBNDCBnjANBgkqhkiG9w0BAQIFADBFMSEwHwYDVQQKExhFdXJvcGVhbiBJQ0Ut
VEVMIFByb2plY3QxIDAeBgNVBAsTF0NlcnRpZmljYXRpb24gQXV0aG9yaXR5Fw05
NzA2MDkxNDQyNDNaFw05NzA3MDkxNDQyNDNaMCgwEgIBChcNOTcwMzAzMTQ0MjU0
WjASAgEJFw05NjEwMDIxMjI5MjdaMA0GCSqGSIb3DQEBAgUAA4GBAH4vgWo2Tej/
i7kbiw4Imd30If91iosjClNpBFwvwUDBclPEeMuYimHbLOk4H8Nofc0fw11+U/IO
KSNouUDcqG7B64oY7c4SXKn+i1MWOb5OJiWeodX3TehHjBlyWzoNMWCnYA8XqFP1
mOKp8Jla1BibEZf14+/HqCi2hnZUiEXh
-----END X509 CRL-----
此差异已折叠。
......@@ -24,10 +24,13 @@ EX_LIBS=
CFLAGS= $(INCLUDE) $(CFLAG) -DCFLAGS=" \"$(CC) $(CFLAG)\" "
ERR=crypto
ERRC=cpt_err
LIBS=
SDIRS= md sha mdc2 \
des rc4 rc2 idea bf \
SDIRS= md2 md5 sha mdc2 hmac ripemd \
des rc2 rc4 rc5 idea bf cast \
bn rsa dsa dh \
buffer bio stack lhash rand err objects \
evp pem x509 \
......@@ -36,8 +39,8 @@ SDIRS= md sha mdc2 \
GENERAL=Makefile README
LIB= $(TOP)/libcrypto.a
LIBSRC= cryptlib.c mem.c cversion.c
LIBOBJ= cryptlib.o mem.o cversion.o
LIBSRC= cryptlib.c mem.c cversion.c ex_data.c $(ERRC).c
LIBOBJ= cryptlib.o mem.o cversion.o ex_data.o $(ERRC).o
SRC= $(LIBSRC)
......@@ -58,7 +61,7 @@ subdirs:
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making all in $$i..."; \
$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' AR='${AR}' all ); \
$(MAKE) CC='$(CC)' INCLUDES='${INCLUDES}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_MULW='${BN_MULW}' DES_ENC='${DES_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' AR='${AR}' all ); \
done;
files:
......@@ -72,7 +75,7 @@ files:
links:
/bin/rm -f Makefile
$(TOP)/util/point.sh Makefile.ssl Makefile ;
$(TOP)/util/mklink.sh ../include $(EXHEADER) ;
$(TOP)/util/mklink.sh ../include $(HEADER) ;
$(TOP)/util/mklink.sh ../test $(TEST) ;
$(TOP)/util/mklink.sh ../apps $(APPS) ;
$(TOP)/util/point.sh Makefile.ssl Makefile;
......@@ -146,7 +149,9 @@ dclean:
done;
errors:
perl ./err/err_code.pl */*.c ../ssl/*.c ../rsaref/*.c
perl ./err/err_code.pl -conf err/ssleay.ec *.c */*.c ../ssl/*.c ../rsaref/*.c
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl err/err_genc.pl -s $(ERR).h $(ERRC).c
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making errors in $$i..."; \
......
......@@ -35,7 +35,8 @@ LIBSRC= a_object.c a_bitstr.c a_utctm.c a_int.c a_octet.c a_print.c \
p7_dgst.c p7_s_e.c p7_enc.c p7_lib.c \
f_int.c f_string.c i2d_dhp.c i2d_dsap.c d2i_dhp.c d2i_dsap.c n_pkey.c \
a_hdr.c x_pkey.c a_bool.c x_exten.c \
asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c
asn1_par.c asn1_lib.c $(ERRC).c a_meth.c a_bytes.c \
evp_asn1.c
LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \
a_type.o a_set.o a_dup.o a_d2i_fp.o a_i2d_fp.o \
a_sign.o a_digest.o a_verify.o \
......@@ -49,7 +50,8 @@ LIBOBJ= a_object.o a_bitstr.o a_utctm.o a_int.o a_octet.o a_print.o \
p7_dgst.o p7_s_e.o p7_enc.o p7_lib.o \
f_int.o f_string.o i2d_dhp.o i2d_dsap.o d2i_dhp.o d2i_dsap.o n_pkey.o \
a_hdr.o x_pkey.o a_bool.o x_exten.o \
asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o
asn1_par.o asn1_lib.o $(ERRC).o a_meth.o a_bytes.o \
evp_asn1.o
SRC= $(LIBSRC)
......@@ -113,6 +115,6 @@ clean:
errors:
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl $(ERR).h $(ERRC).c
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
# DO NOT DELETE THIS LINE -- make depend depends on it.
/* crypto/asn1/a_bitstr.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -156,3 +156,49 @@ err:
return(NULL);
}
/* These next 2 functions from Goetz Babin-Ebell <babinebell@trustcenter.de>
*/
int ASN1_BIT_STRING_set_bit(a,n,value)
ASN1_BIT_STRING *a;
int n;
int value;
{
int w,v,iv;
unsigned char *c;
w=n/8;
v=1<<(7-(n&0x07));
iv= ~v;
if (a == NULL) return(0);
if ((a->length < (w+1)) || (a->data == NULL))
{
if (!value) return(1); /* Don't need to set */
if (a->data == NULL)
c=(unsigned char *)Malloc(w+1);
else
c=(unsigned char *)Realloc(a->data,w+1);
if (c == NULL) return(0);
a->data=c;
a->length=w+1;
c[w]=0;
}
a->data[w]=((a->data[w])&iv)|v;
while ((a->length > 0) && (a->data[a->length-1] == 0))
a->length--;
return(1);
}
int ASN1_BIT_STRING_get_bit(a,n)
ASN1_BIT_STRING *a;
int n;
{
int w,v;
w=n/8;
v=1<<(7-(n&0x07));
if ((a == NULL) || (a->length < (w+1)) || (a->data == NULL))
return(0);
return((a->data[w]&v) != 0);
}
此差异已折叠。
/* crypto/asn1/a_bool.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
此差异已折叠。
/* crypto/asn1/a_d2i_fp.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -63,7 +63,7 @@
#define HEADER_SIZE 8
#ifndef WIN16
#ifndef NO_FP_API
char *ASN1_d2i_fp(xnew,d2i,in,x)
char *(*xnew)();
char *(*d2i)();
......@@ -108,6 +108,7 @@ unsigned char **x;
return(NULL);
}
ERR_clear_error();
for (;;)
{
if (want >= (len-off))
......
/* crypto/asn1/a_digest.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
/* crypto/asn1/a_dup.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
/* crypto/asn1/a_hdr.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......
/* crypto/asn1/a_i2d_fp.c */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
......@@ -61,7 +61,7 @@
#include "buffer.h"
#include "asn1_mac.h"
#ifndef WIN16
#ifndef NO_FP_API
int ASN1_i2d_fp(i2d,out,x)
int (*i2d)();
FILE *out;
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册