summaryrefslogtreecommitdiffstats
path: root/crypto/openssl/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2000-11-13 01:03:58 +0000
committerkris <kris@FreeBSD.org>2000-11-13 01:03:58 +0000
commit539b977eff7c71f628cb2a407543a51070b14763 (patch)
tree258f64877cac3711a3434257baddcbae72af2af3 /crypto/openssl/ssl/ssl_lib.c
parent893841d237b49d10e810e8b130839b4b63fd5ab4 (diff)
downloadFreeBSD-src-539b977eff7c71f628cb2a407543a51070b14763.zip
FreeBSD-src-539b977eff7c71f628cb2a407543a51070b14763.tar.gz
Initial import of OpenSSL 0.9.6
Diffstat (limited to 'crypto/openssl/ssl/ssl_lib.c')
-rw-r--r--crypto/openssl/ssl/ssl_lib.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/crypto/openssl/ssl/ssl_lib.c b/crypto/openssl/ssl/ssl_lib.c
index c515c41..635b250 100644
--- a/crypto/openssl/ssl/ssl_lib.c
+++ b/crypto/openssl/ssl/ssl_lib.c
@@ -58,6 +58,8 @@
* [including the GNU Public Licence.]
*/
+
+#include <assert.h>
#include <stdio.h>
#include <openssl/objects.h>
#include <openssl/lhash.h>
@@ -183,7 +185,7 @@ SSL *SSL_new(SSL_CTX *ctx)
return(NULL);
}
- s=(SSL *)Malloc(sizeof(SSL));
+ s=(SSL *)OPENSSL_malloc(sizeof(SSL));
if (s == NULL) goto err;
memset(s,0,sizeof(SSL));
@@ -239,7 +241,7 @@ err:
ssl_cert_free(s->cert);
if (s->ctx != NULL)
SSL_CTX_free(s->ctx); /* decrement reference count */
- Free(s);
+ OPENSSL_free(s);
}
SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE);
return(NULL);
@@ -375,7 +377,7 @@ void SSL_free(SSL *s)
if (s->method != NULL) s->method->ssl_free(s);
- Free(s);
+ OPENSSL_free(s);
}
void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio)
@@ -874,7 +876,7 @@ long SSL_CTX_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)())
}
}
-int ssl_cipher_id_cmp(SSL_CIPHER *a,SSL_CIPHER *b)
+int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b)
{
long l;
@@ -885,7 +887,8 @@ int ssl_cipher_id_cmp(SSL_CIPHER *a,SSL_CIPHER *b)
return((l > 0)?1:-1);
}
-int ssl_cipher_ptr_id_cmp(SSL_CIPHER **ap,SSL_CIPHER **bp)
+int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap,
+ const SSL_CIPHER * const *bp)
{
long l;
@@ -1033,7 +1036,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num,
return(NULL);
}
if ((skp == NULL) || (*skp == NULL))
- sk=sk_SSL_CIPHER_new(NULL); /* change perhaps later */
+ sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */
else
{
sk= *skp;
@@ -1099,7 +1102,7 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD *meth)
SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS);
goto err;
}
- ret=(SSL_CTX *)Malloc(sizeof(SSL_CTX));
+ ret=(SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX));
if (ret == NULL)
goto err;
@@ -1195,7 +1198,7 @@ err2:
}
static void SSL_COMP_free(SSL_COMP *comp)
- { Free(comp); }
+ { OPENSSL_free(comp); }
void SSL_CTX_free(SSL_CTX *a)
{
@@ -1236,7 +1239,7 @@ void SSL_CTX_free(SSL_CTX *a)
sk_X509_pop_free(a->extra_certs,X509_free);
if (a->comp_methods != NULL)
sk_SSL_COMP_pop_free(a->comp_methods,SSL_COMP_free);
- Free(a);
+ OPENSSL_free(a);
}
void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)
@@ -1759,13 +1762,13 @@ void ssl_clear_cipher_ctx(SSL *s)
if (s->enc_read_ctx != NULL)
{
EVP_CIPHER_CTX_cleanup(s->enc_read_ctx);
- Free(s->enc_read_ctx);
+ OPENSSL_free(s->enc_read_ctx);
s->enc_read_ctx=NULL;
}
if (s->enc_write_ctx != NULL)
{
EVP_CIPHER_CTX_cleanup(s->enc_write_ctx);
- Free(s->enc_write_ctx);
+ OPENSSL_free(s->enc_write_ctx);
s->enc_write_ctx=NULL;
}
if (s->expand != NULL)
@@ -1843,19 +1846,16 @@ int ssl_init_wbio_buffer(SSL *s,int push)
void ssl_free_wbio_buffer(SSL *s)
{
- BIO *under;
-
if (s->bbio == NULL) return;
if (s->bbio == s->wbio)
{
/* remove buffering */
- under=BIO_pop(s->wbio);
- if (under != NULL)
- s->wbio=under;
- else
- abort(); /* ok */
- }
+ s->wbio=BIO_pop(s->wbio);
+#ifdef REF_CHECK /* not the usual REF_CHECK, but this avoids adding one more preprocessor symbol */
+ assert(s->wbio != NULL);
+#endif
+ }
BIO_free(s->bbio);
s->bbio=NULL;
}
OpenPOWER on IntegriCloud