diff options
Diffstat (limited to 'Cryptlib/OpenSSL/crypto/cryptlib.c')
| -rw-r--r-- | Cryptlib/OpenSSL/crypto/cryptlib.c | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/Cryptlib/OpenSSL/crypto/cryptlib.c b/Cryptlib/OpenSSL/crypto/cryptlib.c index 0a59342d..da4b34dc 100644 --- a/Cryptlib/OpenSSL/crypto/cryptlib.c +++ b/Cryptlib/OpenSSL/crypto/cryptlib.c @@ -263,7 +263,7 @@ int CRYPTO_get_new_dynlockid(void) return (0); } pointer->references = 1; - pointer->data = dynlock_create_callback(__FILE__, __LINE__); + pointer->data = dynlock_create_callback(OPENSSL_FILE, OPENSSL_LINE); if (pointer->data == NULL) { OPENSSL_free(pointer); CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); @@ -289,7 +289,7 @@ int CRYPTO_get_new_dynlockid(void) CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); if (i == -1) { - dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); + dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE); OPENSSL_free(pointer); } else i += 1; /* to avoid 0 */ @@ -328,7 +328,7 @@ void CRYPTO_destroy_dynlockid(int i) CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); if (pointer) { - dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); + dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE); OPENSSL_free(pointer); } } @@ -670,6 +670,7 @@ unsigned long *OPENSSL_ia32cap_loc(void) } # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) +#include <stdio.h> # define OPENSSL_CPUID_SETUP # if defined(_WIN32) typedef unsigned __int64 IA32CAP; @@ -953,26 +954,40 @@ void OPENSSL_showfatal(const char *fmta, ...) # if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 /* this -------------v--- guards NT-specific calls */ if (check_winnt() && OPENSSL_isservice() > 0) { - HANDLE h = RegisterEventSource(0, _T("OPENSSL")); - const TCHAR *pmsg = buf; - ReportEvent(h, EVENTLOG_ERROR_TYPE, 0, 0, 0, 1, 0, &pmsg, 0); - DeregisterEventSource(h); + HANDLE hEventLog = RegisterEventSource(NULL, _T("OpenSSL")); + + if (hEventLog != NULL) { + const TCHAR *pmsg = buf; + + if (!ReportEvent(hEventLog, EVENTLOG_ERROR_TYPE, 0, 0, NULL, + 1, 0, &pmsg, NULL)) { +#if defined(DEBUG) + /* + * We are in a situation where we tried to report a critical + * error and this failed for some reason. As a last resort, + * in debug builds, send output to the debugger or any other + * tool like DebugView which can monitor the output. + */ + OutputDebugString(pmsg); +#endif + } + + (void)DeregisterEventSource(hEventLog); + } } else # endif - MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONSTOP); + MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONERROR); } #else -# if defined(OPENSSL_SYS_UEFI) -void EFIAPI OPENSSL_showfatal(const char *fmta, ...) -# else void OPENSSL_showfatal(const char *fmta, ...) -# endif { +#ifndef OPENSSL_NO_STDIO va_list ap; va_start(ap, fmta); vfprintf(stderr, fmta, ap); va_end(ap); +#endif } int OPENSSL_isservice(void) @@ -999,16 +1014,18 @@ void OpenSSLDie(const char *file, int line, const char *assertion) #endif } +#ifndef OPENSSL_NO_STDIO void *OPENSSL_stderr(void) { return stderr; } +#endif -int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) +int CRYPTO_memcmp(const volatile void *in_a, const volatile void *in_b, size_t len) { size_t i; - const unsigned char *a = in_a; - const unsigned char *b = in_b; + const volatile unsigned char *a = in_a; + const volatile unsigned char *b = in_b; unsigned char x = 0; for (i = 0; i < len; i++) |
