aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/bls.hpp1
-rw-r--r--include/bls_if.h1
-rw-r--r--src/bls.cpp4
-rw-r--r--src/bls_if.cpp4
-rw-r--r--test/bls_test.cpp3
5 files changed, 12 insertions, 1 deletions
diff --git a/include/bls.hpp b/include/bls.hpp
index f0a3650..28c6df6 100644
--- a/include/bls.hpp
+++ b/include/bls.hpp
@@ -53,6 +53,7 @@ struct Id;
@param maxUnitSize [in] 4 or 6 (specify same value used in compiling for validation)
*/
void init(int curve = CurveFp254BNb, int maxUnitSize = BLS_MAX_OP_UNIT_SIZE);
+size_t getOpUnitSize();
class SecretKey;
class PublicKey;
diff --git a/include/bls_if.h b/include/bls_if.h
index 194d14f..ce8463e 100644
--- a/include/bls_if.h
+++ b/include/bls_if.h
@@ -44,6 +44,7 @@ typedef struct {
} blsSign;
void blsInit(int curve, int maxUnitSize);
+size_t blsGetOpUnitSize(void);
blsId *blsIdCreate(void);
void blsIdDestroy(blsId *id);
diff --git a/src/bls.cpp b/src/bls.cpp
index a159373..97ca2a1 100644
--- a/src/bls.cpp
+++ b/src/bls.cpp
@@ -206,6 +206,10 @@ void init(int curve, int maxUnitSize)
g_pQ = &Q;
g_pQcoeff = &Qcoeff;
}
+size_t getOpUnitSize()
+{
+ return sizeof(Fp) / sizeof(uint64_t);
+}
Id::Id(unsigned int id)
{
diff --git a/src/bls_if.cpp b/src/bls_if.cpp
index 05ba0e8..8fd1a55 100644
--- a/src/bls_if.cpp
+++ b/src/bls_if.cpp
@@ -47,6 +47,10 @@ void blsInit(int curve, int maxUnitSize)
{
bls::init(curve, maxUnitSize);
}
+size_t blsGetOpUnitSize()
+{
+ return bls::getOpUnitSize();
+}
blsId *blsIdCreate()
{
diff --git a/test/bls_test.cpp b/test/bls_test.cpp
index 2aeb63a..acac038 100644
--- a/test/bls_test.cpp
+++ b/test/bls_test.cpp
@@ -18,7 +18,8 @@ void streamTest(const T& t)
CYBOZU_TEST_AUTO(bls)
{
- bls::init();
+ bls::init(bls::CurveFp254BNb);
+ CYBOZU_TEST_EQUAL(bls::getOpUnitSize(), 4);
bls::SecretKey sec;
sec.init();
streamTest(sec);