This commit is contained in:
Henry Case 2019-01-16 17:20:24 +00:00
parent e57ad23ba3
commit ff97825ea5
3 changed files with 13 additions and 2 deletions

View File

@ -5,6 +5,7 @@ LDFLAGS=
BUILD_DIR=build BUILD_DIR=build
AR=ar rcs AR=ar rcs
RANLIB=ranlib RANLIB=ranlib
GOPATH=/home/hdc/repos/nobs/build
CODE_SRC_C = \ CODE_SRC_C = \
ref/csidh/rng.c \ ref/csidh/rng.c \
@ -30,5 +31,8 @@ all: $(CODE_OBJ)
$(RANLIB) $(BUILD_DIR)/libcsidh.a $(RANLIB) $(BUILD_DIR)/libcsidh.a
$(CC) -o $(BUILD_DIR)/test test/main.c -L$(BUILD_DIR) -lcsidh $(CC) -o $(BUILD_DIR)/test test/main.c -L$(BUILD_DIR) -lcsidh
run: all
GOPATH=$(GOPATH) go run test/test.go
clean: clean:
rm -rf build rm -rf build

@ -1 +1 @@
Subproject commit 08d5c77d3a92c6b1391be6ac71ab30f32ebcb632 Subproject commit 7d60c846d3fa5298451b93dbb1ad6080b7a2bcec

View File

@ -17,6 +17,12 @@ static void fp_print(fp const *x)
u512_print(&y); u512_print(&y);
} }
static void int_print(const int8_t v[37]) {
for (size_t i = 0; i<37; i++)
printf("%02hhx", v[i]);
printf("\n");
}
int main() { int main() {
for(size_t i=0; i<1000; i++) { for(size_t i=0; i<1000; i++) {
private_key prA, prB; private_key prA, prB;
@ -34,7 +40,8 @@ int main() {
//csidh //csidh
csidh(&shA, &pkA, &prB); csidh(&shA, &pkA, &prB);
csidh(&shB, &pkB, &prA); csidh(&shB, &pkB, &prA);
fp_print(&shA.A); int_print(prA.e);
fp_print(&pkA.A);
assert(memcmp(&shA, &shB, sizeof(shB))==0); assert(memcmp(&shA, &shB, sizeof(shB))==0);
} }
} }