HomePhabricator

[secp256k1] Prevent dead-store elimination when clearing secrets in examples

Description

[secp256k1] Prevent dead-store elimination when clearing secrets in examples

Summary:
prevent optimization in algorithms

Add secure_erase function to clear secrets

Update the function with good practices

Renaming random.h to examples_util.h

Signed-off-by: Harshil Jani <harshiljani2002@gmail.com>

This is a backport of secp256k1#1212

Test Plan: ninja secp256k1-examples

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D19817

Details

Provenance
Harshil Jani <harshiljani2002@gmail.com>Authored on Feb 17 2023, 08:38
PiRKCommitted on Apr 11 2026, 12:50
PiRKPushed on Apr 11 2026, 12:50
Reviewer
Restricted Project
Differential Revision
D19817: [secp256k1] Prevent dead-store elimination when clearing secrets in examples
Parents
rABCdd450a387f32: [secp256k1] Native jacobi symbol algorithm
Branches
Unknown
Tags
Unknown