mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
1702c7a69a
Note that other directories were explicitly depending on the generated file, instead of relying on their (already existing) dependency on $(LIGHTNINGD_HSM_CLIENT_OBJS), so we remove that. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
7.6 KiB
7.6 KiB
1 | # Clients should not give a bad request but not the HSM's decision to crash. |
---|---|
2 | msgtype,hsmstatus_client_bad_request,1000 |
3 | msgdata,hsmstatus_client_bad_request,id,node_id, |
4 | msgdata,hsmstatus_client_bad_request,description,wirestring, |
5 | msgdata,hsmstatus_client_bad_request,len,u16, |
6 | msgdata,hsmstatus_client_bad_request,msg,u8,len |
7 | #include <bitcoin/chainparams.h> |
8 | # Start the HSM. |
9 | msgtype,hsmd_init,11 |
10 | msgdata,hsmd_init,bip32_key_version,bip32_key_version, |
11 | msgdata,hsmd_init,chainparams,chainparams, |
12 | msgdata,hsmd_init,hsm_encryption_key,?secret, |
13 | msgdata,hsmd_init,dev_force_privkey,?privkey, |
14 | msgdata,hsmd_init,dev_force_bip32_seed,?secret, |
15 | msgdata,hsmd_init,dev_force_channel_secrets,?secrets, |
16 | msgdata,hsmd_init,dev_force_channel_secrets_shaseed,?sha256, |
17 | #include <common/bip32.h> |
18 | msgtype,hsmd_init_reply,111 |
19 | msgdata,hsmd_init_reply,node_id,node_id, |
20 | msgdata,hsmd_init_reply,bip32,ext_key, |
21 | # Get a new HSM FD, with the specified capabilities |
22 | msgtype,hsmd_client_hsmfd,9 |
23 | # Which identity to use for requests |
24 | msgdata,hsmd_client_hsmfd,id,node_id, |
25 | # Database id for this client, if any. |
26 | msgdata,hsmd_client_hsmfd,dbid,u64, |
27 | msgdata,hsmd_client_hsmfd,capabilities,u64, |
28 | # No content, just an fd. |
29 | msgtype,hsmd_client_hsmfd_reply,109 |
30 | #include <common/derive_basepoints.h> |
31 | # Get the basepoints and funding key for this specific channel. |
32 | msgtype,hsmd_get_channel_basepoints,10 |
33 | msgdata,hsmd_get_channel_basepoints,peerid,node_id, |
34 | msgdata,hsmd_get_channel_basepoints,dbid,u64, |
35 | msgtype,hsmd_get_channel_basepoints_reply,110 |
36 | msgdata,hsmd_get_channel_basepoints_reply,basepoints,basepoints, |
37 | msgdata,hsmd_get_channel_basepoints_reply,funding_pubkey,pubkey, |
38 | # Return signature for a funding tx. |
39 | #include <common/utxo.h> |
40 | # Master asks the HSM to sign a node_announcement |
41 | msgtype,hsmd_node_announcement_sig_req,6 |
42 | msgdata,hsmd_node_announcement_sig_req,annlen,u16, |
43 | msgdata,hsmd_node_announcement_sig_req,announcement,u8,annlen |
44 | msgtype,hsmd_node_announcement_sig_reply,106 |
45 | msgdata,hsmd_node_announcement_sig_reply,signature,secp256k1_ecdsa_signature, |
46 | # Sign a withdrawal request |
47 | #include <bitcoin/psbt.h> |
48 | msgtype,hsmd_sign_withdrawal,7 |
49 | msgdata,hsmd_sign_withdrawal,num_inputs,u16, |
50 | msgdata,hsmd_sign_withdrawal,inputs,utxo,num_inputs |
51 | msgdata,hsmd_sign_withdrawal,psbt,wally_psbt, |
52 | msgtype,hsmd_sign_withdrawal_reply,107 |
53 | msgdata,hsmd_sign_withdrawal_reply,psbt,wally_psbt, |
54 | # Sign an invoice |
55 | msgtype,hsmd_sign_invoice,8 |
56 | msgdata,hsmd_sign_invoice,len,u16, |
57 | msgdata,hsmd_sign_invoice,u5bytes,u8,len |
58 | msgdata,hsmd_sign_invoice,hrplen,u16, |
59 | msgdata,hsmd_sign_invoice,hrp,u8,hrplen |
60 | msgtype,hsmd_sign_invoice_reply,108 |
61 | msgdata,hsmd_sign_invoice_reply,sig,secp256k1_ecdsa_recoverable_signature, |
62 | # Give me ECDH(node-id-secret,point) |
63 | msgtype,hsmd_ecdh_req,1 |
64 | msgdata,hsmd_ecdh_req,point,pubkey, |
65 | msgtype,hsmd_ecdh_resp,100 |
66 | msgdata,hsmd_ecdh_resp,ss,secret, |
67 | msgtype,hsmd_cannouncement_sig_req,2 |
68 | msgdata,hsmd_cannouncement_sig_req,calen,u16, |
69 | msgdata,hsmd_cannouncement_sig_req,ca,u8,calen |
70 | msgtype,hsmd_cannouncement_sig_reply,102 |
71 | msgdata,hsmd_cannouncement_sig_reply,node_signature,secp256k1_ecdsa_signature, |
72 | msgdata,hsmd_cannouncement_sig_reply,bitcoin_signature,secp256k1_ecdsa_signature, |
73 | msgtype,hsmd_cupdate_sig_req,3 |
74 | msgdata,hsmd_cupdate_sig_req,culen,u16, |
75 | msgdata,hsmd_cupdate_sig_req,cu,u8,culen |
76 | msgtype,hsmd_cupdate_sig_reply,103 |
77 | msgdata,hsmd_cupdate_sig_reply,culen,u16, |
78 | msgdata,hsmd_cupdate_sig_reply,cu,u8,culen |
79 | # Master asks HSM to sign a commitment transaction. |
80 | msgtype,hsmd_sign_commitment_tx,5 |
81 | msgdata,hsmd_sign_commitment_tx,peer_id,node_id, |
82 | msgdata,hsmd_sign_commitment_tx,channel_dbid,u64, |
83 | msgdata,hsmd_sign_commitment_tx,tx,bitcoin_tx, |
84 | msgdata,hsmd_sign_commitment_tx,remote_funding_key,pubkey, |
85 | msgtype,hsmd_sign_commitment_tx_reply,105 |
86 | msgdata,hsmd_sign_commitment_tx_reply,sig,bitcoin_signature, |
87 | # Onchaind asks HSM to sign a spend to-us. Four variants, since each set |
88 | # of keys is derived differently... |
89 | # FIXME: Have master tell hsmd the keyindex, so it can validate output! |
90 | msgtype,hsmd_sign_delayed_payment_to_us,12 |
91 | msgdata,hsmd_sign_delayed_payment_to_us,commit_num,u64, |
92 | msgdata,hsmd_sign_delayed_payment_to_us,tx,bitcoin_tx, |
93 | msgdata,hsmd_sign_delayed_payment_to_us,wscript_len,u16, |
94 | msgdata,hsmd_sign_delayed_payment_to_us,wscript,u8,wscript_len |
95 | msgtype,hsmd_sign_remote_htlc_to_us,13 |
96 | msgdata,hsmd_sign_remote_htlc_to_us,remote_per_commitment_point,pubkey, |
97 | msgdata,hsmd_sign_remote_htlc_to_us,tx,bitcoin_tx, |
98 | msgdata,hsmd_sign_remote_htlc_to_us,wscript_len,u16, |
99 | msgdata,hsmd_sign_remote_htlc_to_us,wscript,u8,wscript_len |
100 | msgdata,hsmd_sign_remote_htlc_to_us,option_anchor_outputs,bool, |
101 | msgtype,hsmd_sign_penalty_to_us,14 |
102 | msgdata,hsmd_sign_penalty_to_us,revocation_secret,secret, |
103 | msgdata,hsmd_sign_penalty_to_us,tx,bitcoin_tx, |
104 | msgdata,hsmd_sign_penalty_to_us,wscript_len,u16, |
105 | msgdata,hsmd_sign_penalty_to_us,wscript,u8,wscript_len |
106 | # Onchaind asks HSM to sign a local HTLC success or HTLC timeout tx. |
107 | msgtype,hsmd_sign_local_htlc_tx,16 |
108 | msgdata,hsmd_sign_local_htlc_tx,commit_num,u64, |
109 | msgdata,hsmd_sign_local_htlc_tx,tx,bitcoin_tx, |
110 | msgdata,hsmd_sign_local_htlc_tx,wscript_len,u16, |
111 | msgdata,hsmd_sign_local_htlc_tx,wscript,u8,wscript_len |
112 | msgdata,hsmd_sign_local_htlc_tx,option_anchor_outputs,bool, |
113 | # Openingd/channeld asks HSM to sign the other sides' commitment tx. |
114 | msgtype,hsmd_sign_remote_commitment_tx,19 |
115 | msgdata,hsmd_sign_remote_commitment_tx,tx,bitcoin_tx, |
116 | msgdata,hsmd_sign_remote_commitment_tx,remote_funding_key,pubkey, |
117 | msgdata,hsmd_sign_remote_commitment_tx,remote_per_commit,pubkey, |
118 | msgdata,hsmd_sign_remote_commitment_tx,option_static_remotekey,bool, |
119 | # channeld asks HSM to sign remote HTLC tx. |
120 | msgtype,hsmd_sign_remote_htlc_tx,20 |
121 | msgdata,hsmd_sign_remote_htlc_tx,tx,bitcoin_tx, |
122 | msgdata,hsmd_sign_remote_htlc_tx,len,u16, |
123 | msgdata,hsmd_sign_remote_htlc_tx,wscript,u8,len |
124 | msgdata,hsmd_sign_remote_htlc_tx,remote_per_commit_point,pubkey, |
125 | msgdata,hsmd_sign_remote_htlc_tx,option_anchor_outputs,bool, |
126 | # closingd asks HSM to sign mutual close tx. |
127 | msgtype,hsmd_sign_mutual_close_tx,21 |
128 | msgdata,hsmd_sign_mutual_close_tx,tx,bitcoin_tx, |
129 | msgdata,hsmd_sign_mutual_close_tx,remote_funding_key,pubkey, |
130 | # Reply for all the above requests. |
131 | msgtype,hsmd_sign_tx_reply,112 |
132 | msgdata,hsmd_sign_tx_reply,sig,bitcoin_signature, |
133 | # Openingd/channeld/onchaind asks for Nth per_commitment_point, if > 2, gets N-2 secret. |
134 | msgtype,hsmd_get_per_commitment_point,18 |
135 | msgdata,hsmd_get_per_commitment_point,n,u64, |
136 | msgtype,hsmd_get_per_commitment_point_reply,118 |
137 | msgdata,hsmd_get_per_commitment_point_reply,per_commitment_point,pubkey, |
138 | msgdata,hsmd_get_per_commitment_point_reply,old_commitment_secret,?secret, |
139 | # master -> hsmd: do you have a memleak? |
140 | msgtype,hsmd_dev_memleak,33 |
141 | msgtype,hsmd_dev_memleak_reply,133 |
142 | msgdata,hsmd_dev_memleak_reply,leak,bool, |
143 | # channeld asks to check if claimed future commitment_secret is correct. |
144 | msgtype,hsmd_check_future_secret,22 |
145 | msgdata,hsmd_check_future_secret,n,u64, |
146 | msgdata,hsmd_check_future_secret,commitment_secret,secret, |
147 | msgtype,hsmd_check_future_secret_reply,122 |
148 | msgdata,hsmd_check_future_secret_reply,correct,bool, |
149 | # lightningd asks us to sign a string. |
150 | msgtype,hsmd_sign_message,23 |
151 | msgdata,hsmd_sign_message,len,u16, |
152 | msgdata,hsmd_sign_message,msg,u8,len |
153 | msgtype,hsmd_sign_message_reply,123 |
154 | msgdata,hsmd_sign_message_reply,sig,secp256k1_ecdsa_recoverable_signature, |
155 | # lightningd needs to get a scriptPubkey for a utxo with closeinfo |
156 | msgtype,hsmd_get_output_scriptpubkey,24 |
157 | msgdata,hsmd_get_output_scriptpubkey,channel_id,u64, |
158 | msgdata,hsmd_get_output_scriptpubkey,peer_id,node_id, |
159 | msgdata,hsmd_get_output_scriptpubkey,commitment_point,?pubkey, |
160 | msgtype,hsmd_get_output_scriptpubkey_reply,124 |
161 | msgdata,hsmd_get_output_scriptpubkey_reply,script_len,u16, |
162 | msgdata,hsmd_get_output_scriptpubkey_reply,script,u8,script_len |