Skip to content

Commit 5a0c39f

Browse files
authored
Merge pull request #412 from libtom/fix-win32-includes
fix win32 includes, remove support for everything older than Windows XP
2 parents a478990 + a8ca1c3 commit 5a0c39f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

s_mp_rand_platform.c

+8-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ static mp_err s_read_arc4random(void *p, size_t n)
1616
}
1717
#endif
1818

19-
#if defined(_WIN32) || defined(_WIN32_WCE)
19+
#if defined(_WIN32)
2020
#define S_READ_WINCSP_C
2121

2222
#ifndef _WIN32_WINNT
23-
#define _WIN32_WINNT 0x0400
23+
#define _WIN32_WINNT 0x0501
2424
#endif
25-
#ifdef _WIN32_WCE
26-
#define UNDER_CE
27-
#define ARM
25+
#ifndef WINVER
26+
#define WINVER 0x0501
2827
#endif
2928

3029
#define WIN32_LEAN_AND_MEAN
@@ -36,10 +35,10 @@ static mp_err s_read_wincsp(void *p, size_t n)
3635
static HCRYPTPROV hProv = 0;
3736
if (hProv == 0) {
3837
HCRYPTPROV h = 0;
39-
if (!CryptAcquireContext(&h, NULL, MS_DEF_PROV, PROV_RSA_FULL,
40-
(CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET)) &&
41-
!CryptAcquireContext(&h, NULL, MS_DEF_PROV, PROV_RSA_FULL,
42-
CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET | CRYPT_NEWKEYSET)) {
38+
if (!CryptAcquireContextW(&h, NULL, MS_DEF_PROV_W, PROV_RSA_FULL,
39+
(CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET)) &&
40+
!CryptAcquireContextW(&h, NULL, MS_DEF_PROV_W, PROV_RSA_FULL,
41+
CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET | CRYPT_NEWKEYSET)) {
4342
return MP_ERR;
4443
}
4544
hProv = h;

tommath_private.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* as a shared object. By default, symbols are visible.
1717
* On Win32 a .def file must be used to specify the exported symbols.
1818
*/
19-
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(_WIN32)
19+
#if defined(__GNUC__) && __GNUC__ >= 4 && !defined(_WIN32) && !defined(__CYGWIN__)
2020
# define MP_PRIVATE __attribute__ ((visibility ("hidden")))
2121
#else
2222
# define MP_PRIVATE

0 commit comments

Comments
 (0)