From 9578d671fa5fc9a17beca0ae723e320ea32bf41b Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Sat, 25 May 2019 22:31:33 +0200 Subject: [PATCH 1/3] fix invalid OBJECTS=... definition in makefile.msvc --- makefile.msvc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/makefile.msvc b/makefile.msvc index 6d3bcda..12ec4af 100644 --- a/makefile.msvc +++ b/makefile.msvc @@ -47,16 +47,6 @@ bn_s_mp_invmod_slow.obj bn_s_mp_karatsuba_mul.obj bn_s_mp_karatsuba_sqr.obj bn_s bn_s_mp_mul_digs.obj bn_s_mp_mul_digs_fast.obj bn_s_mp_mul_high_digs.obj bn_s_mp_mul_high_digs_fast.obj \ bn_s_mp_prime_is_divisible.obj bn_s_mp_rand_jenkins.obj bn_s_mp_rand_platform.obj bn_s_mp_reverse.obj \ bn_s_mp_sqr.obj bn_s_mp_sqr_fast.obj bn_s_mp_sub.obj bn_s_mp_toom_mul.obj bn_s_mp_toom_sqr.obj -bn_mp_set_double.obj bn_mp_set_int.obj bn_mp_set_long.obj bn_mp_set_long_long.obj bn_mp_shrink.obj \ -bn_mp_signed_bin_size.obj bn_mp_signed_rsh.obj bn_mp_sqr.obj bn_mp_sqrmod.obj bn_mp_sqrt.obj bn_mp_sqrtmod_prime.obj \ -bn_mp_sub.obj bn_mp_sub_d.obj bn_mp_submod.obj bn_mp_to_signed_bin.obj bn_mp_to_signed_bin_n.obj \ -bn_mp_to_unsigned_bin.obj bn_mp_to_unsigned_bin_n.obj bn_mp_toradix.obj bn_mp_toradix_n.obj \ -bn_mp_unsigned_bin_size.obj bn_mp_xor.obj bn_mp_zero.obj bn_prime_tab.obj bn_s_mp_add.obj bn_s_mp_balance_mul.obj \ -bn_s_mp_exptmod.obj bn_s_mp_exptmod_fast.obj bn_s_mp_get_bit.obj bn_s_mp_invmod_fast.obj bn_s_mp_invmod_slow.obj \ -bn_s_mp_karatsuba_mul.obj bn_s_mp_karatsuba_sqr.obj bn_s_mp_montgomery_reduce_fast.obj bn_s_mp_mul_digs.obj \ -bn_s_mp_mul_digs_fast.obj bn_s_mp_mul_high_digs.obj bn_s_mp_mul_high_digs_fast.obj bn_s_mp_rand_jenkins.obj \ -bn_s_mp_rand_platform.obj bn_s_mp_reverse.obj bn_s_mp_sqr.obj bn_s_mp_sqr_fast.obj bn_s_mp_sub.obj \ -bn_s_mp_toom_mul.obj bn_s_mp_toom_sqr.obj HEADERS_PUB=tommath.h HEADERS=tommath_private.h tommath_class.h tommath_superclass.h $(HEADERS_PUB) From 4b475aca0350a35f9241157d114f2b27193dfd28 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 26 May 2019 09:29:58 +0200 Subject: [PATCH 2/3] fixes for msvc --- bn_s_mp_rand_platform.c | 2 +- tommath.h | 2 +- tommath_private.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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) From 6ce1bcb3966835530de65f33402b49fc89ac37f3 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 26 May 2019 09:36:07 +0200 Subject: [PATCH 3/3] add appveyor.yml: test both vc2015 and vc2017 --- appveyor.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..bdf408d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,11 @@ +version: 1.0.{build} +image: +- Visual Studio 2017 +- Visual Studio 2015 +build_script: +- cmd: >- + if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" + if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 + if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64 + nmake -f makefile.msvc all + test.exe