diff options
author | deshevoy <deshevoy@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
commit | e988f30484abe5fdeedcc7a5d3c226c01a21800c (patch) | |
tree | 0a217b173aabb57b7e51f8a169989b1a3e0309fe /contrib/libs/libevent | |
parent | 33ee501c05d3f24036ae89766a858930ae66c548 (diff) | |
download | ydb-e988f30484abe5fdeedcc7a5d3c226c01a21800c.tar.gz |
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libevent')
-rw-r--r-- | contrib/libs/libevent/bufferevent_openssl.c | 58 | ||||
-rw-r--r-- | contrib/libs/libevent/openssl-compat.h | 24 |
2 files changed, 41 insertions, 41 deletions
diff --git a/contrib/libs/libevent/bufferevent_openssl.c b/contrib/libs/libevent/bufferevent_openssl.c index b51b834bca..935d3107de 100644 --- a/contrib/libs/libevent/bufferevent_openssl.c +++ b/contrib/libs/libevent/bufferevent_openssl.c @@ -65,7 +65,7 @@ #include <openssl/ssl.h> #include <openssl/err.h> -#include "openssl-compat.h" +#include "openssl-compat.h" /* * Define an OpenSSL bio that targets a bufferevent. @@ -109,8 +109,8 @@ print_err(int val) static int bio_bufferevent_new(BIO *b) { - BIO_set_init(b, 0); - BIO_set_data(b, NULL); /* We'll be putting the bufferevent in this field.*/ + BIO_set_init(b, 0); + BIO_set_data(b, NULL); /* We'll be putting the bufferevent in this field.*/ return 1; } @@ -120,10 +120,10 @@ bio_bufferevent_free(BIO *b) { if (!b) return 0; - if (BIO_get_shutdown(b)) { - if (BIO_get_init(b) && BIO_get_data(b)) - bufferevent_free(BIO_get_data(b)); - BIO_free(b); + if (BIO_get_shutdown(b)) { + if (BIO_get_init(b) && BIO_get_data(b)) + bufferevent_free(BIO_get_data(b)); + BIO_free(b); } return 1; } @@ -139,10 +139,10 @@ bio_bufferevent_read(BIO *b, char *out, int outlen) if (!out) return 0; - if (!BIO_get_data(b)) + if (!BIO_get_data(b)) return -1; - input = bufferevent_get_input(BIO_get_data(b)); + input = bufferevent_get_input(BIO_get_data(b)); if (evbuffer_get_length(input) == 0) { /* If there's no data to read, say so. */ BIO_set_retry_read(b); @@ -158,13 +158,13 @@ bio_bufferevent_read(BIO *b, char *out, int outlen) static int bio_bufferevent_write(BIO *b, const char *in, int inlen) { - struct bufferevent *bufev = BIO_get_data(b); + struct bufferevent *bufev = BIO_get_data(b); struct evbuffer *output; size_t outlen; BIO_clear_retry_flags(b); - if (!BIO_get_data(b)) + if (!BIO_get_data(b)) return -1; output = bufferevent_get_output(bufev); @@ -190,15 +190,15 @@ bio_bufferevent_write(BIO *b, const char *in, int inlen) static long bio_bufferevent_ctrl(BIO *b, int cmd, long num, void *ptr) { - struct bufferevent *bufev = BIO_get_data(b); + struct bufferevent *bufev = BIO_get_data(b); long ret = 1; switch (cmd) { case BIO_CTRL_GET_CLOSE: - ret = BIO_get_shutdown(b); + ret = BIO_get_shutdown(b); break; case BIO_CTRL_SET_CLOSE: - BIO_set_shutdown(b, (int)num); + BIO_set_shutdown(b, (int)num); break; case BIO_CTRL_PENDING: ret = evbuffer_get_length(bufferevent_get_input(bufev)) != 0; @@ -227,24 +227,24 @@ bio_bufferevent_puts(BIO *b, const char *s) } /* Method table for the bufferevent BIO */ -static BIO_METHOD *methods_bufferevent; +static BIO_METHOD *methods_bufferevent; /* Return the method table for the bufferevents BIO */ static BIO_METHOD * BIO_s_bufferevent(void) { - if (methods_bufferevent == NULL) { - methods_bufferevent = BIO_meth_new(BIO_TYPE_LIBEVENT, "bufferevent"); - if (methods_bufferevent == NULL) - return NULL; - BIO_meth_set_write(methods_bufferevent, bio_bufferevent_write); - BIO_meth_set_read(methods_bufferevent, bio_bufferevent_read); - BIO_meth_set_puts(methods_bufferevent, bio_bufferevent_puts); - BIO_meth_set_ctrl(methods_bufferevent, bio_bufferevent_ctrl); - BIO_meth_set_create(methods_bufferevent, bio_bufferevent_new); - BIO_meth_set_destroy(methods_bufferevent, bio_bufferevent_free); - } - return methods_bufferevent; + if (methods_bufferevent == NULL) { + methods_bufferevent = BIO_meth_new(BIO_TYPE_LIBEVENT, "bufferevent"); + if (methods_bufferevent == NULL) + return NULL; + BIO_meth_set_write(methods_bufferevent, bio_bufferevent_write); + BIO_meth_set_read(methods_bufferevent, bio_bufferevent_read); + BIO_meth_set_puts(methods_bufferevent, bio_bufferevent_puts); + BIO_meth_set_ctrl(methods_bufferevent, bio_bufferevent_ctrl); + BIO_meth_set_create(methods_bufferevent, bio_bufferevent_new); + BIO_meth_set_destroy(methods_bufferevent, bio_bufferevent_free); + } + return methods_bufferevent; } /* Create a new BIO to wrap communication around a bufferevent. If close_flag @@ -257,8 +257,8 @@ BIO_new_bufferevent(struct bufferevent *bufferevent) return NULL; if (!(result = BIO_new(BIO_s_bufferevent()))) return NULL; - BIO_set_init(result, 1); - BIO_set_data(result, bufferevent); + BIO_set_init(result, 1); + BIO_set_data(result, bufferevent); /* We don't tell the BIO to close the bufferevent; we do it ourselves on * be_openssl_destruct() */ BIO_set_shutdown(result, 0); diff --git a/contrib/libs/libevent/openssl-compat.h b/contrib/libs/libevent/openssl-compat.h index a23e34251b..77383405fc 100644 --- a/contrib/libs/libevent/openssl-compat.h +++ b/contrib/libs/libevent/openssl-compat.h @@ -1,39 +1,39 @@ -#ifndef OPENSSL_COMPAT_H -#define OPENSSL_COMPAT_H - +#ifndef OPENSSL_COMPAT_H +#define OPENSSL_COMPAT_H + #include <openssl/bio.h> #include "util-internal.h" - + #if (OPENSSL_VERSION_NUMBER < 0x10100000L) || \ (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) static inline BIO_METHOD *BIO_meth_new(int type, const char *name) -{ +{ BIO_METHOD *biom = calloc(1, sizeof(BIO_METHOD)); - + if (biom != NULL) { biom->type = type; biom->name = name; } return biom; -} - +} + #define BIO_meth_set_write(b, f) (b)->bwrite = (f) #define BIO_meth_set_read(b, f) (b)->bread = (f) #define BIO_meth_set_puts(b, f) (b)->bputs = (f) #define BIO_meth_set_ctrl(b, f) (b)->ctrl = (f) #define BIO_meth_set_create(b, f) (b)->create = (f) #define BIO_meth_set_destroy(b, f) (b)->destroy = (f) - + #define BIO_set_init(b, val) (b)->init = (val) #define BIO_set_data(b, val) (b)->ptr = (val) #define BIO_set_shutdown(b, val) (b)->shutdown = (val) #define BIO_get_init(b) (b)->init #define BIO_get_data(b) (b)->ptr #define BIO_get_shutdown(b) (b)->shutdown - + #define TLS_method SSLv23_method - + #define X509_getm_notBefore X509_get_notBefore #define X509_getm_notAfter X509_get_notAfter @@ -44,4 +44,4 @@ static inline BIO_METHOD *BIO_meth_new(int type, const char *name) #define BIO_get_init(b) (b)->init #endif -#endif /* OPENSSL_COMPAT_H */ +#endif /* OPENSSL_COMPAT_H */ |