Add runtime checking for DECLASSIFY flag

This commit is contained in:
Pieter Wuille 2022-12-20 12:25:48 -05:00
parent 5e2e6fcfc0
commit 74b026f05d
1 changed files with 6 additions and 0 deletions

View File

@ -99,6 +99,12 @@ size_t secp256k1_context_preallocated_size(unsigned int flags) {
return 0;
}
if (EXPECT(!SECP256K1_CHECKMEM_RUNNING() && (flags & SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY), 0)) {
secp256k1_callback_call(&default_illegal_callback,
"Declassify flag requires running with memory checking");
return 0;
}
return ret;
}