diff options
author | Dmitry Ilyin <dima@doty.ru> | 2022-10-04 17:49:22 +0300 |
---|---|---|
committer | Dmitry Ilyin <dima@doty.ru> | 2022-10-04 17:49:22 +0300 |
commit | 88317a4ef8aacec4f477cfc07d084024da80be0b (patch) | |
tree | 4f575f8b045ec32d426da549ec39f93a52187c5d /test | |
parent | b5b4c7fed589aef04f6b5add5f0f0d9c2f1fd2f5 (diff) | |
download | libevent-88317a4ef8aacec4f477cfc07d084024da80be0b.tar.gz |
Add helpers and all regress tests are passed
Diffstat (limited to 'test')
-rw-r--r-- | test/regress.h | 1 | ||||
-rw-r--r-- | test/regress_http.c | 4 | ||||
-rw-r--r-- | test/regress_mbedtls.c | 18 |
3 files changed, 3 insertions, 20 deletions
diff --git a/test/regress.h b/test/regress.h index 829af4a7..d9d2707e 100644 --- a/test/regress.h +++ b/test/regress.h @@ -146,7 +146,6 @@ void init_ssl(void); #ifdef EVENT__HAVE_MBEDTLS #include <mbedtls/ssl.h> mbedtls_ssl_config *get_mbedtls_config(int endpoint); -mbedtls_ssl_context *mbedtls_ssl_new(mbedtls_ssl_config *config); #endif void * basic_test_setup(const struct testcase_t *testcase); diff --git a/test/regress_http.c b/test/regress_http.c index 0e971c0a..511ab53f 100644 --- a/test/regress_http.c +++ b/test/regress_http.c @@ -168,7 +168,7 @@ https_bev(struct event_base *base, void *arg) static struct bufferevent * https_mbedtls_bev(struct event_base *base, void *arg) { - mbedtls_ssl_context *ssl = mbedtls_ssl_new(get_mbedtls_config(MBEDTLS_SSL_IS_SERVER)); + mbedtls_dyncontext *ssl = bufferevent_mbedtls_dyncontext_new(get_mbedtls_config(MBEDTLS_SSL_IS_SERVER)); return bufferevent_mbedtls_socket_new( base, -1, ssl, BUFFEREVENT_SSL_ACCEPTING, BEV_OPT_CLOSE_ON_FREE); @@ -558,7 +558,7 @@ create_bev(struct event_base *base, evutil_socket_t fd, int ssl_mask, int flags_ #endif } else if (ssl_mask & HTTP_MBEDTLS) { #ifdef EVENT__HAVE_MBEDTLS - mbedtls_ssl_context *ssl = mbedtls_ssl_new(get_mbedtls_config(MBEDTLS_SSL_IS_CLIENT)); + mbedtls_dyncontext *ssl = bufferevent_mbedtls_dyncontext_new(get_mbedtls_config(MBEDTLS_SSL_IS_CLIENT)); if (ssl_mask & HTTP_SSL_FILTER) { struct bufferevent *underlying = bufferevent_socket_new(base, fd, flags); diff --git a/test/regress_mbedtls.c b/test/regress_mbedtls.c index 748f156a..3de43554 100644 --- a/test/regress_mbedtls.c +++ b/test/regress_mbedtls.c @@ -51,7 +51,7 @@ #undef SSL_get_peer_certificate #define SSL_get_peer_certificate mbedtls_ssl_get_peer_cert #define SSL_get1_peer_certificate mbedtls_ssl_get_peer_cert -#define SSL_new mbedtls_ssl_new +#define SSL_new bufferevent_mbedtls_dyncontext_new #define SSL_use_certificate(a, b) \ do { \ } while (0); @@ -80,8 +80,6 @@ const struct testcase_setup_t mbedtls_setup = { #define ssl_setup mbedtls_setup #include "regress_ssl.c" static mbedtls_ssl_config *the_mbedtls_conf[2] = {NULL, NULL}; -static mbedtls_ssl_context *the_mbedtls_ctx[1024] = {NULL}; -static int the_mbedtls_ctx_count = 0; static mbedtls_entropy_context entropy; static mbedtls_ctr_drbg_context ctr_drbg; static mbedtls_x509_crt *the_cert; @@ -282,7 +280,6 @@ mbedtls_test_setup(const struct testcase_t *testcase) static int mbedtls_test_cleanup(const struct testcase_t *testcase, void *ptr) { - int i; int ret = basic_test_cleanup(testcase, ptr); if (!ret) { return ret; @@ -303,9 +300,6 @@ mbedtls_test_cleanup(const struct testcase_t *testcase, void *ptr) mbedtls_pk_free(the_key); free(the_key); - for (i = 0; i < the_mbedtls_ctx_count; i++) { - mbedtls_ssl_free(the_mbedtls_ctx[i]); - } if (the_mbedtls_conf[0]) { mbedtls_ssl_config_free(the_mbedtls_conf[0]); free(the_mbedtls_conf[0]); @@ -320,16 +314,6 @@ mbedtls_test_cleanup(const struct testcase_t *testcase, void *ptr) return 1; } -mbedtls_ssl_context * -mbedtls_ssl_new(mbedtls_ssl_config *config) -{ - mbedtls_ssl_context *ssl = malloc(sizeof(*ssl)); - mbedtls_ssl_init(ssl); - mbedtls_ssl_setup(ssl, config); - the_mbedtls_ctx[the_mbedtls_ctx_count++] = ssl; - return ssl; -} - static int bio_rwcount_read(void *ctx, unsigned char *out, size_t outlen) { |