@@ -60,14 +60,18 @@ struct secp256k1_context_struct {
60
60
secp256k1_ecmult_gen_context ecmult_gen_ctx ;
61
61
secp256k1_callback illegal_callback ;
62
62
secp256k1_callback error_callback ;
63
+ #if SECP256K1_CHECKMEM_ENABLED
63
64
int declassify ;
65
+ #endif
64
66
};
65
67
66
68
static const secp256k1_context secp256k1_context_static_ = {
67
69
{ 0 },
68
70
{ secp256k1_default_illegal_callback_fn , 0 },
69
- { secp256k1_default_error_callback_fn , 0 },
70
- 0
71
+ { secp256k1_default_error_callback_fn , 0 }
72
+ #if SECP256K1_CHECKMEM_ENABLED
73
+ , 0
74
+ #endif
71
75
};
72
76
const secp256k1_context * secp256k1_context_static = & secp256k1_context_static_ ;
73
77
const secp256k1_context * secp256k1_context_no_precomp = & secp256k1_context_static_ ;
@@ -116,7 +120,9 @@ secp256k1_context* secp256k1_context_preallocated_create(void* prealloc, unsigne
116
120
/* Flags have been checked by secp256k1_context_preallocated_size. */
117
121
VERIFY_CHECK ((flags & SECP256K1_FLAGS_TYPE_MASK ) == SECP256K1_FLAGS_TYPE_CONTEXT );
118
122
secp256k1_ecmult_gen_context_build (& ret -> ecmult_gen_ctx );
123
+ #if SECP256K1_CHECKMEM_ENABLED
119
124
ret -> declassify = !!(flags & SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY );
125
+ #endif
120
126
121
127
return ret ;
122
128
}
@@ -199,7 +205,13 @@ void secp256k1_scratch_space_destroy(const secp256k1_context *ctx, secp256k1_scr
199
205
* of the software.
200
206
*/
201
207
static SECP256K1_INLINE void secp256k1_declassify (const secp256k1_context * ctx , const void * p , size_t len ) {
208
+ #if SECP256K1_CHECKMEM_ENABLED
202
209
if (EXPECT (ctx -> declassify , 0 )) SECP256K1_CHECKMEM_DEFINE (p , len );
210
+ #else
211
+ (void )ctx ;
212
+ (void )p ;
213
+ (void )len ;
214
+ #endif
203
215
}
204
216
205
217
static int secp256k1_pubkey_load (const secp256k1_context * ctx , secp256k1_ge * ge , const secp256k1_pubkey * pubkey ) {
0 commit comments