| 403 | } |
| 404 | |
| 405 | void ECC_Start() { |
| 406 | assert(secp256k1_context_sign == nullptr); |
| 407 | |
| 408 | secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_SIGN); |
| 409 | assert(ctx != nullptr); |
| 410 | |
| 411 | { |
| 412 | // Pass in a random blinding seed to the secp256k1 context. |
| 413 | std::vector<unsigned char, secure_allocator<unsigned char>> vseed(32); |
| 414 | GetRandBytes(vseed.data(), 32); |
| 415 | bool ret = secp256k1_context_randomize(ctx, vseed.data()); |
| 416 | assert(ret); |
| 417 | } |
| 418 | |
| 419 | secp256k1_context_sign = ctx; |
| 420 | } |
| 421 | |
| 422 | void ECC_Stop() { |
| 423 | secp256k1_context *ctx = secp256k1_context_sign; |