| 
									
										
										
										
											2016-05-18 02:51:26 +08:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2025-09-02 21:05:45 +08:00
										 |  |  |  * Copyright 1998-2025 The OpenSSL Project Authors. All Rights Reserved. | 
					
						
							| 
									
										
										
										
											2017-06-15 22:16:46 +08:00
										 |  |  |  * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved | 
					
						
							| 
									
										
										
										
											2002-10-28 22:02:19 +08:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2018-12-06 21:03:01 +08:00
										 |  |  |  * Licensed under the Apache License 2.0 (the "License").  You may not use | 
					
						
							| 
									
										
										
										
											2016-05-18 02:51:26 +08:00
										 |  |  |  * this file except in compliance with the License.  You can obtain a copy | 
					
						
							|  |  |  |  * in the file LICENSE in the source distribution or at | 
					
						
							|  |  |  |  * https://www.openssl.org/source/license.html
 | 
					
						
							| 
									
										
										
										
											2002-10-28 22:02:19 +08:00
										 |  |  |  */ | 
					
						
							| 
									
										
										
										
											2016-05-18 02:51:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-04 22:13:01 +08:00
										 |  |  | #include "internal/e_os.h"
 | 
					
						
							| 
									
										
										
										
											2019-09-28 06:45:33 +08:00
										 |  |  | #include "crypto/cryptlib.h"
 | 
					
						
							| 
									
										
										
										
											2000-06-18 23:59:04 +08:00
										 |  |  | #include <openssl/safestack.h>
 | 
					
						
							| 
									
										
										
										
											1998-12-21 18:52:47 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-11 23:31:57 +08:00
										 |  |  | #if defined(_WIN32) && !defined(OPENSSL_SYS_UEFI)
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | # include <tchar.h>
 | 
					
						
							| 
									
										
										
										
											2009-05-03 22:16:40 +08:00
										 |  |  | # include <signal.h>
 | 
					
						
							| 
									
										
										
										
											2010-11-19 08:12:01 +08:00
										 |  |  | # ifdef __WATCOMC__
 | 
					
						
							|  |  |  | #  if defined(_UNICODE) || defined(__UNICODE__)
 | 
					
						
							|  |  |  | #   define _vsntprintf _vsnwprintf
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | #  else
 | 
					
						
							| 
									
										
										
										
											2010-11-19 08:12:01 +08:00
										 |  |  | #   define _vsntprintf _vsnprintf
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | #  endif
 | 
					
						
							|  |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2010-11-19 08:12:01 +08:00
										 |  |  | # ifdef _MSC_VER
 | 
					
						
							|  |  |  | #  define alloca _alloca
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | # endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | # if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
 | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #  ifdef OPENSSL_SYS_WIN_CORE
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int OPENSSL_isservice(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     /* OneCore API cannot interact with GUI */ | 
					
						
							|  |  |  |     return 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #  else
 | 
					
						
							| 
									
										
										
										
											2005-05-21 21:19:27 +08:00
										 |  |  | int OPENSSL_isservice(void) | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     HWINSTA h; | 
					
						
							|  |  |  |     DWORD len; | 
					
						
							|  |  |  |     WCHAR *name; | 
					
						
							| 
									
										
										
										
											2010-03-29 18:06:01 +08:00
										 |  |  |     static union { | 
					
						
							|  |  |  |         void *p; | 
					
						
							| 
									
										
										
										
											2015-09-28 22:00:08 +08:00
										 |  |  |         FARPROC f; | 
					
						
							| 
									
										
										
										
											2010-03-29 18:06:01 +08:00
										 |  |  |     } _OPENSSL_isservice = { | 
					
						
							|  |  |  |         NULL | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (_OPENSSL_isservice.p == NULL) { | 
					
						
							| 
									
										
										
										
											2015-09-28 22:00:08 +08:00
										 |  |  |         HANDLE mod = GetModuleHandle(NULL); | 
					
						
							| 
									
										
										
										
											2018-09-12 06:34:00 +08:00
										 |  |  |         FARPROC f = NULL; | 
					
						
							| 
									
										
										
										
											2018-07-20 19:19:11 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-28 22:00:08 +08:00
										 |  |  |         if (mod != NULL) | 
					
						
							| 
									
										
										
										
											2018-07-20 19:19:11 +08:00
										 |  |  |             f = GetProcAddress(mod, "_OPENSSL_isservice"); | 
					
						
							|  |  |  |         if (f == NULL) | 
					
						
							| 
									
										
										
										
											2010-03-29 18:06:01 +08:00
										 |  |  |             _OPENSSL_isservice.p = (void *)-1; | 
					
						
							| 
									
										
										
										
											2018-07-20 19:19:11 +08:00
										 |  |  |         else | 
					
						
							|  |  |  |             _OPENSSL_isservice.f = f; | 
					
						
							| 
									
										
										
										
											2010-03-29 18:06:01 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (_OPENSSL_isservice.p != (void *)-1) | 
					
						
							| 
									
										
										
										
											2025-06-11 16:48:01 +08:00
										 |  |  |         return (int)((*_OPENSSL_isservice.f)()); | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     h = GetProcessWindowStation(); | 
					
						
							|  |  |  |     if (h == NULL) | 
					
						
							|  |  |  |         return -1; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     if (GetUserObjectInformationW(h, UOI_NAME, NULL, 0, &len) || | 
					
						
							|  |  |  |         GetLastError() != ERROR_INSUFFICIENT_BUFFER) | 
					
						
							|  |  |  |         return -1; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     if (len > 512) | 
					
						
							|  |  |  |         return -1;              /* paranoia */ | 
					
						
							|  |  |  |     len++, len &= ~1;           /* paranoia */ | 
					
						
							|  |  |  |     name = (WCHAR *)alloca(len + sizeof(WCHAR)); | 
					
						
							|  |  |  |     if (!GetUserObjectInformationW(h, UOI_NAME, name, len, &len)) | 
					
						
							|  |  |  |         return -1; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     len++, len &= ~1;           /* paranoia */ | 
					
						
							|  |  |  |     name[len / sizeof(WCHAR)] = L'\0'; /* paranoia */ | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #   if 1
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     /*
 | 
					
						
							|  |  |  |      * This doesn't cover "interactive" services [working with real | 
					
						
							|  |  |  |      * WinSta0's] nor programs started non-interactively by Task Scheduler | 
					
						
							|  |  |  |      * [those are working with SAWinSta]. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     if (wcsstr(name, L"Service-0x")) | 
					
						
							|  |  |  |         return 1; | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #   else
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     /* This covers all non-interactive programs such as services. */ | 
					
						
							|  |  |  |     if (!wcsstr(name, L"WinSta0")) | 
					
						
							|  |  |  |         return 1; | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #   endif
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     else | 
					
						
							|  |  |  |         return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #  endif
 | 
					
						
							| 
									
										
										
										
											2005-08-03 06:07:28 +08:00
										 |  |  | # else
 | 
					
						
							|  |  |  | int OPENSSL_isservice(void) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  | void OPENSSL_showfatal(const char *fmta, ...) | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | { | 
					
						
							|  |  |  |     va_list ap; | 
					
						
							| 
									
										
										
										
											2005-04-13 23:41:11 +08:00
										 |  |  |     TCHAR buf[256]; | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  |     const TCHAR *fmt; | 
					
						
							| 
									
										
										
										
											2017-02-28 21:13:40 +08:00
										 |  |  |     /*
 | 
					
						
							|  |  |  |      * First check if it's a console application, in which case the | 
					
						
							|  |  |  |      * error message would be printed to standard error. | 
					
						
							|  |  |  |      * Windows CE does not have a concept of a console application, | 
					
						
							|  |  |  |      * so we need to guard the check. | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  | # ifdef STD_ERROR_HANDLE
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     HANDLE h; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     if ((h = GetStdHandle(STD_ERROR_HANDLE)) != NULL && | 
					
						
							|  |  |  |         GetFileType(h) != FILE_TYPE_UNKNOWN) { | 
					
						
							| 
									
										
										
										
											2015-01-20 22:49:55 +08:00
										 |  |  |         /* must be console application */ | 
					
						
							| 
									
										
										
										
											2011-10-24 03:41:00 +08:00
										 |  |  |         int len; | 
					
						
							|  |  |  |         DWORD out; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |         va_start(ap, fmta); | 
					
						
							| 
									
										
										
										
											2013-04-04 21:57:43 +08:00
										 |  |  |         len = _vsnprintf((char *)buf, sizeof(buf), fmta, ap); | 
					
						
							| 
									
										
										
										
											2011-10-24 03:41:00 +08:00
										 |  |  |         WriteFile(h, buf, len < 0 ? sizeof(buf) : (DWORD) len, &out, NULL); | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |         va_end(ap); | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2005-08-03 06:07:28 +08:00
										 |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (sizeof(TCHAR) == sizeof(char)) | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  |         fmt = (const TCHAR *)fmta; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     else | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |         do { | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |             int keepgoing; | 
					
						
							|  |  |  |             size_t len_0 = strlen(fmta) + 1, i; | 
					
						
							|  |  |  |             WCHAR *fmtw; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-19 08:12:01 +08:00
										 |  |  |             fmtw = (WCHAR *)alloca(len_0 * sizeof(WCHAR)); | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  |             if (fmtw == NULL) { | 
					
						
							|  |  |  |                 fmt = (const TCHAR *)L"no stack?"; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                 break; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2025-06-11 16:48:01 +08:00
										 |  |  |             if (!MultiByteToWideChar(CP_ACP, 0, fmta, (int)len_0, fmtw, (int)len_0)) | 
					
						
							| 
									
										
										
										
											2013-01-29 01:30:38 +08:00
										 |  |  |                 for (i = 0; i < len_0; i++) | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                     fmtw[i] = (WCHAR)fmta[i]; | 
					
						
							| 
									
										
										
										
											2013-01-29 01:30:38 +08:00
										 |  |  |             for (i = 0; i < len_0; i++) { | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                 if (fmtw[i] == L'%') | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                     do { | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                         keepgoing = 0; | 
					
						
							|  |  |  |                         switch (fmtw[i + 1]) { | 
					
						
							|  |  |  |                         case L'0': | 
					
						
							|  |  |  |                         case L'1': | 
					
						
							|  |  |  |                         case L'2': | 
					
						
							|  |  |  |                         case L'3': | 
					
						
							|  |  |  |                         case L'4': | 
					
						
							|  |  |  |                         case L'5': | 
					
						
							|  |  |  |                         case L'6': | 
					
						
							|  |  |  |                         case L'7': | 
					
						
							|  |  |  |                         case L'8': | 
					
						
							|  |  |  |                         case L'9': | 
					
						
							|  |  |  |                         case L'.': | 
					
						
							|  |  |  |                         case L'*': | 
					
						
							|  |  |  |                         case L'-': | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                             i++; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                             keepgoing = 1; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                             break; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                         case L's': | 
					
						
							|  |  |  |                             fmtw[i + 1] = L'S'; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                             break; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                         case L'S': | 
					
						
							|  |  |  |                             fmtw[i + 1] = L's'; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                             break; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                         case L'c': | 
					
						
							|  |  |  |                             fmtw[i + 1] = L'C'; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                             break; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |                         case L'C': | 
					
						
							|  |  |  |                             fmtw[i + 1] = L'c'; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |                             break; | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2005-08-04 03:56:36 +08:00
										 |  |  |                     } while (keepgoing); | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  |             } | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  |             fmt = (const TCHAR *)fmtw; | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |         } while (0); | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     va_start(ap, fmta); | 
					
						
							| 
									
										
										
										
											2015-05-04 00:32:05 +08:00
										 |  |  |     _vsntprintf(buf, OSSL_NELEM(buf) - 1, fmt, ap); | 
					
						
							|  |  |  |     buf[OSSL_NELEM(buf) - 1] = _T('\0'); | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     va_end(ap); | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | # if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
 | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #  ifdef OPENSSL_SYS_WIN_CORE
 | 
					
						
							|  |  |  |     /* ONECORE is always NONGUI and NT >= 0x0601 */ | 
					
						
							|  |  |  | #   if !defined(NDEBUG)
 | 
					
						
							|  |  |  |         /*
 | 
					
						
							|  |  |  |         * 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(buf); | 
					
						
							|  |  |  | #   endif
 | 
					
						
							|  |  |  | #  else
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     /* this -------------v--- guards NT-specific calls */ | 
					
						
							| 
									
										
										
										
											2014-02-25 20:11:22 +08:00
										 |  |  |     if (check_winnt() && OPENSSL_isservice() > 0) { | 
					
						
							| 
									
										
										
										
											2015-04-28 02:14:45 +08:00
										 |  |  |         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)) { | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #   if !defined(NDEBUG)
 | 
					
						
							| 
									
										
										
										
											2015-04-28 02:14:45 +08:00
										 |  |  |                 /*
 | 
					
						
							|  |  |  |                  * 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); | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  | #   endif
 | 
					
						
							| 
									
										
										
										
											2015-04-28 02:14:45 +08:00
										 |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             (void)DeregisterEventSource(hEventLog); | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2015-04-28 02:14:45 +08:00
										 |  |  |         MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONERROR); | 
					
						
							| 
									
										
										
										
											2018-03-19 16:34:35 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | # else
 | 
					
						
							|  |  |  |     MessageBox(NULL, buf, _T("OpenSSL: FATAL"), MB_OK | MB_ICONERROR); | 
					
						
							| 
									
										
										
										
											2019-02-01 01:55:30 +08:00
										 |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | } | 
					
						
							|  |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  | void OPENSSL_showfatal(const char *fmta, ...) | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-09-12 02:56:32 +08:00
										 |  |  | #ifndef OPENSSL_NO_STDIO
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     va_list ap; | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     va_start(ap, fmta); | 
					
						
							|  |  |  |     vfprintf(stderr, fmta, ap); | 
					
						
							|  |  |  |     va_end(ap); | 
					
						
							| 
									
										
										
										
											2015-09-12 02:56:32 +08:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | int OPENSSL_isservice(void) | 
					
						
							| 
									
										
										
										
											2015-01-22 11:40:55 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2005-04-08 02:39:45 +08:00
										 |  |  |     return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-14 03:20:43 +08:00
										 |  |  | void OPENSSL_die(const char *message, const char *file, int line) | 
					
						
							| 
									
										
										
										
											2002-11-13 23:43:43 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2016-02-14 03:20:43 +08:00
										 |  |  |     OPENSSL_showfatal("%s:%d: OpenSSL internal error: %s\n", | 
					
						
							|  |  |  |                       file, line, message); | 
					
						
							| 
									
										
										
										
											2023-04-11 23:31:57 +08:00
										 |  |  | #if !defined(_WIN32) || defined(OPENSSL_SYS_UEFI)
 | 
					
						
							| 
									
										
										
										
											2002-11-13 23:43:43 +08:00
										 |  |  |     abort(); | 
					
						
							| 
									
										
										
										
											2009-05-03 22:16:40 +08:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2009-05-04 14:23:05 +08:00
										 |  |  |     /*
 | 
					
						
							|  |  |  |      * Win32 abort() customarily shows a dialog, but we just did that... | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2013-01-20 04:23:13 +08:00
										 |  |  | # if !defined(_WIN32_WCE)
 | 
					
						
							| 
									
										
										
										
											2009-05-03 22:16:40 +08:00
										 |  |  |     raise(SIGABRT); | 
					
						
							| 
									
										
										
										
											2013-01-20 04:23:13 +08:00
										 |  |  | # endif
 | 
					
						
							| 
									
										
										
										
											2009-05-03 22:16:40 +08:00
										 |  |  |     _exit(3); | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2002-11-13 23:43:43 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2005-04-13 14:55:42 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-07 05:37:47 +08:00
										 |  |  | #if defined(__TANDEM) && defined(OPENSSL_VPROC)
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Define a VPROC function for HP NonStop build crypto library. | 
					
						
							|  |  |  |  * This is used by platform version identification tools. | 
					
						
							|  |  |  |  * Do not inline this procedure or make it static. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | # define OPENSSL_VPROC_STRING_(x)    x##_CRYPTO
 | 
					
						
							|  |  |  | # define OPENSSL_VPROC_STRING(x)     OPENSSL_VPROC_STRING_(x)
 | 
					
						
							|  |  |  | # define OPENSSL_VPROC_FUNC          OPENSSL_VPROC_STRING(OPENSSL_VPROC)
 | 
					
						
							|  |  |  | void OPENSSL_VPROC_FUNC(void) {} | 
					
						
							|  |  |  | #endif /* __TANDEM */
 |