From 77da2c5c764f1747f9fbf64386ee59c133edfea8 Mon Sep 17 00:00:00 2001 From: Glenn Strauss Date: Tue, 23 Jul 2024 22:08:39 -0400 Subject: [PATCH 1/2] chore: ssl: sync ssl submodule for Mbed TLS 3.0.0 compat github: #26 github: closes #27 Signed-off-by: Glenn Strauss --- src/ssl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ssl b/src/ssl index bc00034..65eb460 160000 --- a/src/ssl +++ b/src/ssl @@ -1 +1 @@ -Subproject commit bc00034a473e791468c3fd9c1af3799631ec18e4 +Subproject commit 65eb4601d0cd54432e7b158678284239c045265e From b16c2866eb78c696aff198c5cb57f742bb6ddce4 Mon Sep 17 00:00:00 2001 From: scratch Date: Fri, 25 Oct 2024 10:47:38 -0400 Subject: [PATCH 2/2] chore: fix interface changes to ssl from Jan 2023 https://github.com/zhaojh329/ssl/commit/7be969cd6fa1ec94464a3918f8a92d3c5e82a95e https://github.com/zhaojh329/ssl/commit/856def8bbae6c53f9e7f6c05a5661bc626d818a0 Signed-off-by: Glenn Strauss --- src/connection.c | 12 ++++++------ src/uhttpd.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/connection.c b/src/connection.c index 503d379..128c629 100644 --- a/src/connection.c +++ b/src/connection.c @@ -832,11 +832,11 @@ static int ssl_negotiated(struct uh_connection_internal *conn) int ret; ret = ssl_accept(conn->ssl, on_ssl_verify_error, NULL); - if (ret == SSL_PENDING) + if (ret == SSL_WANT_READ || ret == SSL_WANT_WRITE) return 0; if (ret == SSL_ERROR) { - log_err("ssl connect error: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf))); + log_err("ssl connect error: %s\n", ssl_last_error_string(conn->ssl, err_buf, sizeof(err_buf))); return -1; } @@ -853,11 +853,11 @@ static int conn_ssl_read(int fd, void *buf, size_t count, void *arg) ret = ssl_read(conn->ssl, buf, count); if (ret == SSL_ERROR) { - log_err("ssl_read: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf))); + log_err("ssl_read: %s\n", ssl_last_error_string(conn->ssl, err_buf, sizeof(err_buf))); return P_FD_ERR; } - if (ret == SSL_PENDING) + if (ret == SSL_WANT_READ || ret == SSL_WANT_WRITE) return P_FD_PENDING; return ret; @@ -884,11 +884,11 @@ static void conn_write_cb(struct ev_loop *loop, struct ev_io *w, int revents) ret = ssl_write(conn->ssl, buffer_data(b), buffer_length(b)); if (ret == SSL_ERROR) { - log_err("ssl_write: %s\n", ssl_last_error_string(err_buf, sizeof(err_buf))); + log_err("ssl_write: %s\n", ssl_last_error_string(conn->ssl, err_buf, sizeof(err_buf))); goto err; } - if (ret == SSL_PENDING) + if (ret == SSL_WANT_READ || ret == SSL_WANT_WRITE) return; buffer_pull(b, NULL, ret); diff --git a/src/uhttpd.c b/src/uhttpd.c index 7460da1..3d3d1bf 100644 --- a/src/uhttpd.c +++ b/src/uhttpd.c @@ -170,7 +170,7 @@ static int uh_server_ssl_init(struct uh_server *srv, const char *cert, const cha return -1; } - if (ssl_load_crt_file(srvi->ssl_ctx, cert)) { + if (ssl_load_cert_file(srvi->ssl_ctx, cert)) { log_err("load certificate file fail\n"); return -1; }