diff --git a/src/crypto/elliptic_common.cpp b/src/crypto/elliptic_common.cpp index dd89c3a..8e4f802 100644 --- a/src/crypto/elliptic_common.cpp +++ b/src/crypto/elliptic_common.cpp @@ -7,8 +7,6 @@ #ifdef _WIN32 # include -#else -# include #endif /* stuff common to all ecc implementations */ @@ -231,12 +229,11 @@ namespace fc { namespace ecc { static std::string _to_base58( const extended_key_data& key ) { - size_t buf_len = key.size() + 4; - char *buffer = (char*)alloca(buf_len); + char buffer[key.size() + 4]; // it's a small static array => allocate on stack memcpy( buffer, key.data(), key.size() ); - fc::sha256 double_hash = fc::sha256::hash( fc::sha256::hash( (char*) key.data(), key.size() )); + fc::sha256 double_hash = fc::sha256::hash( fc::sha256::hash( (char*)key.data(), key.size() )); memcpy( buffer + key.size(), double_hash.data(), 4 ); - return fc::to_base58( buffer, buf_len ); + return fc::to_base58( buffer, sizeof(buffer) ); } static void _parse_extended_data( unsigned char* buffer, std::string base58 ) diff --git a/src/crypto/elliptic_secp256k1.cpp b/src/crypto/elliptic_secp256k1.cpp index b180d44..11969fc 100644 --- a/src/crypto/elliptic_secp256k1.cpp +++ b/src/crypto/elliptic_secp256k1.cpp @@ -14,8 +14,6 @@ #if _WIN32 # include -#else -# include #endif #include "_elliptic_impl_priv.hpp"