From e2f32c3632e51b58ec5f7811a9730982bac82738 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 6 Nov 2014 17:58:37 +0100 Subject: [PATCH 1/6] Fix compilation with Visual Studio --- libdevcrypto/EC.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libdevcrypto/EC.cpp b/libdevcrypto/EC.cpp index af6d0e65e..7bc17ab99 100644 --- a/libdevcrypto/EC.cpp +++ b/libdevcrypto/EC.cpp @@ -134,7 +134,7 @@ bool crypto::verify(Signature const& _signature, bytesConstRef _message) bool crypto::verify(Public const& _p, Signature const& _sig, bytesConstRef _message, bool _hashed) { - static size_t derMaxEncodingLength = 72; + static const size_t derMaxEncodingLength = 72; if (_hashed) { assert(_message.size() == 32); @@ -155,8 +155,9 @@ Public crypto::recover(Signature _signature, bytesConstRef _message) { secp256k1_start(); - int pubkeylen = 65; - byte pubkey[pubkeylen]; + static const int c_pubkeylen = 65; + auto pubkeylen = c_pubkeylen; + byte pubkey[c_pubkeylen]; if (!secp256k1_ecdsa_recover_compact(_message.data(), 32, _signature.data(), pubkey, &pubkeylen, 0, (int)_signature[64])) return Public(); @@ -180,8 +181,9 @@ bool crypto::verifySecret(Secret const& _s, Public const& _p) if (!ok) return false; - int pubkeylen = 65; - byte pubkey[pubkeylen]; + static const int c_pubkeylen = 65; + auto pubkeylen = c_pubkeylen; + byte pubkey[c_pubkeylen]; ok = secp256k1_ecdsa_pubkey_create(pubkey, &pubkeylen, _s.data(), 0); if (!ok || pubkeylen != 65) return false; From de0c84c7df6ad668f0969d35475fe4608e99f072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 6 Nov 2014 18:29:49 +0100 Subject: [PATCH 2/6] Replace auto with int --- libdevcrypto/EC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdevcrypto/EC.cpp b/libdevcrypto/EC.cpp index 7bc17ab99..17304668b 100644 --- a/libdevcrypto/EC.cpp +++ b/libdevcrypto/EC.cpp @@ -182,7 +182,7 @@ bool crypto::verifySecret(Secret const& _s, Public const& _p) return false; static const int c_pubkeylen = 65; - auto pubkeylen = c_pubkeylen; + int pubkeylen = c_pubkeylen; byte pubkey[c_pubkeylen]; ok = secp256k1_ecdsa_pubkey_create(pubkey, &pubkeylen, _s.data(), 0); if (!ok || pubkeylen != 65) From 30bb7c21607d4b9c11a47a94fcdd53d3ecd87a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 6 Nov 2014 18:30:42 +0100 Subject: [PATCH 3/6] Replace auto with int --- libdevcrypto/EC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdevcrypto/EC.cpp b/libdevcrypto/EC.cpp index 17304668b..237acebc5 100644 --- a/libdevcrypto/EC.cpp +++ b/libdevcrypto/EC.cpp @@ -156,7 +156,7 @@ Public crypto::recover(Signature _signature, bytesConstRef _message) secp256k1_start(); static const int c_pubkeylen = 65; - auto pubkeylen = c_pubkeylen; + int pubkeylen = c_pubkeylen; byte pubkey[c_pubkeylen]; if (!secp256k1_ecdsa_recover_compact(_message.data(), 32, _signature.data(), pubkey, &pubkeylen, 0, (int)_signature[64])) return Public(); From c5927833ac583d39bc32975c2e6b4a6a502a3ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 7 Nov 2014 11:37:34 +0100 Subject: [PATCH 4/6] static const variable name fix --- libdevcrypto/EC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdevcrypto/EC.cpp b/libdevcrypto/EC.cpp index 237acebc5..a54c0132d 100644 --- a/libdevcrypto/EC.cpp +++ b/libdevcrypto/EC.cpp @@ -134,7 +134,7 @@ bool crypto::verify(Signature const& _signature, bytesConstRef _message) bool crypto::verify(Public const& _p, Signature const& _sig, bytesConstRef _message, bool _hashed) { - static const size_t derMaxEncodingLength = 72; + static const size_t c_derMaxEncodingLength = 72; if (_hashed) { assert(_message.size() == 32); From 489fb2b430a24eb6b7e2617db3bb7b8646481ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 11 Nov 2014 18:00:49 +0100 Subject: [PATCH 5/6] static const variable name fix --- libdevcrypto/EC.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libdevcrypto/EC.cpp b/libdevcrypto/EC.cpp index a54c0132d..a3438ede1 100644 --- a/libdevcrypto/EC.cpp +++ b/libdevcrypto/EC.cpp @@ -134,15 +134,15 @@ bool crypto::verify(Signature const& _signature, bytesConstRef _message) bool crypto::verify(Public const& _p, Signature const& _sig, bytesConstRef _message, bool _hashed) { - static const size_t c_derMaxEncodingLength = 72; if (_hashed) { assert(_message.size() == 32); byte encpub[65] = {0x04}; memcpy(&encpub[1], _p.data(), 64); - byte dersig[derMaxEncodingLength]; - size_t cssz = DSAConvertSignatureFormat(dersig, derMaxEncodingLength, DSA_DER, _sig.data(), 64, DSA_P1363); - assert(cssz <= derMaxEncodingLength); + static const size_t c_derMaxEncodingLength = 72; + byte dersig[c_derMaxEncodingLength]; + size_t cssz = DSAConvertSignatureFormat(dersig, c_derMaxEncodingLength, DSA_DER, _sig.data(), 64, DSA_P1363); + assert(cssz <= c_derMaxEncodingLength); return (1 == secp256k1_ecdsa_verify(_message.data(), _message.size(), dersig, cssz, encpub, 65)); } From ffdfb74b45a29b57d61710e0d6bf6f5c2f8cb9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Fri, 14 Nov 2014 13:42:07 +0100 Subject: [PATCH 6/6] Update Visual Studio project files --- windows/LibEthereum.vcxproj | 7 ++++--- windows/LibEthereum.vcxproj.filters | 17 ++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/windows/LibEthereum.vcxproj b/windows/LibEthereum.vcxproj index 35ca956d3..0578a8f16 100644 --- a/windows/LibEthereum.vcxproj +++ b/windows/LibEthereum.vcxproj @@ -125,8 +125,8 @@ - + true true @@ -341,7 +341,8 @@ - + + true @@ -567,4 +568,4 @@ - + \ No newline at end of file diff --git a/windows/LibEthereum.vcxproj.filters b/windows/LibEthereum.vcxproj.filters index 514320472..114364008 100644 --- a/windows/LibEthereum.vcxproj.filters +++ b/windows/LibEthereum.vcxproj.filters @@ -40,9 +40,6 @@ libevmcore - - liblll - liblll @@ -202,6 +199,9 @@ libethereum + + libevmcore + @@ -248,9 +248,6 @@ liblll - - - libevmcore liblll @@ -435,6 +432,12 @@ libethereum + + libevmcore + + + libevmcore + @@ -471,4 +474,4 @@ {d838fece-fc20-42f6-bff5-97c236159b80} - + \ No newline at end of file