diff options
-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); |