@@ -171,6 +171,7 @@ bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchS
171
171
return false ;
172
172
secp256k1_pubkey pubkey;
173
173
secp256k1_ecdsa_signature sig;
174
+ assert (secp256k1_context_verify && " secp256k1_context_verify must be initialized to use CPubKey." );
174
175
if (!secp256k1_ec_pubkey_parse (secp256k1_context_verify, &pubkey, vch, size ())) {
175
176
return false ;
176
177
}
@@ -190,6 +191,7 @@ bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned cha
190
191
bool fComp = ((vchSig[0 ] - 27 ) & 4 ) != 0 ;
191
192
secp256k1_pubkey pubkey;
192
193
secp256k1_ecdsa_recoverable_signature sig;
194
+ assert (secp256k1_context_verify && " secp256k1_context_verify must be initialized to use CPubKey." );
193
195
if (!secp256k1_ecdsa_recoverable_signature_parse_compact (secp256k1_context_verify, &sig, &vchSig[1 ], recid)) {
194
196
return false ;
195
197
}
@@ -207,13 +209,15 @@ bool CPubKey::IsFullyValid() const {
207
209
if (!IsValid ())
208
210
return false ;
209
211
secp256k1_pubkey pubkey;
212
+ assert (secp256k1_context_verify && " secp256k1_context_verify must be initialized to use CPubKey." );
210
213
return secp256k1_ec_pubkey_parse (secp256k1_context_verify, &pubkey, vch, size ());
211
214
}
212
215
213
216
bool CPubKey::Decompress () {
214
217
if (!IsValid ())
215
218
return false ;
216
219
secp256k1_pubkey pubkey;
220
+ assert (secp256k1_context_verify && " secp256k1_context_verify must be initialized to use CPubKey." );
217
221
if (!secp256k1_ec_pubkey_parse (secp256k1_context_verify, &pubkey, vch, size ())) {
218
222
return false ;
219
223
}
@@ -232,6 +236,7 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChi
232
236
BIP32Hash (cc, nChild, *begin (), begin ()+1 , out);
233
237
memcpy (ccChild.begin (), out+32 , 32 );
234
238
secp256k1_pubkey pubkey;
239
+ assert (secp256k1_context_verify && " secp256k1_context_verify must be initialized to use CPubKey." );
235
240
if (!secp256k1_ec_pubkey_parse (secp256k1_context_verify, &pubkey, vch, size ())) {
236
241
return false ;
237
242
}
@@ -273,6 +278,7 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int _nChild) const {
273
278
274
279
/* static */ bool CPubKey::CheckLowS (const std::vector<unsigned char >& vchSig) {
275
280
secp256k1_ecdsa_signature sig;
281
+ assert (secp256k1_context_verify && " secp256k1_context_verify must be initialized to use CPubKey." );
276
282
if (!ecdsa_signature_parse_der_lax (secp256k1_context_verify, &sig, vchSig.data (), vchSig.size ())) {
277
283
return false ;
278
284
}
0 commit comments