Questions about some clear functions usage #659

issue spartucus opened this issue on August 28, 2019
  1. spartucus commented at 3:07 AM on August 28, 2019: none

    I saw a lot of clear functions used to clear local scalar, ge or gej variable in the last step of function, does this necessary? I thought the local variables should be no longer exists(or used) after function quit. Is this a manual destruct for local variable? Because it takes longer time(maybe just a small longer time) than just leave them alone.

    Here are example codes.

    static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context *ctx, secp256k1_gej *r, const secp256k1_scalar *gn) {
        secp256k1_ge add;
        secp256k1_scalar gnb;
        int bits;
        // ........
        secp256k1_ge_clear(&add);
        secp256k1_scalar_clear(&gnb);
    }
    
  2. sipa commented at 4:10 AM on August 28, 2019: contributor

    They (optimistically) try to wipe potentially secret data.

  3. elichai commented at 4:11 AM on August 28, 2019: contributor

    See #636

  4. spartucus commented at 5:09 AM on August 28, 2019: none

    Thanks for reply. Solve the questions lasted for days.

  5. spartucus closed this on Aug 28, 2019


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-23 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me