Skip to content

Commit 8fff4a2

Browse files
vt-altbeldmit
authored andcommitted
Compatibility with Solaris 10 (gcc 3.4.3)
Note, you will need to pass `-lsocket -lnsl` to the gcc for socketpair(3SOCKET) to link `test_tls'.
1 parent 47be42d commit 8fff4a2

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ include_directories(${OPENSSL_INCLUDE_DIR})
1414
if (CMAKE_C_COMPILER_ID MATCHES "Clang")
1515
add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Qunused-arguments -Wno-deprecated-declarations)
1616
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
17-
add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas -Wno-deprecated-declarations)
17+
add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas -Wno-error=pragmas -Wno-deprecated-declarations)
1818
elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
1919
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
2020
add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)

gost_grasshopper_math.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static GRASSHOPPER_INLINE void grasshopper_zero128(grasshopper_w128_t* x) {
6666

6767
static GRASSHOPPER_INLINE void grasshopper_copy128(grasshopper_w128_t* to, const grasshopper_w128_t* from) {
6868
#if(GRASSHOPPER_BITS == 8 || GRASSHOPPER_BITS == 16)
69-
__builtin_memcpy(&to, &from, sizeof(w128_t));
69+
__builtin_memcpy(&to, &from, sizeof(grasshopper_w128_t));
7070
#else
7171
int i;
7272
for (i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {

test_tls.c

+15-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <sys/socket.h>
3030
#include <netinet/in.h>
3131
#include <arpa/inet.h>
32-
#include <err.h>
3332

3433
/* For X509_NAME_add_entry_by_txt */
3534
#pragma GCC diagnostic ignored "-Wpointer-sign"
@@ -69,6 +68,17 @@ static const char *cipher_list;
6968
/* How much K to transfer between client and server. */
7069
#define KTRANSFER (1 * 1024)
7170

71+
static void err(int eval, const char *fmt, ...)
72+
{
73+
va_list ap;
74+
75+
va_start(ap, fmt);
76+
vprintf(fmt, ap);
77+
va_end(ap);
78+
printf(": %s\n", strerror(errno));
79+
exit(eval);
80+
}
81+
7282
/*
7383
* Simple TLS Server code is based on
7484
* https://wiki.openssl.org/index.php/Simple_TLS_Server
@@ -274,7 +284,7 @@ int test(const char *algname, const char *paramset)
274284
ck = certgen(algname, paramset);
275285

276286
int sockfd[2];
277-
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd) == -1)
287+
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) == -1)
278288
err(1, "socketpair");
279289

280290
setpgid(0, 0);
@@ -307,22 +317,22 @@ int test(const char *algname, const char *paramset)
307317
ret = (WIFEXITED(status) && WEXITSTATUS(status)) ||
308318
(WIFSIGNALED(status) && WTERMSIG(status));
309319
if (ret) {
310-
warnx(cRED "%s child %s with %d %s" cNORM,
320+
fprintf(stderr, cRED "%s child %s with %d %s" cNORM,
311321
exited_pid == server_pid? "server" : "client",
312322
WIFSIGNALED(status)? "killed" : "exited",
313323
WIFSIGNALED(status)? WTERMSIG(status) : WEXITSTATUS(status),
314324
WIFSIGNALED(status)? strsignal(WTERMSIG(status)) : "");
315325

316326
/* If first child exited with error, kill other. */
317-
warnx("terminating %s by force",
327+
fprintf(stderr, "terminating %s by force",
318328
exited_pid == server_pid? "client" : "server");
319329
kill(exited_pid == server_pid? client_pid : server_pid, SIGTERM);
320330
}
321331

322332
exited_pid = wait(&status);
323333
/* Report error unless we killed it. */
324334
if (!ret && (!WIFEXITED(status) || WEXITSTATUS(status)))
325-
warnx(cRED "%s child %s with %d %s" cNORM,
335+
fprintf(stderr, cRED "%s child %s with %d %s" cNORM,
326336
exited_pid == server_pid? "server" : "client",
327337
WIFSIGNALED(status)? "killed" : "exited",
328338
WIFSIGNALED(status)? WTERMSIG(status) : WEXITSTATUS(status),

0 commit comments

Comments
 (0)