From a1e5304cbc08bf657b9029c8edc5ff48dc79afbe Mon Sep 17 00:00:00 2001 From: Ramana Kumar Date: Thu, 20 Oct 2022 08:35:58 +0100 Subject: [PATCH] Make the sha functions visible with objcopy This will make portable builds tricky --- min-bindings/python/Makefile | 5 ++++- min-src/c_kzg_4844.c | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/min-bindings/python/Makefile b/min-bindings/python/Makefile index 5bd50c3..fe328ea 100644 --- a/min-bindings/python/Makefile +++ b/min-bindings/python/Makefile @@ -11,5 +11,8 @@ test: tests.py ckzg.so ecc_test: py_ecc_tests.py ckzg.so python $< -ckzg.so: ckzg.c ../../min-src/c_kzg_4844.o ../../lib/libblst.a +libblst.a: ../../lib/libblst.a + objcopy --globalize-symbol=sha256_init --globalize-symbol=sha256_update --globalize-symbol=sha256_final $< $@ + +ckzg.so: ckzg.c ../../min-src/c_kzg_4844.o libblst.a clang -O -Wall -shared -fPIC -Wl,-Bsymbolic -I${INCLUDE_PY} ${addprefix -I,${INCLUDE_DIRS}} -o $@ $^ diff --git a/min-src/c_kzg_4844.c b/min-src/c_kzg_4844.c index c944970..5e44a3b 100644 --- a/min-src/c_kzg_4844.c +++ b/min-src/c_kzg_4844.c @@ -1048,9 +1048,9 @@ typedef struct { size_t off; } SHA256_CTX; -extern void sha256_init(SHA256_CTX *ctx); -extern void sha256_update(SHA256_CTX *ctx, const void *_inp, size_t len); -extern void sha256_final(unsigned char md[32], SHA256_CTX *ctx); +void sha256_init(SHA256_CTX *ctx); +void sha256_update(SHA256_CTX *ctx, const void *_inp, size_t len); +void sha256_final(unsigned char md[32], SHA256_CTX *ctx); static void hash(uint8_t md[32], uint8_t input[], size_t n) { SHA256_CTX ctx;