Commit d18af7c9 authored by Johan Pascal's avatar Johan Pascal

build scripts manage the decaf_tables.c generation

- decaf_tables.c are back in the source tree to help cross-compilation
parent e39cc5d9
......@@ -95,6 +95,21 @@ of the distinguishing rules. See the paper for more details.
As of v0.9.4, libdecaf uses the "Ristretto" variant of this encoding.
See https://www.ristretto.group for details, once that site is up.
## Build and Install
cmake -DCMAKE_INSTALL_PREFIX=<Install path> <path to root directory>
make
make test
make install
Most C source code is generated through a python script during the build.
Some files holding tables are generated in one more step building an
executable to generate them. They are thus stored in the source tree to help
cross-compilation. The build script update them when their dependencies
are modified, to build only these files:
make decaf_tables
## Licensing
Most of the source files here are by Mike Hamburg. Those files are (c)
......
......@@ -16,14 +16,14 @@ set(CURVE25519_SOURCE_FILES_C
${GSOURCE_PATH}/c/curve25519/elligator.c
${GSOURCE_PATH}/c/curve25519/scalar.c
${GSOURCE_PATH}/c/curve25519/eddsa.c
${GSOURCE_PATH}/c/curve25519/decaf_tables.c
${PROJECT_SOURCE_DIR}/src/curve25519/decaf_tables.c
)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/decaf.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/elligator.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/scalar.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/eddsa.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/curve25519/decaf_tables.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/curve25519/decaf_tables.c PROPERTIES GENERATED 1)
add_library(CURVE25519 OBJECT ${CURVE25519_SOURCE_FILES_C})
add_dependencies(CURVE25519 generatedCode)
......
This diff is collapsed.
......@@ -16,14 +16,14 @@ set(CURVE448_SOURCE_FILES_C
${GSOURCE_PATH}/c/ed448goldilocks/elligator.c
${GSOURCE_PATH}/c/ed448goldilocks/scalar.c
${GSOURCE_PATH}/c/ed448goldilocks/eddsa.c
${GSOURCE_PATH}/c/ed448goldilocks/decaf_tables.c
${PROJECT_SOURCE_DIR}/src/ed448goldilocks/decaf_tables.c
)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/decaf.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/elligator.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/scalar.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/eddsa.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${GSOURCE_PATH}/c/ed448goldilocks/decaf_tables.c PROPERTIES GENERATED 1)
SET_SOURCE_FILES_PROPERTIES(${PROJECT_SOURCE_DIR}/src/ed448goldilocks/decaf_tables.c PROPERTIES GENERATED 1)
add_library(CURVE448 OBJECT ${CURVE448_SOURCE_FILES_C})
add_dependencies(CURVE448 generatedCode)
......
This diff is collapsed.
......@@ -153,6 +153,11 @@ add_custom_target(generatorCommonCode DEPENDS
add_subdirectory(curve25519)
add_subdirectory(ed448goldilocks)
add_custom_target(decaf_tables DEPENDS
decaf_tables_curve25519
decaf_tables_ed448goldilocks
)
add_custom_target(generatedCode DEPENDS
generatorCommonCode
generatorEd448goldilocks
......
......@@ -75,16 +75,12 @@ add_custom_command(
COMMENT "Generating code for include/decaf/ed255.hxx"
)
#python -B src/generator/template.py --per=curve --item=curve25519 --guard=decaf/point_255.hxx -o src/GENERATED/include/decaf/point_255.hxx src/per_curve/point.tmpl.hxx
#python -B src/generator/template.py --per=curve --item=curve25519 --guard=decaf/ed255.hxx -o src/GENERATED/include/decaf/ed255.hxx src/per_curve/eddsa.tmpl.hxx
add_custom_target(generatorCurve25519 DEPENDS
generatorP25519
${GSOURCE_PATH}/c/curve25519/scalar.c
${GSOURCE_PATH}/c/curve25519/decaf.c
${GSOURCE_PATH}/c/curve25519/elligator.c
${GSOURCE_PATH}/c/curve25519/eddsa.c
${GSOURCE_PATH}/c/curve25519/decaf_tables.c
${GSOURCE_PATH}/include/decaf/point_255.hxx
${GSOURCE_PATH}/include/decaf/ed255.hxx
)
......@@ -94,15 +90,14 @@ include_directories(
${PROJECT_SOURCE_DIR}/src/p25519/${TARGET_ARCH_DIR_P25519}
)
add_executable(decaf_gen_tables_curve25519 ${GSOURCE_PATH}/c/curve25519/decaf_gen_tables.c
add_executable(decaf_gen_tables_curve25519 EXCLUDE_FROM_ALL ${GSOURCE_PATH}/c/curve25519/decaf_gen_tables.c
${GSOURCE_PATH}/c/curve25519/decaf.c
${GSOURCE_PATH}/c/curve25519/scalar.c
${PROJECT_SOURCE_DIR}/src/utils.c
$<TARGET_OBJECTS:p25519>)
add_custom_command(
COMMAND decaf_gen_tables_curve25519 > ${GSOURCE_PATH}/c/curve25519/decaf_tables.c
add_custom_target(decaf_tables_curve25519
COMMAND decaf_gen_tables_curve25519 > ${PROJECT_SOURCE_DIR}/src/curve25519/decaf_tables.c
DEPENDS decaf_gen_tables_curve25519
OUTPUT ${GSOURCE_PATH}/c/curve25519/decaf_tables.c
COMMENT "Generating code for curve25519/decaf_tables.c"
)
......@@ -84,11 +84,11 @@ add_custom_command(
add_custom_target(generatorEd448goldilocks DEPENDS
generatorP448
${GSOURCE_PATH}/c/ed448goldilocks/scalar.c
${GSOURCE_PATH}/c/ed448goldilocks/decaf.c
${GSOURCE_PATH}/c/ed448goldilocks/elligator.c
${GSOURCE_PATH}/c/ed448goldilocks/eddsa.c
${GSOURCE_PATH}/c/ed448goldilocks/decaf_tables.c
${GSOURCE_PATH}/include/decaf/point_448.hxx
${GSOURCE_PATH}/include/decaf/ed448.hxx
)
......@@ -98,15 +98,14 @@ include_directories(
${PROJECT_SOURCE_DIR}/src/p448/${TARGET_ARCH_DIR_P448}
)
add_executable(decaf_gen_tables_ed448goldilocks ${GSOURCE_PATH}/c/ed448goldilocks/decaf_gen_tables.c
add_executable(decaf_gen_tables_ed448goldilocks EXCLUDE_FROM_ALL ${GSOURCE_PATH}/c/ed448goldilocks/decaf_gen_tables.c
${GSOURCE_PATH}/c/ed448goldilocks/decaf.c
${GSOURCE_PATH}/c/ed448goldilocks/scalar.c
${PROJECT_SOURCE_DIR}/src/utils.c
$<TARGET_OBJECTS:p448>)
add_custom_command(
COMMAND decaf_gen_tables_ed448goldilocks > ${GSOURCE_PATH}/c/ed448goldilocks/decaf_tables.c
add_custom_target(decaf_tables_ed448goldilocks
COMMAND decaf_gen_tables_ed448goldilocks > ${PROJECT_SOURCE_DIR}/src/ed448goldilocks/decaf_tables.c
DEPENDS decaf_gen_tables_ed448goldilocks
OUTPUT ${GSOURCE_PATH}/c/ed448goldilocks/decaf_tables.c
COMMENT "Generating code for ed448goldilocks/decaf_tables.c"
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment