diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-01-19 20:09:02 -0500 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-01-19 20:09:02 -0500 |
commit | 600fa4d107a4179f60bd565a04639f3d01327240 (patch) | |
tree | c798e8c9d677800b9913217f0138ad7eb46a16c6 | |
parent | e4e1fbe0edf67bfe0697ef4f0122d144ae94815b (diff) | |
download | cryptopp-git-600fa4d107a4179f60bd565a04639f3d01327240.tar.gz |
Clear unary minus on unsigned warning under MSVC
-rw-r--r-- | TestScripts/tweetnacl.patch | 32 | ||||
-rw-r--r-- | tweetnacl.cpp | 4 |
2 files changed, 20 insertions, 16 deletions
diff --git a/TestScripts/tweetnacl.patch b/TestScripts/tweetnacl.patch index be7d2e69..cf827207 100644 --- a/TestScripts/tweetnacl.patch +++ b/TestScripts/tweetnacl.patch @@ -1,5 +1,5 @@ ---- tweetnacl.c 2018-01-19 18:25:34.736456382 -0500 -+++ tweetnacl.cpp 2018-01-19 18:25:34.738456422 -0500 +--- tweetnacl.c 2018-01-19 20:07:33.246037873 -0500 ++++ tweetnacl.cpp 2018-01-19 20:07:33.247037893 -0500 @@ -1,19 +1,33 @@ -#include "tweetnacl.h" -#define FOR(i,n) for (i = 0;i < n;++i) @@ -25,7 +25,7 @@ + +// Don't destroy const time properties when squashing warnings. +#if CRYPTOPP_MSC_VERSION -+# pragma warning(disable: 4242 4244 4245) ++# pragma warning(disable: 4146 4242 4244 4245) +#endif + +#ifndef CRYPTOPP_DISABLE_NACL @@ -649,22 +649,29 @@ +} + +int crypto_box_unchecked(uint8_t *c, const uint8_t *m, uint64_t d, const uint8_t *n, const uint8_t *y, const uint8_t *x) ++{ ++ uint8_t k[32]; ++ crypto_box_beforenm_unchecked(k, y, x); ++ return crypto_box_afternm(c, m, d, n, k); ++} ++ ++int crypto_box_open(uint8_t *m,const uint8_t *c,uint64_t d,const uint8_t *n,const uint8_t *y,const uint8_t *x) { - u8 k[32]; - crypto_box_beforenm(k,y,x); - return crypto_box_afternm(c,m,d,n,k); + uint8_t k[32]; -+ crypto_box_beforenm_unchecked(k, y, x); -+ return crypto_box_afternm(c, m, d, n, k); ++ if(crypto_box_beforenm(k,y,x) != 0) return -1; ++ return crypto_box_open_afternm(m,c,d,n,k); } -int crypto_box_open(u8 *m,const u8 *c,u64 d,const u8 *n,const u8 *y,const u8 *x) -+int crypto_box_open(uint8_t *m,const uint8_t *c,uint64_t d,const uint8_t *n,const uint8_t *y,const uint8_t *x) ++int crypto_box_open_unchecked(uint8_t *m,const uint8_t *c,uint64_t d,const uint8_t *n,const uint8_t *y,const uint8_t *x) { - u8 k[32]; - crypto_box_beforenm(k,y,x); + uint8_t k[32]; -+ if(crypto_box_beforenm(k,y,x) != 0) return -1; ++ crypto_box_beforenm_unchecked(k,y,x); return crypto_box_open_afternm(m,c,d,n,k); } @@ -698,13 +705,6 @@ - 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, - 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, - 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL -+int crypto_box_open_unchecked(uint8_t *m,const uint8_t *c,uint64_t d,const uint8_t *n,const uint8_t *y,const uint8_t *x) -+{ -+ uint8_t k[32]; -+ crypto_box_beforenm_unchecked(k,y,x); -+ return crypto_box_open_afternm(m,c,d,n,k); -+} -+ +static uint64_t R(uint64_t x,int c) { return (x >> c) | (x << (64 - c)); } +static uint64_t Ch(uint64_t x,uint64_t y,uint64_t z) { return (x & y) ^ (~x & z); } +static uint64_t Maj(uint64_t x,uint64_t y,uint64_t z) { return (x & y) ^ (x & z) ^ (y & z); } @@ -1009,7 +1009,7 @@ crypto_hash(h,m,n); reduce(h); scalarmult(p,q,h); -@@ -799,11 +882,16 @@ +@@ -799,11 +882,18 @@ n -= 64; if (crypto_verify_32(sm, t)) { @@ -1028,3 +1028,5 @@ +NAMESPACE_END // NaCl + +#endif // NO_OS_DEPENDENCE ++ ++ diff --git a/tweetnacl.cpp b/tweetnacl.cpp index 9114ef8c..d5906bc1 100644 --- a/tweetnacl.cpp +++ b/tweetnacl.cpp @@ -12,7 +12,7 @@ // Don't destroy const time properties when squashing warnings.
#if CRYPTOPP_MSC_VERSION
-# pragma warning(disable: 4242 4244 4245)
+# pragma warning(disable: 4146 4242 4244 4245)
#endif
#ifndef CRYPTOPP_DISABLE_NACL
@@ -895,3 +895,5 @@ NAMESPACE_END // CryptoPP NAMESPACE_END // NaCl
#endif // NO_OS_DEPENDENCE
+
+
|