Skip to content

Commit

Permalink
Merge pull request #27 from gstrauss/update-ssl-submodule
Browse files Browse the repository at this point in the history
update ssl submodule for Mbed TLS 3.0.0 compat
  • Loading branch information
zhaojh329 authored Oct 26, 2024
2 parents 790df4a + b16c286 commit a0c64db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/ssl
Submodule ssl updated 9 files
+2 −4 CMakeLists.txt
+32 −26 example-client.c
+35 −28 example-server.c
+21 −0 example.crt
+91 −0 example.h
+28 −0 example.key
+77 −111 mbedtls.c
+87 −91 openssl.c
+19 −32 ssl.h
2 changes: 1 addition & 1 deletion src/uhttpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a0c64db

Please sign in to comment.