1
1
mirror of https://github.com/henrydcase/pqc.git synced 2024-11-22 23:48:58 +00:00

Add travis config

Also fixes some tidy issues

Not sure why my local clang-tidy doesn't complain
This commit is contained in:
Thom Wiggers 2019-01-16 13:02:57 +01:00
parent e32b091ead
commit 4d0082fa43
No known key found for this signature in database
GPG Key ID: 001BB0A7CE26E363
7 changed files with 45 additions and 21 deletions

View File

@ -1,5 +1,5 @@
--- ---
Checks: 'clang-diagnostic-*,clang-analyzer-*,clang-diagnostic-*,clang-analyzer-*,*,-hicpp-signed-bitwise,-llvm-header-guard,-hicpp-function-*,-readability-function-size' Checks: '*,-llvm-header-guard,-hicpp-*,-readability-function-size'
WarningsAsErrors: '*' WarningsAsErrors: '*'
HeaderFilterRegex: '.*' HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false AnalyzeTemporaryDtors: false

View File

@ -1,11 +1,32 @@
language: c language: c
compiler: dist: xenial
- clang
- gcc matrix:
include:
- os: linux
compiler: gcc
env:
- MAKETARGET="test-all tidy-all check-format"
- os: linux
compiler: clang
env:
- MAKETARGET=test-all
- os: osx
compiler: clang
env:
- MAKETARGET=test-all
- os: osx
osx_image: xcode9
env:
- MATRIX_EVAL="brew upgrade && brew install gcc && CC=gcc-8 && CXX=g++-8"
- MAKETARGET=test-all
before_install:
- eval "${MATRIX_EVAL}"
script: script:
- make test-all - make ${MAKETARGET}
- make tidy-all
- make check-format
# vim: set ft=yaml ts=2 sw=2 tw=0 et : # vim: set ft=yaml ts=2 sw=2 tw=0 et :

View File

@ -1,7 +1,7 @@
# This -Wall was supported by the European Commission through the ERC Starting Grant 805031 (EPOQUE) # This -Wall was supported by the European Commission through the ERC Starting Grant 805031 (EPOQUE)
CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 $(EXTRAFLAGS) CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 $(EXTRAFLAGS)
ALL_SCHEMES=$(filter-out crypto_%/test.c, $(wildcard crypto_*/*)) ALL_SCHEMES=$(filter-out crypto_%.c, $(wildcard crypto_*/*))
default: help default: help
@ -63,7 +63,6 @@ check-format:
.PHONY: tidy .PHONY: tidy
tidy: tidy:
$(eval undefine .TIDY_FIX)
$(MAKE) do-tidy $(MAKE) do-tidy
do-tidy: require_scheme do-tidy: require_scheme
@ -81,10 +80,11 @@ apply-tidy:
# The below should be outlined with ts=8 # The below should be outlined with ts=8
.PHONY: help .PHONY: help
help: help:
@echo "make test-all Run all tests"
@echo "make functest SCHEME=scheme Build functional tests for SCHEME" @echo "make functest SCHEME=scheme Build functional tests for SCHEME"
@echo "make functest-all Build functional tests for all schemes"
@echo "make run-functest SCHEME=scheme Run functional tests for SCHEME" @echo "make run-functest SCHEME=scheme Run functional tests for SCHEME"
@echo "make run-functest-all Run all functests" @echo "make run-functest-all Run all functests"
@echo "make testvectors SCHEME=scheme Build testvector generator for SCHEME"
@echo "make clean Clean up the bin/ folder" @echo "make clean Clean up the bin/ folder"
@echo "make format Automatically formats all the source code" @echo "make format Automatically formats all the source code"
@echo "make tidy SCHEME=scheme Runs the clang-tidy linter against SCHEME" @echo "make tidy SCHEME=scheme Runs the clang-tidy linter against SCHEME"
@ -94,23 +94,26 @@ help:
@echo "make help Displays this message" @echo "make help Displays this message"
.PHONY: functest-all .PHONY: functest-all
build-functests: $(foreach skeme,$(ALL_SCHEMES),bin/functest_$(subst /,_,$(skeme))) functest-all:
@for scheme in $(ALL_SCHEMES); do \
$(MAKE) functest SCHEME=$$scheme || exit 1; \
done
.PHONY: run-functest-all .PHONY: run-functest-all
run-functest-all: build-functests run-functest-all: functest-all
@for functest in bin/functest_* ; do \ @for functest in bin/functest_* ; do \
echo ./$$functest ; \ echo ./$$functest ; \
./$$functest ; \ ./$$functest || exit 1 ;\
done done
@echo Tests completed @echo Tests completed
.PHONY: test-all .PHONY: test-all
test-all: run-functests test-all: run-functest-all
.PHONY: tidy-all .PHONY: tidy-all
tidy-all: tidy-all:
@for scheme in $(ALL_SCHEMES); do \ @for scheme in $(ALL_SCHEMES); do \
$(MAKE) tidy SCHEME=$$scheme; \ $(MAKE) tidy SCHEME=$$scheme || exit 1 ; \
done done
.PHONY: apply-tidy-all .PHONY: apply-tidy-all

