Commit 08dde722 authored by Davide Galassi's avatar Davide Galassi

Merge branch 'default_config_file' into 'master'

Default config file

See merge request !25
parents 74889929 4c79442d
Pipeline #62067062 (#232) passed with stages
in 1 minute and 28 seconds
libcry.a
build
include/cry/config.h
test/test
test/out
doc/html
......
......@@ -17,7 +17,7 @@ test:
dependencies:
- build
script:
- make test
- make test config_mk=config/config_ci.mk
- (cd test; valgrind --leak-check=full --error-exitcode=2 ./test)
- gcovr --exclude test -r . | grep TOTAL
......
language: c
script:
- make test && (cd test; ./test)
- make test config_mk=config/config_ci.mk
- (cd test; ./test)
before_install:
- pip install --user -q cpp-coveralls
......
include config.mk
source_dir := src
config_mk := config/config.mk
config_h := include/cry/config.h
include $(config_mk)
CC := gcc
AR := ar
......@@ -6,9 +10,6 @@ AWK := awk
CP := cp
RM := rm -rf
source_dir := src
config := include/cry/config.h
#
# Get build name
#
......@@ -26,7 +27,7 @@ target = $(binary_dir)/libcry.a
.SUFFIXES:
includes-y := -Iinclude -Isrc -include $(config)
includes-y := -Iinclude -Isrc
cflags-y := -Wall -MMD -MP
cflags-$(CRY_COVERAGE) += --coverage
......@@ -72,44 +73,46 @@ $(eval $(call include_subdir,src))
objects = $(call src_to_bin_dir,$(objects_list))
depends = $(patsubst %.o,%.d,$(objects))
CPPFLAGS = $(includes-y)
CFLAGS = $(cflags-y)
AFLAGS = $(aflags-y)
LDFLAGS = $(lflags-y)
CPPFLAGS := $(includes-y)
CFLAGS := $(cflags-y)
AFLAGS := $(aflags-y)
LDFLAGS := $(lflags-y)
DATE := $(shell date +'%y%m%d')
.PHONY: all cry clean test testclean doc
.PHONY: all cry clean config test testclean doc
all: cry
cry: $(target)
clean:
@$(RM) $(binary_dir) $(config) *.a
@echo "Cleanup ..."
@$(RM) $(binary_dir) *.a
@$(RM) `find . -type f \( -name \*.gcda -o -name \*.gcno \)`
$(objects): Makefile config.mk $(config)
config: $(config_mk)
@echo "Building config ..."
@printf "/*\n * Automatically generated. Do not edit.\n */\n\n" > $(config_h)
@$(AWK) -F= 'NF > 1 && $$1 !~ /^[# ]/ { print "#define", $$1; }' $< >> $(config_h)
$(target): $(objects)
$(AR) rcs $@ $^
$(CP) $(target) .
$(config): config.mk
@printf "/*\n * Automatically generated. Do not edit.\n */\n\n" > $(config)
@$(AWK) -F= 'NF > 1 && $$1 !~ /^[# ]/ { print "#define", $$1; }' $< >> $(config)
@echo "#define CRY_RELEASE $(DATE)" >> $(config)
@echo "#define CRY_CFLAGS \"$(CFLAGS)\"" >> $(config)
$(objects): Makefile $(config_h)
$(config_h): $(config_mk)
$(MAKE) config
$(binary_dir)/%.o: $(source_dir)/%.c
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@
test: $(target)
make -C test
$(MAKE) -C test
testclean:
make -C test clean
$(MAKE) -C test clean
doc:
cd doc; doxygen Doxyfile.in
......
################################################################################
# CRY build configuration.
#
# This file is included by Makefile.
################################################################################
################################################################################
# Compiler
################################################################################
CRY_DEBUG=y
#CRY_OMIT_FRAME_POINTER=y
#CRY_SMALL_SIZE=y
#CRY_STACK_PROTECTOR=y
#CRY_COVERAGE=y
################################################################################
# Platform
################################################################################
#CRY_ARCH_X86_64=y
#CRY_ARCH_x86=y
################################################################################
# Algorithms tweaks
################################################################################
# Use Extended Euclidean Algorithm to compute inverse.
# If not defined the faster Binary Extended Algorithm (HAC 14.4.3) is used.
CRY_MPI_INV_EUCLID=y
# Small footprint division. Slower.
#CRY_MPI_DIV_SMALL=y
# Comba as baseline multiplier
CRY_MPI_MUL_COMBA=y
# Karatsuba multiplier enabled, see the mpi_mul.c to set the CUTOFF
CRY_MPI_MUL_KARATSUBA=y
#
# Toom-3 multiplier enabled, see the mpi_mul.c to set the CUTOFF
CRY_MPI_MUL_TOOM3=y
# Elliptic curve point multiplication with windowed algorithm
CRY_ECP_MUL_WIN=y
# Elliptic curve point multiplication with sliding window algorithm (faster)
# Have precedence against the simple windowed one.
CRY_ECP_MUL_SLIDING_WIN=y
################################################################################
# Elliptic curves group parameters
################################################################################
CRY_ECP_GRP_SECP192R1_ENABLE=y
CRY_ECP_GRP_SECP224R1_ENABLE=y
CRY_ECP_GRP_SECP256R1_ENABLE=y
CRY_ECP_GRP_SECP384R1_ENABLE=y
CRY_ECP_GRP_SECP521R1_ENABLE=y
CRY_ECP_GRP_SECP192K1_ENABLE=y
CRY_ECP_GRP_SECP224K1_ENABLE=y
CRY_ECP_GRP_SECP256K1_ENABLE=y
CRY_ECP_GRP_BP256R1_ENABLE=y
CRY_ECP_GRP_BP384R1_ENABLE=y
CRY_ECP_GRP_BP512R1_ENABLE=y
################################################################################
# Miscelanea configurations
################################################################################
#CRY_MPI_DEBUG_CONF=y
/*
* Automatically generated. Do not edit.
*/
#define CRY_DEBUG
#define CRY_MPI_INV_EUCLID
#define CRY_MPI_MUL_COMBA
#define CRY_MPI_MUL_KARATSUBA
#define CRY_MPI_MUL_TOOM3
#define CRY_ECP_MUL_WIN
#define CRY_ECP_MUL_SLIDING_WIN
#define CRY_ECP_GRP_SECP192R1_ENABLE
#define CRY_ECP_GRP_SECP224R1_ENABLE
#define CRY_ECP_GRP_SECP256R1_ENABLE
#define CRY_ECP_GRP_SECP384R1_ENABLE
#define CRY_ECP_GRP_SECP521R1_ENABLE
#define CRY_ECP_GRP_SECP192K1_ENABLE
#define CRY_ECP_GRP_SECP224K1_ENABLE
#define CRY_ECP_GRP_SECP256K1_ENABLE
#define CRY_ECP_GRP_BP256R1_ENABLE
#define CRY_ECP_GRP_BP384R1_ENABLE
#define CRY_ECP_GRP_BP512R1_ENABLE
......@@ -11,9 +11,7 @@
/* Digit max value */
#ifndef CRY_MPI_DIGIT_MAX
# ifndef CRY_HAS_NO_CONFIG_H
# include <cry/config.h>
# endif
# ifndef CRY_MPI_DEBUG_CONF
# define CRY_MPI_DIGIT_MAX ULONG_MAX
# else
......
#include "misc.h"
#include <cry/config.h>
#include <cry/ecp.h>
#include <stdlib.h> /* malloc() */
#include "../misc.h"
#define CHK(exp) CRY_CHK(res = (exp), e)
......
#include "mpi_pvt.h"
#include <cry/config.h>
#ifdef CRY_MPI_DIV_SMALL
......
#include "mpi_pvt.h"
#include <cry/config.h>
#ifdef CRY_MPI_INV_EUCLID
......
#include "mpi_pvt.h"
#include "misc.h"
#include <stdio.h>
#include <cry/config.h>
#define KARATSUBA_CUTOFF 64
#define TOOM3_CUTOFF 300
......
#include "mpi_pvt.h"
#include "misc.h"
#include <cry/config.h>
#if defined(CRY_ARCH_X86)
......
......@@ -26,9 +26,7 @@ typedef uint128_t cry_mpi_dword;
/* Digit max value */
#ifndef CRY_MPI_QUANTUM
# ifndef CRY_HAS_NO_CONFIG_H
# include <cry/config.h>
# endif
# ifndef CRY_MPI_DEBUG_CONF
# define CRY_MPI_QUANTUM 8
# else
......
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