-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add static context object which has no capabilities #553
Conversation
81210ea
to
d421c3c
Compare
Should we document that you can't call set_illegal_callback on this and perhaps add some checks on some of the disallowed calls to fail if you try? |
@gmaxwell I believe the set of permitted functions on this object is exactly the functions which take a |
Sure, we can do a |
Added a commit which I considered using Edit Changed from VERIFY_CHECK to CHECK because Greg pointed out that VERIFY is only defined during unit testing. |
8f18f2d
to
9461ae6
Compare
include/secp256k1.h
Outdated
* API consistency, but currently do not require expensive precomputations or dynamic | ||
* allocations. | ||
*/ | ||
SECP256K1_API extern secp256k1_context *secp256k1_context_no_precomp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you mark this object const
? If that works you don't need any of the CHECK
invocations I think as they all require a non-const argument. It would also alleviate any concerns about synchronization etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
9461ae6
to
40fde61
Compare
@@ -91,6 +99,7 @@ secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) { | |||
} | |||
|
|||
void secp256k1_context_destroy(secp256k1_context* ctx) { | |||
CHECK(ctx != secp256k1_context_no_precomp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these necessary? A non-const
ctx pointer is used, which can't be secp256k1_context_no_precomp
(as that one is const).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point. I guess they're not necessary. I can remove them if you want, though I don't mind having them there.
utACK 40fde61 |
ACK 40fde61 |
40fde61 prevent attempts to modify `secp256k1_context_no_precomp` (Andrew Poelstra) ed7c084 add static context object which has no capabilities (Andrew Poelstra) Pull request description: Tree-SHA512: a843ed7ba00a00a46eec3146ce428d4b49eb440af766f44d731b1f51553d08de8cc9a0af5ed114d0dfdca6f4bf4a2ede4dbd6a37d6bd818b81630089424a0ba5
b3bf5f9 ecmult_impl: expand comment to explain how effective affine interacts with everything (Andrew Poelstra) efa783f Store z-ratios in the 'x' coord they'll recover (Peter Dettman) ffd3b34 add `secp256k1_ge_set_all_gej_var` test which deals with many infinite points (Andrew Poelstra) 84740ac ecmult_impl: save one fe_inv_var (Andrew Poelstra) 4704527 ecmult_impl: eliminate scratch memory used when generating context (Andrew Poelstra) 7f7a2ed ecmult_gen_impl: eliminate scratch memory used when generating context (Andrew Poelstra) Pull request description: Builds on #553 Tree-SHA512: 6031a601a4a476c1d21fc8db219383e7930434d2f199543c61aca0118412322dd814a0109c385ff1f83d16897170dd0c25051697b0f88f15234b0059b661af41
No description provided.