use eth* functions for c api

update-fork
MITSUNARI Shigeo 5 years ago
parent 0870bc8251
commit fee5144d0f
  1. 12
      include/mcl/impl/bn_c_impl.hpp

@ -137,23 +137,17 @@ int mclBn_setMapToMode(int mode)
int mclBn_ethMsgToFp2(mclBnFp2 *out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize) int mclBn_ethMsgToFp2(mclBnFp2 *out, const void *msg, size_t msgSize, uint8_t ctr, const void *dst, size_t dstSize)
{ {
if (mclBn_getCurveType() != MCL_BLS12_381) return -1; return mcl::bn::ethMsgToFp2(*cast(out), msg, msgSize, ctr, dst, dstSize) ? 0 : -1;
mcl::bn::BN::local::hashToFp2(*cast(out), msg, msgSize, ctr, dst, dstSize);
return 0;
} }
int mclBn_ethFp2ToG2(mclBnG2 *out, const mclBnFp2 *t1, const mclBnFp2 *t2) int mclBn_ethFp2ToG2(mclBnG2 *out, const mclBnFp2 *t1, const mclBnFp2 *t2)
{ {
if (mclBn_getCurveType() != MCL_BLS12_381) return -1; return mcl::bn::ethFp2ToG2(*cast(out), *cast(t1), cast(t2)) ? 0 : -1;
mcl::bn::BN::param.mapTo.mapToG2_WB19_.opt_swu2_map(*cast(out), *cast(t1), cast(t2));
return 0;
} }
int mclBn_ethMsgToG2(mclBnG2 *out, const void *msg, size_t msgSize, const void *dst, size_t dstSize) int mclBn_ethMsgToG2(mclBnG2 *out, const void *msg, size_t msgSize, const void *dst, size_t dstSize)
{ {
if (mclBn_getCurveType() != MCL_BLS12_381) return -1; return mcl::bn::ethMsgToG2(*cast(out), msg, msgSize, dst, dstSize) ? 0 : -1;
mcl::bn::BN::param.mapTo.mapToG2_WB19_.map2curve_osswu2(*cast(out), msg, msgSize, dst, dstSize);
return 0;
} }
void mclBn_setOriginalG2cofactor(int enable) void mclBn_setOriginalG2cofactor(int enable)

Loading…
Cancel
Save