hsmd: don't use point32 for bolt12, but use pubkeys (though still always 02)

This is the one place where we hand point32 over the wire internally, so
remove it.

This is also our first hsm version change!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-10-17 11:05:41 +10:30
parent bed905a394
commit 4e39b3ff3d
9 changed files with 57 additions and 29 deletions

View File

@@ -224,16 +224,14 @@ void sighash_from_merkle(const char *messagename,
*
* Since key used to be x-only, we don't hash first byte!
*/
void payer_key_tweak(const struct point32 *bolt12,
void payer_key_tweak(const struct pubkey *bolt12,
const u8 *publictweak, size_t publictweaklen,
struct sha256 *tweak)
{
u8 rawkey[PUBKEY_CMPR_LEN];
struct sha256_ctx sha;
struct pubkey pk;
pk.pubkey = bolt12->pubkey;
pubkey_to_der(rawkey, &pk);
pubkey_to_der(rawkey, bolt12);
sha256_init(&sha);
sha256_update(&sha, rawkey + 1, sizeof(rawkey) - 1);

View File

@@ -25,7 +25,7 @@ void sighash_from_merkle(const char *messagename,
/**
* payer_key_tweak - get the actual tweak to use for a payer_key
*/
void payer_key_tweak(const struct point32 *bolt12,
void payer_key_tweak(const struct pubkey *bolt12,
const u8 *publictweak, size_t publictweaklen,
struct sha256 *tweak);

View File

@@ -11,7 +11,7 @@
#define HSM_MIN_VERSION 1
/* wire/hsmd_wire.csv contents version:
* 409cffa355ab6cc76bd298910adca9936a68223267ddc4815ba16aeac5d0acc3
* 43c435f61de3af0dd7a91514d94b3e0762c962fce5b39be430538f8c6c4b0695
*/
#define HSM_MAX_VERSION 1
#define HSM_MAX_VERSION 2
#endif /* LIGHTNING_COMMON_HSM_VERSION_H */