Permalink
Browse files

Changed verifyNodePublic to use ed25519 in libsodium. NOT FUNCTIONAL.

None of the key generation or signature functions have been updated.
  • Loading branch information...
David Mazieres
David Mazieres committed Jul 10, 2014
1 parent 2e2c68a commit 1ecc992b87c3732dd45e69ae3b02b8072c536015
Showing with 22 additions and 15 deletions.
  1. +2 −0 SConstruct
  2. +7 −0 src/ripple_app/ripple_app.cpp
  3. +13 −15 src/ripple_data/protocol/RippleAddress.cpp
View
@@ -99,6 +99,8 @@ else:
env.ParseConfig('pkg-config --static --cflags --libs openssl')
# Use protobuf
env.ParseConfig('pkg-config --static --cflags --libs protobuf')
# Use libsodium
env.ParseConfig('pkg-config --static --cflags --libs libsodium')
# Beast uses kvm on FreeBSD
if FreeBSD:
@@ -27,6 +27,8 @@
#include <boost/optional.hpp>
#include <boost/version.hpp>
#include <sodium.h>
#include "ripple_app.h"
#include "../ripple_net/ripple_net.h"
@@ -123,6 +125,11 @@ int main (int argc, char** argv)
static_assert (BOOST_VERSION >= 105500,
"Boost version 1.55 or later is required to compile rippled");
if (sodium_init() == -1) {
std::cerr << "sodium_init failed\n";
return 1;
}
//
// These debug heap calls do nothing in release or non Visual Studio builds.
@@ -18,6 +18,7 @@
//==============================================================================
#include "../../beast/beast/unit_test/suite.h"
#include <sodium.h>
namespace ripple {
@@ -165,24 +166,21 @@ void RippleAddress::setNodePublic (Blob const& vPublic)
SetData (VER_NODE_PUBLIC, vPublic);
}
bool RippleAddress::verifyNodePublic (uint256 const& hash, Blob const& vchSig, ECDSA fullyCanonical) const
bool RippleAddress::verifyNodePublic (uint256 const& hash, Blob const& vchSig, ECDSA) const
{
CKey pubkey = CKey ();
bool bVerified;
if (getNodePublic().size() != crypto_sign_PUBLICKEYBYTES
|| vchSig.size () != crypto_sign_BYTES)
return false;
bVerified = isCanonicalECDSASig (vchSig, fullyCanonical);
unsigned char signed_buf[crypto_sign_BYTES + hash.bytes];
memcpy (signed_buf, vchSig.data(), crypto_sign_BYTES);
memcpy (signed_buf+crypto_sign_BYTES, hash.data(), hash.bytes);
if (bVerified && !pubkey.SetPubKey (getNodePublic ()))
{
// Failed to set public key.
bVerified = false;
}
else
{
bVerified = pubkey.Verify (hash, vchSig);
}
return bVerified;
unsigned char ignored_buf[hash.bytes];
unsigned long long ignored_len;
return crypto_sign_open (ignored_buf, &ignored_len,
signed_buf, sizeof (signed_buf),
getNodePublic().data()) == 0;
}
bool RippleAddress::verifyNodePublic (uint256 const& hash, const std::string& strSig, ECDSA fullyCanonical) const

0 comments on commit 1ecc992

Please sign in to comment.