Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */
| 452 | |
| 453 | /** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */ |
| 454 | static 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. */ |
| 472 | static void ECC_Stop() { |
no test coverage detected