What changed, and why it matters
This commit is purely a code-style and formatting update to make the project compile cleanly with the newer clang-21 compiler. It adds or removes spaces inside braces (for example, changing `{0, -1, 0}` to `{ 0, -1, 0 }`) and re-wraps a few long function signatures so they fit on multiple lines. No program logic, security checks, or behavior were changed.
No security action required. Treat as a routine formatting/linting commit. If desired, verify the build succeeds with clang-21 and that no unintended logic changes were introduced by comparing the pre- and post-format AST or object code.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of clang-format/clang-21 style fixes: inserting a space after the opening brace and before the closing brace in compound literals and designated initializers, and reformatting function declarations/definitions that exceed line-length limits. There are no functional changes, no new checks, no removed validations, and no changes to data flow or cryptography. The modifications span 17 files across wallet policy parsing, PSBT signing, swap checks, and UI code, but all are cosmetic.
Changed components
src/common/wallet.csrc/handler/get_wallet_address.csrc/handler/lib/policy.csrc/handler/sign_psbt/amount_from_psbt.csrc/handler/sign_psbt/amount_from_psbt.hsrc/handler/sign_psbt/compare_wallet_script_at_path.csrc/handler/sign_psbt/init_global_state.csrc/handler/sign_psbt/musig_signing.csrc/handler/sign_psbt/preprocess_inputs.csrc/handler/sign_psbt/preprocess_outputs.csrc/handler/sign_psbt/sign_input.csrc/handler/sign_psbt/swap_checks.csrc/handler/sign_psbt/transaction_display.csrc/handler/sign_psbt/txhashes.csrc/handler/sign_psbt/txhashes.hsrc/swap/handle_check_address.csrc/ui/display_nbgl.cInspect captured patch +240 / −238
diff --git a/src/common/wallet.c b/src/common/wallet.c
index 1638829..fdbff9b 100644
--- a/src/common/wallet.c
+++ b/src/common/wallet.c
@@ -2204,8 +2204,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 1;
- out->ops = (miniscript_ops_t){0, -1, 0};
- out->ss = (miniscript_stacksize_t){-1, 0};
+ out->ops = (miniscript_ops_t) {0, -1, 0};
+ out->ss = (miniscript_stacksize_t) {-1, 0};
return 0;
case TOKEN_1:
@@ -2213,8 +2213,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 1;
- out->ops = (miniscript_ops_t){0, 0, -1};
- out->ss = (miniscript_stacksize_t){0, -1};
+ out->ops = (miniscript_ops_t) {0, 0, -1};
+ out->ss = (miniscript_stacksize_t) {0, -1};
return 0;
case TOKEN_PK_K:
@@ -2223,8 +2223,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = (ctx == MINISCRIPT_CONTEXT_TAPSCRIPT ? 33 : 34);
- out->ops = (miniscript_ops_t){0, 0, 0};
- out->ss = (miniscript_stacksize_t){1, 1};
+ out->ops = (miniscript_ops_t) {0, 0, 0};
+ out->ss = (miniscript_stacksize_t) {1, 1};
return 0;
case TOKEN_PK_H:
@@ -2233,8 +2233,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 3 + 21;
- out->ops = (miniscript_ops_t){3, 0, 0};
- out->ss = (miniscript_stacksize_t){2, 2};
+ out->ops = (miniscript_ops_t) {3, 0, 0};
+ out->ss = (miniscript_stacksize_t) {2, 2};
return 0;
case TOKEN_PK: // pk(key) = c:pk_k(key)
@@ -2245,8 +2245,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = (ctx == MINISCRIPT_CONTEXT_TAPSCRIPT ? 34 : 35);
- out->ops = (miniscript_ops_t){1, 0, 0};
- out->ss = (miniscript_stacksize_t){1, 1};
+ out->ops = (miniscript_ops_t) {1, 0, 0};
+ out->ss = (miniscript_stacksize_t) {1, 1};
return 0;
case TOKEN_PKH: // pkh(key) = c:pk_h(key)
@@ -2257,8 +2257,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 3 + 21 + 1;
- out->ops = (miniscript_ops_t){4, 0, 0};
- out->ss = (miniscript_stacksize_t){2, 2};
+ out->ops = (miniscript_ops_t) {4, 0, 0};
+ out->ss = (miniscript_stacksize_t) {2, 2};
return 0;
case TOKEN_MULTI: {
@@ -2272,8 +2272,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = (uint16_t) (1 + get_push_script_size(node->k) +
get_push_script_size(node->n) + 34 * node->n);
- out->ops = (miniscript_ops_t){1, node->n, node->n};
- out->ss = (miniscript_stacksize_t){node->k + 1, node->k + 1};
+ out->ops = (miniscript_ops_t) {1, node->n, node->n};
+ out->ss = (miniscript_stacksize_t) {node->k + 1, node->k + 1};
return 0;
}
@@ -2287,8 +2287,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = (uint16_t) (1 + get_push_script_size(node->k) + 34 * node->n);
- out->ops = (miniscript_ops_t){node->n + 1, 0, 0};
- out->ss = (miniscript_stacksize_t){node->n, node->n};
+ out->ops = (miniscript_ops_t) {node->n + 1, 0, 0};
+ out->ss = (miniscript_stacksize_t) {node->n, node->n};
return 0;
}
@@ -2305,8 +2305,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = (uint16_t) (1 + get_push_script_size(node->n));
- out->ops = (miniscript_ops_t){1, 0, -1};
- out->ss = (miniscript_stacksize_t){0, -1};
+ out->ops = (miniscript_ops_t) {1, 0, -1};
+ out->ss = (miniscript_stacksize_t) {0, -1};
return 0;
}
@@ -2323,8 +2323,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = (uint16_t) (1 + get_push_script_size(node->n));
- out->ops = (miniscript_ops_t){1, 0, -1};
- out->ss = (miniscript_stacksize_t){0, -1};
+ out->ops = (miniscript_ops_t) {1, 0, -1};
+ out->ss = (miniscript_stacksize_t) {0, -1};
return 0;
}
@@ -2334,8 +2334,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 4 + 2 + 33;
- out->ops = (miniscript_ops_t){4, 0, -1};
- out->ss = (miniscript_stacksize_t){1, -1};
+ out->ops = (miniscript_ops_t) {4, 0, -1};
+ out->ss = (miniscript_stacksize_t) {1, -1};
return 0;
case TOKEN_RIPEMD160:
@@ -2344,8 +2344,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 4 + 2 + 21;
- out->ops = (miniscript_ops_t){4, 0, -1};
- out->ss = (miniscript_stacksize_t){1, -1};
+ out->ops = (miniscript_ops_t) {4, 0, -1};
+ out->ss = (miniscript_stacksize_t) {1, -1};
return 0;
case TOKEN_ANDOR: {
@@ -2379,11 +2379,11 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 3 + x.script_size + y.script_size + z.script_size;
- out->ops = (miniscript_ops_t){
+ out->ops = (miniscript_ops_t) {
3 + x.ops.count + y.ops.count + z.ops.count,
maxcheck(sumcheck(y.ops.sat, x.ops.sat), sumcheck(y.ops.dsat, z.ops.sat)),
sumcheck(x.ops.dsat, z.ops.dsat)};
- out->ss = (miniscript_stacksize_t){
+ out->ss = (miniscript_stacksize_t) {
maxcheck(sumcheck(x.ss.sat, y.ss.sat), sumcheck(x.ss.dsat, z.ss.sat)),
sumcheck(x.ss.dsat, z.ss.dsat)};
@@ -2419,8 +2419,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + y.script_size;
out->ops =
- (miniscript_ops_t){x.ops.count + y.ops.count, sumcheck(x.ops.sat, y.ops.sat), -1};
- out->ss = (miniscript_stacksize_t){sumcheck(x.ss.sat, y.ss.sat), -1};
+ (miniscript_ops_t) {x.ops.count + y.ops.count, sumcheck(x.ops.sat, y.ops.sat), -1};
+ out->ss = (miniscript_stacksize_t) {sumcheck(x.ss.sat, y.ss.sat), -1};
return 0;
}
case TOKEN_AND_B: {
@@ -2451,11 +2451,11 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 1 + x.script_size + y.script_size;
- out->ops = (miniscript_ops_t){1 + x.ops.count + y.ops.count,
- sumcheck(x.ops.sat, y.ops.sat),
- sumcheck(x.ops.dsat, y.ops.dsat)};
- out->ss = (miniscript_stacksize_t){sumcheck(x.ss.sat, y.ss.sat),
- sumcheck(x.ss.dsat, y.ss.dsat)};
+ out->ops = (miniscript_ops_t) {1 + x.ops.count + y.ops.count,
+ sumcheck(x.ops.sat, y.ops.sat),
+ sumcheck(x.ops.dsat, y.ops.dsat)};
+ out->ss = (miniscript_stacksize_t) {sumcheck(x.ss.sat, y.ss.sat),
+ sumcheck(x.ss.dsat, y.ss.dsat)};
return 0;
}
@@ -2486,10 +2486,10 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 4 + x.script_size + y.script_size;
- out->ops = (miniscript_ops_t){3 + x.ops.count + y.ops.count,
- maxcheck(sumcheck(y.ops.sat, x.ops.sat), y.ops.dsat),
- x.ops.dsat};
- out->ss = (miniscript_stacksize_t){sumcheck(x.ss.sat, y.ss.sat), x.ss.dsat};
+ out->ops = (miniscript_ops_t) {3 + x.ops.count + y.ops.count,
+ maxcheck(sumcheck(y.ops.sat, x.ops.sat), y.ops.dsat),
+ x.ops.dsat};
+ out->ss = (miniscript_stacksize_t) {sumcheck(x.ss.sat, y.ss.sat), x.ss.dsat};
return 0;
}
case TOKEN_OR_B: {
@@ -2517,11 +2517,11 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 1 + x.script_size + z.script_size;
- out->ops = (miniscript_ops_t){
+ out->ops = (miniscript_ops_t) {
1 + x.ops.count + z.ops.count,
maxcheck(sumcheck(x.ops.sat, z.ops.dsat), sumcheck(z.ops.sat, x.ops.dsat)),
sumcheck(x.ops.dsat, z.ops.dsat)};
- out->ss = (miniscript_stacksize_t){
+ out->ss = (miniscript_stacksize_t) {
maxcheck(sumcheck(x.ss.dsat, z.ss.sat), sumcheck(x.ss.sat, z.ss.dsat)),
sumcheck(x.ss.dsat, z.ss.dsat)};
return 0;
@@ -2551,11 +2551,11 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 2 + x.script_size + z.script_size;
- out->ops = (miniscript_ops_t){2 + x.ops.count + z.ops.count,
- maxcheck(x.ops.sat, sumcheck(z.ops.sat, x.ops.dsat)),
- -1};
+ out->ops = (miniscript_ops_t) {2 + x.ops.count + z.ops.count,
+ maxcheck(x.ops.sat, sumcheck(z.ops.sat, x.ops.dsat)),
+ -1};
out->ss =
- (miniscript_stacksize_t){maxcheck(x.ss.sat, sumcheck(x.ss.dsat, z.ss.sat)), -1};
+ (miniscript_stacksize_t) {maxcheck(x.ss.sat, sumcheck(x.ss.dsat, z.ss.sat)), -1};
return 0;
}
case TOKEN_OR_D: {
@@ -2584,11 +2584,11 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 3 + x.script_size + z.script_size;
- out->ops = (miniscript_ops_t){3 + x.ops.count + z.ops.count,
- maxcheck(x.ops.sat, sumcheck(z.ops.sat, x.ops.dsat)),
- sumcheck(x.ops.dsat, z.ops.dsat)};
- out->ss = (miniscript_stacksize_t){maxcheck(x.ss.sat, sumcheck(x.ss.dsat, z.ss.sat)),
- sumcheck(x.ss.dsat, z.ss.dsat)};
+ out->ops = (miniscript_ops_t) {3 + x.ops.count + z.ops.count,
+ maxcheck(x.ops.sat, sumcheck(z.ops.sat, x.ops.dsat)),
+ sumcheck(x.ops.dsat, z.ops.dsat)};
+ out->ss = (miniscript_stacksize_t) {maxcheck(x.ss.sat, sumcheck(x.ss.dsat, z.ss.sat)),
+ sumcheck(x.ss.dsat, z.ss.dsat)};
return 0;
}
case TOKEN_OR_I: {
@@ -2617,12 +2617,12 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = 3 + x.script_size + z.script_size;
- out->ops = (miniscript_ops_t){3 + x.ops.count + z.ops.count,
- maxcheck(x.ops.sat, z.ops.sat),
- maxcheck(x.ops.dsat, z.ops.dsat)};
+ out->ops = (miniscript_ops_t) {3 + x.ops.count + z.ops.count,
+ maxcheck(x.ops.sat, z.ops.sat),
+ maxcheck(x.ops.dsat, z.ops.dsat)};
out->ss =
- (miniscript_stacksize_t){maxcheck(sumcheck(x.ss.sat, 1), sumcheck(z.ss.sat, 1)),
- maxcheck(sumcheck(x.ss.dsat, 1), sumcheck(z.ss.dsat, 1))};
+ (miniscript_stacksize_t) {maxcheck(sumcheck(x.ss.sat, 1), sumcheck(z.ss.sat, 1)),
+ maxcheck(sumcheck(x.ss.dsat, 1), sumcheck(z.ss.dsat, 1))};
return 0;
}
@@ -2707,7 +2707,7 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + 2;
- out->ops = (miniscript_ops_t){2 + x.ops.count, x.ops.sat, x.ops.dsat};
+ out->ops = (miniscript_ops_t) {2 + x.ops.count, x.ops.sat, x.ops.dsat};
out->ss = x.ss;
return 0;
@@ -2736,7 +2736,7 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + 1;
- out->ops = (miniscript_ops_t){1 + x.ops.count, x.ops.sat, x.ops.dsat};
+ out->ops = (miniscript_ops_t) {1 + x.ops.count, x.ops.sat, x.ops.dsat};
out->ss = x.ss;
return 0;
@@ -2766,7 +2766,7 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->x = 0;
- out->ops = (miniscript_ops_t){1 + x.ops.count, x.ops.sat, x.ops.dsat};
+ out->ops = (miniscript_ops_t) {1 + x.ops.count, x.ops.sat, x.ops.dsat};
out->ss = x.ss;
return 0;
@@ -2791,8 +2791,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + 3;
- out->ops = (miniscript_ops_t){3 + x.ops.count, x.ops.sat, 0};
- out->ss = (miniscript_stacksize_t){sumcheck(1, x.ss.sat), 1};
+ out->ops = (miniscript_ops_t) {3 + x.ops.count, x.ops.sat, 0};
+ out->ss = (miniscript_stacksize_t) {sumcheck(1, x.ss.sat), 1};
return 0;
}
@@ -2816,9 +2816,9 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + 1;
- out->ops = (miniscript_ops_t){x.ops.count, x.ops.sat, -1};
+ out->ops = (miniscript_ops_t) {x.ops.count, x.ops.sat, -1};
- out->ss = (miniscript_stacksize_t){x.ss.sat, -1};
+ out->ss = (miniscript_stacksize_t) {x.ss.sat, -1};
return 0;
}
@@ -2842,8 +2842,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + x.x;
- out->ops = (miniscript_ops_t){x.ops.count + x.x, x.ops.sat, -1};
- out->ss = (miniscript_stacksize_t){x.ss.sat, -1};
+ out->ops = (miniscript_ops_t) {x.ops.count + x.x, x.ops.sat, -1};
+ out->ss = (miniscript_stacksize_t) {x.ss.sat, -1};
return 0;
}
@@ -2867,8 +2867,8 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + 4;
- out->ops = (miniscript_ops_t){4 + x.ops.count, x.ops.sat, 0};
- out->ss = (miniscript_stacksize_t){x.ss.sat, 1};
+ out->ops = (miniscript_ops_t) {4 + x.ops.count, x.ops.sat, 0};
+ out->ss = (miniscript_stacksize_t) {x.ss.sat, 1};
return 0;
}
@@ -2894,9 +2894,9 @@ int compute_miniscript_policy_ext_info(const policy_node_t *policy_node,
out->script_size = x.script_size + 4;
- out->ops = (miniscript_ops_t){3 + x.ops.count, x.ops.sat, x.ops.dsat};
- out->ss = (miniscript_stacksize_t){sumcheck(x.ss.sat, 1),
- maxcheck(1, sumcheck(x.ss.dsat, 1))};
+ out->ops = (miniscript_ops_t) {3 + x.ops.count, x.ops.sat, x.ops.dsat};
+ out->ss = (miniscript_stacksize_t) {sumcheck(x.ss.sat, 1),
+ maxcheck(1, sumcheck(x.ss.dsat, 1))};
return 0;
}
diff --git a/src/handler/get_wallet_address.c b/src/handler/get_wallet_address.c
index b152fb7..0816ca4 100644
--- a/src/handler/get_wallet_address.c
+++ b/src/handler/get_wallet_address.c
@@ -181,11 +181,11 @@ void handler_get_wallet_address(dispatcher_context_t *dc, uint8_t protocol_versi
int script_len = get_wallet_script(
dc,
&wallet_policy_map.parsed,
- &(wallet_derivation_info_t){.wallet_version = wallet_header.version,
- .keys_merkle_root = wallet_header.keys_info_merkle_root,
- .n_keys = wallet_header.n_keys,
- .change = is_change,
- .address_index = address_index},
+ &(wallet_derivation_info_t) {.wallet_version = wallet_header.version,
+ .keys_merkle_root = wallet_header.keys_info_merkle_root,
+ .n_keys = wallet_header.n_keys,
+ .change = is_change,
+ .address_index = address_index},
script);
if (script_len < 0) {
PRINTF("Couldn't produce wallet script\n");
diff --git a/src/handler/lib/policy.c b/src/handler/lib/policy.c
index 403b40b..d7734b4 100644
--- a/src/handler/lib/policy.c
+++ b/src/handler/lib/policy.c
@@ -1226,7 +1226,7 @@ __attribute__((noinline)) int get_wallet_internal_script_hash(
.hash_context = hash_context};
state.nodes[0] =
- (policy_parser_node_state_t){.length = 0, .flags = 0, .step = 0, .policy_node = policy};
+ (policy_parser_node_state_t) {.length = 0, .flags = 0, .step = 0, .policy_node = policy};
int ret;
do {
diff --git a/src/handler/sign_psbt/amount_from_psbt.c b/src/handler/sign_psbt/amount_from_psbt.c
index ac49dd2..1e9eef6 100644
--- a/src/handler/sign_psbt/amount_from_psbt.c
+++ b/src/handler/sign_psbt/amount_from_psbt.c
@@ -44,7 +44,7 @@ int __attribute__((noinline)) get_amount_scriptpubkey_from_psbt_nonwitness(
uint32_t prevout_n;
if (4 != call_get_merkleized_map_value_u32_le(dc,
input_map,
- (uint8_t[]){PSBT_IN_OUTPUT_INDEX},
+ (uint8_t[]) {PSBT_IN_OUTPUT_INDEX},
1,
&prevout_n)) {
return -1;
@@ -54,7 +54,7 @@ int __attribute__((noinline)) get_amount_scriptpubkey_from_psbt_nonwitness(
// request non-witness utxo, and get the prevout's value and scriptpubkey
int res = call_psbt_parse_rawtx(dc,
input_map,
- (uint8_t[]){PSBT_IN_NON_WITNESS_UTXO},
+ (uint8_t[]) {PSBT_IN_NON_WITNESS_UTXO},
1,
prevout_n,
&parser_outputs);
@@ -83,17 +83,17 @@ int __attribute__((noinline)) get_amount_scriptpubkey_from_psbt_nonwitness(
a PSBTv2.
Returns -1 on failure, 0 on success.
*/
-int __attribute__((noinline))
-get_amount_scriptpubkey_from_psbt_witness(dispatcher_context_t *dc,
- const merkleized_map_commitment_t *input_map,
- uint64_t *amount,
- uint8_t scriptPubKey[static MAX_PREVOUT_SCRIPTPUBKEY_LEN],
- size_t *scriptPubKey_len) {
+int __attribute__((noinline)) get_amount_scriptpubkey_from_psbt_witness(
+ dispatcher_context_t *dc,
+ const merkleized_map_commitment_t *input_map,
+ uint64_t *amount,
+ uint8_t scriptPubKey[static MAX_PREVOUT_SCRIPTPUBKEY_LEN],
+ size_t *scriptPubKey_len) {
uint8_t raw_witnessUtxo[8 + 1 + MAX_PREVOUT_SCRIPTPUBKEY_LEN];
int wit_utxo_len = call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_WITNESS_UTXO},
+ (uint8_t[]) {PSBT_IN_WITNESS_UTXO},
1,
raw_witnessUtxo,
sizeof(raw_witnessUtxo));
diff --git a/src/handler/sign_psbt/amount_from_psbt.h b/src/handler/sign_psbt/amount_from_psbt.h
index aa85ecd..0269659 100644
--- a/src/handler/sign_psbt/amount_from_psbt.h
+++ b/src/handler/sign_psbt/amount_from_psbt.h
@@ -44,12 +44,12 @@ int __attribute__((noinline)) get_amount_scriptpubkey_from_psbt_nonwitness(
a PSBTv2.
Returns -1 on failure, 0 on success.
*/
-int __attribute__((noinline))
-get_amount_scriptpubkey_from_psbt_witness(dispatcher_context_t *dc,
- const merkleized_map_commitment_t *input_map,
- uint64_t *amount,
- uint8_t scriptPubKey[static MAX_PREVOUT_SCRIPTPUBKEY_LEN],
- size_t *scriptPubKey_len);
+int __attribute__((noinline)) get_amount_scriptpubkey_from_psbt_witness(
+ dispatcher_context_t *dc,
+ const merkleized_map_commitment_t *input_map,
+ uint64_t *amount,
+ uint8_t scriptPubKey[static MAX_PREVOUT_SCRIPTPUBKEY_LEN],
+ size_t *scriptPubKey_len);
/*
Convenience function to get the amount and scriptpubkey of a certain input in a PSBTv2.
diff --git a/src/handler/sign_psbt/compare_wallet_script_at_path.c b/src/handler/sign_psbt/compare_wallet_script_at_path.c
index 6eb5150..220582e 100644
--- a/src/handler/sign_psbt/compare_wallet_script_at_path.c
+++ b/src/handler/sign_psbt/compare_wallet_script_at_path.c
@@ -44,12 +44,12 @@ int compare_wallet_script_at_path(dispatcher_context_t *dispatcher_context,
int wallet_script_len =
get_wallet_script(dispatcher_context,
policy,
- &(wallet_derivation_info_t){.wallet_version = wallet_version,
- .keys_merkle_root = keys_merkle_root,
- .n_keys = n_keys,
- .change = change,
- .address_index = address_index,
- .sign_psbt_cache = sign_psbt_cache},
+ &(wallet_derivation_info_t) {.wallet_version = wallet_version,
+ .keys_merkle_root = keys_merkle_root,
+ .n_keys = n_keys,
+ .change = change,
+ .address_index = address_index,
+ .sign_psbt_cache = sign_psbt_cache},
wallet_script);
if (wallet_script_len < 0) {
PRINTF("Failed to get wallet script\n");
diff --git a/src/handler/sign_psbt/init_global_state.c b/src/handler/sign_psbt/init_global_state.c
index cb6a0ff..8d07ab2 100644
--- a/src/handler/sign_psbt/init_global_state.c
+++ b/src/handler/sign_psbt/init_global_state.c
@@ -121,8 +121,8 @@ static bool __attribute__((noinline)) parse_sign_psbt_apdu(dispatcher_context_t
* Returns true on success; on failure, an error status word has already been
* sent.
*/
-static bool __attribute__((noinline))
-process_global_map(dispatcher_context_t *dc, sign_psbt_state_t *st) {
+static bool __attribute__((noinline)) process_global_map(dispatcher_context_t *dc,
+ sign_psbt_state_t *st) {
// Check integrity of the global map
if (call_check_merkle_tree_sorted(dc, st->global_map.keys_root, (size_t) st->global_map.size) <
0) {
@@ -136,7 +136,7 @@ process_global_map(dispatcher_context_t *dc, sign_psbt_state_t *st) {
// Read tx version
result_len = call_get_merkleized_map_value(dc,
&st->global_map,
- (uint8_t[]){PSBT_GLOBAL_TX_VERSION},
+ (uint8_t[]) {PSBT_GLOBAL_TX_VERSION},
1,
raw_result,
sizeof(raw_result));
@@ -152,7 +152,7 @@ process_global_map(dispatcher_context_t *dc, sign_psbt_state_t *st) {
// locktime to the appropriate value before calling sign_psbt.
result_len = call_get_merkleized_map_value(dc,
&st->global_map,
- (uint8_t[]){PSBT_GLOBAL_FALLBACK_LOCKTIME},
+ (uint8_t[]) {PSBT_GLOBAL_FALLBACK_LOCKTIME},
1,
raw_result,
sizeof(raw_result));
diff --git a/src/handler/sign_psbt/musig_signing.c b/src/handler/sign_psbt/musig_signing.c
index dd94095..83c0175 100644
--- a/src/handler/sign_psbt/musig_signing.c
+++ b/src/handler/sign_psbt/musig_signing.c
@@ -153,7 +153,7 @@ bool compute_musig_per_input_info(dispatcher_context_t *dc,
// Malicious collisions are not a concern, as they would only result in a signing failure (since
// the nonces would be incorrectly regenerated during round 2 of MuSig2).
crypto_tr_tagged_hash(
- (uint8_t[]){'P', 's', 'b', 't', 'S', 'e', 's', 's', 'i', 'o', 'n', 'I', 'd'},
+ (uint8_t[]) {'P', 's', 'b', 't', 'S', 'e', 's', 's', 'i', 'o', 'n', 'I', 'd'},
13,
st->account.wallet_header
.keys_info_merkle_root, // TODO: wallet policy id would be more precise
diff --git a/src/handler/sign_psbt/preprocess_inputs.c b/src/handler/sign_psbt/preprocess_inputs.c
index bac60b3..59bfc56 100644
--- a/src/handler/sign_psbt/preprocess_inputs.c
+++ b/src/handler/sign_psbt/preprocess_inputs.c
@@ -102,11 +102,11 @@ void input_keys_callback(dispatcher_context_t *dc,
}
}
-bool __attribute__((noinline))
-preprocess_inputs(dispatcher_context_t *dc,
- sign_psbt_state_t *st,
- sign_psbt_cache_t *sign_psbt_cache,
- uint8_t internal_inputs[static BITVECTOR_REAL_SIZE(MAX_N_INPUTS_CAN_SIGN)]) {
+bool __attribute__((noinline)) preprocess_inputs(
+ dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ sign_psbt_cache_t *sign_psbt_cache,
+ uint8_t internal_inputs[static BITVECTOR_REAL_SIZE(MAX_N_INPUTS_CAN_SIGN)]) {
LOG_PROCESSOR(__FILE__, __LINE__, __func__);
memset(internal_inputs, 0, BITVECTOR_REAL_SIZE(MAX_N_INPUTS_CAN_SIGN));
@@ -155,7 +155,7 @@ preprocess_inputs(dispatcher_context_t *dc,
// non-witness utxo
if (0 > call_get_merkleized_map_value(dc,
&input.in_out.map,
- (uint8_t[]){PSBT_IN_PREVIOUS_TXID},
+ (uint8_t[]) {PSBT_IN_PREVIOUS_TXID},
1,
prevout_hash,
sizeof(prevout_hash))) {
@@ -280,7 +280,7 @@ preprocess_inputs(dispatcher_context_t *dc,
// get the sighash_type
if (4 != call_get_merkleized_map_value_u32_le(dc,
&input.in_out.map,
- (uint8_t[]){PSBT_IN_SIGHASH_TYPE},
+ (uint8_t[]) {PSBT_IN_SIGHASH_TYPE},
1,
&input.sighash_type)) {
PRINTF("Malformed PSBT_IN_SIGHASH_TYPE for input %d\n", cur_input_index);
diff --git a/src/handler/sign_psbt/preprocess_outputs.c b/src/handler/sign_psbt/preprocess_outputs.c
index dae2496..ee9c71b 100644
--- a/src/handler/sign_psbt/preprocess_outputs.c
+++ b/src/handler/sign_psbt/preprocess_outputs.c
@@ -87,11 +87,11 @@ static void output_keys_callback(dispatcher_context_t *dc,
}
}
-bool __attribute__((noinline))
-preprocess_outputs(dispatcher_context_t *dc,
- sign_psbt_state_t *st,
- sign_psbt_cache_t *sign_psbt_cache,
- uint8_t internal_outputs[static BITVECTOR_REAL_SIZE(MAX_N_OUTPUTS_CAN_SIGN)]) {
+bool __attribute__((noinline)) preprocess_outputs(
+ dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ sign_psbt_cache_t *sign_psbt_cache,
+ uint8_t internal_outputs[static BITVECTOR_REAL_SIZE(MAX_N_OUTPUTS_CAN_SIGN)]) {
/** OUTPUTS VERIFICATION FLOW
*
* For each output, check if it's internal (that is, a change address).
@@ -137,7 +137,7 @@ preprocess_outputs(dispatcher_context_t *dc,
// Read the output's amount
int result_len = call_get_merkleized_map_value(dc,
&output.in_out.map,
- (uint8_t[]){PSBT_OUT_AMOUNT},
+ (uint8_t[]) {PSBT_OUT_AMOUNT},
1,
raw_result,
sizeof(raw_result));
@@ -160,7 +160,7 @@ preprocess_outputs(dispatcher_context_t *dc,
// Read the output's scriptPubKey
result_len = call_get_merkleized_map_value(dc,
&output.in_out.map,
- (uint8_t[]){PSBT_OUT_SCRIPT},
+ (uint8_t[]) {PSBT_OUT_SCRIPT},
1,
output.in_out.scriptPubKey,
sizeof(output.in_out.scriptPubKey));
diff --git a/src/handler/sign_psbt/sign_input.c b/src/handler/sign_psbt/sign_input.c
index 0759f2f..68165ee 100644
--- a/src/handler/sign_psbt/sign_input.c
+++ b/src/handler/sign_psbt/sign_input.c
@@ -233,7 +233,7 @@ static bool __attribute__((noinline)) sign_transaction_input(dispatcher_context_
// Get sighash type
if (4 != call_get_merkleized_map_value_u32_le(dc,
&input->in_out.map,
- (uint8_t[]){PSBT_IN_SIGHASH_TYPE},
+ (uint8_t[]) {PSBT_IN_SIGHASH_TYPE},
1,
&input->sighash_type)) {
PRINTF("Malformed PSBT_IN_SIGHASH_TYPE for input %d\n", cur_input_index);
@@ -321,7 +321,7 @@ static bool __attribute__((noinline)) sign_transaction_input(dispatcher_context_
int redeemScript_length =
call_get_merkleized_map_value(dc,
&input->in_out.map,
- (uint8_t[]){PSBT_IN_REDEEM_SCRIPT},
+ (uint8_t[]) {PSBT_IN_REDEEM_SCRIPT},
1,
redeemScript,
sizeof(redeemScript));
@@ -403,7 +403,7 @@ static bool __attribute__((noinline)) sign_transaction_input(dispatcher_context_
// keypath spend, we compute the taptree hash
if (0 > compute_taptree_hash(
dc,
- &(wallet_derivation_info_t){
+ &(wallet_derivation_info_t) {
.address_index = input->in_out.address_index,
.change = input->in_out.is_change ? 1 : 0,
.keys_merkle_root = st->account.wallet_header.keys_info_merkle_root,
@@ -425,7 +425,7 @@ static bool __attribute__((noinline)) sign_transaction_input(dispatcher_context_
// keypath spend
if (isnull_policy_node_tree(&policy->tree)) {
// tweak as specified in BIP-86 and BIP-386
- tweak_data = (uint8_t[]){};
+ tweak_data = (uint8_t[]) {};
tweak_data_len = 0;
} else {
// tweak with the taptree hash, per BIP-341
@@ -472,13 +472,13 @@ static bool __attribute__((noinline)) sign_transaction_input(dispatcher_context_
return true;
}
-static bool __attribute__((noinline))
-fill_taproot_keyexpr_info(dispatcher_context_t *dc,
- sign_psbt_state_t *st,
- const input_info_t *input,
- const policy_node_t *tapleaf_ptr,
- keyexpr_info_t *keyexpr_info,
- sign_psbt_cache_t *sign_psbt_cache) {
+static bool __attribute__((noinline)) fill_taproot_keyexpr_info(
+ dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ const input_info_t *input,
+ const policy_node_t *tapleaf_ptr,
+ keyexpr_info_t *keyexpr_info,
+ sign_psbt_cache_t *sign_psbt_cache) {
cx_sha256_t hash_context;
crypto_tr_tapleaf_hash_init(&hash_context);
@@ -604,7 +604,7 @@ bool __attribute__((noinline)) produce_musig2_pubnonces(
if (0 >
compute_taptree_hash(
dc,
- &(wallet_derivation_info_t){
+ &(wallet_derivation_info_t) {
.address_index = input.in_out.address_index,
.change = input.in_out.is_change ? 1 : 0,
.keys_merkle_root = st->account.wallet_header.keys_info_merkle_root,
@@ -641,12 +641,12 @@ bool __attribute__((noinline)) produce_musig2_pubnonces(
return true;
}
-bool __attribute__((noinline))
-sign_transaction(dispatcher_context_t *dc,
- sign_psbt_state_t *st,
- sign_psbt_cache_t *sign_psbt_cache,
- signing_state_t *signing_state,
- const uint8_t internal_inputs[static BITVECTOR_REAL_SIZE(MAX_N_INPUTS_CAN_SIGN)]) {
+bool __attribute__((noinline)) sign_transaction(
+ dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ sign_psbt_cache_t *sign_psbt_cache,
+ signing_state_t *signing_state,
+ const uint8_t internal_inputs[static BITVECTOR_REAL_SIZE(MAX_N_INPUTS_CAN_SIGN)]) {
LOG_PROCESSOR(__FILE__, __LINE__, __func__);
bool keyexpr_to_process[MAX_INTERNAL_KEY_EXPRESSIONS] = {0};
diff --git a/src/handler/sign_psbt/swap_checks.c b/src/handler/sign_psbt/swap_checks.c
index 0d69bce..9d8b5d3 100644
--- a/src/handler/sign_psbt/swap_checks.c
+++ b/src/handler/sign_psbt/swap_checks.c
@@ -35,8 +35,8 @@
#include "swap/swap_globals.h"
#include "sw.h"
-bool __attribute__((noinline))
-execute_swap_checks(dispatcher_context_t *dc, sign_psbt_state_t *st) {
+bool __attribute__((noinline)) execute_swap_checks(dispatcher_context_t *dc,
+ sign_psbt_state_t *st) {
LOG_PROCESSOR(__FILE__, __LINE__, __func__);
// Swap feature: check that wallet policy is a default one
diff --git a/src/handler/sign_psbt/transaction_display.c b/src/handler/sign_psbt/transaction_display.c
index 5aaabdd..eb85362 100644
--- a/src/handler/sign_psbt/transaction_display.c
+++ b/src/handler/sign_psbt/transaction_display.c
@@ -35,14 +35,14 @@
#include "script.h"
#include "sw.h"
-static bool __attribute__((noinline))
-display_output(dispatcher_context_t *dc,
- sign_psbt_state_t *st,
- int cur_output_index,
- int external_outputs_count,
- const uint8_t out_scriptPubKey[static MAX_OUTPUT_SCRIPTPUBKEY_LEN],
- size_t out_scriptPubKey_len,
- uint64_t out_amount) {
+static bool __attribute__((noinline)) display_output(
+ dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ int cur_output_index,
+ int external_outputs_count,
+ const uint8_t out_scriptPubKey[static MAX_OUTPUT_SCRIPTPUBKEY_LEN],
+ size_t out_scriptPubKey_len,
+ uint64_t out_amount) {
UNUSED(cur_output_index);
// show this output's address
@@ -95,7 +95,7 @@ static bool get_output_script_and_amount(
// Read the output's amount
int result_len = call_get_merkleized_map_value(dc,
&map,
- (uint8_t[]){PSBT_OUT_AMOUNT},
+ (uint8_t[]) {PSBT_OUT_AMOUNT},
1,
raw_result,
sizeof(raw_result));
@@ -109,7 +109,7 @@ static bool get_output_script_and_amount(
// Read the output's scriptPubKey
result_len = call_get_merkleized_map_value(dc,
&map,
- (uint8_t[]){PSBT_OUT_SCRIPT},
+ (uint8_t[]) {PSBT_OUT_SCRIPT},
1,
out_scriptPubKey,
MAX_OUTPUT_SCRIPTPUBKEY_LEN);
@@ -180,8 +180,8 @@ static bool __attribute__((noinline)) display_external_outputs(
return true;
}
-static bool __attribute__((noinline))
-display_warnings(dispatcher_context_t *dc, sign_psbt_state_t *st) {
+static bool __attribute__((noinline)) display_warnings(dispatcher_context_t *dc,
+ sign_psbt_state_t *st) {
// If any input has non-default sighash, we warn the user
if (st->warnings.non_default_sighash && !ui_warn_nondefault_sighash(dc)) {
SEND_SW(dc, SW_DENY);
diff --git a/src/handler/sign_psbt/txhashes.c b/src/handler/sign_psbt/txhashes.c
index 8a71b1e..fa03091 100644
--- a/src/handler/sign_psbt/txhashes.c
+++ b/src/handler/sign_psbt/txhashes.c
@@ -97,7 +97,7 @@ static int hash_output_n(dispatcher_context_t *dc,
uint8_t amount_raw[8];
if (8 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_OUT_AMOUNT},
+ (uint8_t[]) {PSBT_OUT_AMOUNT},
1,
amount_raw,
8)) {
@@ -111,7 +111,7 @@ static int hash_output_n(dispatcher_context_t *dc,
uint8_t out_script[MAX_OUTPUT_SCRIPTPUBKEY_LEN];
int out_script_len = call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_OUT_SCRIPT},
+ (uint8_t[]) {PSBT_OUT_SCRIPT},
1,
out_script,
sizeof(out_script));
@@ -137,8 +137,9 @@ static int hash_outputs(dispatcher_context_t *dc,
return 0;
}
-bool __attribute__((noinline))
-compute_tx_hashes(dispatcher_context_t *dc, sign_psbt_state_t *st, tx_hashes_t *hashes) {
+bool __attribute__((noinline)) compute_tx_hashes(dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ tx_hashes_t *hashes) {
{
// compute sha_prevouts and sha_sequences
cx_sha256_t sha_prevouts_context, sha_sequences_context;
@@ -161,7 +162,7 @@ compute_tx_hashes(dispatcher_context_t *dc, sign_psbt_state_t *st, tx_hashes_t *
uint8_t ith_prevout_hash[32];
if (32 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_IN_PREVIOUS_TXID},
+ (uint8_t[]) {PSBT_IN_PREVIOUS_TXID},
1,
ith_prevout_hash,
32)) {
@@ -174,7 +175,7 @@ compute_tx_hashes(dispatcher_context_t *dc, sign_psbt_state_t *st, tx_hashes_t *
uint8_t ith_prevout_n_raw[4];
if (4 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_IN_OUTPUT_INDEX},
+ (uint8_t[]) {PSBT_IN_OUTPUT_INDEX},
1,
ith_prevout_n_raw,
4)) {
@@ -187,7 +188,7 @@ compute_tx_hashes(dispatcher_context_t *dc, sign_psbt_state_t *st, tx_hashes_t *
uint8_t ith_nSequence_raw[4];
if (4 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_IN_SEQUENCE},
+ (uint8_t[]) {PSBT_IN_SEQUENCE},
1,
ith_nSequence_raw,
4)) {
@@ -304,7 +305,7 @@ bool __attribute__((noinline)) compute_sighash_legacy(dispatcher_context_t *dc,
uint8_t ith_prevout_hash[32];
if (32 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_IN_PREVIOUS_TXID},
+ (uint8_t[]) {PSBT_IN_PREVIOUS_TXID},
1,
ith_prevout_hash,
32)) {
@@ -317,7 +318,7 @@ bool __attribute__((noinline)) compute_sighash_legacy(dispatcher_context_t *dc,
uint8_t ith_prevout_n_raw[4];
if (4 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_IN_OUTPUT_INDEX},
+ (uint8_t[]) {PSBT_IN_OUTPUT_INDEX},
1,
ith_prevout_n_raw,
4)) {
@@ -348,7 +349,7 @@ bool __attribute__((noinline)) compute_sighash_legacy(dispatcher_context_t *dc,
int redeemScript_len =
update_hashes_with_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_REDEEM_SCRIPT},
+ (uint8_t[]) {PSBT_IN_REDEEM_SCRIPT},
1,
NULL,
&sighash_context.header);
@@ -364,7 +365,7 @@ bool __attribute__((noinline)) compute_sighash_legacy(dispatcher_context_t *dc,
uint8_t ith_nSequence_raw[4];
if (4 != call_get_merkleized_map_value(dc,
&ith_map,
- (uint8_t[]){PSBT_IN_SEQUENCE},
+ (uint8_t[]) {PSBT_IN_SEQUENCE},
1,
ith_nSequence_raw,
4)) {
@@ -397,16 +398,16 @@ bool __attribute__((noinline)) compute_sighash_legacy(dispatcher_context_t *dc,
return true;
}
-bool __attribute__((noinline))
-compute_sighash_segwitv0(dispatcher_context_t *dc,
- const sign_psbt_state_t *st,
- const tx_hashes_t *hashes,
- const merkleized_map_commitment_t *input_map,
- unsigned int input_index,
- const uint8_t *script,
- size_t script_len,
- uint8_t sighash_byte,
- uint8_t sighash[static 32]) {
+bool __attribute__((noinline)) compute_sighash_segwitv0(
+ dispatcher_context_t *dc,
+ const sign_psbt_state_t *st,
+ const tx_hashes_t *hashes,
+ const merkleized_map_commitment_t *input_map,
+ unsigned int input_index,
+ const uint8_t *script,
+ size_t script_len,
+ uint8_t sighash_byte,
+ uint8_t sighash[static 32]) {
LOG_PROCESSOR(__FILE__, __LINE__, __func__);
cx_sha256_t sighash_context;
@@ -445,7 +446,7 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
uint8_t prevout_hash[32];
if (32 != call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_PREVIOUS_TXID},
+ (uint8_t[]) {PSBT_IN_PREVIOUS_TXID},
1,
prevout_hash,
32)) {
@@ -458,7 +459,7 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
uint8_t prevout_n_raw[4];
if (4 != call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_OUTPUT_INDEX},
+ (uint8_t[]) {PSBT_IN_OUTPUT_INDEX},
1,
prevout_n_raw,
4)) {
@@ -485,7 +486,7 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
int witnessScript_len = update_hashes_with_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_WITNESS_SCRIPT},
+ (uint8_t[]) {PSBT_IN_WITNESS_SCRIPT},
1,
&witnessScript_hash_context.header,
&sighash_context.header);
@@ -519,7 +520,7 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
int witness_utxo_len = call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_WITNESS_UTXO},
+ (uint8_t[]) {PSBT_IN_WITNESS_UTXO},
1,
witness_utxo,
sizeof(witness_utxo));
@@ -538,7 +539,7 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
uint8_t nSequence_raw[4];
if (4 != call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_SEQUENCE},
+ (uint8_t[]) {PSBT_IN_SEQUENCE},
1,
nSequence_raw,
4)) {
@@ -585,17 +586,17 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
return true;
}
-bool __attribute__((noinline))
-compute_sighash_segwitv1(dispatcher_context_t *dc,
- const sign_psbt_state_t *st,
- const tx_hashes_t *hashes,
- const merkleized_map_commitment_t *input_map,
- unsigned int input_index,
- const uint8_t *scriptPubKey,
- size_t scriptPubKey_len,
- const uint8_t *tapleaf_hash,
- uint8_t sighash_byte,
- uint8_t sighash[static 32]) {
+bool __attribute__((noinline)) compute_sighash_segwitv1(
+ dispatcher_context_t *dc,
+ const sign_psbt_state_t *st,
+ const tx_hashes_t *hashes,
+ const merkleized_map_commitment_t *input_map,
+ unsigned int input_index,
+ const uint8_t *scriptPubKey,
+ size_t scriptPubKey_len,
+ const uint8_t *tapleaf_hash,
+ uint8_t sighash_byte,
+ uint8_t sighash[static 32]) {
LOG_PROCESSOR(__FILE__, __LINE__, __func__);
cx_sha256_t sighash_context;
@@ -638,7 +639,7 @@ compute_sighash_segwitv1(dispatcher_context_t *dc,
// outpoint (hash)
if (32 != call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_PREVIOUS_TXID},
+ (uint8_t[]) {PSBT_IN_PREVIOUS_TXID},
1,
tmp,
32)) {
@@ -650,7 +651,7 @@ compute_sighash_segwitv1(dispatcher_context_t *dc,
// outpoint (output index)
if (4 != call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_OUTPUT_INDEX},
+ (uint8_t[]) {PSBT_IN_OUTPUT_INDEX},
1,
tmp,
4)) {
@@ -661,7 +662,7 @@ compute_sighash_segwitv1(dispatcher_context_t *dc,
if (8 > call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_WITNESS_UTXO},
+ (uint8_t[]) {PSBT_IN_WITNESS_UTXO},
1,
tmp,
8 + 1 + MAX_PREVOUT_SCRIPTPUBKEY_LEN)) {
@@ -679,7 +680,7 @@ compute_sighash_segwitv1(dispatcher_context_t *dc,
// nSequence
if (4 != call_get_merkleized_map_value(dc,
input_map,
- (uint8_t[]){PSBT_IN_SEQUENCE},
+ (uint8_t[]) {PSBT_IN_SEQUENCE},
1,
tmp,
4)) {
diff --git a/src/handler/sign_psbt/txhashes.h b/src/handler/sign_psbt/txhashes.h
index 29092c5..778eaed 100644
--- a/src/handler/sign_psbt/txhashes.h
+++ b/src/handler/sign_psbt/txhashes.h
@@ -29,8 +29,9 @@
* @param[out] hashes Pointer to the structure where the computed hashes will be stored.
* @return true if the computation is successful, false otherwise.
*/
-bool __attribute__((noinline))
-compute_tx_hashes(dispatcher_context_t *dc, sign_psbt_state_t *st, tx_hashes_t *hashes);
+bool __attribute__((noinline)) compute_tx_hashes(dispatcher_context_t *dc,
+ sign_psbt_state_t *st,
+ tx_hashes_t *hashes);
/**
* @brief Computes the legacy sighash for a given input.
@@ -73,16 +74,16 @@ bool __attribute__((noinline)) compute_sighash_legacy(dispatcher_context_t *dc,
* @param[out] sighash Array where the computed sighash will be stored (must be at least 32 bytes).
* @return true if the computation is successful, false otherwise.
*/
-bool __attribute__((noinline))
-compute_sighash_segwitv0(dispatcher_context_t *dc,
- const sign_psbt_state_t *st,
- const tx_hashes_t *hashes,
- const merkleized_map_commitment_t *input_map,
- unsigned int input_index,
- const uint8_t *script,
- size_t script_len,
- uint8_t sighash_byte,
- uint8_t sighash[static 32]);
+bool __attribute__((noinline)) compute_sighash_segwitv0(
+ dispatcher_context_t *dc,
+ const sign_psbt_state_t *st,
+ const tx_hashes_t *hashes,
+ const merkleized_map_commitment_t *input_map,
+ unsigned int input_index,
+ const uint8_t *script,
+ size_t script_len,
+ uint8_t sighash_byte,
+ uint8_t sighash[static 32]);
/**
* Computes the SegWit v1 (Taproot) sighash for a given input.
@@ -101,14 +102,14 @@ compute_sighash_segwitv0(dispatcher_context_t *dc,
* @param[out] sighash Array where the computed sighash will be stored (must be at least 32 bytes).
* @return true if the computation is successful, false otherwise.
*/
-bool __attribute__((noinline))
-compute_sighash_segwitv1(dispatcher_context_t *dc,
- const sign_psbt_state_t *st,
- const tx_hashes_t *hashes,
- const merkleized_map_commitment_t *input_map,
- unsigned int input_index,
- const uint8_t *scriptPubKey,
- size_t scriptPubKey_len,
- const uint8_t *tapleaf_hash,
- uint8_t sighash_byte,
- uint8_t sighash[static 32]);
+bool __attribute__((noinline)) compute_sighash_segwitv1(
+ dispatcher_context_t *dc,
+ const sign_psbt_state_t *st,
+ const tx_hashes_t *hashes,
+ const merkleized_map_commitment_t *input_map,
+ unsigned int input_index,
+ const uint8_t *scriptPubKey,
+ size_t scriptPubKey_len,
+ const uint8_t *tapleaf_hash,
+ uint8_t sighash_byte,
+ uint8_t sighash[static 32]);
diff --git a/src/swap/handle_check_address.c b/src/swap/handle_check_address.c
index 74eac53..b8c556a 100644
--- a/src/swap/handle_check_address.c
+++ b/src/swap/handle_check_address.c
@@ -74,7 +74,7 @@ bool get_address_from_compressed_public_key(unsigned char format,
uint8_t parity;
crypto_tr_tweak_pubkey(compressed_pub_key + 1,
- (uint8_t[]){},
+ (uint8_t[]) {},
0,
&parity,
tweaked_key);
diff --git a/src/ui/display_nbgl.c b/src/ui/display_nbgl.c
index e41fadb..722bc9f 100644
--- a/src/ui/display_nbgl.c
+++ b/src/ui/display_nbgl.c
@@ -155,7 +155,7 @@ void ui_display_transaction_simplified_flow_init(void) {
ui_validate_transaction_state_t *state = (ui_validate_transaction_state_t *) &g_ui_state;
if (state->has_wallet_policy) {
- pairs[n_pairs++] = (nbgl_layoutTagValue_t){
+ pairs[n_pairs++] = (nbgl_layoutTagValue_t) {
.item = "From",
.value = state->wallet_policy_name,
};
@@ -169,21 +169,21 @@ void ui_display_transaction_simplified_flow_add(void) {
if (!state->is_self_transfer) {
if (state->n_outputs > 1) {
pairs[n_pairs++] =
- (nbgl_layoutTagValue_t){.item = "Transaction output",
- .value = state->output_index_str[output_index],
- .forcePageStart = true};
+ (nbgl_layoutTagValue_t) {.item = "Transaction output",
+ .value = state->output_index_str[output_index],
+ .forcePageStart = true};
}
- pairs[n_pairs++] = (nbgl_layoutTagValue_t){.item = "Amount",
- .value = state->amount[output_index],
- .forcePageStart = false};
+ pairs[n_pairs++] = (nbgl_layoutTagValue_t) {.item = "Amount",
+ .value = state->amount[output_index],
+ .forcePageStart = false};
- pairs[n_pairs++] = (nbgl_layoutTagValue_t){
+ pairs[n_pairs++] = (nbgl_layoutTagValue_t) {
.item = "To",
.value = state->address_or_description[output_index],
};
} else {
pairs[n_pairs++] =
- (nbgl_layoutTagValue_t){.item = "Amount", .value = SELF_TRANSFER_DESCRIPTION};
+ (nbgl_layoutTagValue_t) {.item = "Amount", .value = SELF_TRANSFER_DESCRIPTION};
}
}
@@ -191,15 +191,15 @@ void ui_display_transaction_simplified_flow_show(void) {
ui_validate_transaction_state_t *state = (ui_validate_transaction_state_t *) &g_ui_state;
if (state->warnings.high_fee) {
- pairs[n_pairs++] = (nbgl_contentTagValue_t){.item = GA_WARN_HIGH_FEES_TITLE,
- .value = GA_WARN_HIGH_FEES,
- .centeredInfo = true,
- .valueIcon = &ICON_APP_IMPORTANT};
+ pairs[n_pairs++] = (nbgl_contentTagValue_t) {.item = GA_WARN_HIGH_FEES_TITLE,
+ .value = GA_WARN_HIGH_FEES,
+ .centeredInfo = true,
+ .valueIcon = &ICON_APP_IMPORTANT};
}
- pairs[n_pairs++] = (nbgl_layoutTagValue_t){.item = "Fees",
- .value = state->fee,
- .forcePageStart = state->n_outputs > 1 ? 1 : 0};
+ pairs[n_pairs++] = (nbgl_layoutTagValue_t) {.item = "Fees",
+ .value = state->fee,
+ .forcePageStart = state->n_outputs > 1 ? 1 : 0};
pairList.nbPairs = n_pairs;
@@ -221,7 +221,7 @@ void ui_display_transaction_streaming_prompt(void) {
ui_validate_transaction_state_t *state = (ui_validate_transaction_state_t *) &g_ui_state;
if (state->has_wallet_policy) {
- pairs[0] = (nbgl_layoutTagValue_t){
+ pairs[0] = (nbgl_layoutTagValue_t) {
.item = "From",
.value = state->wallet_policy_name,
};
@@ -263,10 +263,10 @@ void ui_display_transaction_streaming_flow(bool is_self_transfer) {
ui_validate_transaction_state_t *state = (ui_validate_transaction_state_t *) &g_ui_state;
if (state->warnings.high_fee) {
- pairs[l_n_pairs++] = (nbgl_contentTagValue_t){.item = GA_WARN_HIGH_FEES_TITLE,
- .value = GA_WARN_HIGH_FEES,
- .centeredInfo = true,
- .valueIcon = &ICON_APP_IMPORTANT};
+ pairs[l_n_pairs++] = (nbgl_contentTagValue_t) {.item = GA_WARN_HIGH_FEES_TITLE,
+ .value = GA_WARN_HIGH_FEES,
+ .centeredInfo = true,
+ .valueIcon = &ICON_APP_IMPORTANT};
}
if (!is_self_transfer) {
@@ -351,12 +351,12 @@ void ui_display_register_wallet_policy_flow(void) {
pairList.nbMaxLinesForValue = 0;
pairList.pairs = pairs;
- pairs[n_pairs++] = (nbgl_layoutTagValue_t){
+ pairs[n_pairs++] = (nbgl_layoutTagValue_t) {
.item = "Account name",
.value = g_ui_state.register_wallet_policy.wallet_name,
};
- pairs[n_pairs++] = (nbgl_layoutTagValue_t){
+ pairs[n_pairs++] = (nbgl_layoutTagValue_t) {
#ifdef SCREEN_SIZE_WALLET
.item = "Descriptor template",
#else
@@ -365,14 +365,14 @@ void ui_display_register_wallet_policy_flow(void) {
.value = g_ui_state.register_wallet_policy.descriptor_template,
};
- pairs[n_pairs++] = (nbgl_contentTagValue_t){.centeredInfo = true,
- .item = "Review co-signer\npublic keys",
- .value = ""};
+ pairs[n_pairs++] = (nbgl_contentTagValue_t) {.centeredInfo = true,
+ .item = "Review co-signer\npublic keys",
+ .value = ""};
for (size_t i = 0; i < g_ui_state.register_wallet_policy.n_keys; i++) {
pairs[n_pairs++] =
- (nbgl_layoutTagValue_t){.item = g_ui_state.register_wallet_policy.keys_label[i],
- .value = g_ui_state.register_wallet_policy.keys_info[i]};
+ (nbgl_layoutTagValue_t) {.item = g_ui_state.register_wallet_policy.keys_label[i],
+ .value = g_ui_state.register_wallet_policy.keys_info[i]};
}
pairList.nbPairs = n_pairs;
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.