diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2018-05-29 04:56:33 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2018-05-29 04:58:14 +0800 |
commit | d375dc91093527a57cdcb6383d6319a16579ad9e (patch) | |
tree | 7717ce9cefd48967fd81087e8c60d2cb53a3b27d | |
parent | 57ec8e3db5359f57dbcd34686d3733fb724c634e (diff) | |
download | dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.tar dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.tar.gz dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.tar.bz2 dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.tar.lz dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.tar.xz dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.tar.zst dexon-bls-d375dc91093527a57cdcb6383d6319a16579ad9e.zip |
CSPRNG is not used in wasm
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | include/bls/bls.h | 2 | ||||
-rw-r--r-- | src/bls_c.cpp | 2 |
3 files changed, 5 insertions, 1 deletions
@@ -97,7 +97,7 @@ EMCC_OPT+=-DMCLBN_FP_UNIT_SIZE=6 JS_DEP=src/bls_c.cpp ../mcl/src/fp.cpp Makefile ../bls-wasm/bls_c.js: $(JS_DEP) - emcc -o $@ src/bls_c.cpp ../mcl/src/fp.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=384 -DMCL_USE_WEB_CRYPTO_API -s DISABLE_EXCEPTION_CATCHING=1 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -fno-exceptions -MD -MP -MF obj/bls_c.d + emcc -o $@ src/bls_c.cpp ../mcl/src/fp.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=384 -DMCL_USE_WEB_CRYPTO_API -s DISABLE_EXCEPTION_CATCHING=1 -DCYBOZU_DONT_USE_EXCEPTION -DCYBOZU_DONT_USE_STRING -DMCL_DONT_USE_CSPRNG -fno-exceptions -MD -MP -MF obj/bls_c.d bls-wasm: $(MAKE) ../bls-wasm/bls_c.js diff --git a/include/bls/bls.h b/include/bls/bls.h index ed01090..42e7109 100644 --- a/include/bls/bls.h +++ b/include/bls/bls.h @@ -107,11 +107,13 @@ BLS_DLL_API void blsSignatureAdd(blsSignature *sig, const blsSignature *rhs); // hash buf and set BLS_DLL_API int blsHashToSecretKey(blsSecretKey *sec, const void *buf, mclSize bufSize); +#ifndef MCL_DONT_USE_CSPRNG /* set secretKey if system has /dev/urandom or CryptGenRandom return 0 if success else -1 */ BLS_DLL_API int blsSecretKeySetByCSPRNG(blsSecretKey *sec); +#endif BLS_DLL_API void blsGetPublicKey(blsPublicKey *pub, const blsSecretKey *sec); BLS_DLL_API void blsGetPop(blsSignature *sig, const blsSecretKey *sec); diff --git a/src/bls_c.cpp b/src/bls_c.cpp index 27de518..274babb 100644 --- a/src/bls_c.cpp +++ b/src/bls_c.cpp @@ -288,10 +288,12 @@ int blsHashToSecretKey(blsSecretKey *sec, const void *buf, mclSize bufSize) { return mclBnFr_setHashOf(&sec->v, buf, bufSize); } +#ifndef MCL_DONT_USE_CSPRNG int blsSecretKeySetByCSPRNG(blsSecretKey *sec) { return mclBnFr_setByCSPRNG(&sec->v); } +#endif int blsPublicKeySetHexStr(blsPublicKey *pub, const char *buf, mclSize bufSize) { return mclBnG2_setStr(&pub->v, buf, bufSize, 16); |