PyElliptic refactoring to add structs instead of void pointers
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

The fork of PyElliptic that included in PyBitmessage: https://github.com/Bitmessage/PyBitmessage/tree/v0.6/src/pyelliptic needs to be refactored to use structs instead of void pointers with offsets for references to OpenSSL's BIGNUM and EC_POINT. Example of how it is supposed to be used for BIGNUM can be found in pycoin: https://github.com/richardkiss/pycoin/tree/master/pycoin/ecdsa/native , and EC_POINT is just two BIGNUMs and a couple of extra variables.

The reason for this is that it the void pointers with offsets don't work correctly on some operating systems, such as Windows 10 64bit. I had pycoin tested on W10-64 and that works so it looks like this is the correct solution. I don't have time to do this myself and a suitable testing environment. What the structs for EC_POINT and BIGNUM look like you can find in OpenSSL's headers.

The solution is a PR for PyBitmessage that has the existing unit tests for openssl and/or blind signatures pass on Windows 10 64bit, or the 64bit windows binary that is automatically generated for each PR works on W10 for sending and receiving messages. It doesn't need to be 100% ready for merging, just enough of work done that someone else can do the finishing touches or clean it up.

This is a very specific task. Don't try other approaches. Even if it doesn't work 100%, a partial work is better than something completely else.

If you have questions just ask.

I'm stuck with the correct library versions. Can you please tell me what versions and architectures (x86/x64) of C++ compiler, Qt, Python (x32 or x64?), Qt, sip, PyQt and OpenSSL exactly to compile PyBitmessage in Windows 10 x64?
TheOsch 1 month ago
You can look at the official build script, although it cross compiles on linux, you'll be able to see what libraries are used: https://github.com/Bitmessage/PyBitmessage/blob/v0.6/buildscripts/winbuild.sh
PeterSurda 1 month ago
Thank you very much. Probably I'll finish this task by tomorrow.
TheOsch 1 month ago

Crowdsource coding tasks.

1 Solution


uppose I have this piece of code, with 2 structs and a big function that receives this 2 structs as parameters:

typedef struct
{
int field_A;
int field2_A;
} A;

typedef struct
{
int field_B;
int field2_B;
} B;

void function_need_refactor(A *a, B *b)
{
for(i = 0; i < SIZE; i++)
{
do_something(a->field_A);
}

for(i = 0; i < SIZE; i++)
{
do_something(b->field2_B);
}
}

In addition, the function_need_refactor often also should return a pointer to A or B (now it returns a void *). But in general it looks like you're getting the right idea. There is also a custom malloc function in pyelliptic, which probably needs to be replaced with call to openssl's memory allocation functions (indeed perhaps this is one of the triggers for the failures on W10 64b).
PeterSurda 1 month ago