test of she_c384

dev
MITSUNARI Shigeo 7 years ago
parent 2337888c3e
commit 0f16acd7e5
  1. 13
      Makefile
  2. 2
      src/she_c384.cpp
  3. 2
      test/she_c384_test.cpp
  4. 5
      test/she_c_test.hpp

@ -4,7 +4,7 @@ OBJ_DIR=obj
EXE_DIR=bin
SRC_SRC=fp.cpp bn_c256.cpp bn_c384.cpp bn_c512.cpp she_c256.cpp
TEST_SRC=fp_test.cpp ec_test.cpp fp_util_test.cpp window_method_test.cpp elgamal_test.cpp fp_tower_test.cpp gmp_test.cpp bn_test.cpp bn384_test.cpp glv_test.cpp paillier_test.cpp she_test.cpp vint_test.cpp bn512_test.cpp
TEST_SRC+=bn_c256_test.cpp bn_c384_test.cpp bn_c512_test.cpp she_c256_test.cpp
TEST_SRC+=bn_c256_test.cpp bn_c384_test.cpp bn_c512_test.cpp she_c256_test.cpp she_c384_test.cpp
TEST_SRC+=aggregate_sig_test.cpp
TEST_SRC+=bls12_test.cpp
ifeq ($(CPU),x86-64)
@ -41,7 +41,8 @@ BN384_SLIB=$(LIB_DIR)/lib$(BN384_SNAME).$(LIB_SUF)
BN512_LIB=$(LIB_DIR)/libmclbn512.a
BN512_SLIB=$(LIB_DIR)/lib$(BN512_SNAME).$(LIB_SUF)
SHE256_LIB=$(LIB_DIR)/libmclshe256.a
all: $(MCL_LIB) $(MCL_SLIB) $(BN256_LIB) $(BN256_SLIB) $(BN384_LIB) $(BN384_SLIB) $(BN512_LIB) $(BN512_SLIB) $(SHE256_LIB)
SHE384_LIB=$(LIB_DIR)/libmclshe384.a
all: $(MCL_LIB) $(MCL_SLIB) $(BN256_LIB) $(BN256_SLIB) $(BN384_LIB) $(BN384_SLIB) $(BN512_LIB) $(BN512_SLIB) $(SHE256_LIB) $(SHE384_lib)
#LLVM_VER=-3.8
LLVM_LLC=llc$(LLVM_VER)
@ -68,6 +69,7 @@ BN256_OBJ=$(OBJ_DIR)/bn_c256.o
BN384_OBJ=$(OBJ_DIR)/bn_c384.o
BN512_OBJ=$(OBJ_DIR)/bn_c512.o
SHE256_OBJ=$(OBJ_DIR)/she_c256.o
SHE384_OBJ=$(OBJ_DIR)/she_c384.o
FUNC_LIST=src/func.list
MCL_USE_LLVM?=1
ifeq ($(MCL_USE_LLVM),1)
@ -115,6 +117,9 @@ $(BN256_LIB): $(BN256_OBJ)
$(SHE256_LIB): $(SHE256_OBJ)
$(AR) $@ $(SHE256_OBJ)
$(SHE384_LIB): $(SHE384_OBJ)
$(AR) $@ $(SHE384_OBJ)
ifeq ($(OS),mac)
MAC_LDFLAGS+=-l$(MCL_SNAME) -L./lib
endif
@ -214,6 +219,9 @@ $(EXE_DIR)/pairing_c.exe: $(OBJ_DIR)/pairing_c.o $(BN256_LIB) $(MCL_LIB)
$(EXE_DIR)/she_c256_test.exe: $(OBJ_DIR)/she_c256_test.o $(SHE256_LIB) $(MCL_LIB)
$(PRE)$(CXX) $< -o $@ $(SHE256_LIB) $(MCL_LIB) $(LDFLAGS)
$(EXE_DIR)/she_c384_test.exe: $(OBJ_DIR)/she_c384_test.o $(SHE384_LIB) $(MCL_LIB)
$(PRE)$(CXX) $< -o $@ $(SHE384_LIB) $(MCL_LIB) $(LDFLAGS)
SAMPLE_EXE=$(addprefix $(EXE_DIR)/,$(addsuffix .exe,$(basename $(SAMPLE_SRC))))
sample: $(SAMPLE_EXE) $(MCL_LIB)
@ -233,6 +241,7 @@ ifeq ($(MCL_USE_LLVM),2)
endif
../she-wasm/she_c.js: $(JS_DEP) Makefile
emcc -o $@ src/fp.cpp src/she_c256.cpp $(EMCC_OPT) -s TOTAL_MEMORY=67108864
# emcc -o $@ src/fp.cpp src/she_c384.cpp $(EMCC_OPT) -s TOTAL_MEMORY=67108864
../mcl-wasm/mcl_c.js: src/fp.cpp src/bn_c256.cpp include/mcl/bn.h Makefile
emcc -o $@ src/fp.cpp src/bn_c256.cpp $(EMCC_OPT) -DMCL_MAX_BIT_SIZE=256

@ -0,0 +1,2 @@
#define MCLBN_FP_UNIT_SIZE 6
#include "she_c_impl.hpp"

@ -0,0 +1,2 @@
#define MCLBN_FP_UNIT_SIZE 6
#include "she_c_test.hpp"

@ -170,10 +170,11 @@ CYBOZU_TEST_AUTO(serialize)
shePublicKey pub1, pub2;
sheGetPublicKey(&pub1, &sec1);
char buf1[2048], buf2[2048];
char buf1[4096], buf2[4096];
size_t n1, n2;
size_t r, size;
const size_t sizeofFr = mclBn_getOpUnitSize() * 8;
const size_t sizeofFp = mclBn_getG1ByteSize();
size = sizeofFr * 2;
n1 = sheSecretKeySerialize(buf1, sizeof(buf1), &sec1);
@ -219,7 +220,7 @@ CYBOZU_TEST_AUTO(serialize)
CYBOZU_TEST_EQUAL(n2, size);
CYBOZU_TEST_EQUAL_ARRAY(buf1, buf2, n2);
size = sizeofFr * 12 * 4;
size = sizeofFp * 12 * 4;
n1 = sheCipherTextGTSerialize(buf1, sizeof(buf1), &ct1);
CYBOZU_TEST_EQUAL(n1, size);
r = sheCipherTextGTDeserialize(&ct2, buf1, n1);

Loading…
Cancel
Save