rpc: rename get_boolean to get_bool
What changed, and why it matters
This commit is a simple rename of two internal helper functions from `rpc_get_boolean`/`rpc_get_boolean_or` to `rpc_get_bool`/`rpc_get_bool_or`, updating all call sites accordingly. There is no change to what the code does, no bug fix, and no security relevance.
No action needed; this is a non-functional rename.
Security signals we found
No strong security signals were identified.
Evidence from the diff
A pure refactoring change: function identifiers rpc_get_boolean and rpc_get_boolean_or in main/utils/cbor_rpc.c/cbor_rpc.h are renamed to rpc_get_bool and rpc_get_bool_or. All 18 call sites are updated to use the new names. The function bodies, signatures, return semantics, and behavior remain identical.
Changed components
main/utils/cbor_rpc.cmain/utils/cbor_rpc.hInspect captured patch +24 / −25
diff --git a/main/process/auth_user.c b/main/process/auth_user.c
index 6f517fe..bc389eb 100644
--- a/main/process/auth_user.c
+++ b/main/process/auth_user.c
@@ -359,8 +359,7 @@ void auth_user_process(void* process_ptr)
}
// Optional flag to suppress user confirmation of any pin change
- const bool suppress_pin_change_confirmation
- = rpc_get_boolean_or("suppress_pin_change_confirmation", ¶ms, false);
+ const bool suppress_pin_change_confirmation = rpc_get_bool_or("suppress_pin_change_confirmation", ¶ms, false);
// We have five cases:
// 1. Temporary - has a temporary keys in memory
diff --git a/main/process/debug_scan_qr.c b/main/process/debug_scan_qr.c
index 83c7d72..00e4dd0 100644
--- a/main/process/debug_scan_qr.c
+++ b/main/process/debug_scan_qr.c
@@ -116,7 +116,7 @@ void debug_capture_image_data_process(void* process_ptr)
// Caller may want to restrict to images which contain a valid qr code
bool check_qr = false;
- const bool ret = rpc_get_boolean("check_qr", ¶ms, &check_qr);
+ const bool ret = rpc_get_bool("check_qr", ¶ms, &check_qr);
// Launch the camera with the 'click' callback function set to
// return the captured image data in the reply message
diff --git a/main/process/debug_set_mnemonic.c b/main/process/debug_set_mnemonic.c
index bea2a4f..e26b3cf 100644
--- a/main/process/debug_set_mnemonic.c
+++ b/main/process/debug_set_mnemonic.c
@@ -43,7 +43,7 @@ void debug_set_mnemonic_process(void* process_ptr)
SENSITIVE_PUSH(&keydata, sizeof(keydata));
// Get field which can be set to test 'temporary restore' wallet
- bool temporary_wallet = rpc_get_boolean_or("temporary_wallet", ¶ms, false);
+ bool temporary_wallet = rpc_get_bool_or("temporary_wallet", ¶ms, false);
// Slightly hacky, can accept a seed or a mnemonic
if (rpc_has_field_data("seed", ¶ms)) {
diff --git a/main/process/get_master_blinding_key.c b/main/process/get_master_blinding_key.c
index fb59630..641e50f 100644
--- a/main/process/get_master_blinding_key.c
+++ b/main/process/get_master_blinding_key.c
@@ -26,7 +26,7 @@ void get_master_blinding_key_process(void* process_ptr)
const CborError cberr = cbor_value_map_find_value(&process->ctx.value, CBOR_RPC_TAG_PARAMS, ¶ms);
if (cberr == CborNoError || cbor_value_is_valid(¶ms) || cbor_value_is_map(¶ms)) {
// This field is optional and defaults to false if not present (initialized above)
- only_if_silent = rpc_get_boolean_or("only_if_silent", ¶ms, false);
+ only_if_silent = rpc_get_bool_or("only_if_silent", ¶ms, false);
}
const char* question[] = { "Export master", "blinding key?" };
diff --git a/main/process/get_receive_address.c b/main/process/get_receive_address.c
index f307293..974f877 100644
--- a/main/process/get_receive_address.c
+++ b/main/process/get_receive_address.c
@@ -48,7 +48,7 @@ void get_receive_address_process(void* process_ptr)
size_t master_blinding_key_len = 0;
// Defaults to confidential addresses for liquid
- const bool confidential = rpc_get_boolean_or("confidential", ¶ms, isLiquid);
+ const bool confidential = rpc_get_bool_or("confidential", ¶ms, isLiquid);
if (confidential && !isLiquid) {
jade_process_reject_message(
process, CBOR_RPC_BAD_PARAMETERS, "Confidential addresses only apply to liquid networks");
diff --git a/main/process/get_registered_multisig.c b/main/process/get_registered_multisig.c
index d6dba54..1969549 100644
--- a/main/process/get_registered_multisig.c
+++ b/main/process/get_registered_multisig.c
@@ -124,7 +124,7 @@ void get_registered_multisig_process(void* process_ptr)
bool asfile = false;
if (rpc_has_field_data("as_file", ¶ms)) {
- if (!rpc_get_boolean("as_file", ¶ms, &asfile)) {
+ if (!rpc_get_bool("as_file", ¶ms, &asfile)) {
jade_process_reject_message(process, CBOR_RPC_BAD_PARAMETERS, "Failed to extract valid as_file parameter");
goto cleanup;
}
diff --git a/main/process/get_shared_nonce.c b/main/process/get_shared_nonce.c
index a6a6a4e..9a2ea84 100644
--- a/main/process/get_shared_nonce.c
+++ b/main/process/get_shared_nonce.c
@@ -67,7 +67,7 @@ void get_shared_nonce_process(void* process_ptr)
size_t blinding_pubkey_len = 0;
if (rpc_has_field_data("include_pubkey", ¶ms)) {
bool include_pubkey = false;
- if (!rpc_get_boolean("include_pubkey", ¶ms, &include_pubkey)) {
+ if (!rpc_get_bool("include_pubkey", ¶ms, &include_pubkey)) {
jade_process_reject_message(
process, CBOR_RPC_BAD_PARAMETERS, "Failed to extract valid pubkey flag from parameters");
goto cleanup;
diff --git a/main/process/ota_util.c b/main/process/ota_util.c
index eaca1b2..4c91968 100644
--- a/main/process/ota_util.c
+++ b/main/process/ota_util.c
@@ -216,7 +216,7 @@ jade_ota_ctx_t* ota_init(jade_process_t* process, const bool is_delta)
}
// Optional field indicating preference for rich reply data
- const bool extended_replies = rpc_get_boolean_or("extended_replies", ¶ms, false);
+ const bool extended_replies = rpc_get_bool_or("extended_replies", ¶ms, false);
// Can accept either uploaded file data hash (legacy) or hash of the full/final firmware image (preferred)
uint8_t expected_hash[SHA256_LEN];
diff --git a/main/process/process_utils.c b/main/process/process_utils.c
index 3633967..a441fc6 100644
--- a/main/process/process_utils.c
+++ b/main/process/process_utils.c
@@ -333,7 +333,7 @@ bool params_tx_input_signing_data(const bool use_ae_signatures, CborValue* param
JADE_ASSERT(errmsg);
bool is_witness;
- if (!rpc_get_boolean("is_witness", params, &is_witness)) {
+ if (!rpc_get_bool("is_witness", params, &is_witness)) {
*errmsg = "Failed to extract is_witness from parameters";
return false;
}
diff --git a/main/process/register_multisig.c b/main/process/register_multisig.c
index 3f8efd2..505bde6 100644
--- a/main/process/register_multisig.c
+++ b/main/process/register_multisig.c
@@ -693,7 +693,7 @@ void register_multisig_process(void* process_ptr)
// Handle sorted-multisig - defaults to false if not passed
bool sorted = false;
if (rpc_has_field_data("sorted", &descriptor)) {
- if (!rpc_get_boolean("sorted", &descriptor, &sorted)) {
+ if (!rpc_get_bool("sorted", &descriptor, &sorted)) {
jade_process_reject_message(process, CBOR_RPC_BAD_PARAMETERS, "Invalid sorted flag value");
goto cleanup;
}
diff --git a/main/process/sign_tx.c b/main/process/sign_tx.c
index 38761f8..5fbcf13 100644
--- a/main/process/sign_tx.c
+++ b/main/process/sign_tx.c
@@ -133,7 +133,7 @@ static bool params_signing_outputs(jade_process_t* process, const CborValue* par
// For backward-compatibility reasons we assume all populated items
// are change unless told otherwise (ie. explicit is_change: false)
- bool is_change = rpc_get_boolean_or("is_change", &arrayItem, true);
+ bool is_change = rpc_get_bool_or("is_change", &arrayItem, true);
size_t script_len = 0;
uint8_t script[WALLY_SCRIPTPUBKEY_P2WSH_LEN]; // Sufficient
@@ -450,7 +450,7 @@ static void sign_tx_impl(jade_process_t* process, const bool for_liquid)
// Whether to use Anti-Exfil signatures and message flow
// Optional flag, defaults to false
- const bool use_ae_signatures = rpc_get_boolean_or("use_ae_signatures", ¶ms, false);
+ const bool use_ae_signatures = rpc_get_bool_or("use_ae_signatures", ¶ms, false);
commitment_t* commitments = NULL;
// Liquid: Copy trusted commitment data so we can free the message
@@ -645,7 +645,7 @@ static void sign_tx_impl(jade_process_t* process, const bool for_liquid)
}
} else if (!for_liquid) {
// Bitcoin: May still need witness flag
- const bool is_witness = rpc_get_boolean_or("is_witness", ¶ms, false);
+ const bool is_witness = rpc_get_bool_or("is_witness", ¶ms, false);
input_data->sig_type = is_witness ? WALLY_SIGTYPE_SW_V0 : WALLY_SIGTYPE_PRE_SW;
input_data->sighash = WALLY_SIGHASH_ALL;
}
diff --git a/main/process/sign_utils.c b/main/process/sign_utils.c
index 22d0084..4937232 100644
--- a/main/process/sign_utils.c
+++ b/main/process/sign_utils.c
@@ -223,7 +223,7 @@ bool params_additional_info(jade_process_t* process, CborValue* params, const st
rpc_get_asset_summary(process, "wallet_output_summary", &additional_info, out_sums, num_out_sums);
// 'partial' flag (defaults to false, initially also defaulted above)
- *is_partial = rpc_get_boolean_or("is_partial", &additional_info, false);
+ *is_partial = rpc_get_bool_or("is_partial", &additional_info, false);
// Tx Type
if (!rpc_get_txtype(process, &additional_info, txtype)) {
diff --git a/main/process/update_pinserver.c b/main/process/update_pinserver.c
index e588c17..8b274ab 100644
--- a/main/process/update_pinserver.c
+++ b/main/process/update_pinserver.c
@@ -88,7 +88,7 @@ int update_pinserver(const CborValue* const params, const char** errmsg)
int retval = CBOR_RPC_BAD_PARAMETERS;
// 1. update or erase the pinserver details (defaults to false)
- const bool reset_details = rpc_get_boolean_or("reset_details", params, false);
+ const bool reset_details = rpc_get_bool_or("reset_details", params, false);
size_t urlA_len = 0, urlB_len = 0;
rpc_get_string("urlA", sizeof(urlA), params, urlA, &urlA_len);
@@ -176,7 +176,7 @@ int update_pinserver(const CborValue* const params, const char** errmsg)
}
// 2. update or erase the certificate (defaults to false)
- const bool reset_certificate = rpc_get_boolean_or("reset_certificate", params, false);
+ const bool reset_certificate = rpc_get_bool_or("reset_certificate", params, false);
const bool set_certificate = rpc_has_field_data("certificate", params);
if (set_certificate && reset_certificate) {
diff --git a/main/qrmode.c b/main/qrmode.c
index 91e4899..91ac273 100644
--- a/main/qrmode.c
+++ b/main/qrmode.c
@@ -1728,7 +1728,7 @@ static bool handle_jade_reply_http_request_show_qr(const char* message[], const
// Ultimate response is boolean
bool bool_result = false;
- if (rpc_get_boolean("result", &root, &bool_result)) {
+ if (rpc_get_bool("result", &root, &bool_result)) {
JADE_LOGI("Boolean result: %u", bool_result);
goto cleanup;
}
diff --git a/main/usbhmsc/usbmode.c b/main/usbhmsc/usbmode.c
index 7a041e5..62fa726 100644
--- a/main/usbhmsc/usbmode.c
+++ b/main/usbhmsc/usbmode.c
@@ -537,7 +537,7 @@ static bool handle_ota_reply(const uint8_t* msg, const size_t len, void* ctx)
JADE_LOGE("Invalid cbor message");
} else {
// Optional field, but we expect it to be present and true for a positive response
- *ok = rpc_get_boolean_or("result", &message, false);
+ *ok = rpc_get_bool_or("result", &message, false);
}
// We return true in all cases to indicate that a message was received
diff --git a/main/utils/cbor_rpc.c b/main/utils/cbor_rpc.c
index a6bceca..47b0e2e 100644
--- a/main/utils/cbor_rpc.c
+++ b/main/utils/cbor_rpc.c
@@ -287,7 +287,7 @@ void rpc_get_string(const char* field, const size_t max, const CborValue* value,
*written = local_written;
}
-bool rpc_get_boolean(const char* field, const CborValue* value, bool* res)
+bool rpc_get_bool(const char* field, const CborValue* value, bool* res)
{
JADE_ASSERT(value);
JADE_ASSERT(res);
@@ -296,10 +296,10 @@ bool rpc_get_boolean(const char* field, const CborValue* value, bool* res)
&& cbor_value_get_boolean(&result, res) == CborNoError;
}
-bool rpc_get_boolean_or(const char* field, const CborValue* value, const bool default_value)
+bool rpc_get_bool_or(const char* field, const CborValue* value, const bool default_value)
{
bool res = default_value;
- IGNORE_RESULT(rpc_get_boolean(field, value, &res));
+ IGNORE_RESULT(rpc_get_bool(field, value, &res));
return res;
}
diff --git a/main/utils/cbor_rpc.h b/main/utils/cbor_rpc.h
index 05d302f..4d37ddf 100644
--- a/main/utils/cbor_rpc.h
+++ b/main/utils/cbor_rpc.h
@@ -55,8 +55,8 @@ WARN_UNUSED_RESULT bool rpc_get_sizet(const char* field, const CborValue* value,
WARN_UNUSED_RESULT size_t rpc_get_sizet_or(const char* field, const CborValue* value, size_t default_value);
WARN_UNUSED_RESULT bool rpc_get_uint64_t(const char* field, const CborValue* value, uint64_t* res);
WARN_UNUSED_RESULT uint64_t rpc_get_uint64_t_or(const char* field, const CborValue* value, uint64_t default_value);
-WARN_UNUSED_RESULT bool rpc_get_boolean(const char* field, const CborValue* value, bool* res);
-WARN_UNUSED_RESULT bool rpc_get_boolean_or(const char* field, const CborValue* value, bool default_value);
+WARN_UNUSED_RESULT bool rpc_get_bool(const char* field, const CborValue* value, bool* res);
+WARN_UNUSED_RESULT bool rpc_get_bool_or(const char* field, const CborValue* value, bool default_value);
WARN_UNUSED_RESULT bool rpc_get_bip32_path(
const char* field, const CborValue* value, uint32_t* path_ptr, size_t max_path_len, size_t* written);
diff --git a/main/wire.c b/main/wire.c
index 27c0ba2..89f349b 100644
--- a/main/wire.c
+++ b/main/wire.c
@@ -82,7 +82,7 @@ static bool handle_immediate_message(const cbor_msg_t* const ctx)
// Version-info message - reply immediately if it contains the 'nonblocking' flag
CborValue params;
bool nonblocking = false;
- if (rpc_get_map("params", &ctx->value, ¶ms) && rpc_get_boolean("nonblocking", ¶ms, &nonblocking)
+ if (rpc_get_map("params", &ctx->value, ¶ms) && rpc_get_bool("nonblocking", ¶ms, &nonblocking)
&& nonblocking) {
JADE_LOGI("VerInfoEx message, replying immediately");
uint8_t buf[1024];
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.