SIGN IN SIGN UP

fix: Scrub X25519 shared secret from global RAM after privacy op

handle_perform_privacy_operation() stores the derived X25519 shared
secret in tmpCtx.publicKeyContext.publicKey and, on the confirmation
path, copies a hex view of the secret into strings.common.fullAmount
for UI rendering. Neither global was scrubbed before returning:
set_result_perform_privacy_operation() only copied the secret into the
APDU reply buffer, successful synchronous APDUs were not followed by
reset_app_context(), and reset_app_context() itself did not clear the
strings buffer.

As a result, the last derived shared secret could remain resident in
RAM across later APDU exchanges, where a memory-disclosure bug, crash
dump, fault injection, or forensic extraction could recover it.

Two changes, kept together so the residue is closed end-to-end:

  * logic_perform_privacy_operation.c: scrub tmpCtx.publicKeyContext
    immediately after the secret has been copied to G_io_tx_buffer.
  * main.c: zero the whole strings struct in reset_app_context() so
    any UI-formatted view of secrets (and other transient strings)
    does not persist across resets.

(cherry picked from commit 46b0dba6735000465d916db5080266d2d8afbcc0)
C
Charles-Edouard de la Vergne committed
d019e3c657e2418ec9e5c98e4fd4500a5338309a
Parent: 47a1a82
Committed by Alexandre Paillier <alexandre.paillier@ledger.fr> on 8/25/2026, 3:03:58 PM