secp256k1 icon indicating copy to clipboard operation
secp256k1 copied to clipboard

build: Move generation of prebuilt files out of build system

Open real-or-random opened this issue 2 years ago • 3 comments

#1245 and its need for #1277 have shown that "abusing" autotools to generate prebuilt files is hard to understand, and remains hard to maintain.

With all this autotools mess, and since we don't even have these features in CMake, it would perhaps be cleaner to move (maintainer-)generation of the distributed files entirely out of the build system(s). This is currently hard since creating the files involves running a C program, which needs to be compiled, which needs some kind of build infrastructure. If we used Python to create the table files (see https://github.com/bitcoin-core/secp256k1/pull/919), this would simplify some things. In particular because we have a "maintainer dependency" on Python anyway now with the test vector scripts.... On the other hand, all of this is work and I doubt it's worth spending our time on this right now.

Originally posted by @real-or-random in https://github.com/bitcoin-core/secp256k1/issues/1280#issuecomment-1514726159

real-or-random avatar Apr 19 '23 14:04 real-or-random

If generate prebuilt sources manually, is it just like that:

gcc src/precompute_ecmult.c -o precompute_ecmult && ./precompute_ecmult 
gcc src/precompute_ecmult_gen.c -o precompute_ecmult_gen && ./precompute_ecmult_gen

right?

If there are no pitfalls here, two additional lines in the developers' section of the documentation can significantly simplify the build system and its usage.

UPD. Moreover, src/precompute_ecmult.c and src/precompute_ecmult_gen.c can be excluded from a release archive as build process "implementation details".

hebasto avatar Apr 22 '23 14:04 hebasto

With a "source generation / auditing" dependency on Python now with the Wycheproof code, I'm in favor of just rewriting the precomputation part in Python too. It should be pretty trivial.

sipa avatar Apr 23 '23 10:04 sipa

I'm in favor of just rewriting the precomputation part in Python too. It should be pretty trivial.

It's as trivial as picking up https://github.com/bitcoin-core/secp256k1/pull/919. :)

real-or-random avatar Apr 24 '23 06:04 real-or-random