Skip to content

Questions about some clear functions usage #659

@spartucus

Description

@spartucus

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions