diff options
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/Makefile | 2 | ||||
-rw-r--r-- | crypto/bio/bss_bio.c | 2 | ||||
-rw-r--r-- | crypto/bio/bss_file.c | 2 | ||||
-rw-r--r-- | crypto/bio/bss_mem.c | 22 | ||||
-rw-r--r-- | crypto/bio/bss_sock.c | 5 |
5 files changed, 20 insertions, 13 deletions
diff --git a/crypto/bio/Makefile b/crypto/bio/Makefile index 1ef6c2f..1cd76ce 100644 --- a/crypto/bio/Makefile +++ b/crypto/bio/Makefile @@ -45,7 +45,7 @@ top: all: lib lib: $(LIBOBJ) - $(AR) $(LIB) $(LIBOBJ) + $(ARX) $(LIB) $(LIBOBJ) $(RANLIB) $(LIB) || echo Never mind. @touch lib diff --git a/crypto/bio/bss_bio.c b/crypto/bio/bss_bio.c index 0f9f095..76bd48e 100644 --- a/crypto/bio/bss_bio.c +++ b/crypto/bio/bss_bio.c @@ -919,6 +919,6 @@ int BIO_nwrite(BIO *bio, char **buf, int num) ret = BIO_ctrl(bio, BIO_C_NWRITE, num, buf); if (ret > 0) - bio->num_read += ret; + bio->num_write += ret; return ret; } diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 4df9927..9ad46fa 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -279,7 +279,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) #endif { #if defined(OPENSSL_SYS_WINDOWS) - int fd = fileno((FILE*)ptr); + int fd = _fileno((FILE*)ptr); if (num & BIO_FP_TEXT) _setmode(fd,_O_TEXT); else diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index a4edb71..e7ab9cb 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -284,6 +284,7 @@ static int mem_gets(BIO *bp, char *buf, int size) BIO_clear_retry_flags(bp); j=bm->length; + if ((size-1) < j) j=size-1; if (j <= 0) { *buf='\0'; @@ -292,17 +293,18 @@ static int mem_gets(BIO *bp, char *buf, int size) p=bm->data; for (i=0; i<j; i++) { - if (p[i] == '\n') break; - } - if (i == j) - { - BIO_set_retry_read(bp); - /* return(-1); change the semantics 0.6.6a */ + if (p[i] == '\n') + { + i++; + break; + } } - else - i++; - /* i is the max to copy */ - if ((size-1) < i) i=size-1; + + /* + * i is now the max num of bytes to copy, either j or up to + * and including the first newline + */ + i=mem_read(bp,buf,i); if (i > 0) buf[i]='\0'; ret=i; diff --git a/crypto/bio/bss_sock.c b/crypto/bio/bss_sock.c index 472dd75..30c3cea 100644 --- a/crypto/bio/bss_sock.c +++ b/crypto/bio/bss_sock.c @@ -60,6 +60,9 @@ #include <errno.h> #define USE_SOCKETS #include "cryptlib.h" + +#ifndef OPENSSL_NO_SOCK + #include <openssl/bio.h> #ifdef WATT32 @@ -300,3 +303,5 @@ int BIO_sock_non_fatal_error(int err) } return(0); } + +#endif /* #ifndef OPENSSL_NO_SOCK */ |