Loading crypto/bio/b_addr.c +3 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <ctype.h> CRYPTO_RWLOCK *bio_lookup_lock; extern CRYPTO_RWLOCK *bio_type_lock; static CRYPTO_ONCE bio_lookup_init = CRYPTO_ONCE_STATIC_INIT; /* Loading Loading @@ -605,7 +606,8 @@ static int addrinfo_wrap(int family, int socktype, DEFINE_RUN_ONCE_STATIC(do_bio_lookup_init) { bio_lookup_lock = CRYPTO_THREAD_lock_new(); return (bio_lookup_lock != NULL); bio_type_lock = CRYPTO_THREAD_lock_new(); return bio_lookup_lock != NULL && bio_type_lock != NULL; } /*- Loading crypto/bio/bio_lcl.h +1 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ typedef unsigned int socklen_t; # endif extern CRYPTO_RWLOCK *bio_lookup_lock; extern CRYPTO_RWLOCK *bio_type_lock; int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa); const struct sockaddr *BIO_ADDR_sockaddr(const BIO_ADDR *ap); Loading crypto/bio/bio_lib.c +2 −0 Original line number Diff line number Diff line Loading @@ -594,5 +594,7 @@ void bio_cleanup(void) bio_sock_cleanup_int(); CRYPTO_THREAD_lock_free(bio_lookup_lock); bio_lookup_lock = NULL; CRYPTO_THREAD_lock_free(bio_type_lock); bio_type_lock = NULL; #endif } crypto/bio/bio_meth.c +12 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,18 @@ #include "bio_lcl.h" CRYPTO_RWLOCK *bio_type_lock; static int bio_count = BIO_TYPE_START; int BIO_get_new_index() { int newval; if (!CRYPTO_atomic_add(&bio_count, 1, &newval, bio_type_lock)) return -1; return newval; } BIO_METHOD *BIO_meth_new(int type, const char *name) { BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD)); Loading doc/crypto/BIO_meth_new.pod +6 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ =head1 NAME BIO_get_new_index, BIO_meth_new, BIO_meth_free, BIO_meth_get_write, BIO_meth_set_write, BIO_meth_get_read, BIO_meth_set_read, BIO_meth_get_puts, BIO_meth_set_puts, BIO_meth_get_gets, BIO_meth_set_gets, BIO_meth_get_ctrl, BIO_meth_set_ctrl, Loading @@ -13,6 +14,7 @@ BIO_meth_set_callback_ctrl - Routines to build up BIO methods #include <openssl/bio.h> int BIO_get_new_index(void); BIO_METHOD *BIO_meth_new(int type, const char *name); void BIO_meth_free(BIO_METHOD *biom); int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int); Loading Loading @@ -47,7 +49,10 @@ types. It provides a set of of functions used by OpenSSL for the implementation of the various BIO capabilities. See the L<bio> page for more information. BIO_meth_new() creates a new B<BIO_METHOD> structure. It should be given a unique integer B<type> and a string that represents its B<name>. The set of unique integer B<type> and a string that represents its B<name>. Use BIO_get_new_index() to get the value for B<type>. The set of standard OpenSSL provided BIO types is provided in B<bio.h>. Some examples include B<BIO_TYPE_BUFFER> and B<BIO_TYPE_CIPHER>. Filter BIOs should have a type which have the "filter" bit set (B<BIO_TYPE_FILTER>). Source/sink BIOs Loading Loading
crypto/bio/b_addr.c +3 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <ctype.h> CRYPTO_RWLOCK *bio_lookup_lock; extern CRYPTO_RWLOCK *bio_type_lock; static CRYPTO_ONCE bio_lookup_init = CRYPTO_ONCE_STATIC_INIT; /* Loading Loading @@ -605,7 +606,8 @@ static int addrinfo_wrap(int family, int socktype, DEFINE_RUN_ONCE_STATIC(do_bio_lookup_init) { bio_lookup_lock = CRYPTO_THREAD_lock_new(); return (bio_lookup_lock != NULL); bio_type_lock = CRYPTO_THREAD_lock_new(); return bio_lookup_lock != NULL && bio_type_lock != NULL; } /*- Loading
crypto/bio/bio_lcl.h +1 −0 Original line number Diff line number Diff line Loading @@ -137,6 +137,7 @@ typedef unsigned int socklen_t; # endif extern CRYPTO_RWLOCK *bio_lookup_lock; extern CRYPTO_RWLOCK *bio_type_lock; int BIO_ADDR_make(BIO_ADDR *ap, const struct sockaddr *sa); const struct sockaddr *BIO_ADDR_sockaddr(const BIO_ADDR *ap); Loading
crypto/bio/bio_lib.c +2 −0 Original line number Diff line number Diff line Loading @@ -594,5 +594,7 @@ void bio_cleanup(void) bio_sock_cleanup_int(); CRYPTO_THREAD_lock_free(bio_lookup_lock); bio_lookup_lock = NULL; CRYPTO_THREAD_lock_free(bio_type_lock); bio_type_lock = NULL; #endif }
crypto/bio/bio_meth.c +12 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,18 @@ #include "bio_lcl.h" CRYPTO_RWLOCK *bio_type_lock; static int bio_count = BIO_TYPE_START; int BIO_get_new_index() { int newval; if (!CRYPTO_atomic_add(&bio_count, 1, &newval, bio_type_lock)) return -1; return newval; } BIO_METHOD *BIO_meth_new(int type, const char *name) { BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD)); Loading
doc/crypto/BIO_meth_new.pod +6 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ =head1 NAME BIO_get_new_index, BIO_meth_new, BIO_meth_free, BIO_meth_get_write, BIO_meth_set_write, BIO_meth_get_read, BIO_meth_set_read, BIO_meth_get_puts, BIO_meth_set_puts, BIO_meth_get_gets, BIO_meth_set_gets, BIO_meth_get_ctrl, BIO_meth_set_ctrl, Loading @@ -13,6 +14,7 @@ BIO_meth_set_callback_ctrl - Routines to build up BIO methods #include <openssl/bio.h> int BIO_get_new_index(void); BIO_METHOD *BIO_meth_new(int type, const char *name); void BIO_meth_free(BIO_METHOD *biom); int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int); Loading Loading @@ -47,7 +49,10 @@ types. It provides a set of of functions used by OpenSSL for the implementation of the various BIO capabilities. See the L<bio> page for more information. BIO_meth_new() creates a new B<BIO_METHOD> structure. It should be given a unique integer B<type> and a string that represents its B<name>. The set of unique integer B<type> and a string that represents its B<name>. Use BIO_get_new_index() to get the value for B<type>. The set of standard OpenSSL provided BIO types is provided in B<bio.h>. Some examples include B<BIO_TYPE_BUFFER> and B<BIO_TYPE_CIPHER>. Filter BIOs should have a type which have the "filter" bit set (B<BIO_TYPE_FILTER>). Source/sink BIOs Loading