Skip to content

Commit 336f097

Browse files
committed
Add runtime checking for DECLASSIFY flag
1 parent e63b068 commit 336f097

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/secp256k1.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ size_t secp256k1_context_preallocated_size(unsigned int flags) {
8989
return 0;
9090
}
9191

92+
if (EXPECT(!SECP256K1_CHECKMEM_RUNNING() && (flags & SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY), 0)) {
93+
secp256k1_callback_call(&default_illegal_callback,
94+
"Declassify flag requires running with memory checking");
95+
return 0;
96+
}
97+
9298
return ret;
9399
}
94100

0 commit comments

Comments
 (0)