fixes for msvc
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
diff --git a/bn_s_mp_rand_platform.c b/bn_s_mp_rand_platform.c
index a22558c..63262ce 100644
--- a/bn_s_mp_rand_platform.c
+++ b/bn_s_mp_rand_platform.c
@@ -37,7 +37,7 @@ static mp_err s_read_win_csp(void *p, size_t n)
CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET | CRYPT_NEWKEYSET)) {
return MP_ERR;
}
- hProc = h;
+ hProv = h;
}
return CryptGenRandom(hProv, (DWORD)n, (BYTE *)p) == TRUE ? MP_OKAY : MP_ERR;
}
diff --git a/tommath.h b/tommath.h
index 6b4ae41..388de26 100644
--- a/tommath.h
+++ b/tommath.h
@@ -229,7 +229,7 @@ typedef struct {
/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
typedef int private_mp_prime_callback(unsigned char *dst, int len, void *dat);
-typedef private_mp_prime_callback ltm_prime_callback MP_DEPRECATED(mp_rand_source);
+typedef private_mp_prime_callback MP_DEPRECATED(mp_rand_source) ltm_prime_callback;
/* error code to char* string */
const char *mp_error_to_string(mp_err code) MP_WUR;
diff --git a/tommath_private.h b/tommath_private.h
index b1be9c7..afe01de 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -148,7 +148,7 @@ typedef private_mp_word mp_word;
#define MP_MAX(x, y) (((x) > (y)) ? (x) : (y))
/* Static assertion */
-#define MP_STATIC_ASSERT(msg, cond) typedef char mp_static_assert_##msg[-(!(cond))];
+#define MP_STATIC_ASSERT(msg, cond) typedef char mp_static_assert_##msg[(cond) ? 1 : -1];
/* ---> Basic Manipulations <--- */
#define MP_IS_ZERO(a) ((a)->used == 0)