Make the sha functions visible with objcopy

This will make portable builds tricky
This commit is contained in:
Ramana Kumar 2022-10-20 08:35:58 +01:00
parent dee1769ecc
commit a1e5304cbc
No known key found for this signature in database
GPG Key ID: ED471C788B900433
2 changed files with 7 additions and 4 deletions

View File

@ -11,5 +11,8 @@ test: tests.py ckzg.so
ecc_test: py_ecc_tests.py ckzg.so ecc_test: py_ecc_tests.py ckzg.so
python $< 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 $@ $^ clang -O -Wall -shared -fPIC -Wl,-Bsymbolic -I${INCLUDE_PY} ${addprefix -I,${INCLUDE_DIRS}} -o $@ $^

View File

@ -1048,9 +1048,9 @@ typedef struct {
size_t off; size_t off;
} SHA256_CTX; } SHA256_CTX;
extern void sha256_init(SHA256_CTX *ctx); void sha256_init(SHA256_CTX *ctx);
extern void sha256_update(SHA256_CTX *ctx, const void *_inp, size_t len); 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_final(unsigned char md[32], SHA256_CTX *ctx);
static void hash(uint8_t md[32], uint8_t input[], size_t n) { static void hash(uint8_t md[32], uint8_t input[], size_t n) {
SHA256_CTX ctx; SHA256_CTX ctx;