Skip to content

Commit 9f3dd01

Browse files
committed
sign_tx: Don't read/require host entropy for p2tr inputs
We can't generate AE signatures for these inputs, so make the host entropy optional for them.
1 parent d58d6cf commit 9f3dd01

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

main/process/sign_tx.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,22 @@ void send_ae_signature_replies(jade_process_t* process, signing_data_t* all_sign
300300
// We are expecting to generate a signature for this input
301301
GET_MSG_PARAMS(process);
302302

303-
size_t ae_host_entropy_len = 0;
304303
const uint8_t* ae_host_entropy = NULL;
305-
rpc_get_bytes_ptr("ae_host_entropy", &params, &ae_host_entropy, &ae_host_entropy_len);
304+
size_t ae_host_entropy_len = 0;
306305

307-
if (!ae_host_entropy || ae_host_entropy_len != WALLY_S2C_DATA_LEN) {
308-
jade_process_reject_message(
309-
process, CBOR_RPC_BAD_PARAMETERS, "Failed to extract host entropy from parameters", NULL);
310-
goto cleanup;
306+
if (sig_data->segwit_ver != SEGWIT_V1) {
307+
// Non taproot signature: requires the host entropy to include
308+
// in the signature
309+
rpc_get_bytes_ptr("ae_host_entropy", &params, &ae_host_entropy, &ae_host_entropy_len);
310+
311+
if (!ae_host_entropy || ae_host_entropy_len != WALLY_S2C_DATA_LEN) {
312+
jade_process_reject_message(
313+
process, CBOR_RPC_BAD_PARAMETERS, "Failed to extract host entropy from parameters", NULL);
314+
goto cleanup;
315+
}
311316
}
312317

313-
// Generate Anti-Exfil signature
318+
// Generate Anti-Exfil or non-AE Schnorr signature
314319
if (!wallet_sign_tx_input_hash(sig_data, ae_host_entropy, ae_host_entropy_len)) {
315320
jade_process_reject_message(process, CBOR_RPC_INTERNAL_ERROR, "Failed to sign tx input", NULL);
316321
goto cleanup;

0 commit comments

Comments
 (0)