summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/ssl
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2001-05-20 03:07:21 +0000
committerkris <kris@FreeBSD.org>2001-05-20 03:07:21 +0000
commit12896e829e9474d92c70a1528cc64270e9dc08ad (patch)
treeaf21ae7d0d7d432ead379f1689adfee9ffe965f6 /crypto/openssl/ssl
parent7e55354aa4b06dead79c8a2c91756d71c0f02030 (diff)
downloadFreeBSD-src-12896e829e9474d92c70a1528cc64270e9dc08ad.zip
FreeBSD-src-12896e829e9474d92c70a1528cc64270e9dc08ad.tar.gz
Initial import of OpenSSL 0.9.6a
Diffstat (limited to 'crypto/openssl/ssl')
-rw-r--r--crypto/openssl/ssl/s23_lib.c38
-rw-r--r--crypto/openssl/ssl/s23_meth.c2
-rw-r--r--crypto/openssl/ssl/s2_pkt.c2
-rw-r--r--crypto/openssl/ssl/s3_enc.c5
-rw-r--r--crypto/openssl/ssl/s3_lib.c2
-rw-r--r--crypto/openssl/ssl/ssl.h11
-rw-r--r--crypto/openssl/ssl/ssl_cert.c2
-rw-r--r--crypto/openssl/ssl/ssl_err.c1
-rw-r--r--crypto/openssl/ssl/ssl_lib.c16
-rw-r--r--crypto/openssl/ssl/ssl_locl.h4
-rw-r--r--crypto/openssl/ssl/t1_enc.c5
11 files changed, 59 insertions, 29 deletions
diff --git a/crypto/openssl/ssl/s23_lib.c b/crypto/openssl/ssl/s23_lib.c
index dded7a1..ad2d8da 100644
--- a/crypto/openssl/ssl/s23_lib.c
+++ b/crypto/openssl/ssl/s23_lib.c
@@ -63,6 +63,7 @@
static int ssl23_num_ciphers(void );
static SSL_CIPHER *ssl23_get_cipher(unsigned int u);
static int ssl23_read(SSL *s, void *buf, int len);
+static int ssl23_peek(SSL *s, void *buf, int len);
static int ssl23_write(SSL *s, const void *buf, int len);
static long ssl23_default_timeout(void );
static int ssl23_put_cipher_by_char(const SSL_CIPHER *c, unsigned char *p);
@@ -77,7 +78,7 @@ static SSL_METHOD SSLv23_data= {
ssl_undefined_function,
ssl_undefined_function,
ssl23_read,
- (int (*)(struct ssl_st *, char *, int))ssl_undefined_function,
+ ssl23_peek,
ssl23_write,
ssl_undefined_function,
ssl_undefined_function,
@@ -169,13 +170,6 @@ static int ssl23_read(SSL *s, void *buf, int len)
{
int n;
-#if 0
- if (s->shutdown & SSL_RECEIVED_SHUTDOWN)
- {
- s->rwstate=SSL_NOTHING;
- return(0);
- }
-#endif
clear_sys_error();
if (SSL_in_init(s) && (!s->in_handshake))
{
@@ -195,17 +189,33 @@ static int ssl23_read(SSL *s, void *buf, int len)
}
}
-static int ssl23_write(SSL *s, const void *buf, int len)
+static int ssl23_peek(SSL *s, void *buf, int len)
{
int n;
-#if 0
- if (s->shutdown & SSL_SENT_SHUTDOWN)
+ clear_sys_error();
+ if (SSL_in_init(s) && (!s->in_handshake))
+ {
+ n=s->handshake_func(s);
+ if (n < 0) return(n);
+ if (n == 0)
+ {
+ SSLerr(SSL_F_SSL23_PEEK,SSL_R_SSL_HANDSHAKE_FAILURE);
+ return(-1);
+ }
+ return(SSL_peek(s,buf,len));
+ }
+ else
{
- s->rwstate=SSL_NOTHING;
- return(0);
+ ssl_undefined_function(s);
+ return(-1);
}
-#endif
+ }
+
+static int ssl23_write(SSL *s, const void *buf, int len)
+ {
+ int n;
+
clear_sys_error();
if (SSL_in_init(s) && (!s->in_handshake))
{
diff --git a/crypto/openssl/ssl/s23_meth.c b/crypto/openssl/ssl/s23_meth.c
index b52ca1d..4068431 100644
--- a/crypto/openssl/ssl/s23_meth.c
+++ b/crypto/openssl/ssl/s23_meth.c
@@ -64,7 +64,7 @@ static SSL_METHOD *ssl23_get_method(int ver);
static SSL_METHOD *ssl23_get_method(int ver)
{
if (ver == SSL2_VERSION)
- return(SSLv23_method());
+ return(SSLv2_method());
else if (ver == SSL3_VERSION)
return(SSLv3_method());
else if (ver == TLS1_VERSION)
diff --git a/crypto/openssl/ssl/s2_pkt.c b/crypto/openssl/ssl/s2_pkt.c
index 1f11944..f2f46ff 100644
--- a/crypto/openssl/ssl/s2_pkt.c
+++ b/crypto/openssl/ssl/s2_pkt.c
@@ -300,7 +300,7 @@ int ssl2_read(SSL *s, void *buf, int len)
return ssl2_read_internal(s, buf, len, 0);
}
-int ssl2_peek(SSL *s, char *buf, int len)
+int ssl2_peek(SSL *s, void *buf, int len)
{
return ssl2_read_internal(s, buf, len, 1);
}
diff --git a/crypto/openssl/ssl/s3_enc.c b/crypto/openssl/ssl/s3_enc.c
index 012a4b8..9f52c39 100644
--- a/crypto/openssl/ssl/s3_enc.c
+++ b/crypto/openssl/ssl/s3_enc.c
@@ -504,7 +504,10 @@ int ssl3_mac(SSL *ssl, unsigned char *md, int send)
EVP_DigestFinal( &md_ctx,md,&md_size);
for (i=7; i>=0; i--)
- if (++seq[i]) break;
+ {
+ ++seq[i];
+ if (seq[i] != 0) break;
+ }
return(md_size);
}
diff --git a/crypto/openssl/ssl/s3_lib.c b/crypto/openssl/ssl/s3_lib.c
index c170ceb..c32c06d 100644
--- a/crypto/openssl/ssl/s3_lib.c
+++ b/crypto/openssl/ssl/s3_lib.c
@@ -1335,7 +1335,7 @@ int ssl3_read(SSL *s, void *buf, int len)
return ssl3_read_internal(s, buf, len, 0);
}
-int ssl3_peek(SSL *s, char *buf, int len)
+int ssl3_peek(SSL *s, void *buf, int len)
{
return ssl3_read_internal(s, buf, len, 1);
}
diff --git a/crypto/openssl/ssl/ssl.h b/crypto/openssl/ssl/ssl.h
index fad7a0e..9de9e61 100644
--- a/crypto/openssl/ssl/ssl.h
+++ b/crypto/openssl/ssl/ssl.h
@@ -206,7 +206,7 @@ typedef struct ssl_method_st
int (*ssl_accept)(SSL *s);
int (*ssl_connect)(SSL *s);
int (*ssl_read)(SSL *s,void *buf,int len);
- int (*ssl_peek)(SSL *s,char *buf,int len);
+ int (*ssl_peek)(SSL *s,void *buf,int len);
int (*ssl_write)(SSL *s,const void *buf,int len);
int (*ssl_shutdown)(SSL *s);
int (*ssl_renegotiate)(SSL *s);
@@ -1061,9 +1061,9 @@ int SSL_set_trust(SSL *s, int trust);
void SSL_free(SSL *ssl);
int SSL_accept(SSL *ssl);
int SSL_connect(SSL *ssl);
-int SSL_read(SSL *ssl,char *buf,int num);
-int SSL_peek(SSL *ssl,char *buf,int num);
-int SSL_write(SSL *ssl,const char *buf,int num);
+int SSL_read(SSL *ssl,void *buf,int num);
+int SSL_peek(SSL *ssl,void *buf,int num);
+int SSL_write(SSL *ssl,const void *buf,int num);
long SSL_ctrl(SSL *ssl,int cmd, long larg, char *parg);
long SSL_callback_ctrl(SSL *, int, void (*)());
long SSL_CTX_ctrl(SSL_CTX *ctx,int cmd, long larg, char *parg);
@@ -1209,6 +1209,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
/* 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_SSL_strings(void);
/* Error codes for the SSL functions. */
@@ -1233,6 +1234,7 @@ int SSL_COMP_add_compression_method(int id,char *cm);
#define SSL_F_SSL23_CONNECT 117
#define SSL_F_SSL23_GET_CLIENT_HELLO 118
#define SSL_F_SSL23_GET_SERVER_HELLO 119
+#define SSL_F_SSL23_PEEK 237
#define SSL_F_SSL23_READ 120
#define SSL_F_SSL23_WRITE 121
#define SSL_F_SSL2_ACCEPT 122
@@ -1562,4 +1564,3 @@ int SSL_COMP_add_compression_method(int id,char *cm);
}
#endif
#endif
-
diff --git a/crypto/openssl/ssl/ssl_cert.c b/crypto/openssl/ssl/ssl_cert.c
index c26df62..27e7fcc 100644
--- a/crypto/openssl/ssl/ssl_cert.c
+++ b/crypto/openssl/ssl/ssl_cert.c
@@ -271,7 +271,9 @@ CERT *ssl_cert_dup(CERT *cert)
return(ret);
+#ifndef NO_DH /* avoid 'unreferenced label' warning if NO_DH is defined */
err:
+#endif
#ifndef NO_RSA
if (ret->rsa_tmp != NULL)
RSA_free(ret->rsa_tmp);
diff --git a/crypto/openssl/ssl/ssl_err.c b/crypto/openssl/ssl/ssl_err.c
index 9945758..1ae3333 100644
--- a/crypto/openssl/ssl/ssl_err.c
+++ b/crypto/openssl/ssl/ssl_err.c
@@ -86,6 +86,7 @@ static ERR_STRING_DATA SSL_str_functs[]=
{ERR_PACK(0,SSL_F_SSL23_CONNECT,0), "SSL23_CONNECT"},
{ERR_PACK(0,SSL_F_SSL23_GET_CLIENT_HELLO,0), "SSL23_GET_CLIENT_HELLO"},
{ERR_PACK(0,SSL_F_SSL23_GET_SERVER_HELLO,0), "SSL23_GET_SERVER_HELLO"},
+{ERR_PACK(0,SSL_F_SSL23_PEEK,0), "SSL23_PEEK"},
{ERR_PACK(0,SSL_F_SSL23_READ,0), "SSL23_READ"},
{ERR_PACK(0,SSL_F_SSL23_WRITE,0), "SSL23_WRITE"},
{ERR_PACK(0,SSL_F_SSL2_ACCEPT,0), "SSL2_ACCEPT"},
diff --git a/crypto/openssl/ssl/ssl_lib.c b/crypto/openssl/ssl/ssl_lib.c
index fec98dd..1fe85b6 100644
--- a/crypto/openssl/ssl/ssl_lib.c
+++ b/crypto/openssl/ssl/ssl_lib.c
@@ -708,7 +708,7 @@ long SSL_get_default_timeout(SSL *s)
return(s->method->get_timeout());
}
-int SSL_read(SSL *s,char *buf,int num)
+int SSL_read(SSL *s,void *buf,int num)
{
if (s->handshake_func == 0)
{
@@ -724,8 +724,14 @@ int SSL_read(SSL *s,char *buf,int num)
return(s->method->ssl_read(s,buf,num));
}
-int SSL_peek(SSL *s,char *buf,int num)
+int SSL_peek(SSL *s,void *buf,int num)
{
+ if (s->handshake_func == 0)
+ {
+ SSLerr(SSL_F_SSL_READ, SSL_R_UNINITIALIZED);
+ return -1;
+ }
+
if (s->shutdown & SSL_RECEIVED_SHUTDOWN)
{
return(0);
@@ -733,7 +739,7 @@ int SSL_peek(SSL *s,char *buf,int num)
return(s->method->ssl_peek(s,buf,num));
}
-int SSL_write(SSL *s,const char *buf,int num)
+int SSL_write(SSL *s,const void *buf,int num)
{
if (s->handshake_func == 0)
{
@@ -1679,6 +1685,10 @@ SSL *SSL_dup(SSL *s)
if (s->cert != NULL)
{
+ if (ret->cert != NULL)
+ {
+ ssl_cert_free(ret->cert);
+ }
ret->cert = ssl_cert_dup(s->cert);
if (ret->cert == NULL)
goto err;
diff --git a/crypto/openssl/ssl/ssl_locl.h b/crypto/openssl/ssl/ssl_locl.h
index bc9c699..516d3cc 100644
--- a/crypto/openssl/ssl/ssl_locl.h
+++ b/crypto/openssl/ssl/ssl_locl.h
@@ -516,7 +516,7 @@ void ssl2_free(SSL *s);
int ssl2_accept(SSL *s);
int ssl2_connect(SSL *s);
int ssl2_read(SSL *s, void *buf, int len);
-int ssl2_peek(SSL *s, char *buf, int len);
+int ssl2_peek(SSL *s, void *buf, int len);
int ssl2_write(SSL *s, const void *buf, int len);
int ssl2_shutdown(SSL *s);
void ssl2_clear(SSL *s);
@@ -564,7 +564,7 @@ void ssl3_free(SSL *s);
int ssl3_accept(SSL *s);
int ssl3_connect(SSL *s);
int ssl3_read(SSL *s, void *buf, int len);
-int ssl3_peek(SSL *s,char *buf, int len);
+int ssl3_peek(SSL *s, void *buf, int len);
int ssl3_write(SSL *s, const void *buf, int len);
int ssl3_shutdown(SSL *s);
void ssl3_clear(SSL *s);
diff --git a/crypto/openssl/ssl/t1_enc.c b/crypto/openssl/ssl/t1_enc.c
index 0d34357..d10a23a 100644
--- a/crypto/openssl/ssl/t1_enc.c
+++ b/crypto/openssl/ssl/t1_enc.c
@@ -572,7 +572,10 @@ printf("rec=");
#endif
for (i=7; i>=0; i--)
- if (++seq[i]) break;
+ {
+ ++seq[i];
+ if (seq[i] != 0) break;
+ }
#ifdef TLS_DEBUG
{unsigned int z; for (z=0; z<md_size; z++) printf("%02X ",md[z]); printf("\n"); }
OpenPOWER on IntegriCloud