chore(core): libtropic - remove obsolete bug workaround [no changelog]
What changed, and why it matters
This commit removes a small, unexplained workaround in the hardware wallet's random number generator code. The workaround previously added 4 extra bytes to a temporary buffer when generating randomness. The change makes the code cleaner and slightly more correct, but there is no indication it fixes an active security bug. It appears to be routine cleanup.
No security action required. Treat as routine maintenance. If the original workaround was related to a third-party library bug, confirm that the dependency version no longer requires it.
Security signals we found
No security-relevant keywords in commit title or message
Change is a cleanup/removal of an unexplained workaround
No bounds-checking or input-validation changes
No caller behavior or API changes
No references to vulnerabilities, CVEs, or security reports
Evidence from the diff
In core/embed/sec/rng/rng_common.c, the commit removes a bumper = 4 padding workaround from rng_fill_buffer_strong(). The temporary buffer is reduced from 32 + bumper to 32 bytes, and the block size calculation now uses sizeof(block) instead of sizeof(block) - bumper. The function still calls optiga_random_buffer() or random_buffer() to fill exactly block_size bytes. No functional security issue is evident from the diff; the change eliminates an obsolete buffer-size fudge factor.
Changed components
core/embed/sec/rng/rng_common.crng_fill_buffer_strong()Inspect captured patch +2 / −4
diff --git a/core/embed/sec/rng/rng_common.c b/core/embed/sec/rng/rng_common.c
index 883352fc..94c0b121 100644
--- a/core/embed/sec/rng/rng_common.c
+++ b/core/embed/sec/rng/rng_common.c
@@ -40,12 +40,10 @@ bool rng_fill_buffer_strong(void* buffer, size_t buffer_size) {
uint8_t* dst = (uint8_t*)buffer;
size_t remaining = buffer_size;
- static const int bumper = 4; // !@# workaround
-
- uint8_t block[32 + bumper];
+ uint8_t block[32] = {0};
while (remaining > 0) {
- size_t block_size = MIN(remaining, sizeof(block) - bumper);
+ size_t block_size = MIN(remaining, sizeof(block));
#ifdef USE_OPTIGA
if (!optiga_random_buffer(block, block_size)) {
return false;
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.