summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorbeck <>2001-06-22 00:03:44 +0000
committerbeck <>2001-06-22 00:03:44 +0000
commit38b6ff9e5294811c57541ad47940f8f8f41dc114 (patch)
tree402699541cee3cf3f2943b0384dbda7de534de70 /src/lib/libssl/ssl_lib.c
parentafae624d63e4e717c5bae8c7842a4712309f728f (diff)
downloadopenbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.gz
openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.bz2
openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.zip
openssl-engine-0.9.6a merge
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r--src/lib/libssl/ssl_lib.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c
index 635b25062e..1fe85b6cb7 100644
--- a/src/lib/libssl/ssl_lib.c
+++ b/src/lib/libssl/ssl_lib.c
@@ -119,7 +119,9 @@ int SSL_clear(SSL *s)
119 s->client_version=s->version; 119 s->client_version=s->version;
120 s->rwstate=SSL_NOTHING; 120 s->rwstate=SSL_NOTHING;
121 s->rstate=SSL_ST_READ_HEADER; 121 s->rstate=SSL_ST_READ_HEADER;
122#if 0
122 s->read_ahead=s->ctx->read_ahead; 123 s->read_ahead=s->ctx->read_ahead;
124#endif
123 125
124 if (s->init_buf != NULL) 126 if (s->init_buf != NULL)
125 { 127 {
@@ -229,6 +231,7 @@ SSL *SSL_new(SSL_CTX *ctx)
229 s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1; 231 s->server=(ctx->method->ssl_accept == ssl_undefined_function)?0:1;
230 s->options=ctx->options; 232 s->options=ctx->options;
231 s->mode=ctx->mode; 233 s->mode=ctx->mode;
234 s->read_ahead=ctx->read_ahead; /* used to happen in SSL_clear */
232 SSL_clear(s); 235 SSL_clear(s);
233 236
234 CRYPTO_new_ex_data(ssl_meth,s,&s->ex_data); 237 CRYPTO_new_ex_data(ssl_meth,s,&s->ex_data);
@@ -705,7 +708,7 @@ long SSL_get_default_timeout(SSL *s)
705 return(s->method->get_timeout()); 708 return(s->method->get_timeout());
706 } 709 }
707 710
708int SSL_read(SSL *s,char *buf,int num) 711int SSL_read(SSL *s,void *buf,int num)
709 { 712 {
710 if (s->handshake_func == 0) 713 if (s->handshake_func == 0)
711 { 714 {
@@ -721,8 +724,14 @@ int SSL_read(SSL *s,char *buf,int num)
721 return(s->method->ssl_read(s,buf,num)); 724 return(s->method->ssl_read(s,buf,num));
722 } 725 }
723 726
724int SSL_peek(SSL *s,char *buf,int num) 727int SSL_peek(SSL *s,void *buf,int num)
725 { 728 {
729 if (s->handshake_func == 0)
730 {
731 SSLerr(SSL_F_SSL_READ, SSL_R_UNINITIALIZED);
732 return -1;
733 }
734
726 if (s->shutdown & SSL_RECEIVED_SHUTDOWN) 735 if (s->shutdown & SSL_RECEIVED_SHUTDOWN)
727 { 736 {
728 return(0); 737 return(0);
@@ -730,7 +739,7 @@ int SSL_peek(SSL *s,char *buf,int num)
730 return(s->method->ssl_peek(s,buf,num)); 739 return(s->method->ssl_peek(s,buf,num));
731 } 740 }
732 741
733int SSL_write(SSL *s,const char *buf,int num) 742int SSL_write(SSL *s,const void *buf,int num)
734 { 743 {
735 if (s->handshake_func == 0) 744 if (s->handshake_func == 0)
736 { 745 {
@@ -1676,6 +1685,10 @@ SSL *SSL_dup(SSL *s)
1676 1685
1677 if (s->cert != NULL) 1686 if (s->cert != NULL)
1678 { 1687 {
1688 if (ret->cert != NULL)
1689 {
1690 ssl_cert_free(ret->cert);
1691 }
1679 ret->cert = ssl_cert_dup(s->cert); 1692 ret->cert = ssl_cert_dup(s->cert);
1680 if (ret->cert == NULL) 1693 if (ret->cert == NULL)
1681 goto err; 1694 goto err;