← Watch feed
Improve docs of get_merkle_preimage.h; remove stale TODO
What changed, and why it matters
This commit only updates comments and removes a stale TODO marker. No executable code, logic, or security behavior changed.
Recommended action
No action required; this is a non-functional documentation cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies documentation in get_merkle_preimage.h (clarifying that the function strips a leading 0x00 Merkle leaf prefix while still hashing the full preimage, and correcting a typo) and removes a TODO comment from get_merkle_preimage.c. There are no functional changes.
Changed components
src/handler/lib/get_merkle_preimage.csrc/handler/lib/get_merkle_preimage.hInspect captured patch +6 / −4
diff --git a/src/handler/lib/get_merkle_preimage.c b/src/handler/lib/get_merkle_preimage.c
index 6bb0de1..ebce71e 100644
--- a/src/handler/lib/get_merkle_preimage.c
+++ b/src/handler/lib/get_merkle_preimage.c
@@ -11,8 +11,6 @@
#include "debug.h"
#include "sw.h"
-// TODO: refactor common code with stream_preimage.c
-
int call_get_merkle_preimage(dispatcher_context_t *dispatcher_context,
const uint8_t hash[static 32],
uint8_t *out_ptr,
diff --git a/src/handler/lib/get_merkle_preimage.h b/src/handler/lib/get_merkle_preimage.h
index 1bd457b..7b367a0 100644
--- a/src/handler/lib/get_merkle_preimage.h
+++ b/src/handler/lib/get_merkle_preimage.h
@@ -4,12 +4,16 @@
#include "dispatcher.h"
/**
+ * Like call_get_preimage, but strips the leading 0x00 Merkle leaf prefix from the output.
+ * The hash is still verified over the full preimage (including the prefix byte).
+ *
* In this flow, the HWW sends a CCMD_GET_PREIMAGE command with a SHA256 hash.
- * The client must respond with a the preimage (at most 254 bytes), prefixed by its length.
+ * The client must respond with the preimage (at most 254 bytes), prefixed by its length.
* The flow fails with SW_WRONG_DATA_LENGTH if the response is too short; it will fail with
* SW_INCORRECT_DATA if the computed hash does not match.
*
- * Returns the length of the preimage on success, or a negative number in case of failure.
+ * Returns the length of the preimage without the prefix on success, or a negative number in case
+ * of failure.
*/
int call_get_merkle_preimage(dispatcher_context_t *dispatcher_context,
const uint8_t hash[static 32],
Risk score
Our methodology →Why this scored 15/100
Human-validated context
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
No validated notes yet.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.