build(core): avoid unused variable warning in rng_fill_buffer_strong
What changed, and why it matters
This is a minor build cleanup. A developer added a compile-time branch so that when neither the Optiga nor Tropic security chips are used, the 'strong' random-number wrapper simply calls the normal random-number function and returns. The only reason for the change is to silence a compiler warning about an unused variable. There is no functional security change.
No security action needed. Treat as a normal build-warning fix.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies core/embed/sec/rng/rng_strong.c. Previously, rng_fill_buffer_strong always called rng_fill_buffer and then declared a dst pointer that was only used inside USE_OPTIGA/USE_TROPIC blocks. When both were disabled, dst was set but never read, triggering a -Wunused-variable warning under Clang. The patch wraps the original implementation in #if defined(USE_OPTIGA) || defined(USE_TROPIC) and provides a minimal fallback implementation for the disabled case. The fallback is behaviorally identical to the original code path for that configuration because the post-fill logic was already skipped.
Changed components
core/embed/sec/rng/rng_strong.cInspect captured patch +8 / −0
diff --git a/core/embed/sec/rng/rng_strong.c b/core/embed/sec/rng/rng_strong.c
index af036613..c7713a7b 100644
--- a/core/embed/sec/rng/rng_strong.c
+++ b/core/embed/sec/rng/rng_strong.c
@@ -34,6 +34,7 @@
#include "memzero.h"
#include "rand.h"
+#if defined(USE_OPTIGA) || defined(USE_TROPIC)
bool rng_fill_buffer_strong(void* buffer, size_t buffer_size) {
rng_fill_buffer(buffer, buffer_size);
@@ -70,6 +71,13 @@ bool rng_fill_buffer_strong(void* buffer, size_t buffer_size) {
return true;
}
+#else // defined(USE_OPTIGA) || defined(USE_TROPIC)
+bool rng_fill_buffer_strong(void* buffer, size_t buffer_size) {
+ rng_fill_buffer(buffer, buffer_size);
+ return true;
+}
+#endif
+
void rng_fill_buffer_strong_time(uint32_t* time_ms) {
// Assuming the buffer size is 32 bytes
#ifdef USE_OPTIGA
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.