summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-04-16 02:42:06 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-04-16 02:42:06 +0000
commitb1d876619f5be52ebad9cfc9862bb267f7307300 (patch)
tree413b45305d37ce93c8aeffd5ae835909d6606435 /lib
parent38b9ad6efdc2d601ea2e507c923dc183d40814c1 (diff)
Remove non-posix support. Why is OPENSSL_isservice even here?
Is this a crypto library or a generic platform abstraction library? "A hack to make Visual C++ 5.0 work correctly" ... time to upgrade.
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/crypto/cryptlib.c229
1 files changed, 0 insertions, 229 deletions
diff --git a/lib/libssl/src/crypto/cryptlib.c b/lib/libssl/src/crypto/cryptlib.c
index 89667d175a8..2bf5def17d9 100644
--- a/lib/libssl/src/crypto/cryptlib.c
+++ b/lib/libssl/src/crypto/cryptlib.c
@@ -201,14 +201,6 @@ CRYPTO_get_new_lockid(char *name)
char *str;
int i;
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
- /* A hack to make Visual C++ 5.0 work correctly when linking as
- * a DLL using /MT. Without this, the application cannot use
- * any floating point printf's.
- * It also seems to be needed for Visual C 1.5 (win16) */
- SSLeay_MSVC5_hack = (double)name[0]*(double)name[1];
-#endif
-
if ((app_locks == NULL) && ((app_locks = sk_OPENSSL_STRING_new_null()) == NULL)) {
CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_LOCKID, ERR_R_MALLOC_FAILURE);
return (0);
@@ -488,16 +480,8 @@ CRYPTO_THREADID_current(CRYPTO_THREADID *id)
}
#endif
/* Else pick a backup */
-#ifdef OPENSSL_SYS_WIN16
- CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask());
-#elif defined(OPENSSL_SYS_WIN32)
- CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId());
-#elif defined(OPENSSL_SYS_BEOS)
- CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
-#else
/* For everything else, default to using the address of 'errno' */
CRYPTO_THREADID_set_pointer(id, (void*)&errno);
-#endif
}
int
@@ -536,17 +520,7 @@ CRYPTO_thread_id(void)
unsigned long ret = 0;
if (id_callback == NULL) {
-#ifdef OPENSSL_SYS_WIN16
- ret = (unsigned long)GetCurrentTask();
-#elif defined(OPENSSL_SYS_WIN32)
- ret = (unsigned long)GetCurrentThreadId();
-#elif defined(GETPID_IS_MEANINGLESS)
- ret = 1L;
-#elif defined(OPENSSL_SYS_BEOS)
- ret = (unsigned long)find_thread(NULL);
-#else
ret = (unsigned long)getpid();
-#endif
} else
ret = id_callback();
return (ret);
@@ -721,203 +695,7 @@ void
OPENSSL_cpuid_setup(void) {}
#endif
-#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(_WINDLL)
-#ifdef __CYGWIN__
-/* pick DLL_[PROCESS|THREAD]_[ATTACH|DETACH] definitions */
-#include <windows.h>
-/* this has side-effect of _WIN32 getting defined, which otherwise
- * is mutually exclusive with __CYGWIN__... */
-#endif
-
-/* All we really need to do is remove the 'error' state when a thread
- * detaches */
-
-BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- OPENSSL_cpuid_setup();
-#if defined(_WIN32_WINNT)
- {
- IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)hinstDLL;
- IMAGE_NT_HEADERS *nt_headers;
-
- if (dos_header->e_magic == IMAGE_DOS_SIGNATURE) {
- nt_headers = (IMAGE_NT_HEADERS *)((char *)dos_header
- + dos_header->e_lfanew);
- if (nt_headers->Signature == IMAGE_NT_SIGNATURE &&
- hinstDLL != (HINSTANCE)(nt_headers->OptionalHeader.ImageBase))
- OPENSSL_NONPIC_relocated = 1;
- }
- }
-#endif
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- break;
- }
- return (TRUE);
-}
-#endif
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-#include <tchar.h>
-#include <signal.h>
-#ifdef __WATCOMC__
-#if defined(_UNICODE) || defined(__UNICODE__)
-#define _vsntprintf _vsnwprintf
-#else
-#define _vsntprintf _vsnprintf
-#endif
-#endif
-#ifdef _MSC_VER
-#define alloca _alloca
-#endif
-
-#if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333
-int
-OPENSSL_isservice(void)
- { HWINSTA h;
- DWORD len;
- WCHAR *name;
- static union { void *p;
- int (*f)(void);
- } _OPENSSL_isservice = { NULL };
-
- if (_OPENSSL_isservice.p == NULL) {
- HANDLE h = GetModuleHandle(NULL);
- if (h != NULL)
- _OPENSSL_isservice.p = GetProcAddress(h, "_OPENSSL_isservice");
- if (_OPENSSL_isservice.p == NULL)
- _OPENSSL_isservice.p = (void *) - 1;
- }
- if (_OPENSSL_isservice.p != (void *) - 1)
- return (*_OPENSSL_isservice.f)();
-
- (void)GetDesktopWindow(); /* return value is ignored */
-
- h = GetProcessWindowStation();
- if (h == NULL)
- return -1;
-
- if (GetUserObjectInformationW (h, UOI_NAME, NULL, 0, &len) ||
- GetLastError() != ERROR_INSUFFICIENT_BUFFER)
- return -1;
-
- 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;
-
- len++, len&=~1;
- /* paranoia */
- name[len/sizeof(WCHAR)]=L'\0'; /* paranoia */
-#if 1
- /* 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;
-#else
- /* This covers all non-interactive programs such as services. */
- if (!wcsstr(name, L"WinSta0")) return 1;
-#endif
- else return 0;
-}
-#else
- int OPENSSL_isservice(void) { return 0;
-}
-#endif
-
-void OPENSSL_showfatal (const char *fmta,...)
- { va_list ap;
- TCHAR buf[256];
- const TCHAR *fmt;
-#ifdef STD_ERROR_HANDLE /* what a dirty trick! */
- HANDLE h;
-
- if ((h = GetStdHandle(STD_ERROR_HANDLE)) != NULL &&
- GetFileType(h) != FILE_TYPE_UNKNOWN)
- { /* must be console application */
- va_start (ap, fmta);
- vfprintf (stderr, fmta, ap);
- va_end (ap);
- return;
- }
-#endif
-
- if (sizeof(TCHAR) == sizeof(char))
- fmt = (const TCHAR *)fmta;
- else do
- { int keepgoing;
- size_t len_0 = strlen(fmta) + 1, i;
- WCHAR *fmtw;
-
- fmtw = (WCHAR *)alloca(len_0*sizeof(WCHAR));
- if (fmtw == NULL) {
- fmt = (const TCHAR *)L"no stack?";
- break;
- }
-
-#ifndef OPENSSL_NO_MULTIBYTE
- if (!MultiByteToWideChar(CP_ACP, 0, fmta, len_0, fmtw, len_0))
-#endif
- for (i = 0;i < len_0;i++) fmtw[i] = (WCHAR)fmta[i];
-
- for (i = 0; i < len_0; i++)
- { if (fmtw[i]==L'%') do
- { 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'-':
- i++;
- keepgoing = 1;
- break;
- case L's':
- fmtw[i + 1] = L'S';
- break;
- case L'S':
- fmtw[i + 1] = L's';
- break;
- case L'c':
- fmtw[i + 1] = L'C';
- break;
- case L'C':
- fmtw[i + 1] = L'c';
- break;
- }
- } while (keepgoing);
- }
- fmt = (const TCHAR *)fmtw;
- } while (0);
-
- va_start (ap, fmta);
- _vsntprintf (buf, sizeof(buf)/sizeof(TCHAR) - 1, fmt, ap);
- buf [sizeof(buf)/sizeof(TCHAR) - 1] = _T('\0');
- va_end (ap);
-
-#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);
- } else
-#endif
- MessageBox (NULL, buf, _T("OpenSSL: FATAL"), MB_OK|MB_ICONSTOP);
-}
-#else
void OPENSSL_showfatal(const char *fmta, ...)
{
va_list ap;
@@ -931,7 +709,6 @@ int OPENSSL_isservice(void)
{
return 0;
}
-#endif
void
OpenSSLDie(const char *file, int line, const char *assertion)
@@ -939,13 +716,7 @@ OpenSSLDie(const char *file, int line, const char *assertion)
OPENSSL_showfatal(
"%s(%d): OpenSSL internal error, assertion failed: %s\n",
file, line, assertion);
-#if !defined(_WIN32) || defined(__CYGWIN__)
abort();
-#else
- /* Win32 abort() customarily shows a dialog, but we just did that... */
- raise(SIGABRT);
- _exit(3);
-#endif
}
void *OPENSSL_stderr(void)