-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlegacy.diff
More file actions
70 lines (69 loc) · 3 KB
/
legacy.diff
File metadata and controls
70 lines (69 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index 51d489cdf0..06424f7522 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -446,8 +446,14 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
#if !defined(_WIN32_WCE)
/* 0x400 is the spin count value suggested in the documentation */
if (!InitializeCriticalSectionAndSpinCount(lock, 0x400)) {
- OPENSSL_free(lock);
- return NULL;
+ /* On Windows 9x the return value of InitializeCriticalSectionAndSpinCount is unreliable,
+ because it is implemented as a simple wrapper that calls InitializeCriticalSection (a void function). */
+ OSVERSIONINFOA osvi = { 0 };
+ osvi.dwOSVersionInfoSize = sizeof(osvi);
+ if (!GetVersionExA(&osvi) || (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)) {
+ OPENSSL_free(lock);
+ return NULL;
+ }
}
#else
InitializeCriticalSection(lock);
diff --git a/include/internal/e_winsock.h b/include/internal/e_winsock.h
index c2a08ebed1..e821c7c59d 100644
--- a/include/internal/e_winsock.h
+++ b/include/internal/e_winsock.h
@@ -36,7 +36,7 @@
* at run-time [DSO_global_lookup is recommended]...
*/
#include <winsock2.h>
-#include <ws2tcpip.h>
+#include <wspiapi.h>
/*
* Clang-based C++Builder 10.3.3 toolchains cannot find C inline
* definitions at link-time. This header defines WspiapiLoad() as an
diff --git a/providers/implementations/rands/seeding/rand_win.c b/providers/implementations/rands/seeding/rand_win.c
index 323a579ac4..54ac9226c5 100644
--- a/providers/implementations/rands/seeding/rand_win.c
+++ b/providers/implementations/rands/seeding/rand_win.c
@@ -41,7 +41,7 @@
* http://developer.intel.com/design/security/rng/redist_license.htm
*/
#define PROV_INTEL_SEC 22
-#define INTEL_DEF_PROV L"Intel Hardware Cryptographic Service Provider"
+#define INTEL_DEF_PROV "Intel Hardware Cryptographic Service Provider"
#endif
size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
@@ -86,8 +86,8 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
if (buffer != NULL) {
size_t bytes = 0;
/* poll the CryptoAPI PRNG */
- if (CryptAcquireContextW(&hProvider, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT)
+ if (CryptAcquireContextA(&hProvider, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT)
!= 0) {
if (CryptGenRandom(hProvider, bytes_needed, buffer) != 0)
bytes = bytes_needed;
@@ -106,9 +106,9 @@ size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
if (buffer != NULL) {
size_t bytes = 0;
/* poll the Pentium PRG with CryptoAPI */
- if (CryptAcquireContextW(&hProvider, NULL,
+ if (CryptAcquireContextA(&hProvider, NULL,
INTEL_DEF_PROV, PROV_INTEL_SEC,
- CRYPT_VERIFYCONTEXT | CRYPT_SILENT)
+ CRYPT_VERIFYCONTEXT)
!= 0) {
if (CryptGenRandom(hProvider, bytes_needed, buffer) != 0)
bytes = bytes_needed;