mclBn_eth* functions are removed

update-fork
MITSUNARI Shigeo 4 years ago
parent 730c50d4ea
commit c193bb4cfe
  1. 27
      include/mcl/bn.h
  2. 33
      include/mcl/bn.hpp
  3. 15
      include/mcl/impl/bn_c_impl.hpp
  4. 1
      readme.md
  5. 25
      test/mapto_wb19_test.cpp

@ -206,33 +206,6 @@ MCLBN_DLL_API int mclBn_getETHserialization(void);
*/ */
MCLBN_DLL_API int mclBn_setMapToMode(int mode); 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 deserialize

@ -2173,39 +2173,6 @@ inline const G1& getG1basePoint()
return BN::param.basePoint; 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 } } // mcl::bn
namespace mcl { namespace local { namespace mcl { namespace local {

@ -135,21 +135,6 @@ int mclBn_setMapToMode(int mode)
return setMapToMode(mode) ? 0 : -1; 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 // set zero
void mclBnFr_clear(mclBnFr *x) void mclBnFr_clear(mclBnFr *x)

@ -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. which supports the optimal Ate pairing over BN curves and BLS12-381 curves.
# News # 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::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::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/). - `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/).

@ -244,31 +244,6 @@ void iso3Test(const T& mapto)
CYBOZU_TEST_EQUAL(Q1, Q2); 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<class T> template<class T>
void testHashToFp2v7(const T& mapto) void testHashToFp2v7(const T& mapto)
{ {

Loading…
Cancel
Save