What changed, and why it matters
This commit fixes a minor error-handling bug in the BitBox02 firmware's Optiga secure-chip code. Two functions were returning a generic error code (1) when a salt-related failure occurred, instead of returning the specific salt-error code (SC_ERR_SALT). The commit message says the error path is essentially unreachable in normal use because the salt root is always set when Optiga functions are used. The change improves code correctness and diagnostics but does not appear to create or fix a directly exploitable security vulnerability.
Treat as a routine correctness fix. No urgent security action is required. Include in normal firmware release testing; consider adding an assertion or early-fail path for the unset-salt-root condition to make the invariant explicit.
Security signals we found
Error-code correction in secure-element password handling
No change to control flow, parsing, cryptography, or memory operations
Corrected error path described by vendor as practically unreachable
Evidence from the diff
In src/optiga/optiga.c, optiga_init_new_password() and _optiga_verify_password() call a function that salts and hashes the user password. On failure, both returned the literal integer 1 rather than the symbolic error constant SC_ERR_SALT. The patch changes both return values to SC_ERR_SALT. The commit message states the failure can only occur when the salt root is unset, which never happens during Optiga operations, so the corrected path is effectively dead code under normal operation. No buffer overflows, authentication bypasses, cryptographic flaws, or privilege changes are present in the diff.
Changed components
src/optiga/optiga.coptiga_init_new_password()_optiga_verify_password()Inspect captured patch +2 / −2
diff --git a/src/optiga/optiga.c b/src/optiga/optiga.c
index 04f62dd..65fe8b9 100644
--- a/src/optiga/optiga.c
+++ b/src/optiga/optiga.c
@@ -1351,7 +1351,7 @@ int optiga_init_new_password(const char* password)
strlen(password),
"optiga_password",
password_salted_hashed)) {
- return 1;
+ return SC_ERR_SALT;
}
res = _set_password(
@@ -1383,7 +1383,7 @@ static int _optiga_verify_password(const char* password, uint8_t* password_secre
strlen(password),
"optiga_password",
password_salted_hashed)) {
- return 1;
+ return SC_ERR_SALT;
}
optiga_lib_status_t res =
Why this scored 22/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.