Skip to content

Accessing scalars from Python code #101

Description

@devos50

I'm currently trying to write a few Python bindings around the FROST algorithm. To get this up and running, I need to call the secp256k1_scalar_chacha20 function, which signature seems to be defined here. The problem, however, is that I'm not entirely sure how to write the appropriate CFFI bindings to this function, given that the scalar.h file is in the src directory. The existing CFFI bindings are all related to header files in the include directory.

I tried to add the following line to the _cffi_build/build.py file:

Source('scalar.h', '#include <scalar.h>'),

I also created a scalar.h file in the _cffi_build directory with the following contents:

typedef struct {
    uint64_t d[4];
} secp256k1_scalar;

static void secp256k1_scalar_chacha20(
    secp256k1_scalar *r1,
    secp256k1_scalar *r2,
    const unsigned char *seed,
    uint64_t idx
);

When running python3 setup.py build, I'm getting the following error:

build/temp.macosx-11-x86_64-3.9/_libsecp256k1.c:570:10: fatal error: 'scalar.h' file not found

Anyone knows what I'm doing wrong here? Any help would be highly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions