Merge TLS API

This commit is contained in:
Zhi Guan
2026-06-11 14:46:35 +08:00
parent b48f2c3772
commit e1c69d5633
3 changed files with 122 additions and 9 deletions

View File

@@ -443,7 +443,7 @@ bad:
// TLS_CONNECT
if (tls13_init(&conn, &ctx) != 1) {
if (tls_init(&conn, &ctx) != 1) {
error_print();
goto end;
}
@@ -669,7 +669,7 @@ bad:
if (FD_ISSET(conn.sock, &fds_recv)) {
memset(buf, 0, sizeof(buf));
if ((ret = tls13_recv(&conn, (uint8_t *)buf, sizeof(buf), &len)) != 1) {
if ((ret = tls_recv(&conn, (uint8_t *)buf, sizeof(buf), &len)) != 1) {
if (ret == TLS_ERROR_SEND_AGAIN || ret == TLS_ERROR_RECV_AGAIN) {
continue;
} else {
@@ -705,7 +705,7 @@ bad:
if (sent_len > 0 && FD_ISSET(conn.sock, &fds_send)) {
// tls13_send 会返回一个 -1 , 但是没有打印错误信息!!!!
if ((ret = tls13_send(&conn, (uint8_t *)send_buf + sent_offset, sent_len, &sentlen)) != 1) {
if ((ret = tls_send(&conn, (uint8_t *)send_buf + sent_offset, sent_len, &sentlen)) != 1) {
if (ret == TLS_ERROR_SEND_AGAIN || ret == TLS_ERROR_RECV_AGAIN) {
continue;
} else {

View File

@@ -448,7 +448,7 @@ bad:
goto end;
}
if (tls13_init(&conn, &ctx) != 1) {
if (tls_init(&conn, &ctx) != 1) {
error_print();
goto end;
}
@@ -553,7 +553,7 @@ bad:
format_bytes(stderr, 0, 0, "tls13_send", (const uint8_t *)buf + send_offset, send_len);
if ((ret = tls13_send(&conn, (uint8_t *)buf + send_offset, send_len, &sentlen)) != 1) {
if ((ret = tls_send(&conn, (uint8_t *)buf + send_offset, send_len, &sentlen)) != 1) {
if (ret == TLS_ERROR_SEND_AGAIN || ret == TLS_ERROR_RECV_AGAIN) {
continue;
}
@@ -575,7 +575,7 @@ bad:
memset(buf, 0, sizeof(buf));
if ((ret = tls13_recv(&conn, (uint8_t *)buf, sizeof(buf), &len)) != 1) {
if ((ret = tls_recv(&conn, (uint8_t *)buf, sizeof(buf), &len)) != 1) {
if (ret == TLS_ERROR_SEND_AGAIN || ret == TLS_ERROR_RECV_AGAIN) {
continue;
}