diff options
author | beck <> | 2000-12-15 02:58:47 +0000 |
---|---|---|
committer | beck <> | 2000-12-15 02:58:47 +0000 |
commit | 9200bb13d15da4b2a23e6bc92c20e95b74aa2113 (patch) | |
tree | 5c52d628ec1e34be76e7ef2a4235d248b7c44d24 /src/lib/libssl/ssl_lib.c | |
parent | e131d25072e3d4197ba4b9bcc0d1b27d34d6488d (diff) | |
download | openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.tar.gz openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.tar.bz2 openbsd-9200bb13d15da4b2a23e6bc92c20e95b74aa2113.zip |
openssl-engine-0.9.6 merge
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
-rw-r--r-- | src/lib/libssl/ssl_lib.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index c515c41b4e..635b25062e 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
@@ -58,6 +58,8 @@ | |||
58 | * [including the GNU Public Licence.] | 58 | * [including the GNU Public Licence.] |
59 | */ | 59 | */ |
60 | 60 | ||
61 | |||
62 | #include <assert.h> | ||
61 | #include <stdio.h> | 63 | #include <stdio.h> |
62 | #include <openssl/objects.h> | 64 | #include <openssl/objects.h> |
63 | #include <openssl/lhash.h> | 65 | #include <openssl/lhash.h> |
@@ -183,7 +185,7 @@ SSL *SSL_new(SSL_CTX *ctx) | |||
183 | return(NULL); | 185 | return(NULL); |
184 | } | 186 | } |
185 | 187 | ||
186 | s=(SSL *)Malloc(sizeof(SSL)); | 188 | s=(SSL *)OPENSSL_malloc(sizeof(SSL)); |
187 | if (s == NULL) goto err; | 189 | if (s == NULL) goto err; |
188 | memset(s,0,sizeof(SSL)); | 190 | memset(s,0,sizeof(SSL)); |
189 | 191 | ||
@@ -239,7 +241,7 @@ err: | |||
239 | ssl_cert_free(s->cert); | 241 | ssl_cert_free(s->cert); |
240 | if (s->ctx != NULL) | 242 | if (s->ctx != NULL) |
241 | SSL_CTX_free(s->ctx); /* decrement reference count */ | 243 | SSL_CTX_free(s->ctx); /* decrement reference count */ |
242 | Free(s); | 244 | OPENSSL_free(s); |
243 | } | 245 | } |
244 | SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE); | 246 | SSLerr(SSL_F_SSL_NEW,ERR_R_MALLOC_FAILURE); |
245 | return(NULL); | 247 | return(NULL); |
@@ -375,7 +377,7 @@ void SSL_free(SSL *s) | |||
375 | 377 | ||
376 | if (s->method != NULL) s->method->ssl_free(s); | 378 | if (s->method != NULL) s->method->ssl_free(s); |
377 | 379 | ||
378 | Free(s); | 380 | OPENSSL_free(s); |
379 | } | 381 | } |
380 | 382 | ||
381 | void SSL_set_bio(SSL *s,BIO *rbio,BIO *wbio) | 383 | 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)()) | |||
874 | } | 876 | } |
875 | } | 877 | } |
876 | 878 | ||
877 | int ssl_cipher_id_cmp(SSL_CIPHER *a,SSL_CIPHER *b) | 879 | int ssl_cipher_id_cmp(const SSL_CIPHER *a, const SSL_CIPHER *b) |
878 | { | 880 | { |
879 | long l; | 881 | long l; |
880 | 882 | ||
@@ -885,7 +887,8 @@ int ssl_cipher_id_cmp(SSL_CIPHER *a,SSL_CIPHER *b) | |||
885 | return((l > 0)?1:-1); | 887 | return((l > 0)?1:-1); |
886 | } | 888 | } |
887 | 889 | ||
888 | int ssl_cipher_ptr_id_cmp(SSL_CIPHER **ap,SSL_CIPHER **bp) | 890 | int ssl_cipher_ptr_id_cmp(const SSL_CIPHER * const *ap, |
891 | const SSL_CIPHER * const *bp) | ||
889 | { | 892 | { |
890 | long l; | 893 | long l; |
891 | 894 | ||
@@ -1033,7 +1036,7 @@ STACK_OF(SSL_CIPHER) *ssl_bytes_to_cipher_list(SSL *s,unsigned char *p,int num, | |||
1033 | return(NULL); | 1036 | return(NULL); |
1034 | } | 1037 | } |
1035 | if ((skp == NULL) || (*skp == NULL)) | 1038 | if ((skp == NULL) || (*skp == NULL)) |
1036 | sk=sk_SSL_CIPHER_new(NULL); /* change perhaps later */ | 1039 | sk=sk_SSL_CIPHER_new_null(); /* change perhaps later */ |
1037 | else | 1040 | else |
1038 | { | 1041 | { |
1039 | sk= *skp; | 1042 | sk= *skp; |
@@ -1099,7 +1102,7 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD *meth) | |||
1099 | SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); | 1102 | SSLerr(SSL_F_SSL_CTX_NEW,SSL_R_X509_VERIFICATION_SETUP_PROBLEMS); |
1100 | goto err; | 1103 | goto err; |
1101 | } | 1104 | } |
1102 | ret=(SSL_CTX *)Malloc(sizeof(SSL_CTX)); | 1105 | ret=(SSL_CTX *)OPENSSL_malloc(sizeof(SSL_CTX)); |
1103 | if (ret == NULL) | 1106 | if (ret == NULL) |
1104 | goto err; | 1107 | goto err; |
1105 | 1108 | ||
@@ -1195,7 +1198,7 @@ err2: | |||
1195 | } | 1198 | } |
1196 | 1199 | ||
1197 | static void SSL_COMP_free(SSL_COMP *comp) | 1200 | static void SSL_COMP_free(SSL_COMP *comp) |
1198 | { Free(comp); } | 1201 | { OPENSSL_free(comp); } |
1199 | 1202 | ||
1200 | void SSL_CTX_free(SSL_CTX *a) | 1203 | void SSL_CTX_free(SSL_CTX *a) |
1201 | { | 1204 | { |
@@ -1236,7 +1239,7 @@ void SSL_CTX_free(SSL_CTX *a) | |||
1236 | sk_X509_pop_free(a->extra_certs,X509_free); | 1239 | sk_X509_pop_free(a->extra_certs,X509_free); |
1237 | if (a->comp_methods != NULL) | 1240 | if (a->comp_methods != NULL) |
1238 | sk_SSL_COMP_pop_free(a->comp_methods,SSL_COMP_free); | 1241 | sk_SSL_COMP_pop_free(a->comp_methods,SSL_COMP_free); |
1239 | Free(a); | 1242 | OPENSSL_free(a); |
1240 | } | 1243 | } |
1241 | 1244 | ||
1242 | void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb) | 1245 | 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) | |||
1759 | if (s->enc_read_ctx != NULL) | 1762 | if (s->enc_read_ctx != NULL) |
1760 | { | 1763 | { |
1761 | EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); | 1764 | EVP_CIPHER_CTX_cleanup(s->enc_read_ctx); |
1762 | Free(s->enc_read_ctx); | 1765 | OPENSSL_free(s->enc_read_ctx); |
1763 | s->enc_read_ctx=NULL; | 1766 | s->enc_read_ctx=NULL; |
1764 | } | 1767 | } |
1765 | if (s->enc_write_ctx != NULL) | 1768 | if (s->enc_write_ctx != NULL) |
1766 | { | 1769 | { |
1767 | EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); | 1770 | EVP_CIPHER_CTX_cleanup(s->enc_write_ctx); |
1768 | Free(s->enc_write_ctx); | 1771 | OPENSSL_free(s->enc_write_ctx); |
1769 | s->enc_write_ctx=NULL; | 1772 | s->enc_write_ctx=NULL; |
1770 | } | 1773 | } |
1771 | if (s->expand != NULL) | 1774 | if (s->expand != NULL) |
@@ -1843,19 +1846,16 @@ int ssl_init_wbio_buffer(SSL *s,int push) | |||
1843 | 1846 | ||
1844 | void ssl_free_wbio_buffer(SSL *s) | 1847 | void ssl_free_wbio_buffer(SSL *s) |
1845 | { | 1848 | { |
1846 | BIO *under; | ||
1847 | |||
1848 | if (s->bbio == NULL) return; | 1849 | if (s->bbio == NULL) return; |
1849 | 1850 | ||
1850 | if (s->bbio == s->wbio) | 1851 | if (s->bbio == s->wbio) |
1851 | { | 1852 | { |
1852 | /* remove buffering */ | 1853 | /* remove buffering */ |
1853 | under=BIO_pop(s->wbio); | 1854 | s->wbio=BIO_pop(s->wbio); |
1854 | if (under != NULL) | 1855 | #ifdef REF_CHECK /* not the usual REF_CHECK, but this avoids adding one more preprocessor symbol */ |
1855 | s->wbio=under; | 1856 | assert(s->wbio != NULL); |
1856 | else | 1857 | #endif |
1857 | abort(); /* ok */ | 1858 | } |
1858 | } | ||
1859 | BIO_free(s->bbio); | 1859 | BIO_free(s->bbio); |
1860 | s->bbio=NULL; | 1860 | s->bbio=NULL; |
1861 | } | 1861 | } |