diff --git a/channeld/channeld.c b/channeld/channeld.c index 73dad4261..5e5eeb4a8 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -2320,7 +2320,7 @@ static void peer_in(struct peer *peer, const u8 *msg) case WIRE_PING: case WIRE_WARNING: case WIRE_ERROR: - case WIRE_ONION_MESSAGE: + case WIRE_OBS2_ONION_MESSAGE: abort(); } diff --git a/common/blindedpath.c b/common/blindedpath.c index ab16d8569..9e8569811 100644 --- a/common/blindedpath.c +++ b/common/blindedpath.c @@ -61,7 +61,7 @@ static bool blind_node(const struct privkey *blinding, static u8 *enctlv_from_encmsg(const tal_t *ctx, const struct privkey *blinding, const struct pubkey *node, - const struct tlv_encmsg_tlvs *encmsg, + const struct tlv_obs2_encmsg_tlvs *encmsg, struct privkey *next_blinding, struct pubkey *node_alias) { @@ -89,7 +89,7 @@ static u8 *enctlv_from_encmsg(const tal_t *ctx, /* Marshall */ ret = tal_arr(ctx, u8, 0); - towire_encmsg_tlvs(&ret, encmsg); + towire_obs2_encmsg_tlvs(&ret, encmsg); SUPERVERBOSE("\t\"encmsg_hex\": \"%s\",\n", tal_hex(tmpctx, ret)); /* @@ -136,16 +136,16 @@ bool unblind_onion(const struct pubkey *blinding, hmac.data) == 1; } -static struct tlv_encmsg_tlvs *decrypt_encmsg(const tal_t *ctx, - const struct pubkey *blinding, - const struct secret *ss, - const u8 *enctlv) +static struct tlv_obs2_encmsg_tlvs *decrypt_encmsg(const tal_t *ctx, + const struct pubkey *blinding, + const struct secret *ss, + const u8 *enctlv) { struct secret rho; u8 *dec; const u8 *cursor; size_t maxlen; - struct tlv_encmsg_tlvs *encmsg; + struct tlv_obs2_encmsg_tlvs *encmsg; /* All-zero npub */ static const unsigned char npub[crypto_aead_chacha20poly1305_ietf_NPUBBYTES]; @@ -179,21 +179,21 @@ static struct tlv_encmsg_tlvs *decrypt_encmsg(const tal_t *ctx, * - if the `enctlv` is not a valid TLV... * - MUST drop the message. */ - encmsg = tlv_encmsg_tlvs_new(ctx); - if (!fromwire_encmsg_tlvs(&cursor, &maxlen, encmsg) + encmsg = tlv_obs2_encmsg_tlvs_new(ctx); + if (!fromwire_obs2_encmsg_tlvs(&cursor, &maxlen, encmsg) || !tlv_fields_valid(encmsg->fields, NULL, NULL)) return tal_free(encmsg); return encmsg; } -bool decrypt_enctlv(const struct pubkey *blinding, - const struct secret *ss, - const u8 *enctlv, - struct pubkey *next_node, - struct pubkey *next_blinding) +bool decrypt_obs2_enctlv(const struct pubkey *blinding, + const struct secret *ss, + const u8 *enctlv, + struct pubkey *next_node, + struct pubkey *next_blinding) { - struct tlv_encmsg_tlvs *encmsg; + struct tlv_obs2_encmsg_tlvs *encmsg; encmsg = decrypt_encmsg(tmpctx, blinding, ss, enctlv); if (!encmsg) @@ -244,15 +244,15 @@ bool decrypt_enctlv(const struct pubkey *blinding, return true; } -bool decrypt_final_enctlv(const tal_t *ctx, - const struct pubkey *blinding, - const struct secret *ss, - const u8 *enctlv, - const struct pubkey *my_id, - struct pubkey *alias, - struct secret **self_id) +bool decrypt_obs2_final_enctlv(const tal_t *ctx, + const struct pubkey *blinding, + const struct secret *ss, + const u8 *enctlv, + const struct pubkey *my_id, + struct pubkey *alias, + struct secret **self_id) { - struct tlv_encmsg_tlvs *encmsg; + struct tlv_obs2_encmsg_tlvs *encmsg; struct secret node_id_blinding; /* Repeat the tweak to get the alias it was using for us */ @@ -276,16 +276,16 @@ bool decrypt_final_enctlv(const tal_t *ctx, return true; } -u8 *create_enctlv(const tal_t *ctx, - const struct privkey *blinding, - const struct pubkey *node, - const struct pubkey *next_node, - size_t padlen, - const struct pubkey *override_blinding, - struct privkey *next_blinding, - struct pubkey *node_alias) +u8 *create_obs2_enctlv(const tal_t *ctx, + const struct privkey *blinding, + const struct pubkey *node, + const struct pubkey *next_node, + size_t padlen, + const struct pubkey *override_blinding, + struct privkey *next_blinding, + struct pubkey *node_alias) { - struct tlv_encmsg_tlvs *encmsg = tlv_encmsg_tlvs_new(tmpctx); + struct tlv_obs2_encmsg_tlvs *encmsg = tlv_obs2_encmsg_tlvs_new(tmpctx); if (padlen) encmsg->padding = tal_arrz(encmsg, u8, padlen); encmsg->next_node_id = cast_const(struct pubkey *, next_node); @@ -295,14 +295,14 @@ u8 *create_enctlv(const tal_t *ctx, next_blinding, node_alias); } -u8 *create_final_enctlv(const tal_t *ctx, - const struct privkey *blinding, - const struct pubkey *final_node, - size_t padlen, - const struct secret *self_id, - struct pubkey *node_alias) +u8 *create_obs2_final_enctlv(const tal_t *ctx, + const struct privkey *blinding, + const struct pubkey *final_node, + size_t padlen, + const struct secret *self_id, + struct pubkey *node_alias) { - struct tlv_encmsg_tlvs *encmsg = tlv_encmsg_tlvs_new(tmpctx); + struct tlv_obs2_encmsg_tlvs *encmsg = tlv_obs2_encmsg_tlvs_new(tmpctx); struct privkey unused_next_blinding; if (padlen) diff --git a/common/blindedpath.h b/common/blindedpath.h index 1a54f5c1d..a207c316d 100644 --- a/common/blindedpath.h +++ b/common/blindedpath.h @@ -23,7 +23,7 @@ struct secret; * * Returns the enctlv blob, or NULL if the secret is invalid. */ -u8 *create_enctlv(const tal_t *ctx, +u8 *create_obs2_enctlv(const tal_t *ctx, const struct privkey *blinding, const struct pubkey *node, const struct pubkey *next_node, @@ -44,7 +44,7 @@ u8 *create_enctlv(const tal_t *ctx, * * If it fails, it means one of the privkeys is bad. */ -u8 *create_final_enctlv(const tal_t *ctx, +u8 *create_obs2_final_enctlv(const tal_t *ctx, const struct privkey *blinding, const struct pubkey *final_node, size_t padlen, @@ -77,7 +77,7 @@ bool unblind_onion(const struct pubkey *blinding, * * Returns false if decryption failed or encmsg was malformed. */ -bool decrypt_enctlv(const struct pubkey *blinding, +bool decrypt_obs2_enctlv(const struct pubkey *blinding, const struct secret *ss, const u8 *enctlv, struct pubkey *next_node, @@ -96,7 +96,7 @@ bool decrypt_enctlv(const struct pubkey *blinding, * * Returns false if decryption failed or encmsg was malformed. */ -bool decrypt_final_enctlv(const tal_t *ctx, +bool decrypt_obs2_final_enctlv(const tal_t *ctx, const struct pubkey *blinding, const struct secret *ss, const u8 *enctlv, diff --git a/common/json_helpers.c b/common/json_helpers.c index bcde33a61..0fa2233c9 100644 --- a/common/json_helpers.c +++ b/common/json_helpers.c @@ -141,15 +141,15 @@ struct wally_psbt *json_to_psbt(const tal_t *ctx, const char *buffer, return psbt_from_b64(ctx, buffer + tok->start, tok->end - tok->start); } -struct tlv_onionmsg_payload_reply_path * -json_to_reply_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok) +struct tlv_obs2_onionmsg_payload_reply_path * +json_to_obs2_reply_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok) { - struct tlv_onionmsg_payload_reply_path *rpath; + struct tlv_obs2_onionmsg_payload_reply_path *rpath; const jsmntok_t *hops, *t; size_t i; const char *err; - rpath = tal(ctx, struct tlv_onionmsg_payload_reply_path); + rpath = tal(ctx, struct tlv_obs2_onionmsg_payload_reply_path); err = json_scan(tmpctx, buffer, tok, "{blinding:%,first_node_id:%}", JSON_SCAN(json_to_pubkey, &rpath->blinding), JSON_SCAN(json_to_pubkey, &rpath->first_node_id), diff --git a/common/json_helpers.h b/common/json_helpers.h index e3001a0e7..c6febd343 100644 --- a/common/json_helpers.h +++ b/common/json_helpers.h @@ -80,8 +80,8 @@ bool split_tok(const char *buffer, const jsmntok_t *tok, jsmntok_t *b); /* Extract reply path from this JSON */ -struct tlv_onionmsg_payload_reply_path * -json_to_reply_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok); +struct tlv_obs2_onionmsg_payload_reply_path * +json_to_obs2_reply_path(const tal_t *ctx, const char *buffer, const jsmntok_t *tok); /* Helpers for outputting JSON results */ diff --git a/common/test/run-blindedpath_enctlv.c b/common/test/run-blindedpath_enctlv.c index ec735ec10..867b8c82f 100644 --- a/common/test/run-blindedpath_enctlv.c +++ b/common/test/run-blindedpath_enctlv.c @@ -84,7 +84,7 @@ static void test_decrypt(const struct pubkey *blinding, mykey = me; assert(unblind_onion(blinding, test_ecdh, &dummy, &ss)); - assert(decrypt_enctlv(blinding, &ss, enctlv, &next_node, &next_blinding)); + assert(decrypt_obs2_enctlv(blinding, &ss, enctlv, &next_node, &next_blinding)); pubkey_from_privkey(expected_next_blinding_priv, &expected_next_blinding); assert(pubkey_eq(&next_blinding, &expected_next_blinding)); @@ -106,8 +106,8 @@ static void test_final_decrypt(const struct pubkey *blinding, mykey = me; pubkey_from_privkey(me, &my_pubkey); assert(unblind_onion(blinding, test_ecdh, &dummy, &ss)); - assert(decrypt_final_enctlv(tmpctx, blinding, &ss, enctlv, &my_pubkey, - &alias, &self_id)); + assert(decrypt_obs2_final_enctlv(tmpctx, blinding, &ss, enctlv, &my_pubkey, + &alias, &self_id)); assert(pubkey_eq(&alias, expected_alias)); assert(secret_eq_consttime(self_id, expected_self_id)); @@ -150,8 +150,8 @@ int main(int argc, char *argv[]) "\t},\n", type_to_string(tmpctx, struct pubkey, &bob_id)); - enctlv = create_enctlv(tmpctx, &blinding, &alice_id, &bob_id, - 0, NULL, &blinding, &alias); + enctlv = create_obs2_enctlv(tmpctx, &blinding, &alice_id, &bob_id, + 0, NULL, &blinding, &alias); printf("\t\"enctlv_hex\": \"%s\"\n" "},\n", tal_hex(tmpctx, enctlv)); @@ -180,8 +180,8 @@ int main(int argc, char *argv[]) type_to_string(tmpctx, struct pubkey, &carol_id), type_to_string(tmpctx, struct privkey, &override_blinding)); - enctlv = create_enctlv(tmpctx, &blinding, &bob_id, &carol_id, - 0, &override_blinding_pub, &blinding, &alias); + enctlv = create_obs2_enctlv(tmpctx, &blinding, &bob_id, &carol_id, + 0, &override_blinding_pub, &blinding, &alias); printf("\t\"enctlv_hex\": \"%s\"\n" "},\n", tal_hex(tmpctx, enctlv)); @@ -209,8 +209,8 @@ int main(int argc, char *argv[]) type_to_string(tmpctx, struct pubkey, &dave_id), tal_hex(tmpctx, tal_arrz(tmpctx, u8, 35))); - enctlv = create_enctlv(tmpctx, &blinding, &carol_id, &dave_id, - 35, NULL, &blinding, &alias); + enctlv = create_obs2_enctlv(tmpctx, &blinding, &carol_id, &dave_id, + 35, NULL, &blinding, &alias); printf("\t\"enctlv_hex\": \"%s\"\n" "}]\n", tal_hex(tmpctx, enctlv)); @@ -220,8 +220,8 @@ int main(int argc, char *argv[]) /* FIXME: Add this to the test vectors! */ fclose(stdout); memset(&self_id, 0x77, sizeof(self_id)); - enctlv = create_final_enctlv(tmpctx, &blinding, &dave_id, - 0, &self_id, &alias); + enctlv = create_obs2_final_enctlv(tmpctx, &blinding, &dave_id, + 0, &self_id, &alias); pubkey_from_privkey(&blinding, &blinding_pub); test_final_decrypt(&blinding_pub, enctlv, &dave, &alias, &self_id); diff --git a/devtools/blindedpath.c b/devtools/blindedpath.c index 7647e8c58..57d320894 100644 --- a/devtools/blindedpath.c +++ b/devtools/blindedpath.c @@ -138,17 +138,17 @@ int main(int argc, char **argv) u8 *p; u8 buf[BIGSIZE_MAX_LEN]; const unsigned char npub[crypto_aead_chacha20poly1305_ietf_NPUBBYTES] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - struct tlv_onionmsg_payload *outer; - struct tlv_encmsg_tlvs *inner; + struct tlv_obs2_onionmsg_payload *outer; + struct tlv_obs2_encmsg_tlvs *inner; int ret; /* Inner is encrypted */ - inner = tlv_encmsg_tlvs_new(tmpctx); + inner = tlv_obs2_encmsg_tlvs_new(tmpctx); inner->next_node_id = tal_dup(inner, struct pubkey, &nodes[i+1]); p = tal_arr(tmpctx, u8, 0); - towire_encmsg_tlvs(&p, inner); + towire_obs2_encmsg_tlvs(&p, inner); - outer = tlv_onionmsg_payload_new(tmpctx); + outer = tlv_obs2_onionmsg_payload_new(tmpctx); outer->enctlv = tal_arr(outer, u8, tal_count(p) + crypto_aead_chacha20poly1305_ietf_ABYTES); ret = crypto_aead_chacha20poly1305_ietf_encrypt(outer->enctlv, NULL, @@ -160,7 +160,7 @@ int main(int argc, char **argv) assert(ret == 0); p = tal_arr(tmpctx, u8, 0); - towire_onionmsg_payload(&p, outer); + towire_obs2_onionmsg_payload(&p, outer); ret = bigsize_put(buf, tal_bytelen(p)); if (simpleout) { @@ -194,7 +194,7 @@ int main(int argc, char **argv) struct secret hmac, rho; struct route_step *rs; const u8 *cursor; - struct tlv_onionmsg_payload *outer; + struct tlv_obs2_onionmsg_payload *outer; size_t max, len; struct pubkey res; struct sha256 h; @@ -257,8 +257,8 @@ int main(int argc, char **argv) /* Always true since we're non-legacy */ assert(len == max); - outer = tlv_onionmsg_payload_new(tmpctx); - if (!fromwire_onionmsg_payload(&cursor, &max, outer)) + outer = tlv_obs2_onionmsg_payload_new(tmpctx); + if (!fromwire_obs2_onionmsg_payload(&cursor, &max, outer)) errx(1, "Invalid payload %s", tal_hex(tmpctx, rs->raw_payload)); diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index cdc75156d..b9e07a353 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -350,15 +350,15 @@ static bool handle_local_channel_announcement(struct daemon *daemon, return true; } -/* Peer sends onion msg. */ -static u8 *handle_onion_message(struct peer *peer, const u8 *msg) +/* Peer sends obsolete onion msg. */ +static u8 *handle_obs2_onion_message(struct peer *peer, const u8 *msg) { enum onion_wire badreason; struct onionpacket *op; struct pubkey blinding, ephemeral; struct route_step *rs; u8 *onion; - struct tlv_onionmsg_payload *om; + struct tlv_obs2_onionmsg_payload *om; struct secret ss, onion_ss; const u8 *cursor; size_t max, maxlen; @@ -369,7 +369,7 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg) return NULL; /* FIXME: ratelimit! */ - if (!fromwire_onion_message(msg, msg, &blinding, &onion)) + if (!fromwire_obs2_onion_message(msg, msg, &blinding, &onion)) return towire_warningfmt(peer, NULL, "Bad onion_message"); /* We unwrap the onion now. */ @@ -411,8 +411,8 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg) return NULL; } - om = tlv_onionmsg_payload_new(msg); - if (!fromwire_onionmsg_payload(&cursor, &maxlen, om)) { + om = tlv_obs2_onionmsg_payload_new(msg); + if (!fromwire_obs2_onionmsg_payload(&cursor, &maxlen, om)) { status_peer_debug(&peer->id, "onion msg: invalid onionmsg_payload %s", tal_hex(tmpctx, rs->raw_payload)); return NULL; @@ -433,9 +433,9 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg) if (!om->enctlv) { alias = me; self_id = NULL; - } else if (!decrypt_final_enctlv(tmpctx, &blinding, &ss, - om->enctlv, &me, &alias, - &self_id)) { + } else if (!decrypt_obs2_final_enctlv(tmpctx, &blinding, &ss, + om->enctlv, &me, &alias, + &self_id)) { status_peer_debug(&peer->id, "onion msg: failed to decrypt enctlv" " %s", tal_hex(tmpctx, om->enctlv)); @@ -469,8 +469,8 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg) struct node_id next_node_id; /* This fails as expected if no enctlv. */ - if (!decrypt_enctlv(&blinding, &ss, om->enctlv, &next_node, - &next_blinding)) { + if (!decrypt_obs2_enctlv(&blinding, &ss, om->enctlv, &next_node, + &next_blinding)) { status_peer_debug(&peer->id, "onion msg: invalid enctlv %s", tal_hex(tmpctx, om->enctlv)); @@ -490,9 +490,9 @@ static u8 *handle_onion_message(struct peer *peer, const u8 *msg) return NULL; } queue_peer_msg(next_peer, - take(towire_onion_message(NULL, - &next_blinding, - serialize_onionpacket(tmpctx, rs->next)))); + take(towire_obs2_onion_message(NULL, + &next_blinding, + serialize_onionpacket(tmpctx, rs->next)))); } return NULL; @@ -514,8 +514,8 @@ static struct io_plan *onionmsg_req(struct io_conn *conn, struct daemon *daemon, peer = find_peer(daemon, &id); if (peer) { queue_peer_msg(peer, - take(towire_onion_message(NULL, - &blinding, onionmsg))); + take(towire_obs2_onion_message(NULL, + &blinding, onionmsg))); } return daemon_conn_read_next(conn, daemon->master); } @@ -553,8 +553,8 @@ static struct io_plan *peer_msg_in(struct io_conn *conn, case WIRE_REPLY_SHORT_CHANNEL_IDS_END: err = handle_reply_short_channel_ids_end(peer, msg); goto handled_relay; - case WIRE_ONION_MESSAGE: - err = handle_onion_message(peer, msg); + case WIRE_OBS2_ONION_MESSAGE: + err = handle_obs2_onion_message(peer, msg); goto handled_relay; /* These are non-gossip messages (!is_msg_for_gossipd()) */ diff --git a/gossipd/gossipd_wire.csv b/gossipd/gossipd_wire.csv index 2deab8752..4a1e49a35 100644 --- a/gossipd/gossipd_wire.csv +++ b/gossipd/gossipd_wire.csv @@ -84,7 +84,7 @@ msgdata,gossipd_got_onionmsg_to_us,reply_path,onionmsg_path,reply_path_len msgdata,gossipd_got_onionmsg_to_us,rawmsg_len,u16, msgdata,gossipd_got_onionmsg_to_us,rawmsg,u8,rawmsg_len -# Lightningd tells us to send a onion message. +# Lightningd tells us to send an onion message. msgtype,gossipd_send_onionmsg,3041 msgdata,gossipd_send_onionmsg,id,node_id, msgdata,gossipd_send_onionmsg,onion_len,u16, diff --git a/lightningd/onion_message.c b/lightningd/onion_message.c index e1bdd27a1..1a0de05e9 100644 --- a/lightningd/onion_message.c +++ b/lightningd/onion_message.c @@ -21,7 +21,7 @@ struct onion_message_hook_payload { struct pubkey *reply_first_node; struct pubkey *our_alias; - struct tlv_onionmsg_payload *om; + struct tlv_obs2_onionmsg_payload *om; }; static void json_add_blindedpath(struct json_stream *stream, @@ -116,7 +116,7 @@ void handle_onionmsg_to_us(struct lightningd *ld, const u8 *msg) const u8 *subptr; payload = tal(ld, struct onion_message_hook_payload); - payload->om = tlv_onionmsg_payload_new(payload); + payload->om = tlv_obs2_onionmsg_payload_new(payload); payload->our_alias = tal(payload, struct pubkey); if (!fromwire_gossipd_got_onionmsg_to_us(payload, msg, @@ -138,8 +138,8 @@ void handle_onionmsg_to_us(struct lightningd *ld, const u8 *msg) submsglen = tal_bytelen(submsg); subptr = submsg; - if (!fromwire_onionmsg_payload(&subptr, - &submsglen, payload->om)) { + if (!fromwire_obs2_onionmsg_payload(&subptr, + &submsglen, payload->om)) { tal_free(payload); log_broken(ld->log, "bad got_onionmsg_tous om: %s", tal_hex(tmpctx, msg)); @@ -327,26 +327,26 @@ static struct command_result *json_blindedpath(struct command *cmd, for (size_t i = 0; i < nhops - 1; i++) { path[i] = tal(path, struct onionmsg_path); - path[i]->enctlv = create_enctlv(path[i], - &blinding_iter, - &ids[i], - &ids[i+1], - /* FIXME: Pad? */ - 0, - NULL, - &blinding_iter, - &path[i]->node_id); + path[i]->enctlv = create_obs2_enctlv(path[i], + &blinding_iter, + &ids[i], + &ids[i+1], + /* FIXME: Pad? */ + 0, + NULL, + &blinding_iter, + &path[i]->node_id); } /* FIXME: Add padding! */ path[nhops-1] = tal(path, struct onionmsg_path); - path[nhops-1]->enctlv = create_final_enctlv(path[nhops-1], - &blinding_iter, - &ids[nhops-1], - /* FIXME: Pad? */ - 0, - &cmd->ld->onion_reply_secret, - &path[nhops-1]->node_id); + path[nhops-1]->enctlv = create_obs2_final_enctlv(path[nhops-1], + &blinding_iter, + &ids[nhops-1], + /* FIXME: Pad? */ + 0, + &cmd->ld->onion_reply_secret, + &path[nhops-1]->node_id); response = json_stream_success(cmd); json_add_blindedpath(response, "blindedpath", diff --git a/openingd/dualopend.c b/openingd/dualopend.c index 528c3e604..903aaa7f2 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -1285,7 +1285,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state) case WIRE_CHANNEL_REESTABLISH: case WIRE_ANNOUNCEMENT_SIGNATURES: case WIRE_GOSSIP_TIMESTAMP_FILTER: - case WIRE_ONION_MESSAGE: + case WIRE_OBS2_ONION_MESSAGE: case WIRE_ACCEPT_CHANNEL2: case WIRE_TX_ADD_INPUT: case WIRE_TX_REMOVE_INPUT: @@ -1631,7 +1631,7 @@ static bool run_tx_interactive(struct state *state, case WIRE_CHANNEL_REESTABLISH: case WIRE_ANNOUNCEMENT_SIGNATURES: case WIRE_GOSSIP_TIMESTAMP_FILTER: - case WIRE_ONION_MESSAGE: + case WIRE_OBS2_ONION_MESSAGE: case WIRE_TX_SIGNATURES: case WIRE_OPEN_CHANNEL2: case WIRE_ACCEPT_CHANNEL2: @@ -3684,7 +3684,7 @@ static u8 *handle_peer_in(struct state *state) case WIRE_CHANNEL_REESTABLISH: case WIRE_ANNOUNCEMENT_SIGNATURES: case WIRE_GOSSIP_TIMESTAMP_FILTER: - case WIRE_ONION_MESSAGE: + case WIRE_OBS2_ONION_MESSAGE: case WIRE_ACCEPT_CHANNEL2: case WIRE_TX_ADD_INPUT: case WIRE_TX_REMOVE_INPUT: diff --git a/plugins/fetchinvoice.c b/plugins/fetchinvoice.c index b66785673..06d2f4097 100644 --- a/plugins/fetchinvoice.c +++ b/plugins/fetchinvoice.c @@ -639,14 +639,14 @@ struct sending { static struct command_result * send_modern_message(struct command *cmd, - struct tlv_onionmsg_payload_reply_path *reply_path, + struct tlv_obs2_onionmsg_payload_reply_path *reply_path, struct sending *sending) { struct sent *sent = sending->sent; struct privkey blinding_iter; struct pubkey fwd_blinding, *node_alias; size_t nhops = tal_count(sent->path); - struct tlv_onionmsg_payload **payloads; + struct tlv_obs2_onionmsg_payload **payloads; struct out_req *req; /* Now create enctlvs for *forward* path. */ @@ -658,29 +658,29 @@ send_modern_message(struct command *cmd, &blinding_iter)); /* We overallocate: this node (0) doesn't have payload or alias */ - payloads = tal_arr(cmd, struct tlv_onionmsg_payload *, nhops); + payloads = tal_arr(cmd, struct tlv_obs2_onionmsg_payload *, nhops); node_alias = tal_arr(cmd, struct pubkey, nhops); for (size_t i = 1; i < nhops - 1; i++) { - payloads[i] = tlv_onionmsg_payload_new(payloads); - payloads[i]->enctlv = create_enctlv(payloads[i], - &blinding_iter, - &sent->path[i], - &sent->path[i+1], - /* FIXME: Pad? */ - 0, - NULL, - &blinding_iter, - &node_alias[i]); + payloads[i] = tlv_obs2_onionmsg_payload_new(payloads); + payloads[i]->enctlv = create_obs2_enctlv(payloads[i], + &blinding_iter, + &sent->path[i], + &sent->path[i+1], + /* FIXME: Pad? */ + 0, + NULL, + &blinding_iter, + &node_alias[i]); } /* Final payload contains the actual data. */ - payloads[nhops-1] = tlv_onionmsg_payload_new(payloads); + payloads[nhops-1] = tlv_obs2_onionmsg_payload_new(payloads); /* We don't include enctlv in final, but it gives us final alias */ - if (!create_final_enctlv(tmpctx, &blinding_iter, &sent->path[nhops-1], - /* FIXME: Pad? */ 0, - NULL, - &node_alias[nhops-1])) { + if (!create_obs2_final_enctlv(tmpctx, &blinding_iter, &sent->path[nhops-1], + /* FIXME: Pad? */ 0, + NULL, + &node_alias[nhops-1])) { /* Should not happen! */ return command_fail(cmd, LIGHTNINGD, "Could create final enctlv"); @@ -709,7 +709,7 @@ send_modern_message(struct command *cmd, json_object_start(req->js, NULL); json_add_pubkey(req->js, "id", &node_alias[i]); tlv = tal_arr(tmpctx, u8, 0); - towire_onionmsg_payload(&tlv, payloads[i]); + towire_obs2_onionmsg_payload(&tlv, payloads[i]); json_add_hex_talarr(req->js, "tlv", tlv); json_object_end(req->js); } @@ -724,10 +724,10 @@ static struct command_result *use_reply_path(struct command *cmd, const jsmntok_t *result, struct sending *sending) { - struct tlv_onionmsg_payload_reply_path *rpath; + struct tlv_obs2_onionmsg_payload_reply_path *rpath; - rpath = json_to_reply_path(cmd, buf, - json_get_member(buf, result, "blindedpath")); + rpath = json_to_obs2_reply_path(cmd, buf, + json_get_member(buf, result, "blindedpath")); if (!rpath) plugin_err(cmd->plugin, "could not parse reply path %.*s?", diff --git a/plugins/offers.c b/plugins/offers.c index 3d69bfe8f..0de0718a9 100644 --- a/plugins/offers.c +++ b/plugins/offers.c @@ -43,7 +43,7 @@ static struct command_result *sendonionmessage_error(struct command *cmd, /* FIXME: replyfield string interface is to accomodate obsolete API */ struct command_result * send_onion_reply(struct command *cmd, - struct tlv_onionmsg_payload_reply_path *reply_path, + struct tlv_obs2_onionmsg_payload_reply_path *reply_path, const char *replyfield, const u8 *replydata) { @@ -57,13 +57,13 @@ send_onion_reply(struct command *cmd, json_add_pubkey(req->js, "blinding", &reply_path->blinding); json_array_start(req->js, "hops"); for (size_t i = 0; i < nhops; i++) { - struct tlv_onionmsg_payload *omp; + struct tlv_obs2_onionmsg_payload *omp; u8 *tlv; json_object_start(req->js, NULL); json_add_pubkey(req->js, "id", &reply_path->path[i]->node_id); - omp = tlv_onionmsg_payload_new(tmpctx); + omp = tlv_obs2_onionmsg_payload_new(tmpctx); omp->enctlv = reply_path->path[i]->enctlv; /* Put payload in last hop. */ @@ -76,7 +76,7 @@ send_onion_reply(struct command *cmd, } } tlv = tal_arr(tmpctx, u8, 0); - towire_onionmsg_payload(&tlv, omp); + towire_obs2_onionmsg_payload(&tlv, omp); json_add_hex_talarr(req->js, "tlv", tlv); json_object_end(req->js); } @@ -89,7 +89,7 @@ static struct command_result *onion_message_modern_call(struct command *cmd, const jsmntok_t *params) { const jsmntok_t *om, *replytok, *invreqtok, *invtok; - struct tlv_onionmsg_payload_reply_path *reply_path; + struct tlv_obs2_onionmsg_payload_reply_path *reply_path; if (!offers_enabled) return command_hook_success(cmd); @@ -97,7 +97,7 @@ static struct command_result *onion_message_modern_call(struct command *cmd, om = json_get_member(buf, params, "onion_message"); replytok = json_get_member(buf, om, "reply_blindedpath"); if (replytok) { - reply_path = json_to_reply_path(cmd, buf, replytok); + reply_path = json_to_obs2_reply_path(cmd, buf, replytok); if (!reply_path) plugin_err(cmd->plugin, "Invalid reply path %.*s?", json_tok_full_len(replytok), diff --git a/plugins/offers.h b/plugins/offers.h index dab0c6216..00a5480fb 100644 --- a/plugins/offers.h +++ b/plugins/offers.h @@ -9,7 +9,7 @@ struct command; /* Helper to send a reply */ struct command_result *WARN_UNUSED_RESULT send_onion_reply(struct command *cmd, - struct tlv_onionmsg_payload_reply_path *reply_path, + struct tlv_obs2_onionmsg_payload_reply_path *reply_path, const char *replyfield, const u8 *replydata); #endif /* LIGHTNING_PLUGINS_OFFERS_H */ diff --git a/plugins/offers_inv_hook.c b/plugins/offers_inv_hook.c index 22d245448..efbaa6f6f 100644 --- a/plugins/offers_inv_hook.c +++ b/plugins/offers_inv_hook.c @@ -11,7 +11,7 @@ struct inv { struct tlv_invoice *inv; /* May be NULL */ - struct tlv_onionmsg_payload_reply_path *reply_path; + struct tlv_obs2_onionmsg_payload_reply_path *reply_path; /* The offer, once we've looked it up. */ struct tlv_offer *offer; @@ -313,7 +313,7 @@ static struct command_result *listoffers_error(struct command *cmd, struct command_result *handle_invoice(struct command *cmd, const u8 *invbin, - struct tlv_onionmsg_payload_reply_path *reply_path STEALS) + struct tlv_obs2_onionmsg_payload_reply_path *reply_path STEALS) { size_t len = tal_count(invbin); struct inv *inv = tal(cmd, struct inv); diff --git a/plugins/offers_inv_hook.h b/plugins/offers_inv_hook.h index fbc12ace6..fae90f981 100644 --- a/plugins/offers_inv_hook.h +++ b/plugins/offers_inv_hook.h @@ -6,5 +6,5 @@ /* We got an onionmessage with an invoice! reply_path could be NULL. */ struct command_result *handle_invoice(struct command *cmd, const u8 *invbin, - struct tlv_onionmsg_payload_reply_path *reply_path STEALS); + struct tlv_obs2_onionmsg_payload_reply_path *reply_path STEALS); #endif /* LIGHTNING_PLUGINS_OFFERS_INV_HOOK_H */ diff --git a/plugins/offers_invreq_hook.c b/plugins/offers_invreq_hook.c index 313ef3a65..ef37f393e 100644 --- a/plugins/offers_invreq_hook.c +++ b/plugins/offers_invreq_hook.c @@ -15,7 +15,7 @@ /* We need to keep the reply path around so we can reply with invoice */ struct invreq { struct tlv_invoice_request *invreq; - struct tlv_onionmsg_payload_reply_path *reply_path; + struct tlv_obs2_onionmsg_payload_reply_path *reply_path; /* The offer, once we've looked it up. */ struct tlv_offer *offer; @@ -830,7 +830,7 @@ static struct command_result *handle_offerless_request(struct command *cmd, struct command_result *handle_invoice_request(struct command *cmd, const u8 *invreqbin, - struct tlv_onionmsg_payload_reply_path *reply_path) + struct tlv_obs2_onionmsg_payload_reply_path *reply_path) { size_t len = tal_count(invreqbin); struct invreq *ir = tal(cmd, struct invreq); diff --git a/plugins/offers_invreq_hook.h b/plugins/offers_invreq_hook.h index a51d0e800..502679970 100644 --- a/plugins/offers_invreq_hook.h +++ b/plugins/offers_invreq_hook.h @@ -8,5 +8,5 @@ extern u32 cltv_final; /* We got an onionmessage with an invreq! */ struct command_result *handle_invoice_request(struct command *cmd, const u8 *invreqbin, - struct tlv_onionmsg_payload_reply_path *reply_path STEALS); + struct tlv_obs2_onionmsg_payload_reply_path *reply_path STEALS); #endif /* LIGHTNING_PLUGINS_OFFERS_INVREQ_HOOK_H */ diff --git a/wire/extracted_onion_01_offers.patch b/wire/extracted_onion_01_offers.patch index 44a313ce0..90c0cb6c4 100644 --- a/wire/extracted_onion_01_offers.patch +++ b/wire/extracted_onion_01_offers.patch @@ -4,26 +4,26 @@ tlvtype,tlv_payload,payment_data,8 tlvdata,tlv_payload,payment_data,payment_secret,byte,32 tlvdata,tlv_payload,payment_data,total_msat,tu64, -+tlvtype,onionmsg_payload,reply_path,2 -+tlvdata,onionmsg_payload,reply_path,first_node_id,point, -+tlvdata,onionmsg_payload,reply_path,blinding,point, -+tlvdata,onionmsg_payload,reply_path,path,onionmsg_path,... -+tlvtype,onionmsg_payload,enctlv,10 -+tlvdata,onionmsg_payload,enctlv,enctlv,byte,... -+tlvtype,onionmsg_payload,invoice_request,64 -+tlvdata,onionmsg_payload,invoice_request,invoice_request,byte,... -+tlvtype,onionmsg_payload,invoice,66 -+tlvdata,onionmsg_payload,invoice,invoice,byte,... -+tlvtype,onionmsg_payload,invoice_error,68 -+tlvdata,onionmsg_payload,invoice_error,invoice_error,byte,... -+tlvtype,encmsg_tlvs,padding,1 -+tlvdata,encmsg_tlvs,padding,pad,byte,... -+tlvtype,encmsg_tlvs,next_node_id,4 -+tlvdata,encmsg_tlvs,next_node_id,node_id,point, -+tlvtype,encmsg_tlvs,next_blinding,12 -+tlvdata,encmsg_tlvs,next_blinding,blinding,point, -+tlvtype,encmsg_tlvs,self_id,14 -+tlvdata,encmsg_tlvs,self_id,data,byte,... ++tlvtype,obs2_onionmsg_payload,reply_path,2 ++tlvdata,obs2_onionmsg_payload,reply_path,first_node_id,point, ++tlvdata,obs2_onionmsg_payload,reply_path,blinding,point, ++tlvdata,obs2_onionmsg_payload,reply_path,path,onionmsg_path,... ++tlvtype,obs2_onionmsg_payload,enctlv,10 ++tlvdata,obs2_onionmsg_payload,enctlv,enctlv,byte,... ++tlvtype,obs2_onionmsg_payload,invoice_request,64 ++tlvdata,obs2_onionmsg_payload,invoice_request,invoice_request,byte,... ++tlvtype,obs2_onionmsg_payload,invoice,66 ++tlvdata,obs2_onionmsg_payload,invoice,invoice,byte,... ++tlvtype,obs2_onionmsg_payload,invoice_error,68 ++tlvdata,obs2_onionmsg_payload,invoice_error,invoice_error,byte,... ++tlvtype,obs2_encmsg_tlvs,padding,1 ++tlvdata,obs2_encmsg_tlvs,padding,pad,byte,... ++tlvtype,obs2_encmsg_tlvs,next_node_id,4 ++tlvdata,obs2_encmsg_tlvs,next_node_id,node_id,point, ++tlvtype,obs2_encmsg_tlvs,next_blinding,12 ++tlvdata,obs2_encmsg_tlvs,next_blinding,blinding,point, ++tlvtype,obs2_encmsg_tlvs,self_id,14 ++tlvdata,obs2_encmsg_tlvs,self_id,data,byte,... +subtype,onionmsg_path +subtypedata,onionmsg_path,node_id,point, +subtypedata,onionmsg_path,enclen,u16, diff --git a/wire/extracted_onion_exp_enctlv.patch b/wire/extracted_onion_exp_enctlv.patch index ea55b7704..59d5b08c6 100644 --- a/wire/extracted_onion_exp_enctlv.patch +++ b/wire/extracted_onion_exp_enctlv.patch @@ -8,6 +8,6 @@ +tlvdata,tlv_payload,enctlv,enctlv,byte,... +tlvtype,tlv_payload,blinding_seed,12 +tlvdata,tlv_payload,blinding_seed,blinding_seed,pubkey, - tlvtype,onionmsg_payload,reply_path,2 - tlvdata,onionmsg_payload,reply_path,first_node_id,point, - tlvdata,onionmsg_payload,reply_path,blinding,point, + tlvtype,obs2_onionmsg_payload,reply_path,2 + tlvdata,obs2_onionmsg_payload,reply_path,first_node_id,point, + tlvdata,obs2_onionmsg_payload,reply_path,blinding,point, diff --git a/wire/extracted_peer_05_newonion.patch b/wire/extracted_peer_05_newonion.patch index 7e581997d..ed35699aa 100644 --- a/wire/extracted_peer_05_newonion.patch +++ b/wire/extracted_peer_05_newonion.patch @@ -4,7 +4,7 @@ msgdata,gossip_timestamp_filter,chain_hash,chain_hash, msgdata,gossip_timestamp_filter,first_timestamp,u32, msgdata,gossip_timestamp_filter,timestamp_range,u32, -+msgtype,onion_message,387,option_onion_messages -+msgdata,onion_message,blinding,point, -+msgdata,onion_message,len,u16, -+msgdata,onion_message,onionmsg,byte,len ++msgtype,obs2_onion_message,387,option_onion_messages ++msgdata,obs2_onion_message,blinding,point, ++msgdata,obs2_onion_message,len,u16, ++msgdata,obs2_onion_message,onionmsg,byte,len diff --git a/wire/onion_wire.csv b/wire/onion_wire.csv index e3c7bc27f..ca41fd885 100644 --- a/wire/onion_wire.csv +++ b/wire/onion_wire.csv @@ -8,26 +8,26 @@ tlvdata,tlv_payload,short_channel_id,short_channel_id,short_channel_id, tlvtype,tlv_payload,payment_data,8 tlvdata,tlv_payload,payment_data,payment_secret,byte,32 tlvdata,tlv_payload,payment_data,total_msat,tu64, -tlvtype,onionmsg_payload,reply_path,2 -tlvdata,onionmsg_payload,reply_path,first_node_id,point, -tlvdata,onionmsg_payload,reply_path,blinding,point, -tlvdata,onionmsg_payload,reply_path,path,onionmsg_path,... -tlvtype,onionmsg_payload,enctlv,10 -tlvdata,onionmsg_payload,enctlv,enctlv,byte,... -tlvtype,onionmsg_payload,invoice_request,64 -tlvdata,onionmsg_payload,invoice_request,invoice_request,byte,... -tlvtype,onionmsg_payload,invoice,66 -tlvdata,onionmsg_payload,invoice,invoice,byte,... -tlvtype,onionmsg_payload,invoice_error,68 -tlvdata,onionmsg_payload,invoice_error,invoice_error,byte,... -tlvtype,encmsg_tlvs,padding,1 -tlvdata,encmsg_tlvs,padding,pad,byte,... -tlvtype,encmsg_tlvs,next_node_id,4 -tlvdata,encmsg_tlvs,next_node_id,node_id,point, -tlvtype,encmsg_tlvs,next_blinding,12 -tlvdata,encmsg_tlvs,next_blinding,blinding,point, -tlvtype,encmsg_tlvs,self_id,14 -tlvdata,encmsg_tlvs,self_id,data,byte,... +tlvtype,obs2_onionmsg_payload,reply_path,2 +tlvdata,obs2_onionmsg_payload,reply_path,first_node_id,point, +tlvdata,obs2_onionmsg_payload,reply_path,blinding,point, +tlvdata,obs2_onionmsg_payload,reply_path,path,onionmsg_path,... +tlvtype,obs2_onionmsg_payload,enctlv,10 +tlvdata,obs2_onionmsg_payload,enctlv,enctlv,byte,... +tlvtype,obs2_onionmsg_payload,invoice_request,64 +tlvdata,obs2_onionmsg_payload,invoice_request,invoice_request,byte,... +tlvtype,obs2_onionmsg_payload,invoice,66 +tlvdata,obs2_onionmsg_payload,invoice,invoice,byte,... +tlvtype,obs2_onionmsg_payload,invoice_error,68 +tlvdata,obs2_onionmsg_payload,invoice_error,invoice_error,byte,... +tlvtype,obs2_encmsg_tlvs,padding,1 +tlvdata,obs2_encmsg_tlvs,padding,pad,byte,... +tlvtype,obs2_encmsg_tlvs,next_node_id,4 +tlvdata,obs2_encmsg_tlvs,next_node_id,node_id,point, +tlvtype,obs2_encmsg_tlvs,next_blinding,12 +tlvdata,obs2_encmsg_tlvs,next_blinding,blinding,point, +tlvtype,obs2_encmsg_tlvs,self_id,14 +tlvdata,obs2_encmsg_tlvs,self_id,data,byte,... subtype,onionmsg_path subtypedata,onionmsg_path,node_id,point, subtypedata,onionmsg_path,enclen,u16, diff --git a/wire/peer_wire.c b/wire/peer_wire.c index 7fb1d2ae8..1a259da3f 100644 --- a/wire/peer_wire.c +++ b/wire/peer_wire.c @@ -33,7 +33,7 @@ static bool unknown_type(enum peer_wire t) case WIRE_QUERY_CHANNEL_RANGE: case WIRE_REPLY_CHANNEL_RANGE: case WIRE_GOSSIP_TIMESTAMP_FILTER: - case WIRE_ONION_MESSAGE: + case WIRE_OBS2_ONION_MESSAGE: case WIRE_TX_ADD_INPUT: case WIRE_TX_REMOVE_INPUT: case WIRE_TX_ADD_OUTPUT: @@ -62,7 +62,7 @@ bool is_msg_for_gossipd(const u8 *cursor) case WIRE_REPLY_SHORT_CHANNEL_IDS_END: case WIRE_QUERY_CHANNEL_RANGE: case WIRE_REPLY_CHANNEL_RANGE: - case WIRE_ONION_MESSAGE: + case WIRE_OBS2_ONION_MESSAGE: return true; case WIRE_WARNING: case WIRE_INIT: diff --git a/wire/peer_wire.csv b/wire/peer_wire.csv index 23b9d8bc5..0a28459fa 100644 --- a/wire/peer_wire.csv +++ b/wire/peer_wire.csv @@ -328,7 +328,7 @@ msgtype,gossip_timestamp_filter,265,gossip_queries msgdata,gossip_timestamp_filter,chain_hash,chain_hash, msgdata,gossip_timestamp_filter,first_timestamp,u32, msgdata,gossip_timestamp_filter,timestamp_range,u32, -msgtype,onion_message,387,option_onion_messages -msgdata,onion_message,blinding,point, -msgdata,onion_message,len,u16, -msgdata,onion_message,onionmsg,byte,len +msgtype,obs2_onion_message,387,option_onion_messages +msgdata,obs2_onion_message,blinding,point, +msgdata,obs2_onion_message,len,u16, +msgdata,obs2_onion_message,onionmsg,byte,len