From 83b4ea2e2224b7d92565d17d36afb26f9b7c6cb2 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sun, 27 May 2018 15:51:35 +0900 Subject: [PATCH] add ecdsaFree --- Makefile | 2 +- src/ecdsa_c.cpp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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;