summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bio_lib.c
diff options
context:
space:
mode:
authorbeck <>2002-05-15 02:29:21 +0000
committerbeck <>2002-05-15 02:29:21 +0000
commitb64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch)
treefa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/bio/bio_lib.c
parente471e1ea98d673597b182ea85f29e30c97cd08b5 (diff)
downloadopenbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2
openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/bio/bio_lib.c')
-rw-r--r--src/lib/libcrypto/bio/bio_lib.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c
index 381afc9b8e..50df2238fa 100644
--- a/src/lib/libcrypto/bio/bio_lib.c
+++ b/src/lib/libcrypto/bio/bio_lib.c
@@ -63,9 +63,6 @@
63#include <openssl/bio.h> 63#include <openssl/bio.h>
64#include <openssl/stack.h> 64#include <openssl/stack.h>
65 65
66static STACK_OF(CRYPTO_EX_DATA_FUNCS) *bio_meth=NULL;
67static int bio_meth_num=0;
68
69BIO *BIO_new(BIO_METHOD *method) 66BIO *BIO_new(BIO_METHOD *method)
70 { 67 {
71 BIO *ret=NULL; 68 BIO *ret=NULL;
@@ -100,10 +97,14 @@ int BIO_set(BIO *bio, BIO_METHOD *method)
100 bio->references=1; 97 bio->references=1;
101 bio->num_read=0L; 98 bio->num_read=0L;
102 bio->num_write=0L; 99 bio->num_write=0L;
103 CRYPTO_new_ex_data(bio_meth,bio,&bio->ex_data); 100 CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data);
104 if (method->create != NULL) 101 if (method->create != NULL)
105 if (!method->create(bio)) 102 if (!method->create(bio))
103 {
104 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio,
105 &bio->ex_data);
106 return(0); 106 return(0);
107 }
107 return(1); 108 return(1);
108 } 109 }
109 110
@@ -129,7 +130,7 @@ int BIO_free(BIO *a)
129 ((i=(int)a->callback(a,BIO_CB_FREE,NULL,0,0L,1L)) <= 0)) 130 ((i=(int)a->callback(a,BIO_CB_FREE,NULL,0,0L,1L)) <= 0))
130 return(i); 131 return(i);
131 132
132 CRYPTO_free_ex_data(bio_meth,a,&a->ex_data); 133 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, a, &a->ex_data);
133 134
134 if ((a->method == NULL) || (a->method->destroy == NULL)) return(1); 135 if ((a->method == NULL) || (a->method->destroy == NULL)) return(1);
135 ret=a->method->destroy(a); 136 ret=a->method->destroy(a);
@@ -482,7 +483,8 @@ BIO *BIO_dup_chain(BIO *in)
482 } 483 }
483 484
484 /* copy app data */ 485 /* copy app data */
485 if (!CRYPTO_dup_ex_data(bio_meth,&new->ex_data,&bio->ex_data)) 486 if (!CRYPTO_dup_ex_data(CRYPTO_EX_INDEX_BIO, &new->ex_data,
487 &bio->ex_data))
486 goto err; 488 goto err;
487 489
488 if (ret == NULL) 490 if (ret == NULL)
@@ -512,9 +514,8 @@ void BIO_copy_next_retry(BIO *b)
512int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, 514int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
513 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func) 515 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func)
514 { 516 {
515 bio_meth_num++; 517 return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, argl, argp,
516 return(CRYPTO_get_ex_new_index(bio_meth_num-1,&bio_meth, 518 new_func, dup_func, free_func);
517 argl,argp,new_func,dup_func,free_func));
518 } 519 }
519 520
520int BIO_set_ex_data(BIO *bio, int idx, void *data) 521int BIO_set_ex_data(BIO *bio, int idx, void *data)