diff options
Diffstat (limited to 'src/key.cpp')
-rw-r--r-- | src/key.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/key.cpp b/src/key.cpp index 2bd6396298..97d7821e74 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -166,12 +166,6 @@ void CKey::MakeNewKey(bool fCompressedIn) { fCompressed = fCompressedIn; } -bool CKey::Negate() -{ - assert(keydata); - return secp256k1_ec_seckey_negate(secp256k1_context_sign, keydata->data()); -} - CPrivKey CKey::GetPrivKey() const { assert(keydata); CPrivKey seckey; @@ -432,7 +426,8 @@ bool ECC_InitSanityCheck() { return key.VerifyPubKey(pubkey); } -void ECC_Start() { +/** Initialize the elliptic curve support. May not be called twice without calling ECC_Stop first. */ +static void ECC_Start() { assert(secp256k1_context_sign == nullptr); secp256k1_context *ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE); @@ -449,7 +444,8 @@ void ECC_Start() { secp256k1_context_sign = ctx; } -void ECC_Stop() { +/** Deinitialize the elliptic curve support. No-op if ECC_Start wasn't called first. */ +static void ECC_Stop() { secp256k1_context *ctx = secp256k1_context_sign; secp256k1_context_sign = nullptr; @@ -457,3 +453,13 @@ void ECC_Stop() { secp256k1_context_destroy(ctx); } } + +ECC_Context::ECC_Context() +{ + ECC_Start(); +} + +ECC_Context::~ECC_Context() +{ + ECC_Stop(); +} |