aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-06-06 05:04:06 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-06-06 05:04:06 +0800
commit194928d9e850b9296bf5edaec77d20e2ca921e21 (patch)
tree88a6d26b1764bcedbe0e401178634c0272843019
parentb93d19879787b0e197f7ca3351a6becf549fe8fd (diff)
downloaddexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.tar
dexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.tar.gz
dexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.tar.bz2
dexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.tar.lz
dexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.tar.xz
dexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.tar.zst
dexon-bls-194928d9e850b9296bf5edaec77d20e2ca921e21.zip
unify curve const
-rw-r--r--include/bls/bls.h6
-rw-r--r--include/bls/bls.hpp8
-rw-r--r--src/bls.cpp8
-rw-r--r--test/bls_c384_test.cpp6
-rw-r--r--test/bls_test.cpp8
5 files changed, 12 insertions, 24 deletions
diff --git a/include/bls/bls.h b/include/bls/bls.h
index 47b33cf..634a699 100644
--- a/include/bls/bls.h
+++ b/include/bls/bls.h
@@ -27,12 +27,6 @@
extern "C" {
#endif
-enum {
- blsCurveFp254BNb = 0,
- blsCurveFp382_1 = 1,
- blsCurveFp382_2 = 2
-};
-
typedef struct {
mclBnFr v;
} blsId;
diff --git a/include/bls/bls.hpp b/include/bls/bls.hpp
index 3eda465..1b30cff 100644
--- a/include/bls/bls.hpp
+++ b/include/bls/bls.hpp
@@ -18,12 +18,6 @@
namespace bls {
-enum {
- CurveFp254BNb = 0,
- CurveFp382_1 = 1,
- CurveFp382_2 = 2
-};
-
// same value with IoMode of mcl/op.hpp
enum {
IoBin = 2, // binary number
@@ -59,7 +53,7 @@ struct Id;
@param maxUnitSize [in] 4 or 6 (specify same value used in compiling for validation)
@note init() is not thread safe
*/
-void init(int curve = CurveFp254BNb, int maxUnitSize = MCLBN_FP_UNIT_SIZE);
+void init(int curve = mclBn_CurveFp254BNb, int maxUnitSize = MCLBN_FP_UNIT_SIZE);
size_t getOpUnitSize();
void getCurveOrder(std::string& str);
void getFieldOrder(std::string& str);
diff --git a/src/bls.cpp b/src/bls.cpp
index d6f5bc0..d42c01c 100644
--- a/src/bls.cpp
+++ b/src/bls.cpp
@@ -168,14 +168,14 @@ void init(int curve, int maxUnitSize)
if (maxUnitSize != MCLBN_FP_UNIT_SIZE) throw cybozu::Exception("bls:init:bad maxUnitSize") << maxUnitSize << MCLBN_FP_UNIT_SIZE;
mcl::bn::CurveParam cp;
switch (curve) {
- case bls::CurveFp254BNb:
+ case mclBn_CurveFp254BNb:
cp = mcl::bn::CurveFp254BNb;
break;
#if MCLBN_FP_UNIT_SIZE == 6
- case bls::CurveFp382_1:
+ case mclBn_CurveFp382_1:
cp = mcl::bn::CurveFp382_1;
break;
- case bls::CurveFp382_2:
+ case mclBn_CurveFp382_2:
cp = mcl::bn::CurveFp382_2;
break;
#endif
@@ -192,7 +192,7 @@ void init(int curve, int maxUnitSize)
assert(sizeof(PublicKey) == sizeof(impl::PublicKey));
assert(sizeof(Signature) == sizeof(impl::Signature));
static G2 Q;
- if (curve == bls::CurveFp254BNb) {
+ if (curve == mclBn_CurveFp254BNb) {
Q.set(
Fp2("12723517038133731887338407189719511622662176727675373276651903807414909099441", "4168783608814932154536427934509895782246573715297911553964171371032945126671"),
Fp2("13891744915211034074451795021214165905772212241412891944830863846330766296736", "7937318970632701341203597196594272556916396164729705624521405069090520231616")
diff --git a/test/bls_c384_test.cpp b/test/bls_c384_test.cpp
index 8405926..8c3761f 100644
--- a/test/bls_c384_test.cpp
+++ b/test/bls_c384_test.cpp
@@ -65,10 +65,10 @@ void blsOrderTest(const char *curveOrder, const char *fieldOrder)
CYBOZU_TEST_AUTO(all)
{
const int tbl[] = {
- blsCurveFp254BNb,
+ mclBn_CurveFp254BNb,
#if MCLBN_FP_UNIT_SIZE == 6
- blsCurveFp382_1,
- blsCurveFp382_2
+ mclBn_CurveFp382_1,
+ mclBn_CurveFp382_2
#endif
};
const char *curveOrderTbl[] = {
diff --git a/test/bls_test.cpp b/test/bls_test.cpp
index 7c587d6..ebd3d6c 100644
--- a/test/bls_test.cpp
+++ b/test/bls_test.cpp
@@ -66,7 +66,7 @@ void SecretKeyTestBN256()
CYBOZU_TEST_AUTO(bn256)
{
- bls::init(bls::CurveFp254BNb);
+ bls::init(mclBn_CurveFp254BNb);
IdTestBN256();
SecretKeyTestBN256();
CYBOZU_TEST_EQUAL(bls::getOpUnitSize(), 4);
@@ -402,10 +402,10 @@ CYBOZU_TEST_AUTO(all)
int type;
const char *name;
} tbl[] = {
- { bls::CurveFp254BNb, "Fp254" },
+ { mclBn_CurveFp254BNb, "Fp254" },
#if MCLBN_FP_UNIT_SIZE == 6
- { bls::CurveFp382_1, "Fp382_1" },
- { bls::CurveFp382_2, "Fp382_2" },
+ { mclBn_CurveFp382_1, "Fp382_1" },
+ { mclBn_CurveFp382_2, "Fp382_2" },
#endif
};
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) {