aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/openssl/crypto/bio
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2002-01-27 03:13:07 +0000
committerKris Kennaway <kris@FreeBSD.org>2002-01-27 03:13:07 +0000
commita21b1b381ecca3813b44ac652d05a5133d3f4e2b (patch)
tree844bea9e360a2132b36667e0042dd30ac9f931ff /crypto/openssl/crypto/bio
parent26d191b459ef5c6e6f66683faef459d6cf694aa2 (diff)
downloadsrc-a21b1b381ecca3813b44ac652d05a5133d3f4e2b.tar.gz
src-a21b1b381ecca3813b44ac652d05a5133d3f4e2b.zip
Initial import of OpenSSL 0.9.6c
Notes
Notes: svn path=/vendor-crypto/openssl/dist/; revision=89837
Diffstat (limited to 'crypto/openssl/crypto/bio')
-rw-r--r--crypto/openssl/crypto/bio/b_print.c4
-rw-r--r--crypto/openssl/crypto/bio/b_sock.c40
-rw-r--r--crypto/openssl/crypto/bio/bio.h6
-rw-r--r--crypto/openssl/crypto/bio/bss_bio.c3
4 files changed, 32 insertions, 21 deletions
diff --git a/crypto/openssl/crypto/bio/b_print.c b/crypto/openssl/crypto/bio/b_print.c
index 91a049406e4d..f0a50c29bed5 100644
--- a/crypto/openssl/crypto/bio/b_print.c
+++ b/crypto/openssl/crypto/bio/b_print.c
@@ -569,7 +569,7 @@ pow10(int exp)
}
static long
-round(LDOUBLE value)
+roundv(LDOUBLE value)
{
long intpart;
intpart = (long) value;
@@ -621,7 +621,7 @@ fmtfp(
/* we "cheat" by converting the fractional part to integer by
multiplying by a factor of 10 */
- fracpart = round((pow10(max)) * (ufvalue - intpart));
+ fracpart = roundv((pow10(max)) * (ufvalue - intpart));
if (fracpart >= pow10(max)) {
intpart++;
diff --git a/crypto/openssl/crypto/bio/b_sock.c b/crypto/openssl/crypto/bio/b_sock.c
index 62cc3f1a0c81..7dfcbab769cd 100644
--- a/crypto/openssl/crypto/bio/b_sock.c
+++ b/crypto/openssl/crypto/bio/b_sock.c
@@ -95,8 +95,10 @@ static struct ghbn_cache_st
} ghbn_cache[GHBN_NUM];
static int get_ip(const char *str,unsigned char *ip);
+#if 0
static void ghbn_free(struct hostent *a);
static struct hostent *ghbn_dup(struct hostent *a);
+#endif
int BIO_get_host_ip(const char *str, unsigned char *ip)
{
int i;
@@ -266,6 +268,7 @@ long BIO_ghbn_ctrl(int cmd, int iarg, char *parg)
return(1);
}
+#if 0
static struct hostent *ghbn_dup(struct hostent *a)
{
struct hostent *ret;
@@ -342,21 +345,27 @@ 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)
{
+#if 1
+ /* Caching gethostbyname() results forever is wrong,
+ * so we have to let the true gethostbyname() worry about this */
+ return gethostbyname(name);
+#else
struct hostent *ret;
int i,lowi=0,j;
unsigned long low= (unsigned long)-1;
-/* return(gethostbyname(name)); */
-#if 0 /* It doesn't make sense to use locking here: The function interface
- * is not thread-safe, because threads can never be sure when
- * some other thread destroys the data they were given a pointer to.
- */
+# if 0
+ /* It doesn't make sense to use locking here: The function interface
+ * is not thread-safe, because threads can never be sure when
+ * some other thread destroys the data they were given a pointer to.
+ */
CRYPTO_w_lock(CRYPTO_LOCK_GETHOSTBYNAME);
-#endif
+# endif
j=strlen(name);
if (j < 128)
{
@@ -384,20 +393,21 @@ struct hostent *BIO_gethostbyname(const char *name)
* parameter is 'char *', instead of 'const char *'
*/
ret=gethostbyname(
-#ifndef CONST_STRICT
+# ifndef CONST_STRICT
(char *)
-#endif
+# endif
name);
if (ret == NULL)
goto end;
if (j > 128) /* too big to cache */
{
-#if 0 /* If we were trying to make this function thread-safe (which
- * is bound to fail), we'd have to give up in this case
- * (or allocate more memory). */
+# if 0
+ /* If we were trying to make this function thread-safe (which
+ * is bound to fail), we'd have to give up in this case
+ * (or allocate more memory). */
ret = NULL;
-#endif
+# endif
goto end;
}
@@ -421,12 +431,14 @@ struct hostent *BIO_gethostbyname(const char *name)
ghbn_cache[i].order=BIO_ghbn_miss+BIO_ghbn_hits;
}
end:
-#if 0
+# if 0
CRYPTO_w_unlock(CRYPTO_LOCK_GETHOSTBYNAME);
-#endif
+# endif
return(ret);
+#endif
}
+
int BIO_sock_init(void)
{
#ifdef WINDOWS
diff --git a/crypto/openssl/crypto/bio/bio.h b/crypto/openssl/crypto/bio/bio.h
index 97003b503c66..3777f2866bdf 100644
--- a/crypto/openssl/crypto/bio/bio.h
+++ b/crypto/openssl/crypto/bio/bio.h
@@ -431,7 +431,7 @@ int BIO_read_filename(BIO *b,const char *name);
#define BIO_set_ssl_renegotiate_bytes(b,num) \
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL);
#define BIO_get_num_renegotiates(b) \
- BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL);
+ BIO_ctrl(b,BIO_C_GET_SSL_NUM_RENEGOTIATES,0,NULL);
#define BIO_set_ssl_renegotiate_timeout(b,seconds) \
BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL);
@@ -588,8 +588,6 @@ int BIO_sock_init(void );
void BIO_sock_cleanup(void);
int BIO_set_tcp_ndelay(int sock,int turn_on);
-void ERR_load_BIO_strings(void );
-
BIO *BIO_new_socket(int sock, int close_flag);
BIO *BIO_new_fd(int fd, int close_flag);
BIO *BIO_new_connect(char *host_port);
@@ -615,6 +613,7 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
+void ERR_load_BIO_strings(void);
/* Error codes for the BIO functions. */
@@ -684,4 +683,3 @@ int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args);
}
#endif
#endif
-
diff --git a/crypto/openssl/crypto/bio/bss_bio.c b/crypto/openssl/crypto/bio/bss_bio.c
index 78c6ab4fdd97..4614ad44dd1a 100644
--- a/crypto/openssl/crypto/bio/bss_bio.c
+++ b/crypto/openssl/crypto/bio/bss_bio.c
@@ -474,7 +474,8 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
break;
case BIO_C_GET_WRITE_BUF_SIZE:
- num = (long) b->size;
+ ret = (long) b->size;
+ break;
case BIO_C_MAKE_BIO_PAIR:
{