@ -41,8 +41,8 @@
# include <errno.h>
# include <fcntl.h>
# include <hsmd/capabilities.h>
/*~ All gen_ files are autogenerated; in this case by tools/generate-wire.py */
# include <hsmd/gen_ hsm_wire.h>
/*~ _wiregen files are autogenerated by tools/generate-wire.py */
# include <hsmd/hsmd _wiregen .h>
# include <inttypes.h>
# include <secp256k1_ecdh.h>
# include <sodium.h>
@ -690,7 +690,7 @@ static struct io_plan *init_hsm(struct io_conn *conn,
* definitions in hsm_client_wire . csv . The format of those files is
* an extension of the simple comma - separated format output by the
* BOLT tools / extract - formats . py tool . */
if ( ! fromwire_hsm_init ( NULL , msg_in , & bip32_key_version , & chainparams ,
if ( ! fromwire_hsmd _init ( NULL , msg_in , & bip32_key_version , & chainparams ,
& hsm_encryption_key , & privkey , & seed , & secrets , & shaseed ) )
return bad_req ( conn , c , msg_in ) ;
@ -731,7 +731,7 @@ static struct io_plan *init_hsm(struct io_conn *conn,
* not the secrets ! So we ' re not actually handing them out here !
*/
return req_reply ( conn , c ,
take ( towire_hsm_init_reply ( NULL , & node_id ,
take ( towire_hsmd _init_reply ( NULL , & node_id ,
& secretstuff . bip32 ) ) ) ;
}
@ -747,7 +747,7 @@ static struct io_plan *handle_ecdh(struct io_conn *conn,
struct pubkey point ;
struct secret ss ;
if ( ! fromwire_hsm_ecdh_req ( msg_in , & point ) )
if ( ! fromwire_hsmd _ecdh_req ( msg_in , & point ) )
return bad_req ( conn , c , msg_in ) ;
/*~ We simply use the secp256k1_ecdh function: if privkey.secret.data is invalid,
@ -760,7 +760,7 @@ static struct io_plan *handle_ecdh(struct io_conn *conn,
/*~ In the normal case, we return the shared secret, and then read
* the next msg . */
return req_reply ( conn , c , take ( towire_hsm_ecdh_resp ( NULL , & ss ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _ecdh_resp ( NULL , & ss ) ) ) ;
}
/*~ The specific routine to sign the channel_announcement message. This is
@ -812,7 +812,7 @@ static struct io_plan *handle_cannouncement_sig(struct io_conn *conn,
/*~ fromwire_ routines which need to do allocation take a tal context
* as their first field ; tmpctx is good here since we won ' t need it
* after this function . */
if ( ! fromwire_hsm_cannouncement_sig_req ( tmpctx , msg_in , & ca ) )
if ( ! fromwire_hsmd _cannouncement_sig_req ( tmpctx , msg_in , & ca ) )
return bad_req ( conn , c , msg_in ) ;
if ( tal_count ( ca ) < offset )
@ -830,7 +830,7 @@ static struct io_plan *handle_cannouncement_sig(struct io_conn *conn,
sign_hash ( & node_pkey , & hash , & node_sig ) ;
sign_hash ( & funding_privkey , & hash , & bitcoin_sig ) ;
reply = towire_hsm_cannouncement_sig_reply ( NULL , & node_sig ,
reply = towire_hsmd _cannouncement_sig_reply ( NULL , & node_sig ,
& bitcoin_sig ) ;
return req_reply ( conn , c , take ( reply ) ) ;
}
@ -859,7 +859,7 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn,
struct bitcoin_blkid chain_hash ;
u8 * cu ;
if ( ! fromwire_hsm_cupdate_sig_req ( tmpctx , msg_in , & cu ) )
if ( ! fromwire_hsmd _cupdate_sig_req ( tmpctx , msg_in , & cu ) )
return bad_req ( conn , c , msg_in ) ;
if ( ! fromwire_channel_update_option_channel_htlc_max ( cu , & sig ,
@ -883,7 +883,7 @@ static struct io_plan *handle_channel_update_sig(struct io_conn *conn,
cltv_expiry_delta , htlc_minimum ,
fee_base_msat , fee_proportional_mill ,
htlc_maximum ) ;
return req_reply ( conn , c , take ( towire_hsm_cupdate_sig_reply ( NULL , cu ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _cupdate_sig_reply ( NULL , cu ) ) ) ;
}
/*~ This gets the basepoints for a channel; it's not private information really
@ -902,14 +902,14 @@ static struct io_plan *handle_get_channel_basepoints(struct io_conn *conn,
struct basepoints basepoints ;
struct pubkey funding_pubkey ;
if ( ! fromwire_hsm_get_channel_basepoints ( msg_in , & peer_id , & dbid ) )
if ( ! fromwire_hsmd _get_channel_basepoints ( msg_in , & peer_id , & dbid ) )
return bad_req ( conn , c , msg_in ) ;
get_channel_seed ( & peer_id , dbid , & seed ) ;
derive_basepoints ( & seed , & funding_pubkey , & basepoints , NULL , NULL ) ;
return req_reply ( conn , c ,
take ( towire_hsm_get_channel_basepoints_reply ( NULL ,
take ( towire_hsmd _get_channel_basepoints_reply ( NULL ,
& basepoints ,
& funding_pubkey ) ) ) ;
}
@ -934,7 +934,7 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
struct secrets secrets ;
const u8 * funding_wscript ;
if ( ! fromwire_hsm_sign_commitment_tx ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_commitment_tx ( tmpctx , msg_in ,
& peer_id , & dbid ,
& tx ,
& remote_funding_pubkey ) )
@ -965,7 +965,7 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
& sig ) ;
return req_reply ( conn , c ,
take ( towire_hsm_sign_commitment_tx_reply ( NULL , & sig ) ) ) ;
take ( towire_hsmd _sign_commitment_tx_reply ( NULL , & sig ) ) ) ;
}
/*~ This is used by channeld to create signatures for the remote peer's
@ -989,7 +989,7 @@ static struct io_plan *handle_sign_remote_commitment_tx(struct io_conn *conn,
struct pubkey remote_per_commit ;
bool option_static_remotekey ;
if ( ! fromwire_hsm_sign_remote_commitment_tx ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_remote_commitment_tx ( tmpctx , msg_in ,
& tx ,
& remote_funding_pubkey ,
& remote_per_commit ,
@ -1016,7 +1016,7 @@ static struct io_plan *handle_sign_remote_commitment_tx(struct io_conn *conn,
SIGHASH_ALL ,
& sig ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _sign_tx_reply ( NULL , & sig ) ) ) ;
}
/*~ This is used by channeld to create signatures for the remote peer's
@ -1036,7 +1036,7 @@ static struct io_plan *handle_sign_remote_htlc_tx(struct io_conn *conn,
struct pubkey htlc_pubkey ;
bool option_anchor_outputs ;
if ( ! fromwire_hsm_sign_remote_htlc_tx ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_remote_htlc_tx ( tmpctx , msg_in ,
& tx , & wscript ,
& remote_per_commit_point ,
& option_anchor_outputs ) )
@ -1069,7 +1069,7 @@ static struct io_plan *handle_sign_remote_htlc_tx(struct io_conn *conn,
? ( SIGHASH_SINGLE | SIGHASH_ANYONECANPAY )
: SIGHASH_ALL , & sig ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _sign_tx_reply ( NULL , & sig ) ) ) ;
}
/*~ This covers several cases where onchaind is creating a transaction which
@ -1094,7 +1094,7 @@ static struct io_plan *handle_sign_to_us_tx(struct io_conn *conn,
sign_tx_input ( tx , 0 , NULL , wscript , privkey , & pubkey , sighash_type , & sig ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _sign_tx_reply ( NULL , & sig ) ) ) ;
}
/*~ When we send a commitment transaction onchain (unilateral close), there's
@ -1115,7 +1115,7 @@ static struct io_plan *handle_sign_delayed_payment_to_us(struct io_conn *conn,
u8 * wscript ;
/*~ We don't derive the wscript ourselves, but perhaps we should? */
if ( ! fromwire_hsm_sign_delayed_payment_to_us ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_delayed_payment_to_us ( tmpctx , msg_in ,
& commit_num ,
& tx , & wscript ) )
return bad_req ( conn , c , msg_in ) ;
@ -1169,7 +1169,7 @@ static struct io_plan *handle_sign_remote_htlc_to_us(struct io_conn *conn,
u8 * wscript ;
bool option_anchor_outputs ;
if ( ! fromwire_hsm_sign_remote_htlc_to_us ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_remote_htlc_to_us ( tmpctx , msg_in ,
& remote_per_commitment_point ,
& tx , & wscript ,
& option_anchor_outputs ) )
@ -1217,7 +1217,7 @@ static struct io_plan *handle_sign_penalty_to_us(struct io_conn *conn,
struct privkey privkey ;
u8 * wscript ;
if ( ! fromwire_hsm_sign_penalty_to_us ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_penalty_to_us ( tmpctx , msg_in ,
& revocation_secret ,
& tx , & wscript ) )
return bad_req ( conn , c , msg_in ) ;
@ -1264,7 +1264,7 @@ static struct io_plan *handle_sign_local_htlc_tx(struct io_conn *conn,
struct pubkey htlc_pubkey ;
bool option_anchor_outputs ;
if ( ! fromwire_hsm_sign_local_htlc_tx ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_local_htlc_tx ( tmpctx , msg_in ,
& commit_num , & tx , & wscript ,
& option_anchor_outputs ) )
return bad_req ( conn , c , msg_in ) ;
@ -1313,7 +1313,7 @@ static struct io_plan *handle_sign_local_htlc_tx(struct io_conn *conn,
: SIGHASH_ALL ,
& sig ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _sign_tx_reply ( NULL , & sig ) ) ) ;
}
/*~ This get the Nth a per-commitment point, and for N > 2, returns the
@ -1331,7 +1331,7 @@ static struct io_plan *handle_get_per_commitment_point(struct io_conn *conn,
u64 n ;
struct secret * old_secret ;
if ( ! fromwire_hsm_get_per_commitment_point ( msg_in , & n ) )
if ( ! fromwire_hsmd _get_per_commitment_point ( msg_in , & n ) )
return bad_req ( conn , c , msg_in ) ;
get_channel_seed ( & c - > id , c - > dbid , & channel_seed ) ;
@ -1356,7 +1356,7 @@ static struct io_plan *handle_get_per_commitment_point(struct io_conn *conn,
* gets included if the parameter is non - NULL . We violate 80 columns
* pretty badly here , but it ' s a recommendation not a religion . */
return req_reply ( conn , c ,
take ( towire_hsm_get_per_commitment_point_reply ( NULL ,
take ( towire_hsmd _get_per_commitment_point_reply ( NULL ,
& per_commitment_point ,
old_secret ) ) ) ;
}
@ -1374,7 +1374,7 @@ static struct io_plan *handle_check_future_secret(struct io_conn *conn,
u64 n ;
struct secret secret , suggested ;
if ( ! fromwire_hsm_check_future_secret ( msg_in , & n , & suggested ) )
if ( ! fromwire_hsmd _check_future_secret ( msg_in , & n , & suggested ) )
return bad_req ( conn , c , msg_in ) ;
get_channel_seed ( & c - > id , c - > dbid , & channel_seed ) ;
@ -1390,7 +1390,7 @@ static struct io_plan *handle_check_future_secret(struct io_conn *conn,
* comparison risks leaking information about the secret if it is
* timing dependent . */
return req_reply ( conn , c ,
take ( towire_hsm_check_future_secret_reply ( NULL ,
take ( towire_hsmd _check_future_secret_reply ( NULL ,
secret_eq_consttime ( & secret , & suggested ) ) ) ) ;
}
@ -1406,7 +1406,7 @@ static struct io_plan *handle_sign_mutual_close_tx(struct io_conn *conn,
struct secrets secrets ;
const u8 * funding_wscript ;
if ( ! fromwire_hsm_sign_mutual_close_tx ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_mutual_close_tx ( tmpctx , msg_in ,
& tx ,
& remote_funding_pubkey ) )
return bad_req ( conn , c , msg_in ) ;
@ -1427,7 +1427,7 @@ static struct io_plan *handle_sign_mutual_close_tx(struct io_conn *conn,
& local_funding_pubkey ,
SIGHASH_ALL , & sig ) ;
return req_reply ( conn , c , take ( towire_hsm_sign_tx_reply ( NULL , & sig ) ) ) ;
return req_reply ( conn , c , take ( towire_hsmd _sign_tx_reply ( NULL , & sig ) ) ) ;
}
/*~ Since we process requests then service them in strict order, and because
@ -1473,7 +1473,7 @@ static struct io_plan *pass_client_hsmfd(struct io_conn *conn,
/* This must be lightningd itself. */
assert ( is_lightningd ( c ) ) ;
if ( ! fromwire_hsm_client_hsmfd ( msg_in , & id , & dbid , & capabilities ) )
if ( ! fromwire_hsmd _client_hsmfd ( msg_in , & id , & dbid , & capabilities ) )
return bad_req ( conn , c , msg_in ) ;
/* socketpair is a bi-directional pipe, which is what we want. */
@ -1488,7 +1488,7 @@ static struct io_plan *pass_client_hsmfd(struct io_conn *conn,
* the client pointer to the callback . The other way would be to
* create a boutique structure and hand that , but we don ' t need to . */
pending_client_fd = fds [ 1 ] ;
return io_write_wire ( conn , take ( towire_hsm_client_hsmfd_reply ( NULL ) ) ,
return io_write_wire ( conn , take ( towire_hsmd _client_hsmfd_reply ( NULL ) ) ,
send_pending_client_fd , c ) ;
}
@ -1606,14 +1606,14 @@ static struct io_plan *handle_sign_withdrawal_tx(struct io_conn *conn,
struct utxo * * utxos ;
struct wally_psbt * psbt ;
if ( ! fromwire_hsm_sign_withdrawal ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _sign_withdrawal ( tmpctx , msg_in ,
& utxos , & psbt ) )
return bad_req ( conn , c , msg_in ) ;
sign_our_inputs ( utxos , psbt ) ;
return req_reply ( conn , c ,
take ( towire_hsm_sign_withdrawal_reply ( NULL , psbt ) ) ) ;
take ( towire_hsmd _sign_withdrawal_reply ( NULL , psbt ) ) ) ;
}
static struct io_plan * handle_get_output_scriptpubkey ( struct io_conn * conn ,
@ -1626,7 +1626,7 @@ static struct io_plan *handle_get_output_scriptpubkey(struct io_conn *conn,
u8 * scriptPubkey ;
info . commitment_point = NULL ;
if ( ! fromwire_hsm_get_output_scriptpubkey ( tmpctx , msg_in ,
if ( ! fromwire_hsmd _get_output_scriptpubkey ( tmpctx , msg_in ,
& info . channel_id ,
& info . peer_id ,
& info . commitment_point ) )
@ -1637,7 +1637,7 @@ static struct io_plan *handle_get_output_scriptpubkey(struct io_conn *conn,
scriptPubkey = scriptpubkey_p2wpkh ( tmpctx , & pubkey ) ;
return req_reply ( conn , c ,
take ( towire_hsm_get_output_scriptpubkey_reply ( NULL ,
take ( towire_hsmd _get_output_scriptpubkey_reply ( NULL ,
scriptPubkey ) ) ) ;
}
@ -1661,7 +1661,7 @@ static struct io_plan *handle_sign_invoice(struct io_conn *conn,
struct hash_u5 hu5 ;
struct privkey node_pkey ;
if ( ! fromwire_hsm_sign_invoice ( tmpctx , msg_in , & u5bytes , & hrpu8 ) )
if ( ! fromwire_hsmd _sign_invoice ( tmpctx , msg_in , & u5bytes , & hrpu8 ) )
return bad_req ( conn , c , msg_in ) ;
/* BOLT #11:
@ -1702,7 +1702,7 @@ static struct io_plan *handle_sign_invoice(struct io_conn *conn,
}
return req_reply ( conn , c ,
take ( towire_hsm_sign_invoice_reply ( NULL , & rsig ) ) ) ;
take ( towire_hsmd _sign_invoice_reply ( NULL , & rsig ) ) ) ;
}
/*~ It's optional for nodes to send node_announcement, but it lets us set our
@ -1728,7 +1728,7 @@ static struct io_plan *handle_sign_node_announcement(struct io_conn *conn,
u8 * reply ;
u8 * ann ;
if ( ! fromwire_hsm_node_announcement_sig_req ( tmpctx , msg_in , & ann ) )
if ( ! fromwire_hsmd _node_announcement_sig_req ( tmpctx , msg_in , & ann ) )
return bad_req ( conn , c , msg_in ) ;
if ( tal_count ( ann ) < offset )
@ -1744,7 +1744,7 @@ static struct io_plan *handle_sign_node_announcement(struct io_conn *conn,
sign_hash ( & node_pkey , & hash , & sig ) ;
reply = towire_hsm_node_announcement_sig_reply ( NULL , & sig ) ;
reply = towire_hsmd _node_announcement_sig_reply ( NULL , & sig ) ;
return req_reply ( conn , c , take ( reply ) ) ;
}
@ -1766,7 +1766,7 @@ static struct io_plan *handle_sign_message(struct io_conn *conn,
secp256k1_ecdsa_recoverable_signature rsig ;
struct privkey node_pkey ;
if ( ! fromwire_hsm_sign_message ( tmpctx , msg_in , & msg ) )
if ( ! fromwire_hsmd _sign_message ( tmpctx , msg_in , & msg ) )
return bad_req ( conn , c , msg_in ) ;
/* Prefixing by a known string means we'll never be convinced
@ -1787,7 +1787,7 @@ static struct io_plan *handle_sign_message(struct io_conn *conn,
}
return req_reply ( conn , c ,
take ( towire_hsm_sign_message_reply ( NULL , & rsig ) ) ) ;
take ( towire_hsmd _sign_message_reply ( NULL , & rsig ) ) ) ;
}
# if DEVELOPER
@ -1812,14 +1812,14 @@ static struct io_plan *handle_memleak(struct io_conn *conn,
memleak_scan_region ( memtable , dev_force_bip32_seed , 0 ) ;
found_leak = dump_memleak ( memtable ) ;
reply = towire_hsm_dev_memleak_reply ( NULL , found_leak ) ;
reply = towire_hsmd _dev_memleak_reply ( NULL , found_leak ) ;
return req_reply ( conn , c , take ( reply ) ) ;
}
# endif /* DEVELOPER */
/*~ This routine checks that a client is allowed to call the handler. */
static bool check_client_capabilities ( struct client * client ,
enum hsm_wire_typ e t )
enum hsmd _wire t )
{
/*~ Here's a useful trick: enums in C are not real types, they're
* semantic sugar sprinkled over an int , bascally ( in fact , older
@ -1836,62 +1836,62 @@ static bool check_client_capabilities(struct client *client,
* we add a new enum identifier !
*/
switch ( t ) {
case WIRE_HSM_ECDH_REQ :
case WIRE_HSMD _ECDH_REQ :
return ( client - > capabilities & HSM_CAP_ECDH ) ! = 0 ;
case WIRE_HSM_CANNOUNCEMENT_SIG_REQ :
case WIRE_HSM_CUPDATE_SIG_REQ :
case WIRE_HSM_NODE_ANNOUNCEMENT_SIG_REQ :
case WIRE_HSMD _CANNOUNCEMENT_SIG_REQ :
case WIRE_HSMD _CUPDATE_SIG_REQ :
case WIRE_HSMD _NODE_ANNOUNCEMENT_SIG_REQ :
return ( client - > capabilities & HSM_CAP_SIGN_GOSSIP ) ! = 0 ;
case WIRE_HSM_SIGN_DELAYED_PAYMENT_TO_US :
case WIRE_HSM_SIGN_REMOTE_HTLC_TO_US :
case WIRE_HSM_SIGN_PENALTY_TO_US :
case WIRE_HSM_SIGN_LOCAL_HTLC_TX :
case WIRE_HSMD _SIGN_DELAYED_PAYMENT_TO_US :
case WIRE_HSMD _SIGN_REMOTE_HTLC_TO_US :
case WIRE_HSMD _SIGN_PENALTY_TO_US :
case WIRE_HSMD _SIGN_LOCAL_HTLC_TX :
return ( client - > capabilities & HSM_CAP_SIGN_ONCHAIN_TX ) ! = 0 ;
case WIRE_HSM_GET_PER_COMMITMENT_POINT :
case WIRE_HSM_CHECK_FUTURE_SECRET :
case WIRE_HSMD _GET_PER_COMMITMENT_POINT :
case WIRE_HSMD _CHECK_FUTURE_SECRET :
return ( client - > capabilities & HSM_CAP_COMMITMENT_POINT ) ! = 0 ;
case WIRE_HSM_SIGN_REMOTE_COMMITMENT_TX :
case WIRE_HSM_SIGN_REMOTE_HTLC_TX :
case WIRE_HSMD _SIGN_REMOTE_COMMITMENT_TX :
case WIRE_HSMD _SIGN_REMOTE_HTLC_TX :
return ( client - > capabilities & HSM_CAP_SIGN_REMOTE_TX ) ! = 0 ;
case WIRE_HSM_SIGN_MUTUAL_CLOSE_TX :
case WIRE_HSMD _SIGN_MUTUAL_CLOSE_TX :
return ( client - > capabilities & HSM_CAP_SIGN_CLOSING_TX ) ! = 0 ;
case WIRE_HSM_INIT :
case WIRE_HSM_CLIENT_HSMFD :
case WIRE_HSM_SIGN_WITHDRAWAL :
case WIRE_HSM_SIGN_INVOICE :
case WIRE_HSM_SIGN_COMMITMENT_TX :
case WIRE_HSM_GET_CHANNEL_BASEPOINTS :
case WIRE_HSM_DEV_MEMLEAK :
case WIRE_HSM_SIGN_MESSAGE :
case WIRE_HSM_GET_OUTPUT_SCRIPTPUBKEY :
case WIRE_HSMD _INIT :
case WIRE_HSMD _CLIENT_HSMFD :
case WIRE_HSMD _SIGN_WITHDRAWAL :
case WIRE_HSMD _SIGN_INVOICE :
case WIRE_HSMD _SIGN_COMMITMENT_TX :
case WIRE_HSMD _GET_CHANNEL_BASEPOINTS :
case WIRE_HSMD _DEV_MEMLEAK :
case WIRE_HSMD _SIGN_MESSAGE :
case WIRE_HSMD _GET_OUTPUT_SCRIPTPUBKEY :
return ( client - > capabilities & HSM_CAP_MASTER ) ! = 0 ;
/*~ These are messages sent by the HSM so we should never receive them. */
/* FIXME: Since we autogenerate these, we should really generate separate
* enums for replies to avoid this kind of clutter ! */
case WIRE_HSM_ECDH_RESP :
case WIRE_HSM_CANNOUNCEMENT_SIG_REPLY :
case WIRE_HSM_CUPDATE_SIG_REPLY :
case WIRE_HSM_CLIENT_HSMFD_REPLY :
case WIRE_HSM_NODE_ANNOUNCEMENT_SIG_REPLY :
case WIRE_HSM_SIGN_WITHDRAWAL_REPLY :
case WIRE_HSM_SIGN_INVOICE_REPLY :
case WIRE_HSM_INIT_REPLY :
case WIRE_HSMD _ECDH_RESP :
case WIRE_HSMD _CANNOUNCEMENT_SIG_REPLY :
case WIRE_HSMD _CUPDATE_SIG_REPLY :
case WIRE_HSMD _CLIENT_HSMFD_REPLY :
case WIRE_HSMD _NODE_ANNOUNCEMENT_SIG_REPLY :
case WIRE_HSMD _SIGN_WITHDRAWAL_REPLY :
case WIRE_HSMD _SIGN_INVOICE_REPLY :
case WIRE_HSMD _INIT_REPLY :
case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST :
case WIRE_HSM_SIGN_COMMITMENT_TX_REPLY :
case WIRE_HSM_SIGN_TX_REPLY :
case WIRE_HSM_GET_PER_COMMITMENT_POINT_REPLY :
case WIRE_HSM_CHECK_FUTURE_SECRET_REPLY :
case WIRE_HSM_GET_CHANNEL_BASEPOINTS_REPLY :
case WIRE_HSM_DEV_MEMLEAK_REPLY :
case WIRE_HSM_SIGN_MESSAGE_REPLY :
case WIRE_HSM_GET_OUTPUT_SCRIPTPUBKEY_REPLY :
case WIRE_HSMD _SIGN_COMMITMENT_TX_REPLY :
case WIRE_HSMD _SIGN_TX_REPLY :
case WIRE_HSMD _GET_PER_COMMITMENT_POINT_REPLY :
case WIRE_HSMD _CHECK_FUTURE_SECRET_REPLY :
case WIRE_HSMD _GET_CHANNEL_BASEPOINTS_REPLY :
case WIRE_HSMD _DEV_MEMLEAK_REPLY :
case WIRE_HSMD _SIGN_MESSAGE_REPLY :
case WIRE_HSMD _GET_OUTPUT_SCRIPTPUBKEY_REPLY :
break ;
}
return false ;
@ -1900,7 +1900,7 @@ static bool check_client_capabilities(struct client *client,
/*~ This is the core of the HSM daemon: handling requests. */
static struct io_plan * handle_client ( struct io_conn * conn , struct client * c )
{
enum hsm_wire_typ e t = fromwire_peektype ( c - > msg_in ) ;
enum hsmd _wire t = fromwire_peektype ( c - > msg_in ) ;
status_debug ( " Client: Received message %d from client " , t ) ;
@ -1912,91 +1912,91 @@ static struct io_plan *handle_client(struct io_conn *conn, struct client *c)
/* Now actually go and do what the client asked for */
switch ( t ) {
case WIRE_HSM_INIT :
case WIRE_HSMD _INIT :
return init_hsm ( conn , c , c - > msg_in ) ;
case WIRE_HSM_CLIENT_HSMFD :
case WIRE_HSMD _CLIENT_HSMFD :
return pass_client_hsmfd ( conn , c , c - > msg_in ) ;
case WIRE_HSM_GET_CHANNEL_BASEPOINTS :
case WIRE_HSMD _GET_CHANNEL_BASEPOINTS :
return handle_get_channel_basepoints ( conn , c , c - > msg_in ) ;
case WIRE_HSM_GET_OUTPUT_SCRIPTPUBKEY :
case WIRE_HSMD _GET_OUTPUT_SCRIPTPUBKEY :
return handle_get_output_scriptpubkey ( conn , c , c - > msg_in ) ;
case WIRE_HSM_ECDH_REQ :
case WIRE_HSMD _ECDH_REQ :
return handle_ecdh ( conn , c , c - > msg_in ) ;
case WIRE_HSM_CANNOUNCEMENT_SIG_REQ :
case WIRE_HSMD _CANNOUNCEMENT_SIG_REQ :
return handle_cannouncement_sig ( conn , c , c - > msg_in ) ;
case WIRE_HSM_CUPDATE_SIG_REQ :
case WIRE_HSMD _CUPDATE_SIG_REQ :
return handle_channel_update_sig ( conn , c , c - > msg_in ) ;
case WIRE_HSM_NODE_ANNOUNCEMENT_SIG_REQ :
case WIRE_HSMD _NODE_ANNOUNCEMENT_SIG_REQ :
return handle_sign_node_announcement ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_INVOICE :
case WIRE_HSMD _SIGN_INVOICE :
return handle_sign_invoice ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_WITHDRAWAL :
case WIRE_HSMD _SIGN_WITHDRAWAL :
return handle_sign_withdrawal_tx ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_COMMITMENT_TX :
case WIRE_HSMD _SIGN_COMMITMENT_TX :
return handle_sign_commitment_tx ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_DELAYED_PAYMENT_TO_US :
case WIRE_HSMD _SIGN_DELAYED_PAYMENT_TO_US :
return handle_sign_delayed_payment_to_us ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_REMOTE_HTLC_TO_US :
case WIRE_HSMD _SIGN_REMOTE_HTLC_TO_US :
return handle_sign_remote_htlc_to_us ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_PENALTY_TO_US :
case WIRE_HSMD _SIGN_PENALTY_TO_US :
return handle_sign_penalty_to_us ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_LOCAL_HTLC_TX :
case WIRE_HSMD _SIGN_LOCAL_HTLC_TX :
return handle_sign_local_htlc_tx ( conn , c , c - > msg_in ) ;
case WIRE_HSM_GET_PER_COMMITMENT_POINT :
case WIRE_HSMD _GET_PER_COMMITMENT_POINT :
return handle_get_per_commitment_point ( conn , c , c - > msg_in ) ;
case WIRE_HSM_CHECK_FUTURE_SECRET :
case WIRE_HSMD _CHECK_FUTURE_SECRET :
return handle_check_future_secret ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_REMOTE_COMMITMENT_TX :
case WIRE_HSMD _SIGN_REMOTE_COMMITMENT_TX :
return handle_sign_remote_commitment_tx ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_REMOTE_HTLC_TX :
case WIRE_HSMD _SIGN_REMOTE_HTLC_TX :
return handle_sign_remote_htlc_tx ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_MUTUAL_CLOSE_TX :
case WIRE_HSMD _SIGN_MUTUAL_CLOSE_TX :
return handle_sign_mutual_close_tx ( conn , c , c - > msg_in ) ;
case WIRE_HSM_SIGN_MESSAGE :
case WIRE_HSMD _SIGN_MESSAGE :
return handle_sign_message ( conn , c , c - > msg_in ) ;
# if DEVELOPER
case WIRE_HSM_DEV_MEMLEAK :
case WIRE_HSMD _DEV_MEMLEAK :
return handle_memleak ( conn , c , c - > msg_in ) ;
# else
case WIRE_HSM_DEV_MEMLEAK :
case WIRE_HSMD _DEV_MEMLEAK :
# endif /* DEVELOPER */
case WIRE_HSM_ECDH_RESP :
case WIRE_HSM_CANNOUNCEMENT_SIG_REPLY :
case WIRE_HSM_CUPDATE_SIG_REPLY :
case WIRE_HSM_CLIENT_HSMFD_REPLY :
case WIRE_HSM_NODE_ANNOUNCEMENT_SIG_REPLY :
case WIRE_HSM_SIGN_WITHDRAWAL_REPLY :
case WIRE_HSM_SIGN_INVOICE_REPLY :
case WIRE_HSM_INIT_REPLY :
case WIRE_HSMD _ECDH_RESP :
case WIRE_HSMD _CANNOUNCEMENT_SIG_REPLY :
case WIRE_HSMD _CUPDATE_SIG_REPLY :
case WIRE_HSMD _CLIENT_HSMFD_REPLY :
case WIRE_HSMD _NODE_ANNOUNCEMENT_SIG_REPLY :
case WIRE_HSMD _SIGN_WITHDRAWAL_REPLY :
case WIRE_HSMD _SIGN_INVOICE_REPLY :
case WIRE_HSMD _INIT_REPLY :
case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST :
case WIRE_HSM_SIGN_COMMITMENT_TX_REPLY :
case WIRE_HSM_SIGN_TX_REPLY :
case WIRE_HSM_GET_PER_COMMITMENT_POINT_REPLY :
case WIRE_HSM_CHECK_FUTURE_SECRET_REPLY :
case WIRE_HSM_GET_CHANNEL_BASEPOINTS_REPLY :
case WIRE_HSM_DEV_MEMLEAK_REPLY :
case WIRE_HSM_SIGN_MESSAGE_REPLY :
case WIRE_HSM_GET_OUTPUT_SCRIPTPUBKEY_REPLY :
case WIRE_HSMD _SIGN_COMMITMENT_TX_REPLY :
case WIRE_HSMD _SIGN_TX_REPLY :
case WIRE_HSMD _GET_PER_COMMITMENT_POINT_REPLY :
case WIRE_HSMD _CHECK_FUTURE_SECRET_REPLY :
case WIRE_HSMD _GET_CHANNEL_BASEPOINTS_REPLY :
case WIRE_HSMD _DEV_MEMLEAK_REPLY :
case WIRE_HSMD _SIGN_MESSAGE_REPLY :
case WIRE_HSMD _GET_OUTPUT_SCRIPTPUBKEY_REPLY :
break ;
}