summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/bio
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2003-01-28 21:43:22 +0000
committermarkm <markm@FreeBSD.org>2003-01-28 21:43:22 +0000
commitaad1d64cb5a8d9b503d9199642363dc1e92d2f9b (patch)
tree610a51c6e3965764fb0f1629c1376e2d23afffe8 /crypto/openssl/crypto/bio
parenteba366e36e93f5da8ae5c744eb337c3ef6872641 (diff)
downloadFreeBSD-src-aad1d64cb5a8d9b503d9199642363dc1e92d2f9b.zip
FreeBSD-src-aad1d64cb5a8d9b503d9199642363dc1e92d2f9b.tar.gz
Vendor import of OpenSSL release 0.9.7. This release includes
support for AES and OpenBSD's hardware crypto.
Diffstat (limited to 'crypto/openssl/crypto/bio')
-rw-r--r--crypto/openssl/crypto/bio/Makefile.ssl176
-rw-r--r--crypto/openssl/crypto/bio/b_print.c14
-rw-r--r--crypto/openssl/crypto/bio/b_sock.c38
-rw-r--r--crypto/openssl/crypto/bio/bf_buff.c3
-rw-r--r--crypto/openssl/crypto/bio/bf_nbio.c1
-rw-r--r--crypto/openssl/crypto/bio/bf_null.c1
-rw-r--r--crypto/openssl/crypto/bio/bio.h29
-rw-r--r--crypto/openssl/crypto/bio/bio_cb.c2
-rw-r--r--crypto/openssl/crypto/bio/bio_err.c6
-rw-r--r--crypto/openssl/crypto/bio/bio_lib.c31
-rw-r--r--crypto/openssl/crypto/bio/bss_acpt.c18
-rw-r--r--crypto/openssl/crypto/bio/bss_bio.c11
-rw-r--r--crypto/openssl/crypto/bio/bss_conn.c19
-rw-r--r--crypto/openssl/crypto/bio/bss_fd.c226
-rw-r--r--crypto/openssl/crypto/bio/bss_file.c24
-rw-r--r--crypto/openssl/crypto/bio/bss_log.c28
-rw-r--r--crypto/openssl/crypto/bio/bss_mem.c8
-rw-r--r--crypto/openssl/crypto/bio/bss_sock.c137
18 files changed, 460 insertions, 312 deletions
diff --git a/crypto/openssl/crypto/bio/Makefile.ssl b/crypto/openssl/crypto/bio/Makefile.ssl
index 3009873..141a03a 100644
--- a/crypto/openssl/crypto/bio/Makefile.ssl
+++ b/crypto/openssl/crypto/bio/Makefile.ssl
@@ -5,13 +5,14 @@
DIR= bio
TOP= ../..
CC= cc
-INCLUDES= -I.. -I../../include
+INCLUDES= -I.. -I$(TOP) -I../../include
CFLAG=-g
INSTALL_PREFIX=
OPENSSLDIR= /usr/local/ssl
INSTALLTOP=/usr/local/ssl
MAKE= make -f Makefile.ssl
-MAKEDEPEND= $(TOP)/util/domd $(TOP)
+MAKEDEPPROG= makedepend
+MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
MAKEFILE= Makefile.ssl
AR= ar r
@@ -49,8 +50,7 @@ all: lib
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
- @echo You may get an error following this line. Please ignore.
- - $(RANLIB) $(LIB)
+ $(RANLIB) $(LIB) || echo Never mind.
@touch lib
files:
@@ -78,7 +78,7 @@ lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
depend:
- $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
+ $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
@@ -89,156 +89,128 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
-b_dump.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-b_dump.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+b_dump.o: ../../e_os.h ../../include/openssl/bio.h
+b_dump.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
b_dump.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
b_dump.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
b_dump.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
b_dump.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-b_dump.o: ../cryptlib.h
-b_print.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
+b_dump.o: ../cryptlib.h b_dump.c
+b_print.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h
b_print.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
-b_print.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
-b_print.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
-b_print.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-b_print.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-b_print.o: ../../include/openssl/symhacks.h ../cryptlib.h
-b_sock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-b_sock.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+b_print.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+b_print.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+b_print.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
+b_print.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+b_print.o: ../cryptlib.h b_print.c
+b_sock.o: ../../e_os.h ../../include/openssl/bio.h
+b_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
b_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
b_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
b_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
b_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-b_sock.o: ../cryptlib.h
-bf_buff.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-bf_buff.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
-bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
-bf_buff.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-bf_buff.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-bf_buff.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
-bf_buff.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-bf_buff.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
-bf_buff.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
-bf_buff.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
-bf_buff.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-bf_buff.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-bf_buff.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
-bf_buff.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
-bf_buff.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-bf_buff.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-bf_buff.o: ../../include/openssl/symhacks.h ../cryptlib.h
-bf_nbio.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-bf_nbio.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
-bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
-bf_nbio.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-bf_nbio.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-bf_nbio.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
-bf_nbio.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-bf_nbio.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
-bf_nbio.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
-bf_nbio.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
-bf_nbio.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-bf_nbio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
-bf_nbio.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
-bf_nbio.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
-bf_nbio.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
+b_sock.o: ../cryptlib.h b_sock.c
+bf_buff.o: ../../e_os.h ../../include/openssl/bio.h
+bf_buff.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+bf_buff.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+bf_buff.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+bf_buff.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
+bf_buff.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+bf_buff.o: ../cryptlib.h bf_buff.c
+bf_nbio.o: ../../e_os.h ../../include/openssl/bio.h
+bf_nbio.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+bf_nbio.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+bf_nbio.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+bf_nbio.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+bf_nbio.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h
bf_nbio.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bf_nbio.o: ../cryptlib.h
-bf_null.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
-bf_null.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
-bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
-bf_null.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
-bf_null.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
-bf_null.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
-bf_null.o: ../../include/openssl/err.h ../../include/openssl/evp.h
-bf_null.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
-bf_null.o: ../../include/openssl/md2.h ../../include/openssl/md4.h
-bf_null.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h
-bf_null.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
-bf_null.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
-bf_null.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h
-bf_null.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h
-bf_null.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h
-bf_null.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
-bf_null.o: ../../include/openssl/symhacks.h ../cryptlib.h
-bio_cb.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bio_cb.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bf_nbio.o: ../cryptlib.h bf_nbio.c
+bf_null.o: ../../e_os.h ../../include/openssl/bio.h
+bf_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+bf_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+bf_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
+bf_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
+bf_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
+bf_null.o: ../cryptlib.h bf_null.c
+bio_cb.o: ../../e_os.h ../../include/openssl/bio.h
+bio_cb.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bio_cb.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bio_cb.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bio_cb.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bio_cb.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bio_cb.o: ../cryptlib.h
+bio_cb.o: ../cryptlib.h bio_cb.c
bio_err.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-bio_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
+bio_err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
+bio_err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bio_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bio_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bio_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bio_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bio_err.o: bio_err.c
+bio_lib.o: ../../e_os.h ../../include/openssl/bio.h
+bio_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bio_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bio_lib.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bio_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bio_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bio_lib.o: ../cryptlib.h
-bss_acpt.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_acpt.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bio_lib.o: ../cryptlib.h bio_lib.c
+bss_acpt.o: ../../e_os.h ../../include/openssl/bio.h
+bss_acpt.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_acpt.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_acpt.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_acpt.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_acpt.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_acpt.o: ../cryptlib.h
-bss_bio.o: ../../include/openssl/bio.h ../../include/openssl/crypto.h
-bss_bio.o: ../../include/openssl/e_os.h ../../include/openssl/e_os2.h
+bss_acpt.o: ../cryptlib.h bss_acpt.c
+bss_bio.o: ../../e_os.h ../../include/openssl/bio.h
+bss_bio.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
bss_bio.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
bss_bio.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
bss_bio.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
-bss_bio.o: ../../include/openssl/symhacks.h
-bss_conn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_conn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_bio.o: ../../include/openssl/symhacks.h bss_bio.c
+bss_conn.o: ../../e_os.h ../../include/openssl/bio.h
+bss_conn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_conn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_conn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_conn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_conn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_conn.o: ../cryptlib.h
-bss_fd.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_fd.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_conn.o: ../cryptlib.h bss_conn.c
+bss_fd.o: ../../e_os.h ../../include/openssl/bio.h
+bss_fd.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_fd.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_fd.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_fd.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_fd.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_fd.o: ../cryptlib.h bss_sock.c
-bss_file.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_file.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_fd.o: ../cryptlib.h bss_fd.c
+bss_file.o: ../../e_os.h ../../include/openssl/bio.h
+bss_file.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_file.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_file.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_file.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_file.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_file.o: ../cryptlib.h
-bss_log.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_log.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_file.o: ../cryptlib.h bss_file.c
+bss_log.o: ../../e_os.h ../../include/openssl/bio.h
+bss_log.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_log.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_log.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_log.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_log.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_log.o: ../cryptlib.h
-bss_mem.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_mem.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_log.o: ../cryptlib.h bss_log.c
+bss_mem.o: ../../e_os.h ../../include/openssl/bio.h
+bss_mem.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_mem.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_mem.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_mem.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_mem.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_mem.o: ../cryptlib.h
-bss_null.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_mem.o: ../cryptlib.h bss_mem.c
+bss_null.o: ../../e_os.h ../../include/openssl/bio.h
+bss_null.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_null.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_null.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_null.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_null.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_null.o: ../cryptlib.h
-bss_sock.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
-bss_sock.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
+bss_null.o: ../cryptlib.h bss_null.c
+bss_sock.o: ../../e_os.h ../../include/openssl/bio.h
+bss_sock.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
bss_sock.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
bss_sock.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
bss_sock.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
bss_sock.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
-bss_sock.o: ../cryptlib.h
+bss_sock.o: ../cryptlib.h bss_sock.c
diff --git a/crypto/openssl/crypto/bio/b_print.c b/crypto/openssl/crypto/bio/b_print.c
index fa4e350..3f5d6a7 100644
--- a/crypto/openssl/crypto/bio/b_print.c
+++ b/crypto/openssl/crypto/bio/b_print.c
@@ -116,7 +116,7 @@
#endif
#if HAVE_LONG_LONG
-# if defined(WIN32) && !defined(__GNUC__)
+# if defined(OPENSSL_SYS_WIN32) && !defined(__GNUC__)
# define LLONG _int64
# else
# define LLONG long long
@@ -483,7 +483,7 @@ fmtint(
{
int signvalue = 0;
unsigned LLONG uvalue;
- char convert[20];
+ char convert[DECIMAL_SIZE(value)+1];
int place = 0;
int spadlen = 0;
int zpadlen = 0;
@@ -508,8 +508,8 @@ fmtint(
(caps ? "0123456789ABCDEF" : "0123456789abcdef")
[uvalue % (unsigned) base];
uvalue = (uvalue / (unsigned) base);
- } while (uvalue && (place < 20));
- if (place == 20)
+ } while (uvalue && (place < sizeof convert));
+ if (place == sizeof convert)
place--;
convert[place] = 0;
@@ -641,8 +641,8 @@ fmtfp(
(caps ? "0123456789ABCDEF"
: "0123456789abcdef")[intpart % 10];
intpart = (intpart / 10);
- } while (intpart && (iplace < 20));
- if (iplace == 20)
+ } while (intpart && (iplace < sizeof iplace));
+ if (iplace == sizeof iplace)
iplace--;
iconvert[iplace] = 0;
@@ -653,7 +653,7 @@ fmtfp(
: "0123456789abcdef")[fracpart % 10];
fracpart = (fracpart / 10);
} while (fplace < max);
- if (fplace == 20)
+ if (fplace == sizeof fplace)
fplace--;
fconvert[fplace] = 0;
diff --git a/crypto/openssl/crypto/bio/b_sock.c b/crypto/openssl/crypto/bio/b_sock.c
index 8fb0716..86f3817 100644
--- a/crypto/openssl/crypto/bio/b_sock.c
+++ b/crypto/openssl/crypto/bio/b_sock.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#ifndef NO_SOCK
+#ifndef OPENSSL_NO_SOCK
#include <stdio.h>
#include <stdlib.h>
@@ -65,7 +65,7 @@
#include "cryptlib.h"
#include <openssl/bio.h>
-#ifdef WIN16
+#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
#define SOCKET_PROTOCOL IPPROTO_TCP
@@ -79,10 +79,11 @@
#define MAX_LISTEN 32
#endif
-#ifdef WINDOWS
+#ifdef OPENSSL_SYS_WINDOWS
static int wsa_init_done=0;
#endif
+#if 0
static unsigned long BIO_ghbn_hits=0L;
static unsigned long BIO_ghbn_miss=0L;
@@ -93,6 +94,7 @@ static struct ghbn_cache_st
struct hostent *ent;
unsigned long order;
} ghbn_cache[GHBN_NUM];
+#endif
static int get_ip(const char *str,unsigned char *ip);
#if 0
@@ -230,6 +232,7 @@ int BIO_sock_error(int sock)
return(j);
}
+#if 0
long BIO_ghbn_ctrl(int cmd, int iarg, char *parg)
{
int i;
@@ -267,6 +270,7 @@ long BIO_ghbn_ctrl(int cmd, int iarg, char *parg)
}
return(1);
}
+#endif
#if 0
static struct hostent *ghbn_dup(struct hostent *a)
@@ -345,6 +349,7 @@ static void ghbn_free(struct hostent *a)
if (a->h_name != NULL) OPENSSL_free(a->h_name);
OPENSSL_free(a);
}
+
#endif
struct hostent *BIO_gethostbyname(const char *name)
@@ -441,7 +446,7 @@ end:
int BIO_sock_init(void)
{
-#ifdef WINDOWS
+#ifdef OPENSSL_SYS_WINDOWS
static struct WSAData wsa_state;
if (!wsa_init_done)
@@ -461,29 +466,41 @@ int BIO_sock_init(void)
return(-1);
}
}
-#endif /* WINDOWS */
+#endif /* OPENSSL_SYS_WINDOWS */
+#ifdef WATT32
+ extern int _watt_do_exit;
+ _watt_do_exit = 0; /* don't make sock_init() call exit() */
+ if (sock_init())
+ return (-1);
+#endif
return(1);
}
void BIO_sock_cleanup(void)
{
-#ifdef WINDOWS
+#ifdef OPENSSL_SYS_WINDOWS
if (wsa_init_done)
{
wsa_init_done=0;
+#ifndef OPENSSL_SYS_WINCE
WSACancelBlockingCall();
+#endif
WSACleanup();
}
#endif
}
-#if !defined(VMS) || __VMS_VER >= 70000000
+#if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000
int BIO_socket_ioctl(int fd, long type, unsigned long *arg)
{
int i;
+#ifdef __DJGPP__
+ i=ioctlsocket(fd,type,(char *)arg);
+#else
i=ioctlsocket(fd,type,arg);
+#endif /* __DJGPP__ */
if (i < 0)
SYSerr(SYS_F_IOCTLSOCKET,get_last_socket_error());
return(i);
@@ -506,16 +523,16 @@ static int get_ip(const char *str, unsigned char ip[4])
{
ok=1;
tmp[num]=tmp[num]*10+c-'0';
- if (tmp[num] > 255) return(-1);
+ if (tmp[num] > 255) return(0);
}
else if (c == '.')
{
if (!ok) return(-1);
- if (num == 3) break;
+ if (num == 3) return(0);
num++;
ok=0;
}
- else if ((num == 3) && ok)
+ else if (c == '\0' && (num == 3) && ok)
break;
else
return(0);
@@ -673,6 +690,7 @@ int BIO_accept(int sock, char **addr)
ret=accept(sock,(struct sockaddr *)&from,(void *)&len);
if (ret == INVALID_SOCKET)
{
+ if(BIO_sock_should_retry(ret)) return -2;
SYSerr(SYS_F_ACCEPT,get_last_socket_error());
BIOerr(BIO_F_BIO_ACCEPT,BIO_R_ACCEPT_ERROR);
goto end;
diff --git a/crypto/openssl/crypto/bio/bf_buff.c b/crypto/openssl/crypto/bio/bf_buff.c
index c90238b..1cecd70 100644
--- a/crypto/openssl/crypto/bio/bf_buff.c
+++ b/crypto/openssl/crypto/bio/bf_buff.c
@@ -60,7 +60,6 @@
#include <errno.h>
#include "cryptlib.h"
#include <openssl/bio.h>
-#include <openssl/evp.h>
static int buffer_write(BIO *h, const char *buf,int num);
static int buffer_read(BIO *h, char *buf, int size);
@@ -483,7 +482,7 @@ static int buffer_gets(BIO *b, char *buf, int size)
size-=i;
ctx->ibuf_len-=i;
ctx->ibuf_off+=i;
- if ((flag) || (i == size))
+ if (flag || size == 0)
{
*buf='\0';
return(num);
diff --git a/crypto/openssl/crypto/bio/bf_nbio.c b/crypto/openssl/crypto/bio/bf_nbio.c
index 988cd5a..1ce2bfa 100644
--- a/crypto/openssl/crypto/bio/bf_nbio.c
+++ b/crypto/openssl/crypto/bio/bf_nbio.c
@@ -61,7 +61,6 @@
#include "cryptlib.h"
#include <openssl/rand.h>
#include <openssl/bio.h>
-#include <openssl/evp.h>
/* BIO_put and BIO_get both add to the digest,
* BIO_gets returns the digest */
diff --git a/crypto/openssl/crypto/bio/bf_null.c b/crypto/openssl/crypto/bio/bf_null.c
index 2678a1a..c1bf39a 100644
--- a/crypto/openssl/crypto/bio/bf_null.c
+++ b/crypto/openssl/crypto/bio/bf_null.c
@@ -60,7 +60,6 @@
#include <errno.h>
#include "cryptlib.h"
#include <openssl/bio.h>
-#include <openssl/evp.h>
/* BIO_put and BIO_get both add to the digest,
* BIO_gets returns the digest */
diff --git a/crypto/openssl/crypto/bio/bio.h b/crypto/openssl/crypto/bio/bio.h
index fd3aaa0..ecd2899 100644
--- a/crypto/openssl/crypto/bio/bio.h
+++ b/crypto/openssl/crypto/bio/bio.h
@@ -59,12 +59,13 @@
#ifndef HEADER_BIO_H
#define HEADER_BIO_H
-#ifndef NO_FP_API
+#ifndef OPENSSL_NO_FP_API
# include <stdio.h>
#endif
#include <stdarg.h>
#include <openssl/crypto.h>
+#include <openssl/e_os2.h>
#ifdef __cplusplus
extern "C" {
@@ -179,7 +180,7 @@ extern "C" {
#define BIO_retry_type(a) ((a)->flags & BIO_FLAGS_RWS)
#define BIO_should_retry(a) ((a)->flags & BIO_FLAGS_SHOULD_RETRY)
-/* The next two are used in conjunction with the
+/* The next three are used in conjunction with the
* BIO_should_io_special() condition. After this returns true,
* BIO *BIO_get_retry_BIO(BIO *bio, int *reason); will walk the BIO
* stack and return the 'reason' for the special and the offending BIO.
@@ -188,6 +189,8 @@ extern "C" {
#define BIO_RR_SSL_X509_LOOKUP 0x01
/* Returned from the connect BIO when a connect would have blocked */
#define BIO_RR_CONNECT 0x02
+/* Returned from the accept BIO when an accept would have blocked */
+#define BIO_RR_ACCEPT 0x03
/* These are passed by the BIO callback */
#define BIO_CB_FREE 0x01
@@ -215,7 +218,7 @@ typedef struct bio_st BIO;
typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
-#ifndef WIN16
+#ifndef OPENSSL_SYS_WIN16
typedef struct bio_method_st
{
int type;
@@ -464,8 +467,9 @@ int BIO_read_filename(BIO *b,const char *name);
size_t BIO_ctrl_pending(BIO *b);
size_t BIO_ctrl_wpending(BIO *b);
#define BIO_flush(b) (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
-#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0,(bio_info_cb **)(cbp))
-#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,(bio_info_cb *)(cb))
+#define BIO_get_info_callback(b,cbp) (int)BIO_ctrl(b,BIO_CTRL_GET_CALLBACK,0, \
+ cbp)
+#define BIO_set_info_callback(b,cb) (int)BIO_callback_ctrl(b,BIO_CTRL_SET_CALLBACK,cb)
/* For the BIO_f_buffer() type */
#define BIO_buffer_get_num_lines(b) BIO_ctrl(b,BIO_CTRL_GET,0,NULL)
@@ -493,8 +497,8 @@ int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
unsigned long BIO_number_read(BIO *bio);
unsigned long BIO_number_written(BIO *bio);
-# ifndef NO_FP_API
-# if defined(WIN16) && defined(_WINDLL)
+# ifndef OPENSSL_NO_FP_API
+# if defined(OPENSSL_SYS_WIN16) && defined(_WINDLL)
BIO_METHOD *BIO_s_file_internal(void);
BIO *BIO_new_file_internal(char *filename, char *mode);
BIO *BIO_new_fp_internal(FILE *stream, int close_flag);
@@ -518,6 +522,7 @@ int BIO_read(BIO *b, void *data, int len);
int BIO_gets(BIO *bp,char *buf, int size);
int BIO_write(BIO *b, const void *data, int len);
int BIO_puts(BIO *bp,const char *buf);
+int BIO_indent(BIO *b,int indent,int max);
long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));
char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
@@ -536,7 +541,7 @@ int BIO_nread(BIO *bio, char **buf, int num);
int BIO_nwrite0(BIO *bio, char **buf);
int BIO_nwrite(BIO *bio, char **buf, int num);
-#ifndef WIN16
+#ifndef OPENSSL_SYS_WIN16
long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
long argl,long ret);
#else
@@ -550,12 +555,14 @@ BIO_METHOD *BIO_s_socket(void);
BIO_METHOD *BIO_s_connect(void);
BIO_METHOD *BIO_s_accept(void);
BIO_METHOD *BIO_s_fd(void);
+#ifndef OPENSSL_SYS_OS2
BIO_METHOD *BIO_s_log(void);
+#endif
BIO_METHOD *BIO_s_bio(void);
BIO_METHOD *BIO_s_null(void);
BIO_METHOD *BIO_f_null(void);
BIO_METHOD *BIO_f_buffer(void);
-#ifdef VMS
+#ifdef OPENSSL_SYS_VMS
BIO_METHOD *BIO_f_linebuffer(void);
#endif
BIO_METHOD *BIO_f_nbio_test(void);
@@ -602,7 +609,7 @@ int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
void BIO_copy_next_retry(BIO *b);
-long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);
+/*long BIO_ghbn_ctrl(int cmd,int iarg,char *parg);*/
int BIO_printf(BIO *bio, const char *format, ...);
int BIO_vprintf(BIO *bio, const char *format, va_list args);
@@ -643,6 +650,7 @@ void ERR_load_BIO_strings(void);
#define BIO_F_CONN_CTRL 127
#define BIO_F_CONN_STATE 115
#define BIO_F_FILE_CTRL 116
+#define BIO_F_FILE_READ 130
#define BIO_F_LINEBUFFER_CTRL 129
#define BIO_F_MEM_READ 128
#define BIO_F_MEM_WRITE 117
@@ -669,6 +677,7 @@ void ERR_load_BIO_strings(void);
#define BIO_R_NO_HOSTNAME_SPECIFIED 112
#define BIO_R_NO_PORT_DEFINED 113
#define BIO_R_NO_PORT_SPECIFIED 114
+#define BIO_R_NO_SUCH_FILE 128
#define BIO_R_NULL_PARAMETER 115
#define BIO_R_TAG_MISMATCH 116
#define BIO_R_UNABLE_TO_BIND_SOCKET 117
diff --git a/crypto/openssl/crypto/bio/bio_cb.c b/crypto/openssl/crypto/bio/bio_cb.c
index 37c7c22..0ffa4d2 100644
--- a/crypto/openssl/crypto/bio/bio_cb.c
+++ b/crypto/openssl/crypto/bio/bio_cb.c
@@ -125,7 +125,7 @@ long MS_CALLBACK BIO_debug_callback(BIO *bio, int cmd, const char *argp,
b=(BIO *)bio->cb_arg;
if (b != NULL)
BIO_write(b,buf,strlen(buf));
-#if !defined(NO_STDIO) && !defined(WIN16)
+#if !defined(OPENSSL_NO_STDIO) && !defined(OPENSSL_SYS_WIN16)
else
fputs(buf,stderr);
#endif
diff --git a/crypto/openssl/crypto/bio/bio_err.c b/crypto/openssl/crypto/bio/bio_err.c
index bb815fb..68a119d 100644
--- a/crypto/openssl/crypto/bio/bio_err.c
+++ b/crypto/openssl/crypto/bio/bio_err.c
@@ -63,7 +63,7 @@
#include <openssl/bio.h>
/* BEGIN ERROR CODES */
-#ifndef NO_ERR
+#ifndef OPENSSL_NO_ERR
static ERR_STRING_DATA BIO_str_functs[]=
{
{ERR_PACK(0,BIO_F_ACPT_STATE,0), "ACPT_STATE"},
@@ -91,6 +91,7 @@ static ERR_STRING_DATA BIO_str_functs[]=
{ERR_PACK(0,BIO_F_CONN_CTRL,0), "CONN_CTRL"},
{ERR_PACK(0,BIO_F_CONN_STATE,0), "CONN_STATE"},
{ERR_PACK(0,BIO_F_FILE_CTRL,0), "FILE_CTRL"},
+{ERR_PACK(0,BIO_F_FILE_READ,0), "FILE_READ"},
{ERR_PACK(0,BIO_F_LINEBUFFER_CTRL,0), "LINEBUFFER_CTRL"},
{ERR_PACK(0,BIO_F_MEM_READ,0), "MEM_READ"},
{ERR_PACK(0,BIO_F_MEM_WRITE,0), "MEM_WRITE"},
@@ -120,6 +121,7 @@ static ERR_STRING_DATA BIO_str_reasons[]=
{BIO_R_NO_HOSTNAME_SPECIFIED ,"no hostname specified"},
{BIO_R_NO_PORT_DEFINED ,"no port defined"},
{BIO_R_NO_PORT_SPECIFIED ,"no port specified"},
+{BIO_R_NO_SUCH_FILE ,"no such file"},
{BIO_R_NULL_PARAMETER ,"null parameter"},
{BIO_R_TAG_MISMATCH ,"tag mismatch"},
{BIO_R_UNABLE_TO_BIND_SOCKET ,"unable to bind socket"},
@@ -141,7 +143,7 @@ void ERR_load_BIO_strings(void)
if (init)
{
init=0;
-#ifndef NO_ERR
+#ifndef OPENSSL_NO_ERR
ERR_load_strings(ERR_LIB_BIO,BIO_str_functs);
ERR_load_strings(ERR_LIB_BIO,BIO_str_reasons);
#endif
diff --git a/crypto/openssl/crypto/bio/bio_lib.c b/crypto/openssl/crypto/bio/bio_lib.c
index 381afc9..98ce395 100644
--- a/crypto/openssl/crypto/bio/bio_lib.c
+++ b/crypto/openssl/crypto/bio/bio_lib.c
@@ -63,9 +63,6 @@
#include <openssl/bio.h>
#include <openssl/stack.h>
-static STACK_OF(CRYPTO_EX_DATA_FUNCS) *bio_meth=NULL;
-static int bio_meth_num=0;
-
BIO *BIO_new(BIO_METHOD *method)
{
BIO *ret=NULL;
@@ -100,10 +97,14 @@ int BIO_set(BIO *bio, BIO_METHOD *method)
bio->references=1;
bio->num_read=0L;
bio->num_write=0L;
- CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data);
+ CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data);
if (method->create != NULL)
if (!method->create(bio))
+ {
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio,
+ &bio->ex_data);
return(0);
+ }
return(1);
}
@@ -129,7 +130,7 @@ int BIO_free(BIO *a)
((i=(int)a->callback(a,BIO_CB_FREE,NULL,0,0L,1L)) <= 0))
return(i);
- CRYPTO_free_ex_data(bio_meth,a,&a->ex_data);
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
ret=a->method->destroy(a);
@@ -271,6 +272,18 @@ int BIO_gets(BIO *b, char *in, int inl)
return(i);
}
+int BIO_indent(BIO *b,int indent,int max)
+ {
+ if(indent < 0)
+ indent=0;
+ if(indent > max)
+ indent=max;
+ while(indent--)
+ if(BIO_puts(b," ") != 1)
+ return 0;
+ return 1;
+ }
+
long BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg)
{
int i;
@@ -482,7 +495,8 @@ BIO *BIO_dup_chain(BIO *in)
}
/* copy app data */
- if (!CRYPTO_dup_ex_data(bio_meth,&new->ex_data,&bio->ex_data))
+ if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new->ex_data,
+ &bio->ex_data))
goto err;
if (ret == NULL)
@@ -512,9 +526,8 @@ void BIO_copy_next_retry(BIO *b)
int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
{
- bio_meth_num++;
- return(CRYPTO_get_ex_new_index(bio_meth_num-1,&bio_meth,
- argl,argp,new_func,dup_func,free_func));
+ return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, argl, argp,
+ new_func, dup_func, free_func);
}
int BIO_set_ex_data(BIO *bio, int idx, void *data)
diff --git a/crypto/openssl/crypto/bio/bss_acpt.c b/crypto/openssl/crypto/bio/bss_acpt.c
index 4da5822..8ea1db1 100644
--- a/crypto/openssl/crypto/bio/bss_acpt.c
+++ b/crypto/openssl/crypto/bio/bss_acpt.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#ifndef NO_SOCK
+#ifndef OPENSSL_NO_SOCK
#include <stdio.h>
#include <errno.h>
@@ -64,13 +64,13 @@
#include "cryptlib.h"
#include <openssl/bio.h>
-#ifdef WIN16
+#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
#define SOCKET_PROTOCOL IPPROTO_TCP
#endif
-#if (defined(VMS) && __VMS_VER < 70000000)
+#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
@@ -236,8 +236,20 @@ again:
c->state=ACPT_S_OK;
goto again;
}
+ BIO_clear_retry_flags(b);
+ b->retry_reason=0;
i=BIO_accept(c->accept_sock,&(c->addr));
+
+ /* -2 return means we should retry */
+ if(i == -2)
+ {
+ BIO_set_retry_special(b);
+ b->retry_reason=BIO_RR_ACCEPT;
+ return -1;
+ }
+
if (i < 0) return(i);
+
bio=BIO_new_socket(i,BIO_CLOSE);
if (bio == NULL) goto err;
diff --git a/crypto/openssl/crypto/bio/bss_bio.c b/crypto/openssl/crypto/bio/bss_bio.c
index 2797049..aa58dab 100644
--- a/crypto/openssl/crypto/bio/bss_bio.c
+++ b/crypto/openssl/crypto/bio/bss_bio.c
@@ -28,16 +28,15 @@
#include <openssl/bio.h>
#include <openssl/err.h>
-#include <openssl/err.h>
#include <openssl/crypto.h>
-#include "openssl/e_os.h"
+#include "e_os.h"
-/* VxWorks defines SSiZE_MAX with an empty value causing compile errors */
-#if defined(VXWORKS)
+/* VxWorks defines SSIZE_MAX with an empty value causing compile errors */
+#if defined(OPENSSL_SYS_VXWORKS)
# undef SSIZE_MAX
-# define SSIZE_MAX INT_MAX
-#elif !defined(SSIZE_MAX)
+#endif
+#ifndef SSIZE_MAX
# define SSIZE_MAX INT_MAX
#endif
diff --git a/crypto/openssl/crypto/bio/bss_conn.c b/crypto/openssl/crypto/bio/bss_conn.c
index a6b77a2..743db6f 100644
--- a/crypto/openssl/crypto/bio/bss_conn.c
+++ b/crypto/openssl/crypto/bio/bss_conn.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#ifndef NO_SOCK
+#ifndef OPENSSL_NO_SOCK
#include <stdio.h>
#include <errno.h>
@@ -64,13 +64,13 @@
#include "cryptlib.h"
#include <openssl/bio.h>
-#ifdef WIN16
+#ifdef OPENSSL_SYS_WIN16
#define SOCKET_PROTOCOL 0 /* more microsoft stupidity */
#else
#define SOCKET_PROTOCOL IPPROTO_TCP
#endif
-#if (defined(VMS) && __VMS_VER < 70000000)
+#if (defined(OPENSSL_SYS_VMS) && __VMS_VER < 70000000)
/* FIONBIO used as a switch to enable ioctl, and that isn't in VMS < 7.0 */
#undef FIONBIO
#endif
@@ -95,7 +95,7 @@ typedef struct bio_connect_st
/* called when the connection is initially made
* callback(BIO,state,ret); The callback should return
* 'ret'. state is for compatibility with the ssl info_callback */
- int (*info_callback)();
+ int (*info_callback)(const BIO *bio,int state,int ret);
} BIO_CONNECT;
static int conn_write(BIO *h, const char *buf, int num);
@@ -236,7 +236,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c)
}
c->state=BIO_CONN_S_CONNECT;
-#if defined(SO_KEEPALIVE) && !defined(MPE)
+#if defined(SO_KEEPALIVE) && !defined(OPENSSL_SYS_MPE)
i=1;
i=setsockopt(b->num,SOL_SOCKET,SO_KEEPALIVE,(char *)&i,sizeof(i));
if (i < 0)
@@ -519,7 +519,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
else if (num == 2)
{
char buf[16];
- char *p = ptr;
+ unsigned char *p = ptr;
sprintf(buf,"%d.%d.%d.%d",
p[0],p[1],p[2],p[3]);
@@ -530,7 +530,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
}
else if (num == 3)
{
- char buf[16];
+ char buf[DECIMAL_SIZE(int)+1];
sprintf(buf,"%d",*(int *)ptr);
if (data->param_port != NULL)
@@ -574,7 +574,8 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr)
if (data->param_hostname)
BIO_set_conn_hostname(dbio,data->param_hostname);
BIO_set_nbio(dbio,data->nbio);
- (void)BIO_set_info_callback(dbio,data->info_callback);
+ /* FIXME: the cast of the function seems unlikely to be a good idea */
+ (void)BIO_set_info_callback(dbio,(bio_info_cb *)data->info_callback);
}
break;
case BIO_CTRL_SET_CALLBACK:
@@ -613,7 +614,7 @@ static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp)
{
case BIO_CTRL_SET_CALLBACK:
{
- data->info_callback=(int (*)())fp;
+ data->info_callback=(int (*)(const struct bio_st *, int, int))fp;
}
break;
default:
diff --git a/crypto/openssl/crypto/bio/bss_fd.c b/crypto/openssl/crypto/bio/bss_fd.c
index 686c4909..5e3e187 100644
--- a/crypto/openssl/crypto/bio/bss_fd.c
+++ b/crypto/openssl/crypto/bio/bss_fd.c
@@ -56,7 +56,227 @@
* [including the GNU Public Licence.]
*/
-#define BIO_FD
-#include "bss_sock.c"
-#undef BIO_FD
+#include <stdio.h>
+#include <errno.h>
+#define USE_SOCKETS
+#include "cryptlib.h"
+#include <openssl/bio.h>
+static int fd_write(BIO *h, const char *buf, int num);
+static int fd_read(BIO *h, char *buf, int size);
+static int fd_puts(BIO *h, const char *str);
+static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2);
+static int fd_new(BIO *h);
+static int fd_free(BIO *data);
+int BIO_fd_should_retry(int s);
+
+static BIO_METHOD methods_fdp=
+ {
+ BIO_TYPE_FD,"file descriptor",
+ fd_write,
+ fd_read,
+ fd_puts,
+ NULL, /* fd_gets, */
+ fd_ctrl,
+ fd_new,
+ fd_free,
+ NULL,
+ };
+
+BIO_METHOD *BIO_s_fd(void)
+ {
+ return(&methods_fdp);
+ }
+
+BIO *BIO_new_fd(int fd,int close_flag)
+ {
+ BIO *ret;
+ ret=BIO_new(BIO_s_fd());
+ if (ret == NULL) return(NULL);
+ BIO_set_fd(ret,fd,close_flag);
+ return(ret);
+ }
+
+static int fd_new(BIO *bi)
+ {
+ bi->init=0;
+ bi->num=0;
+ bi->ptr=NULL;
+ bi->flags=0;
+ return(1);
+ }
+
+static int fd_free(BIO *a)
+ {
+ if (a == NULL) return(0);
+ if (a->shutdown)
+ {
+ if (a->init)
+ {
+ close(a->num);
+ }
+ a->init=0;
+ a->flags=0;
+ }
+ return(1);
+ }
+
+static int fd_read(BIO *b, char *out,int outl)
+ {
+ int ret=0;
+
+ if (out != NULL)
+ {
+ clear_sys_error();
+ ret=read(b->num,out,outl);
+ BIO_clear_retry_flags(b);
+ if (ret <= 0)
+ {
+ if (BIO_fd_should_retry(ret))
+ BIO_set_retry_read(b);
+ }
+ }
+ return(ret);
+ }
+
+static int fd_write(BIO *b, const char *in, int inl)
+ {
+ int ret;
+ clear_sys_error();
+ ret=write(b->num,in,inl);
+ BIO_clear_retry_flags(b);
+ if (ret <= 0)
+ {
+ if (BIO_fd_should_retry(ret))
+ BIO_set_retry_write(b);
+ }
+ return(ret);
+ }
+
+static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
+ {
+ long ret=1;
+ int *ip;
+
+ switch (cmd)
+ {
+ case BIO_CTRL_RESET:
+ num=0;
+ case BIO_C_FILE_SEEK:
+ ret=(long)lseek(b->num,num,0);
+ break;
+ case BIO_C_FILE_TELL:
+ case BIO_CTRL_INFO:
+ ret=(long)lseek(b->num,0,1);
+ break;
+ case BIO_C_SET_FD:
+ fd_free(b);
+ b->num= *((int *)ptr);
+ b->shutdown=(int)num;
+ b->init=1;
+ break;
+ case BIO_C_GET_FD:
+ if (b->init)
+ {
+ ip=(int *)ptr;
+ if (ip != NULL) *ip=b->num;
+ ret=b->num;
+ }
+ else
+ ret= -1;
+ break;
+ case BIO_CTRL_GET_CLOSE:
+ ret=b->shutdown;
+ break;
+ case BIO_CTRL_SET_CLOSE:
+ b->shutdown=(int)num;
+ break;
+ case BIO_CTRL_PENDING:
+ case BIO_CTRL_WPENDING:
+ ret=0;
+ break;
+ case BIO_CTRL_DUP:
+ case BIO_CTRL_FLUSH:
+ ret=1;
+ break;
+ default:
+ ret=0;
+ break;
+ }
+ return(ret);
+ }
+
+static int fd_puts(BIO *bp, const char *str)
+ {
+ int n,ret;
+
+ n=strlen(str);
+ ret=fd_write(bp,str,n);
+ return(ret);
+ }
+
+int BIO_fd_should_retry(int i)
+ {
+ int err;
+
+ if ((i == 0) || (i == -1))
+ {
+ err=get_last_sys_error();
+
+#if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
+ if ((i == -1) && (err == 0))
+ return(1);
+#endif
+
+ return(BIO_fd_non_fatal_error(err));
+ }
+ return(0);
+ }
+
+int BIO_fd_non_fatal_error(int err)
+ {
+ switch (err)
+ {
+
+#ifdef EWOULDBLOCK
+# ifdef WSAEWOULDBLOCK
+# if WSAEWOULDBLOCK != EWOULDBLOCK
+ case EWOULDBLOCK:
+# endif
+# else
+ case EWOULDBLOCK:
+# endif
+#endif
+
+#if defined(ENOTCONN)
+ case ENOTCONN:
+#endif
+
+#ifdef EINTR
+ case EINTR:
+#endif
+
+#ifdef EAGAIN
+#if EWOULDBLOCK != EAGAIN
+ case EAGAIN:
+# endif
+#endif
+
+#ifdef EPROTO
+ case EPROTO:
+#endif
+
+#ifdef EINPROGRESS
+ case EINPROGRESS:
+#endif
+
+#ifdef EALREADY
+ case EALREADY:
+#endif
+ return(1);
+ /* break; */
+ default:
+ break;
+ }
+ return(0);
+ }
diff --git a/crypto/openssl/crypto/bio/bss_file.c b/crypto/openssl/crypto/bio/bss_file.c
index 1f770b3..a66600c 100644
--- a/crypto/openssl/crypto/bio/bss_file.c
+++ b/crypto/openssl/crypto/bio/bss_file.c
@@ -71,7 +71,7 @@
#include <openssl/bio.h>
#include <openssl/err.h>
-#if !defined(NO_STDIO)
+#if !defined(OPENSSL_NO_STDIO)
static int MS_CALLBACK file_write(BIO *h, const char *buf, int num);
static int MS_CALLBACK file_read(BIO *h, char *buf, int size);
@@ -103,7 +103,10 @@ BIO *BIO_new_file(const char *filename, const char *mode)
{
SYSerr(SYS_F_FOPEN,get_last_sys_error());
ERR_add_error_data(5,"fopen('",filename,"','",mode,"')");
- BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
+ if (errno == ENOENT)
+ BIOerr(BIO_F_BIO_NEW_FILE,BIO_R_NO_SUCH_FILE);
+ else
+ BIOerr(BIO_F_BIO_NEW_FILE,ERR_R_SYS_LIB);
return(NULL);
}
if ((ret=BIO_new(BIO_s_file_internal())) == NULL)
@@ -159,6 +162,12 @@ static int MS_CALLBACK file_read(BIO *b, char *out, int outl)
if (b->init && (out != NULL))
{
ret=fread(out,1,(int)outl,(FILE *)b->ptr);
+ if(ret == 0 && ferror((FILE *)b->ptr))
+ {
+ SYSerr(SYS_F_FREAD,get_last_sys_error());
+ BIOerr(BIO_F_FILE_READ,ERR_R_SYS_LIB);
+ ret=-1;
+ }
}
return(ret);
}
@@ -204,12 +213,17 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
b->shutdown=(int)num&BIO_CLOSE;
b->ptr=(char *)ptr;
b->init=1;
-#if defined(MSDOS) || defined(WINDOWS)
+#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS)
/* Set correct text/binary mode */
if (num & BIO_FP_TEXT)
_setmode(fileno((FILE *)ptr),_O_TEXT);
else
_setmode(fileno((FILE *)ptr),_O_BINARY);
+#elif defined(OPENSSL_SYS_OS2)
+ if (num & BIO_FP_TEXT)
+ setmode(fileno((FILE *)ptr), O_TEXT);
+ else
+ setmode(fileno((FILE *)ptr), O_BINARY);
#endif
break;
case BIO_C_SET_FILENAME:
@@ -233,7 +247,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr)
ret=0;
break;
}
-#if defined(MSDOS) || defined(WINDOWS)
+#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2)
if (!(num & BIO_FP_TEXT))
strcat(p,"b");
else
@@ -303,7 +317,7 @@ static int MS_CALLBACK file_puts(BIO *bp, const char *str)
return(ret);
}
-#endif /* NO_STDIO */
+#endif /* OPENSSL_NO_STDIO */
#endif /* HEADER_BSS_FILE_C */
diff --git a/crypto/openssl/crypto/bio/bss_log.c b/crypto/openssl/crypto/bio/bss_log.c
index 7ba2aca..1eb678c 100644
--- a/crypto/openssl/crypto/bio/bss_log.c
+++ b/crypto/openssl/crypto/bio/bss_log.c
@@ -66,26 +66,28 @@
#include <stdio.h>
#include <errno.h>
-#if defined(WIN32)
+#include "cryptlib.h"
+
+#if defined(OPENSSL_SYS_WINCE)
+#elif defined(OPENSSL_SYS_WIN32)
# include <process.h>
-#elif defined(VMS) || defined(__VMS)
+#elif defined(OPENSSL_SYS_VMS)
# include <opcdef.h>
# include <descrip.h>
# include <lib$routines.h>
# include <starlet.h>
#elif defined(__ultrix)
# include <sys/syslog.h>
-#elif !defined(MSDOS) && !defined(VXWORKS) /* Unix */
+#elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG)
# include <syslog.h>
#endif
-#include "cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/err.h>
#ifndef NO_SYSLOG
-#if defined(WIN32)
+#if defined(OPENSSL_SYS_WIN32)
#define LOG_EMERG 0
#define LOG_ALERT 1
#define LOG_CRIT 2
@@ -96,7 +98,7 @@
#define LOG_DEBUG 7
#define LOG_DAEMON (3<<3)
-#elif defined(VMS)
+#elif defined(OPENSSL_SYS_VMS)
/* On VMS, we don't really care about these, but we need them to compile */
#define LOG_EMERG 0
#define LOG_ALERT 1
@@ -118,7 +120,7 @@ static int MS_CALLBACK slg_free(BIO *data);
static void xopenlog(BIO* bp, char* name, int level);
static void xsyslog(BIO* bp, int priority, const char* string);
static void xcloselog(BIO* bp);
-#ifdef WIN32
+#ifdef OPENSSL_SYS_WIN32
LONG (WINAPI *go_for_advapi)() = RegOpenKeyEx;
HANDLE (WINAPI *register_event_source)() = NULL;
BOOL (WINAPI *deregister_event_source)() = NULL;
@@ -241,7 +243,7 @@ static int MS_CALLBACK slg_puts(BIO *bp, const char *str)
return(ret);
}
-#if defined(WIN32)
+#if defined(OPENSSL_SYS_WIN32)
static void xopenlog(BIO* bp, char* name, int level)
{
@@ -273,7 +275,7 @@ static void xsyslog(BIO *bp, int priority, const char *string)
LPCSTR lpszStrings[2];
WORD evtype= EVENTLOG_ERROR_TYPE;
int pid = _getpid();
- char pidbuf[20];
+ char pidbuf[DECIMAL_SIZE(pid)+4];
switch (priority)
{
@@ -313,7 +315,7 @@ static void xcloselog(BIO* bp)
bp->ptr= NULL;
}
-#elif defined(VMS)
+#elif defined(OPENSSL_SYS_VMS)
static int VMS_OPC_target = LOG_DAEMON;
@@ -372,11 +374,15 @@ static void xcloselog(BIO* bp)
{
}
-#else /* Unix */
+#else /* Unix/Watt32 */
static void xopenlog(BIO* bp, char* name, int level)
{
+#ifdef WATT32 /* djgpp/DOS */
+ openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level);
+#else
openlog(name, LOG_PID|LOG_CONS, level);
+#endif
}
static void xsyslog(BIO *bp, int priority, const char *string)
diff --git a/crypto/openssl/crypto/bio/bss_mem.c b/crypto/openssl/crypto/bio/bss_mem.c
index 28ff758..a4edb71 100644
--- a/crypto/openssl/crypto/bio/bss_mem.c
+++ b/crypto/openssl/crypto/bio/bss_mem.c
@@ -190,7 +190,7 @@ static int mem_write(BIO *b, const char *in, int inl)
BIO_clear_retry_flags(b);
blen=bm->length;
- if (BUF_MEM_grow(bm,blen+inl) != (blen+inl))
+ if (BUF_MEM_grow_clean(bm,blen+inl) != (blen+inl))
goto end;
memcpy(&(bm->data[blen]),in,inl);
ret=inl;
@@ -284,7 +284,11 @@ static int mem_gets(BIO *bp, char *buf, int size)
BIO_clear_retry_flags(bp);
j=bm->length;
- if (j <= 0) return(0);
+ if (j <= 0)
+ {
+ *buf='\0';
+ return 0;
+ }
p=bm->data;
for (i=0; i<j; i++)
{
diff --git a/crypto/openssl/crypto/bio/bss_sock.c b/crypto/openssl/crypto/bio/bss_sock.c
index 50c6744..2c1c405 100644
--- a/crypto/openssl/crypto/bio/bss_sock.c
+++ b/crypto/openssl/crypto/bio/bss_sock.c
@@ -56,7 +56,7 @@
* [including the GNU Public Licence.]
*/
-#if !defined(NO_SOCK) || defined(BIO_FD)
+#ifndef OPENSSL_NO_SOCK
#include <stdio.h>
#include <errno.h>
@@ -64,7 +64,12 @@
#include "cryptlib.h"
#include <openssl/bio.h>
-#ifndef BIO_FD
+#ifdef WATT32
+#define sock_write SockWrite /* Watt-32 uses same names */
+#define sock_read SockRead
+#define sock_puts SockPuts
+#endif
+
static int sock_write(BIO *h, const char *buf, int num);
static int sock_read(BIO *h, char *buf, int size);
static int sock_puts(BIO *h, const char *str);
@@ -72,18 +77,7 @@ static long sock_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int sock_new(BIO *h);
static int sock_free(BIO *data);
int BIO_sock_should_retry(int s);
-#else
-static int fd_write(BIO *h, const char *buf, int num);
-static int fd_read(BIO *h, char *buf, int size);
-static int fd_puts(BIO *h, const char *str);
-static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2);
-static int fd_new(BIO *h);
-static int fd_free(BIO *data);
-int BIO_fd_should_retry(int s);
-#endif
-
-#ifndef BIO_FD
static BIO_METHOD methods_sockp=
{
BIO_TYPE_SOCKET,
@@ -102,49 +96,18 @@ BIO_METHOD *BIO_s_socket(void)
{
return(&methods_sockp);
}
-#else
-static BIO_METHOD methods_fdp=
- {
- BIO_TYPE_FD,"file descriptor",
- fd_write,
- fd_read,
- fd_puts,
- NULL, /* fd_gets, */
- fd_ctrl,
- fd_new,
- fd_free,
- NULL,
- };
-BIO_METHOD *BIO_s_fd(void)
- {
- return(&methods_fdp);
- }
-#endif
-
-#ifndef BIO_FD
BIO *BIO_new_socket(int fd, int close_flag)
-#else
-BIO *BIO_new_fd(int fd,int close_flag)
-#endif
{
BIO *ret;
-#ifndef BIO_FD
ret=BIO_new(BIO_s_socket());
-#else
- ret=BIO_new(BIO_s_fd());
-#endif
if (ret == NULL) return(NULL);
BIO_set_fd(ret,fd,close_flag);
return(ret);
}
-#ifndef BIO_FD
static int sock_new(BIO *bi)
-#else
-static int fd_new(BIO *bi)
-#endif
{
bi->init=0;
bi->num=0;
@@ -153,23 +116,14 @@ static int fd_new(BIO *bi)
return(1);
}
-#ifndef BIO_FD
static int sock_free(BIO *a)
-#else
-static int fd_free(BIO *a)
-#endif
{
if (a == NULL) return(0);
if (a->shutdown)
{
if (a->init)
{
-#ifndef BIO_FD
SHUTDOWN2(a->num);
-#else /* BIO_FD */
- close(a->num);
-#endif
-
}
a->init=0;
a->flags=0;
@@ -177,70 +131,40 @@ static int fd_free(BIO *a)
return(1);
}
-#ifndef BIO_FD
static int sock_read(BIO *b, char *out, int outl)
-#else
-static int fd_read(BIO *b, char *out,int outl)
-#endif
{
int ret=0;
if (out != NULL)
{
-#ifndef BIO_FD
clear_socket_error();
ret=readsocket(b->num,out,outl);
-#else
- clear_sys_error();
- ret=read(b->num,out,outl);
-#endif
BIO_clear_retry_flags(b);
if (ret <= 0)
{
-#ifndef BIO_FD
if (BIO_sock_should_retry(ret))
-#else
- if (BIO_fd_should_retry(ret))
-#endif
BIO_set_retry_read(b);
}
}
return(ret);
}
-#ifndef BIO_FD
static int sock_write(BIO *b, const char *in, int inl)
-#else
-static int fd_write(BIO *b, const char *in, int inl)
-#endif
{
int ret;
-#ifndef BIO_FD
clear_socket_error();
ret=writesocket(b->num,in,inl);
-#else
- clear_sys_error();
- ret=write(b->num,in,inl);
-#endif
BIO_clear_retry_flags(b);
if (ret <= 0)
{
-#ifndef BIO_FD
if (BIO_sock_should_retry(ret))
-#else
- if (BIO_fd_should_retry(ret))
-#endif
BIO_set_retry_write(b);
}
return(ret);
}
-#ifndef BIO_FD
static long sock_ctrl(BIO *b, int cmd, long num, void *ptr)
-#else
-static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
-#endif
{
long ret=1;
int *ip;
@@ -250,26 +174,14 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_CTRL_RESET:
num=0;
case BIO_C_FILE_SEEK:
-#ifdef BIO_FD
- ret=(long)lseek(b->num,num,0);
-#else
ret=0;
-#endif
break;
case BIO_C_FILE_TELL:
case BIO_CTRL_INFO:
-#ifdef BIO_FD
- ret=(long)lseek(b->num,0,1);
-#else
ret=0;
-#endif
break;
case BIO_C_SET_FD:
-#ifndef BIO_FD
sock_free(b);
-#else
- fd_free(b);
-#endif
b->num= *((int *)ptr);
b->shutdown=(int)num;
b->init=1;
@@ -305,69 +217,38 @@ static long fd_ctrl(BIO *b, int cmd, long num, void *ptr)
return(ret);
}
-#ifdef undef
-static int sock_gets(BIO *bp, char *buf,int size)
- {
- return(-1);
- }
-#endif
-
-#ifndef BIO_FD
static int sock_puts(BIO *bp, const char *str)
-#else
-static int fd_puts(BIO *bp, const char *str)
-#endif
{
int n,ret;
n=strlen(str);
-#ifndef BIO_FD
ret=sock_write(bp,str,n);
-#else
- ret=fd_write(bp,str,n);
-#endif
return(ret);
}
-#ifndef BIO_FD
int BIO_sock_should_retry(int i)
-#else
-int BIO_fd_should_retry(int i)
-#endif
{
int err;
if ((i == 0) || (i == -1))
{
-#ifndef BIO_FD
err=get_last_socket_error();
-#else
- err=get_last_sys_error();
-#endif
-#if defined(WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
+#if defined(OPENSSL_SYS_WINDOWS) && 0 /* more microsoft stupidity? perhaps not? Ben 4/1/99 */
if ((i == -1) && (err == 0))
return(1);
#endif
-#ifndef BIO_FD
return(BIO_sock_non_fatal_error(err));
-#else
- return(BIO_fd_non_fatal_error(err));
-#endif
}
return(0);
}
-#ifndef BIO_FD
int BIO_sock_non_fatal_error(int err)
-#else
-int BIO_fd_non_fatal_error(int err)
-#endif
{
switch (err)
{
-#if !defined(BIO_FD) && defined(WINDOWS)
+#if defined(OPENSSL_SYS_WINDOWS)
# if defined(WSAEWOULDBLOCK)
case WSAEWOULDBLOCK:
# endif
OpenPOWER on IntegriCloud