diff --git a/Makefile b/Makefile index 6a4b620..c4c5eba 100644 --- a/Makefile +++ b/Makefile @@ -267,7 +267,7 @@ endif emcc -o $@ src/fp.cpp src/bn_c512.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=512 -DMCL_USE_WEB_CRYPTO_API -s DISABLE_EXCEPTION_CATCHING=1 ../ecdsa-wasm/ecdsa_c.js: src/ecdsa_c.cpp src/fp.cpp include/mcl/ecdsa.hpp include/mcl/ecdsa.h Makefile - emcc -o $@ src/fp.cpp src/ecdsa_c.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=256 + emcc -o $@ src/fp.cpp src/ecdsa_c.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=256 -DMCL_USE_WEB_CRYPTO_API -s DISABLE_EXCEPTION_CATCHING=1 mcl-wasm: $(MAKE) ../mcl-wasm/mcl_c.js diff --git a/src/ecdsa_c.cpp b/src/ecdsa_c.cpp index e3e7f40..3b1d53c 100644 --- a/src/ecdsa_c.cpp +++ b/src/ecdsa_c.cpp @@ -16,6 +16,14 @@ static const Signature *cast(const ecdsaSignature *p) { return reinterpret_cast< static PrecomputedPublicKey *cast(ecdsaPrecomputedPublicKey *p) { return reinterpret_cast(p); } static const PrecomputedPublicKey *cast(const ecdsaPrecomputedPublicKey *p) { return reinterpret_cast(p); } +#ifdef __EMSCRIPTEN__ +// use these functions forcibly +extern "C" ECDSA_DLL_API void ecdsaFree(void *p) +{ + free(p); +} +#endif + int ecdsaInit(void) { bool b;