Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fixes for various platforms, especially Windows #922

Merged
merged 5 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,6 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" S
set(HOST_X86_64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64|AMD64)")
set(HOST_X86_64 true)
if (MSVC)
set(ENABLE_ASM false)
endif()
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|[xX]86)")
set(ENABLE_ASM false)
set(HOST_I386 true)
Expand Down Expand Up @@ -404,7 +401,6 @@ if(SIZEOF_TIME_T STREQUAL "4")
message(WARNING " ** Warning, this system is unable to represent times past 2038\n"
" ** It will behave incorrectly when handling valid RFC5280 dates")
endif()
add_definitions(-DSIZEOF_TIME_T=${SIZEOF_TIME_T})

set(OPENSSL_LIBS ssl crypto ${PLATFORM_LIBS})
set(LIBTLS_LIBS tls ${PLATFORM_LIBS})
Expand Down
3 changes: 2 additions & 1 deletion crypto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ if(HOST_ASM_MACOSX_X86_64)
bn/arch/amd64/word_clz.S
bn/arch/amd64/bn_arch.c
)
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM)
Expand Down Expand Up @@ -153,6 +152,7 @@ if(HOST_ASM_MASM_X86_64)
whrlpool/wp-masm-x86_64.S
cpuid-masm-x86_64.S
)
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM)
Expand Down Expand Up @@ -193,6 +193,7 @@ if(HOST_ASM_MINGW64_X86_64)
whrlpool/wp-mingw64-x86_64.S
cpuid-mingw64-x86_64.S
)
add_definitions(-Dendbr64=)
add_definitions(-DAES_ASM)
add_definitions(-DBSAES_ASM)
add_definitions(-DVPAES_ASM)
Expand Down
1 change: 0 additions & 1 deletion crypto/Makefile.am.macosx-x86_64
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ASM_X86_64_MACOSX += bn/arch/amd64/bn_arch.c
EXTRA_DIST += $(ASM_X86_64_MACOSX)

if HOST_ASM_MACOSX_X86_64
libcrypto_la_CPPFLAGS += -Dendbr64=
libcrypto_la_CPPFLAGS += -DAES_ASM
libcrypto_la_CPPFLAGS += -DBSAES_ASM
libcrypto_la_CPPFLAGS += -DVPAES_ASM
Expand Down
42 changes: 0 additions & 42 deletions crypto/compat/ui_openssl_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,6 @@ static int is_a_tty;

/* Declare static functions */
static int read_till_nl(FILE *);
static void recsig(int);
static void pushsig(void);
static void popsig(void);
static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl);

static int read_string(UI *ui, UI_STRING *uis);
Expand Down Expand Up @@ -236,8 +233,6 @@ read_till_nl(FILE *in)
return 1;
}

static volatile sig_atomic_t intr_signal;

static int
read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
{
Expand All @@ -247,12 +242,9 @@ read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
int maxsize = BUFSIZ - 1;
char *p;

intr_signal = 0;
ok = 0;
ps = 0;

pushsig();

ps = 1;

if (!echo && !noecho_console(ui))
Expand All @@ -276,16 +268,11 @@ read_string_inner(UI *ui, UI_STRING *uis, int echo, int strip_nl)
ok = 1;

error:
if (intr_signal == SIGINT)
ok = -1;
if (!echo)
fprintf(tty_out, "\n");
if (ps >= 2 && !echo && !echo_console(ui))
ok = 0;

if (ps >= 1)
popsig();

explicit_bzero(result, BUFSIZ);
return ok;
}
Expand Down Expand Up @@ -348,32 +335,3 @@ close_console(UI *ui)

return 1;
}

/* Internal functions to handle signals and act on them */
static void
pushsig(void)
{
savsig[SIGABRT] = signal(SIGABRT, recsig);
savsig[SIGFPE] = signal(SIGFPE, recsig);
savsig[SIGILL] = signal(SIGILL, recsig);
savsig[SIGINT] = signal(SIGINT, recsig);
savsig[SIGSEGV] = signal(SIGSEGV, recsig);
savsig[SIGTERM] = signal(SIGTERM, recsig);
}

static void
popsig(void)
{
signal(SIGABRT, savsig[SIGABRT]);
signal(SIGFPE, savsig[SIGFPE]);
signal(SIGILL, savsig[SIGILL]);
signal(SIGINT, savsig[SIGINT]);
signal(SIGSEGV, savsig[SIGSEGV]);
signal(SIGTERM, savsig[SIGTERM]);
}

static void
recsig(int i)
{
intr_signal = i;
}
8 changes: 8 additions & 0 deletions include/compat/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
* sys/time.h compatibility shim
*/

#ifndef SIZEOF_TIME_T
#ifdef SMALL_TIME_T
#define SIZEOF_TIME_T 4
#else
#define SIZEOF_TIME_T 8
#endif
#endif

#ifdef _MSC_VER
#if _MSC_VER >= 1900
#include <../ucrt/time.h>
Expand Down
Loading