remove bls12.hpp

dev
MITSUNARI Shigeo 7 years ago
parent 7814aea9ed
commit f898b4f412
  1. 2
      include/mcl/aggregate_sig.hpp
  2. 51
      include/mcl/bls12.hpp
  3. 6
      include/mcl/bls12_381.hpp
  4. 1500
      include/mcl/bn.hpp
  5. 4
      include/mcl/bn256.hpp
  6. 4
      include/mcl/bn384.hpp
  7. 2
      include/mcl/bn512.hpp
  8. 1472
      include/mcl/pairing_util.hpp
  9. 2
      include/mcl/she.hpp
  10. 2
      src/bn_c_impl.hpp
  11. 2
      src/she_c_impl.hpp
  12. 2
      test/bls12_test.cpp
  13. 2
      test/bn384_test.cpp
  14. 2
      test/bn512_test.cpp
  15. 2
      test/bn_test.cpp
  16. 8
      test/glv_test.cpp
  17. 6
      test/she_test.cpp

@ -53,7 +53,7 @@ struct AGGST {
static G2 Q_;
static std::vector<bn_current::Fp6> Qcoeff_;
public:
static void init(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb)
static void init(const mcl::CurveParam& cp = mcl::bn::CurveFp254BNb)
{
bn_current::initPairing(cp);
BN::hashAndMapToG1(P_, "0");

@ -1,51 +0,0 @@
#pragma once
/**
@file
@brief BLS12-381 curve
@author MITSUNARI Shigeo(@herumi)
@license modified new BSD license
http://opensource.org/licenses/BSD-3-Clause
*/
#include <mcl/pairing_util.hpp>
namespace mcl { namespace bls12 {
using mcl::CurveParam;
using mcl::getCurveParam;
template<class Fp>
struct ParamT : public util::CommonParamT<Fp> {
typedef util::CommonParamT<Fp> Common;
typedef Fp2T<Fp> Fp2;
typedef mcl::EcT<Fp> G1;
typedef mcl::EcT<Fp2> G2;
util::MapToT<Fp> mapTo;
void init(const CurveParam& cp, fp::Mode mode)
{
Common::initCommonParam(cp, mode);
mapTo.init(0, this->z, false);
}
};
template<class Fp>
struct BLS12T : mcl::util::BasePairingT<BLS12T<Fp>, Fp, ParamT<Fp> > {
typedef ParamT<Fp> Param;
typedef typename mcl::util::BasePairingT<BLS12T<Fp>, Fp, Param> Base;
typedef mcl::Fp2T<Fp> Fp2;
typedef mcl::Fp6T<Fp> Fp6;
typedef mcl::Fp12T<Fp> Fp12;
typedef mcl::EcT<Fp> G1;
typedef mcl::EcT<Fp2> G2;
typedef util::HaveFrobenius<G2> G2withF;
typedef mcl::FpDblT<Fp> FpDbl;
typedef mcl::Fp2DblT<Fp> Fp2Dbl;
static void init(const mcl::CurveParam& cp = mcl::BLS12_381, fp::Mode mode = fp::FP_AUTO)
{
Base::param.init(cp, mode);
G2withF::init(cp.isMtype);
}
};
} } // mcl::bls12

@ -6,7 +6,7 @@
@license modified new BSD license
http://opensource.org/licenses/BSD-3-Clause
*/
#include <mcl/bls12.hpp>
#include <mcl/bn.hpp>
namespace mcl { namespace bls12_381 {
@ -16,7 +16,7 @@ struct FrTag;
}
typedef mcl::FpT<local::FpTag, 384> Fp;
typedef mcl::bls12::BLS12T<Fp> BLS12;
typedef mcl::bn::BNT<Fp> BLS12;
typedef BLS12::Fp2 Fp2;
typedef BLS12::Fp6 Fp6;
typedef BLS12::Fp12 Fp12;
@ -27,7 +27,7 @@ typedef BLS12::Fp12 GT;
/* the order of G1 is r */
typedef mcl::FpT<local::FrTag, 256> Fr;
static inline void initPairing(const mcl::bls12::CurveParam& cp = mcl::BLS12_381, fp::Mode mode = fp::FP_AUTO)
static inline void initPairing(const mcl::CurveParam& cp = mcl::BLS12_381, fp::Mode mode = fp::FP_AUTO)
{
BLS12::init(cp, mode);
G1::setCompressedExpression();

File diff suppressed because it is too large Load Diff

@ -27,7 +27,7 @@ typedef BN::Fp12 GT;
/* the order of G1 is r */
typedef mcl::FpT<local::FrTag, 256> Fr;
static inline void initPairing(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
static inline void initPairing(const mcl::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
{
BN::init(cp, mode);
G1::setCompressedExpression();
@ -35,7 +35,7 @@ static inline void initPairing(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp2
Fr::init(BN::param.r);
}
static inline void bn256init(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
static inline void bn256init(const mcl::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
{
initPairing(cp, mode);
}

@ -27,7 +27,7 @@ typedef BN::Fp12 GT;
/* the order of G1 is r */
typedef mcl::FpT<local::FrTag, 384> Fr;
static inline void initPairing(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp382_2, fp::Mode mode = fp::FP_AUTO)
static inline void initPairing(const mcl::CurveParam& cp = mcl::bn::CurveFp382_2, fp::Mode mode = fp::FP_AUTO)
{
BN::init(cp, mode);
G1::setCompressedExpression();
@ -35,7 +35,7 @@ static inline void initPairing(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp3
Fr::init(BN::param.r);
}
static inline void bn384init(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp382_2, fp::Mode mode = fp::FP_AUTO)
static inline void bn384init(const mcl::CurveParam& cp = mcl::bn::CurveFp382_2, fp::Mode mode = fp::FP_AUTO)
{
initPairing(cp, mode);
}

@ -27,7 +27,7 @@ typedef BN::Fp12 GT;
/* the order of G1 is r */
typedef mcl::FpT<local::FrTag, 512> Fr;
static inline void initPairing(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
static inline void initPairing(const mcl::CurveParam& cp = mcl::bn::CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
{
BN::init(cp, mode);
G1::setCompressedExpression();

File diff suppressed because it is too large Load Diff

@ -506,7 +506,7 @@ public:
typedef CipherTextAT<G1> CipherTextG1;
typedef CipherTextAT<G2> CipherTextG2;
static void init(const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb)
static void init(const mcl::CurveParam& cp = mcl::bn::CurveFp254BNb)
{
bn_current::initPairing(cp);
BN::hashAndMapToG1(P_, "0");

@ -126,7 +126,7 @@ int mclBn_init(int curve, int maxUnitSize)
fprintf(stderr, "mclBn_init:maxUnitSize is mismatch %d %d\n", maxUnitSize, MCLBN_FP_UNIT_SIZE);
return -1;
}
const mcl::bn::CurveParam& cp = mcl::bn::getCurveParam(curve);
const mcl::CurveParam& cp = mcl::getCurveParam(curve);
initPairing(cp);
return 0;
} catch (std::exception& e) {

@ -59,7 +59,7 @@ int sheInit(int curve, int maxUnitSize)
static int g_curve = -1;
if (g_curve == curve) return 0;
mcl::bn::CurveParam cp;
mcl::CurveParam cp;
switch (curve) {
case mclBn_CurveFp254BNb:
cp = mcl::bn::CurveFp254BNb;

@ -17,7 +17,7 @@ using namespace mcl::bls12_381;
mcl::fp::Mode g_mode;
const struct TestSet {
mcl::bls12::CurveParam cp;
mcl::CurveParam cp;
const char *name;
const char *p;
const char *r;

@ -12,7 +12,7 @@ mcl::fp::Mode g_mode;
#include "bench.hpp"
void testCurve(const mcl::bn::CurveParam& cp)
void testCurve(const mcl::CurveParam& cp)
{
initPairing(cp, g_mode);
G1 P;

@ -12,7 +12,7 @@ mcl::fp::Mode g_mode;
#include "bench.hpp"
void testCurve(const mcl::bn::CurveParam& cp)
void testCurve(const mcl::CurveParam& cp)
{
initPairing(cp, g_mode);
G1 P;

@ -17,7 +17,7 @@ using namespace mcl::bn256;
mcl::fp::Mode g_mode;
const struct TestSet {
mcl::bn::CurveParam cp;
mcl::CurveParam cp;
const char *name;
struct G2 {
const char *aa;

@ -119,7 +119,7 @@ void testGLV1()
oldGLV oldGlv;
oldGlv.init(BN::param.r, BN::param.z);
mcl::bn::GLV1<Fp> glv;
mcl::util::GLV1<Fp> glv;
glv.init(BN::param.r, BN::param.z);
compareLength(glv, oldGlv);
@ -160,7 +160,7 @@ void testGLV2()
mpz_class z = BN::param.z;
mpz_class r = BN::param.r;
mpz_class lambda = 6 * z * z;
mcl::bn::GLV2<Fp2> glv2;
mcl::util::GLV2<Fp2> glv2;
glv2.init(r, z);
mpz_class n;
cybozu::XorShift rg;
@ -187,13 +187,13 @@ void testGLV2()
CYBOZU_TEST_AUTO(glv)
{
const mcl::bn::CurveParam tbl[] = {
const mcl::CurveParam tbl[] = {
mcl::bn::CurveFp254BNb,
mcl::bn::CurveFp382_1,
mcl::bn::CurveFp382_2,
};
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) {
const mcl::bn::CurveParam& cp = tbl[i];
const mcl::CurveParam& cp = tbl[i];
initPairing(cp);
testGLV1();
testGLV2();

@ -14,13 +14,13 @@ SecretKey g_sec;
CYBOZU_TEST_AUTO(log)
{
#if MCLBN_FP_UNIT_SIZE == 4
const mcl::bn::CurveParam& cp = mcl::bn::CurveFp254BNb;
const mcl::CurveParam& cp = mcl::bn::CurveFp254BNb;
puts("CurveFp254BNb");
#elif MCLBN_FP_UNIT_SIZE == 6
const mcl::bn::CurveParam& cp = mcl::bn::CurveFp382_1;
const mcl::CurveParam& cp = mcl::bn::CurveFp382_1;
puts("CurveFp382_1");
#elif MCLBN_FP_UNIT_SIZE == 8
const mcl::bn::CurveParam& cp = mcl::bn::CurveFp462;
const mcl::CurveParam& cp = mcl::bn::CurveFp462;
puts("CurveFp462");
#endif
SHE::init(cp);

Loading…
Cancel
Save