mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-24 16:01:26 +02:00
common: Add ECC_Context RAII wrapper for ECC_Start/ECC_Stop
This commit is contained in:
parent
6f1d906438
commit
538fedde1d
10
src/key.cpp
10
src/key.cpp
@ -457,3 +457,13 @@ void ECC_Stop() {
|
|||||||
secp256k1_context_destroy(ctx);
|
secp256k1_context_destroy(ctx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ECC_Context::ECC_Context()
|
||||||
|
{
|
||||||
|
ECC_Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
ECC_Context::~ECC_Context()
|
||||||
|
{
|
||||||
|
ECC_Stop();
|
||||||
|
}
|
||||||
|
14
src/key.h
14
src/key.h
@ -245,4 +245,18 @@ void ECC_Stop();
|
|||||||
/** Check that required EC support is available at runtime. */
|
/** Check that required EC support is available at runtime. */
|
||||||
bool ECC_InitSanityCheck();
|
bool ECC_InitSanityCheck();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RAII class initializing and deinitializing global state for elliptic curve support.
|
||||||
|
* Only one instance may be initialized at a time.
|
||||||
|
*
|
||||||
|
* In the future global ECC state could be removed, and this class could contain
|
||||||
|
* state and be passed as an argument to ECC key functions.
|
||||||
|
*/
|
||||||
|
class ECC_Context
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ECC_Context();
|
||||||
|
~ECC_Context();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // BITCOIN_KEY_H
|
#endif // BITCOIN_KEY_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user