trinary_input_string: simply bip39 word helper function
What changed, and why it matters
This is a small internal cleanup in the BitBox02 firmware's on-screen text input component. A helper function that fetches BIP39 seed words was simplified so callers no longer check its return value; the helper itself now aborts on failure. There is no security vulnerability here—just a minor code-style refactor that keeps the same failure behavior.
No security action required. Treat as normal code-quality/maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors _get_bip39_word_stack() from returning bool (success/failure of rust_get_bip39_word()) to returning void and calling Abort() internally on failure. Three call sites are updated to remove the now-redundant if (!...) checks. The functional behavior on failure remains identical: the firmware aborts. The change is purely structural and does not alter error handling, trust boundaries, buffer sizes, or control flow in any security-relevant way.
Changed components
src/ui/components/trinary_input_string.cInspect captured patch +7 / −11
diff --git a/src/ui/components/trinary_input_string.c b/src/ui/components/trinary_input_string.c
index 297d1d5..2a92367 100644
--- a/src/ui/components/trinary_input_string.c
+++ b/src/ui/components/trinary_input_string.c
@@ -61,9 +61,11 @@ static char _special_chars[] = " !\"#$%&'()*+,-./:;<=>?^[\\]@_{|}";
static const UG_FONT* _font = &font_password_11X12;
-static bool _get_bip39_word_stack(uint16_t idx, char* word_out, size_t word_out_size)
+static void _get_bip39_word_stack(uint16_t idx, char* word_out, size_t word_out_size)
{
- return rust_get_bip39_word(idx, rust_util_bytes_mut((uint8_t*)word_out, word_out_size));
+ if (!rust_get_bip39_word(idx, rust_util_bytes_mut((uint8_t*)word_out, word_out_size))) {
+ Abort("_get_bip39_word_stack");
+ }
}
typedef struct {
@@ -294,9 +296,7 @@ static void _set_alphabet(component_t* trinary_input_string, bool maybe_autocomp
char charset[27] = {0};
for (size_t word_idx = 0; word_idx < data->wordlist_size; word_idx++) {
char word[10];
- if (!_get_bip39_word_stack(data->wordlist[word_idx], word, sizeof(word))) {
- Abort("_get_bip39_word_stack");
- }
+ _get_bip39_word_stack(data->wordlist[word_idx], word, sizeof(word));
if (STREQ(word, data->string)) {
data->can_confirm = true;
@@ -322,9 +322,7 @@ static void _set_alphabet(component_t* trinary_input_string, bool maybe_autocomp
if (maybe_autocomplete && !found_word_not_unique && found_word_idx != data->wordlist_size) {
char word[10];
- if (!_get_bip39_word_stack(data->wordlist[found_word_idx], word, sizeof(word))) {
- Abort("_get_bip39_word_stack");
- }
+ _get_bip39_word_stack(data->wordlist[found_word_idx], word, sizeof(word));
data->string_index = snprintf(data->string, sizeof(data->string), "%s", word);
// We autocompleted, so we don't offer any more letters to choose. The charset above
@@ -527,9 +525,7 @@ void trinary_input_string_set_input(component_t* trinary_input_string, const cha
}
for (size_t i = 0; i < data->wordlist_size; i++) {
char bip39_word[10];
- if (!_get_bip39_word_stack(data->wordlist[i], bip39_word, sizeof(bip39_word))) {
- Abort("_get_bip39_word_stack");
- }
+ _get_bip39_word_stack(data->wordlist[i], bip39_word, sizeof(bip39_word));
if (STREQ(bip39_word, word)) {
data->string_index = snprintf(data->string, sizeof(data->string), "%s", word);
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.