What changed, and why it matters
This commit fixes build errors in the simulator (non-production) build of the Keystone 3 firmware. It removes an unused public-key derivation step in Bitcoin PSBT handling, relaxes a hardware flash-read assertion when compiling for the simulator, and adds a simulator-only header include. There is no evidence of a security vulnerability being patched.
No security action required. Treat as a normal build/maintenance fix. If reviewing, confirm the removed PSBT code was genuinely unused and that the simulator flash-read skip is guarded by COMPILE_SIMULATOR in all build configurations.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit is a build-fix for the COMPILE_SIMULATOR target. Changes: (1) rust/apps/bitcoin/src/transactions/psbt/wrapped_psbt.rs removes a dead/unused derive_public_key_by_path call and its error handling; (2) src/crypto/rsa.c skips the ASSERT that the RSA primes read from flash succeeded when COMPILE_SIMULATOR is defined, because the simulator lacks real flash hardware; (3) src/ui/gui_chain/gui_chain.c includes simulator_model.h only under COMPILE_SIMULATOR. No cryptographic or access-control bug is corrected.
Changed components
Bitcoin PSBT transaction parsing (simulator build)RSA prime flash read path (simulator build only)GUI chain module (simulator build only)Inspect captured patch +7 / −13
diff --git a/rust/apps/bitcoin/src/transactions/psbt/wrapped_psbt.rs b/rust/apps/bitcoin/src/transactions/psbt/wrapped_psbt.rs
index d25a9e0..771d475 100644
--- a/rust/apps/bitcoin/src/transactions/psbt/wrapped_psbt.rs
+++ b/rust/apps/bitcoin/src/transactions/psbt/wrapped_psbt.rs
@@ -909,18 +909,6 @@ impl WrappedPsbt {
)));
}
};
- let public_key = match derive_public_key_by_path(
- xpub,
- parent_path,
- &_child_path,
- ) {
- Ok(pk) => pk,
- Err(_) => {
- return Err(BitcoinError::InvalidTransaction(format!(
- "invalid {purpose} #{index}, cannot derive associated public key"
- )));
- }
- };
return Ok(Some((
child.to_uppercase(),
Self::judge_external_key(child, parent_path.to_string()),
diff --git a/src/crypto/rsa.c b/src/crypto/rsa.c
index c9ca81d..06afc82 100644
--- a/src/crypto/rsa.c
+++ b/src/crypto/rsa.c
@@ -61,7 +61,10 @@ Rsa_primes_t *FlashReadRsaPrimes(void)
do {
primes = SRAM_MALLOC(sizeof(Rsa_primes_t));
- ASSERT(Gd25FlashReadBuffer(GetRsaAddress(), fullData, sizeof(fullData)) == sizeof(fullData));
+ int readLen = Gd25FlashReadBuffer(GetRsaAddress(), fullData, sizeof(fullData));
+#ifndef COMPILE_SIMULATOR
+ ASSERT(readLen == sizeof(fullData));
+#endif
int len = (GetMnemonicType() == MNEMONIC_TYPE_BIP39) ? (int)sizeof(seed) : GetCurrentAccountEntropyLen();
if (SecretCacheGetPassword() == NULL) {
diff --git a/src/ui/gui_chain/gui_chain.c b/src/ui/gui_chain/gui_chain.c
index 1bdb29d..0194bd3 100644
--- a/src/ui/gui_chain/gui_chain.c
+++ b/src/ui/gui_chain/gui_chain.c
@@ -2,6 +2,9 @@
#include "gui_chain.h"
#include "keystore.h"
#include "user_memory.h"
+#ifdef COMPILE_SIMULATOR
+#include "simulator_model.h"
+#endif
typedef TransactionCheckResult *(*CheckUrResultHandler)(void);
Why this scored 12/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.