Add SM4-FF1, update socket API

This commit is contained in:
Zhi Guan
2026-06-22 22:52:39 +08:00
parent 3a3f632b46
commit 6c2b35b96d
15 changed files with 1058 additions and 44 deletions

View File

@@ -220,7 +220,6 @@ int tls12_client_main(int argc, char *argv[])
int verbose = 0;
TLS_CTX ctx;
TLS_CONNECT conn;
struct hostent *hp;
struct sockaddr_in server;
tls_socket_t sock = tls_socket_invalid();
char buf[1024] = {0};
@@ -469,15 +468,11 @@ bad:
goto end;
}
if (!(hp = gethostbyname(host))) {
if (tls_socket_get_addr(host, port, &server) != 1) {
fprintf(stderr, "%s: failed to parse host name '%s'\n", prog, host);
goto end;
}
server.sin_addr = *((struct in_addr *)hp->h_addr_list[0]);
server.sin_family = AF_INET;
server.sin_port = htons(port);
if (tls_socket_connect(sock, &server) != 1) {
fprintf(stderr, "%s: socket connect error\n", prog);
goto end;