mirror of https://github.com/oxen-io/lokinet
Abstract signing hash data location
This makes the interface a little cleaner by not requiring the class user to know how we laid out the data in the object.
This commit is contained in:
parent
739ce92aeb
commit
8cd95c01b3
|
@ -194,7 +194,7 @@ namespace llarp
|
|||
// PrivateKeys will come from a hash of the root key's s concatenated with
|
||||
// the derivation hash.
|
||||
crypto_hash_sha512_init(&hs);
|
||||
crypto_hash_sha512_update(&hs, privkey.data() + 32, 32);
|
||||
crypto_hash_sha512_update(&hs, privkey.signingHash(), 32);
|
||||
crypto_hash_sha512_update(&hs, buf.base, buf.sz);
|
||||
crypto_hash_sha512_final(&hs, nonce);
|
||||
crypto_core_ed25519_scalar_reduce(nonce, nonce);
|
||||
|
@ -362,9 +362,9 @@ namespace llarp
|
|||
// s' = H(h || s)
|
||||
std::array< byte_t, 64 > buf;
|
||||
std::copy(h.begin(), h.end(), buf.begin());
|
||||
std::copy(a.begin() + 32, a.end(), buf.begin() + 32);
|
||||
std::copy(a.signingHash(), a.signingHash() + 32, buf.begin() + 32);
|
||||
return -1
|
||||
!= crypto_generichash_blake2b(out_key.data() + 32, 32, buf.data(),
|
||||
!= crypto_generichash_blake2b(out_key.signingHash(), 32, buf.data(),
|
||||
buf.size(), nullptr, 0);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -156,6 +156,22 @@ namespace llarp
|
|||
{
|
||||
}
|
||||
|
||||
/// Returns a pointer to the beginning of the 32-byte hash which is used for
|
||||
/// pseudorandomness when signing with this private key.
|
||||
const byte_t *
|
||||
signingHash() const
|
||||
{
|
||||
return data() + 32;
|
||||
}
|
||||
|
||||
/// Returns a pointer to the beginning of the 32-byte hash which is used for
|
||||
/// pseudorandomness when signing with this private key.
|
||||
byte_t *
|
||||
signingHash()
|
||||
{
|
||||
return data() + 32;
|
||||
}
|
||||
|
||||
std::ostream &
|
||||
print(std::ostream &stream, int level, int spaces) const
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue