MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ECC_Start

Function ECC_Start

src/key.cpp:454–469  ·  view source on GitHub ↗

Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */

Source from the content-addressed store, hash-verified

452
453/** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */
454static void ECC_Start() {
455 assert(secp256k1_context_sign == nullptr);
456
457 secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);
458 assert(ctx != nullptr);
459
460 {
461 // Pass in a random blinding seed to the secp256k1 context.
462 std::vector<unsigned char, secure_allocator<unsigned char>> vseed(32);
463 GetRandBytes(vseed);
464 bool ret = secp256k1_context_randomize(ctx, vseed.data());
465 assert(ret);
466 }
467
468 secp256k1_context_sign = ctx;
469}
470
471/** Deinitialize the elliptic curve support. No-op if ECC_Start wasn't called first. */
472static void ECC_Stop() {

Callers 1

ECC_ContextMethod · 0.85

Calls 4

secp256k1_context_createFunction · 0.85
GetRandBytesFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected