Skip to content

Commit 9db30df

Browse files
committed
Make everything compile on MSVC
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent 03515d5 commit 9db30df

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

src/headers/tomcrypt_custom.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -777,11 +777,4 @@
777777
#undef LTC_ECC521
778778
#endif
779779

780-
/* MSVC can't build PEM */
781-
#if defined(LTC_PEM) && defined(_MSC_VER)
782-
#undef LTC_PEM
783-
#undef LTC_PEM_DECODE_BUFSZ
784-
#undef LTC_PEM_READ_BUFSIZE
785-
#endif
786-
787780
#endif /* TOMCRYPT_CUSTOM_H_ */

src/headers/tomcrypt_private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ struct str {
282282
};
283283

284284
#define SET_STR(n, s) n.p = s, n.len = XSTRLEN(s)
285-
#define SET_CSTR(n, s) n.p = (char*)s, n.len = XSTRLEN(s)
285+
#define SET_CSTR(n, s) n.p = (char*)s, n.len = (sizeof s) - 1
286286
#define COPY_STR(n, s, l) do { XMEMCPY(n.p, s, l); n.len = l; } while(0)
287287
#define RESET_STR(n) do { n.p = NULL; n.len = 0; } while(0)
288288

src/prngs/rng_get_bytes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ static unsigned long s_rng_win32(unsigned char *buf, unsigned long len,
112112
static unsigned long s_rng_win32(unsigned char *buf, unsigned long len,
113113
void (*callback)(void))
114114
{
115+
static HCRYPTPROV hProv = 0;
115116
LTC_UNUSED_PARAM(callback);
116117

117-
static HCRYPTPROV hProv = 0;
118118
if (hProv == 0) {
119119
HCRYPTPROV h = 0;
120120
if (!CryptAcquireContextW(&h, NULL, MS_DEF_PROV_W, PROV_RSA_FULL,

0 commit comments

Comments
 (0)