Closed davidstritzl closed 5 years ago
Any progress on merging this patch so far? It fixes several bugs and also gives a speedup of the Python code “for free.”
Apologies for the delay. Wanted to review/test to verify there were no unintended breaking changes and dropped the ball on testing. Anyway, merging now.
This commit removes the conversion to MPZ integers when converting a Python long object to an OpenSSL bignum. For the intermediate conversion to a decimal string representation, Python internal functions are used here, however this is arguably less prone to breakage due to potential upcoming CPython changes than accessing internal fields as in the current code. This commit fixes an issue where for instance
group.init(-1) == group.init(1)
org == -1 * g
for some group elementg
. As for performance, on my local machine using Python 3.7, this reduces the time spent ongroup.init(...)
by more than half; on Python 2.7 I see no significant change.