diff --git a/include/mcl/bn.h b/include/mcl/bn.h index 1396d6b..d553066 100644 --- a/include/mcl/bn.h +++ b/include/mcl/bn.h @@ -206,33 +206,6 @@ MCLBN_DLL_API int mclBn_getETHserialization(void); */ MCLBN_DLL_API int mclBn_setMapToMode(int mode); -/* - the next three functions are auxiliary of the new eth 2.0 spec - these always return 0 if MCL_BLS12_381 is set -*/ -/* - set out to hash of (msg[msgSize], ctr, dst[dstSize]) - return 0 if success - @note append zero byte to msg if necessary -*/ -// deprecated -MCLBN_DLL_API int mclBn_ethMsgToFp2(mclBnFp2 *out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize); - -/* - set out to hash of (t1, t2) - allow t2 is NULL - return 0 if success -*/ -MCLBN_DLL_API int mclBn_ethFp2ToG2(mclBnG2 *out, const mclBnFp2 *t1, const mclBnFp2 *t2); - -/* - set out to hash of (msg[msgSize], dst[dstSize]) - @note append zero byte to msg if necessary - return 0 if success -*/ -// deprecated -MCLBN_DLL_API int mclBn_ethMsgToG2(mclBnG2 *out, const void *msg, size_t msgSize, const void *dst, size_t dstSize); - //////////////////////////////////////////////// /* deserialize diff --git a/include/mcl/bn.hpp b/include/mcl/bn.hpp index 13e43e9..427ddf3 100644 --- a/include/mcl/bn.hpp +++ b/include/mcl/bn.hpp @@ -2173,39 +2173,6 @@ inline const G1& getG1basePoint() return BN::param.basePoint; } -inline const Fr& getG2cofactorAdj() -{ - return BN::param.mapTo.g2cofactorAdj_; -} - -inline const Fr& getG2cofactorAdjInv() -{ - return BN::param.mapTo.g2cofactorAdjInv_; -} - -// deprecated -inline bool ethMsgToFp2(Fp2& out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize) -{ - if (!BN::param.isBLS12) return false; - hashToFp2old(out, msg, msgSize, ctr, dst, dstSize); - return true; -} - -inline bool ethFp2ToG2(G2& out, const Fp2& t1, const Fp2 *t2 = 0) -{ - if (!BN::param.isBLS12) return false; - BN::param.mapTo.mapTo_WB19_.opt_swu2_map(out, t1, t2); - return true; -} - -// deprecated -inline bool ethMsgToG2(G2& out, const void *msg, size_t msgSize, const void *dst, size_t dstSize) -{ - if (!BN::param.isBLS12) return false; - BN::param.mapTo.mapTo_WB19_.map2curve_osswu2(out, msg, msgSize, dst, dstSize); - return true; -} - } } // mcl::bn namespace mcl { namespace local { diff --git a/include/mcl/impl/bn_c_impl.hpp b/include/mcl/impl/bn_c_impl.hpp index 1cca838..cf0b547 100644 --- a/include/mcl/impl/bn_c_impl.hpp +++ b/include/mcl/impl/bn_c_impl.hpp @@ -135,21 +135,6 @@ int mclBn_setMapToMode(int mode) return setMapToMode(mode) ? 0 : -1; } -int mclBn_ethMsgToFp2(mclBnFp2 *out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize) -{ - return mcl::bn::ethMsgToFp2(*cast(out), msg, msgSize, ctr, dst, dstSize) ? 0 : -1; -} - -int mclBn_ethFp2ToG2(mclBnG2 *out, const mclBnFp2 *t1, const mclBnFp2 *t2) -{ - return mcl::bn::ethFp2ToG2(*cast(out), *cast(t1), cast(t2)) ? 0 : -1; -} - -int mclBn_ethMsgToG2(mclBnG2 *out, const void *msg, size_t msgSize, const void *dst, size_t dstSize) -{ - return mcl::bn::ethMsgToG2(*cast(out), msg, msgSize, dst, dstSize) ? 0 : -1; -} - //////////////////////////////////////////////// // set zero void mclBnFr_clear(mclBnFr *x) diff --git a/readme.md b/readme.md index c1b1b56..1762e11 100644 --- a/readme.md +++ b/readme.md @@ -10,6 +10,7 @@ mcl is a library for pairing-based cryptography, which supports the optimal Ate pairing over BN curves and BLS12-381 curves. # News +- `mclBn_eth*` functions are removed. - `mcl::bn::mapToG1(G1& out, const Fp& v)` supports `BLS12_MAP_FP_TO_G1` in [EIP 2537](https://eips.ethereum.org/EIPS/eip-2537). - `mcl::bn::hashAndMapToG1(G1& out, const void *msg, size_t msgSize)` supports ([hash-to-curve-09 BLS12381G1_XMD:SHA-256_SSWU_RO_](https://www.ietf.org/id/draft-irtf-cfrg-hash-to-curve-09.html#name-bls12381g1_xmdsha-256_sswu_)) - `MCL_MAP_TO_MODE_HASH_TO_CURVE_07` is added for [hash-to-curve-draft-07](https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/07/). diff --git a/test/mapto_wb19_test.cpp b/test/mapto_wb19_test.cpp index 7cd6b2d..c40c129 100644 --- a/test/mapto_wb19_test.cpp +++ b/test/mapto_wb19_test.cpp @@ -244,31 +244,6 @@ void iso3Test(const T& mapto) CYBOZU_TEST_EQUAL(Q1, Q2); } -void testVec(const char *file) -{ - std::ifstream ifs(file); - if (!ifs) { - printf("skip testVec because `%s` is not found\n", file); - } - printf("testVec %s\n", file); - Fp2 t1, t2; - G2 out, P; - std::string s; - for (;;) { - ifs >> s; - if (s != "t1") break; - ifs >> t1; - ifs >> s; - CYBOZU_TEST_EQUAL(s, "t2"); - ifs >> t2; - ifs >> s; - CYBOZU_TEST_EQUAL(s, "out"); - ifs >> out.x >> out.y >> out.z; - ethFp2ToG2(P, t1, &t2); - CYBOZU_TEST_EQUAL(P, out); - } -} - template void testHashToFp2v7(const T& mapto) {