View File

@ -1,9 +1,9 @@
#ifndef SHA2_H #ifndef SHA2_H
#define SHA2_H #define SHA2_H
int sha384(unsigned char *output, const unsigned char *input, int sha384(unsigned char *out, const unsigned char *in,
unsigned long long inlen); unsigned long long inlen);
int sha512(unsigned char *output, const unsigned char *input, int sha512(unsigned char *out, const unsigned char *in,
unsigned long long inlen); unsigned long long inlen);
#endif #endif

View File

@ -3,7 +3,7 @@
#include <stdint.h> #include <stdint.h>
void ntt(uint16_t *poly); void ntt(uint16_t *p);
void invntt(uint16_t *a); void invntt(uint16_t *a);
#endif #endif

View File

@ -18,7 +18,7 @@ void polyvecl_ntt(polyvecl *v);
void polyvecl_pointwise_acc_invmontgomery(poly *w, const polyvecl *u, void polyvecl_pointwise_acc_invmontgomery(poly *w, const polyvecl *u,
const polyvecl *v); const polyvecl *v);
int polyvecl_chknorm(const polyvecl *v, uint32_t B); int polyvecl_chknorm(const polyvecl *v, uint32_t bound);
/* Vectors of polynomials of length K */ /* Vectors of polynomials of length K */
typedef struct { typedef struct {
@ -36,7 +36,7 @@ void polyveck_shiftl(polyveck *v, unsigned int k);
void polyveck_ntt(polyveck *v); void polyveck_ntt(polyveck *v);
void polyveck_invntt_montgomery(polyveck *v); void polyveck_invntt_montgomery(polyveck *v);
int polyveck_chknorm(const polyveck *v, uint32_t B); int polyveck_chknorm(const polyveck *v, uint32_t bound);
void polyveck_power2round(polyveck *v1, polyveck *v0, const polyveck *v); void polyveck_power2round(polyveck *v1, polyveck *v0, const polyveck *v);
void polyveck_decompose(polyveck *v1, polyveck *v0, const polyveck *v); void polyveck_decompose(polyveck *v1, polyveck *v0, const polyveck *v);

View File

@ -11,7 +11,7 @@ void challenge(poly *c, const unsigned char mu[CRHBYTES], const polyveck *w1);
int crypto_sign_keypair(unsigned char *pk, unsigned char *sk); int crypto_sign_keypair(unsigned char *pk, unsigned char *sk);
int crypto_sign(unsigned char *sm, unsigned long long *smlen, int crypto_sign(unsigned char *sm, unsigned long long *smlen,
const unsigned char *msg, unsigned long long len, const unsigned char *m, unsigned long long mlen,
const unsigned char *sk); const unsigned char *sk);
int crypto_sign_open(unsigned char *m, unsigned long long *mlen, int crypto_sign_open(unsigned char *m, unsigned long long *mlen,