Trust-Machines / p256k1

Wrappers around secp256k1 to expose the underlying math, specifically unwrapped points and scalars with multiexponentiation
Apache License 2.0
12 stars 6 forks source link

The p256k1/update tool should apply patches #44

Closed sergey-shandar closed 1 year ago

sergey-shandar commented 1 year ago
sergey-shandar commented 1 year ago

@xoloki I think, we can export static and inline functions by defining new functions, for example, instead of replacing

// secp256k1.h
SECP256K1_INLINE static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) {

to

// secp256k1.h
static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) {

we can create a new external (non static) function

// secp256k1_extension.h
#include <secp256k1.h>
SECP256K1 void prefix_secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a);
// secp256k1_extension.c
#include <secp256k1_extension.h>
SECP256K1 void prefix_secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a) {
    secp256k1_fe_add(r, a);
}
xoloki commented 1 year ago

That should work, and it would be much cleaner.

sergey-shandar commented 1 year ago

That should work, and it would be much cleaner.

50