As pointed out in this review: #277 (comment) I'm not sure the impact on performance if we create a BN_CTX every time we call into the method, instead of statically initializing a context and subsequently reusing it. I suspect we should get a bit of improvement from reuse but need to lookout for race conditions as the context doesn't seem to be thread safe. From the openssl docs there seems to be some overhead of even freeing unmanaged BIGNUMs.
One could leave the caller in Java to setup the context statically through an init function and then leave management creation/usage of contexts to the executing thread.
Possibly investigate other libs that use the same kind of context from where objects are allocated.