Questions about some clear functions usage #659

issue spartucus openend 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.

    0static void secp256k1_ecmult_gen(const secp256k1_ecmult_gen_context *ctx, secp256k1_gej *r, const secp256k1_scalar *gn) {
    1    secp256k1_ge add;
    2    secp256k1_scalar gnb;
    3    int bits;
    4    // ........
    5    secp256k1_ge_clear(&add);
    6    secp256k1_scalar_clear(&gnb);
    7}
    
  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: 2024-11-21 16:15 UTC

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