From 65918c0fa8c0276e5fb76ae6c9f6e5d879b3a090 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Fri, 1 Feb 2019 20:58:26 -0500 Subject: [PATCH 01/14] Add local Makefile for kyber768 --- crypto_kem/kyber768/clean/Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 crypto_kem/kyber768/clean/Makefile diff --git a/crypto_kem/kyber768/clean/Makefile b/crypto_kem/kyber768/clean/Makefile new file mode 100644 index 00000000..6551de20 --- /dev/null +++ b/crypto_kem/kyber768/clean/Makefile @@ -0,0 +1,14 @@ +LIB=libkyber768.so +OBJECTS=cbd.o indcpa.o kem.o kex.o ntt.o poly.o polyvec.o precomp.o reduce.o verify.o + +COMMON_DIR=../../../common +COMMON_OBJECTS=$(COMMON_DIR)/fips202.o $(COMMON_DIR)/notrandombytes.o + +CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -fPIC -g -I$(COMMON_DIR) $(EXTRAFLAGS) + +$(LIB): $(OBJECTS) $(COMMON_OBJECTS) + $(CC) -shared -o $@ $(OBJECTS) $(COMMON_OBJECTS) + +clean: + $(RM) $(OBJECTS) $(COMMON_OBJECTS) + $(RM) $(LIB) From da6dd5f792c28e05201f10d99d5302c639d598eb Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 12:22:58 -0500 Subject: [PATCH 02/14] Clean up Makefile --- crypto_kem/kyber768/clean/Makefile | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/crypto_kem/kyber768/clean/Makefile b/crypto_kem/kyber768/clean/Makefile index 6551de20..e802b821 100644 --- a/crypto_kem/kyber768/clean/Makefile +++ b/crypto_kem/kyber768/clean/Makefile @@ -1,14 +1,13 @@ -LIB=libkyber768.so -OBJECTS=cbd.o indcpa.o kem.o kex.o ntt.o poly.o polyvec.o precomp.o reduce.o verify.o +LIB=kyber768_clean.a -COMMON_DIR=../../../common -COMMON_OBJECTS=$(COMMON_DIR)/fips202.o $(COMMON_DIR)/notrandombytes.o +SOURCES=$(wildcard *.c) +OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) -CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -fPIC -g -I$(COMMON_DIR) $(EXTRAFLAGS) +CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) -$(LIB): $(OBJECTS) $(COMMON_OBJECTS) - $(CC) -shared -o $@ $(OBJECTS) $(COMMON_OBJECTS) +$(LIB): $(OBJECTS) + $(AR) -r $@ $(OBJECTS) clean: - $(RM) $(OBJECTS) $(COMMON_OBJECTS) + $(RM) $(OBJECTS) $(RM) $(LIB) From d6d72177428329352fc09d5e799ab482789fdebe Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 12:41:55 -0500 Subject: [PATCH 03/14] Rename GNU Makefile --- crypto_kem/kyber768/clean/{Makefile => Makefile.GNU_make} | 2 ++ 1 file changed, 2 insertions(+) rename crypto_kem/kyber768/clean/{Makefile => Makefile.GNU_make} (95%) diff --git a/crypto_kem/kyber768/clean/Makefile b/crypto_kem/kyber768/clean/Makefile.GNU_make similarity index 95% rename from crypto_kem/kyber768/clean/Makefile rename to crypto_kem/kyber768/clean/Makefile.GNU_make index e802b821..770f3e6c 100644 --- a/crypto_kem/kyber768/clean/Makefile +++ b/crypto_kem/kyber768/clean/Makefile.GNU_make @@ -5,6 +5,8 @@ OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) +all: $(LIB) + $(LIB): $(OBJECTS) $(AR) -r $@ $(OBJECTS) From 06223ecb3a01a4c28a5f209de2e27a83295da247 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 12:46:50 -0500 Subject: [PATCH 04/14] Rename --- crypto_kem/kyber768/clean/{Makefile.GNU_make => GNUmakefile} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename crypto_kem/kyber768/clean/{Makefile.GNU_make => GNUmakefile} (91%) diff --git a/crypto_kem/kyber768/clean/Makefile.GNU_make b/crypto_kem/kyber768/clean/GNUmakefile similarity index 91% rename from crypto_kem/kyber768/clean/Makefile.GNU_make rename to crypto_kem/kyber768/clean/GNUmakefile index 770f3e6c..b7ad903a 100644 --- a/crypto_kem/kyber768/clean/Makefile.GNU_make +++ b/crypto_kem/kyber768/clean/GNUmakefile @@ -1,4 +1,4 @@ -LIB=kyber768_clean.a +LIB=libkyber768_clean.a SOURCES=$(wildcard *.c) OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) From e914d186960e400a7491ae7bcde51ce67ea856a4 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 18:37:50 -0500 Subject: [PATCH 05/14] Create nmake file for building on Windows and fix compilation error --- .gitignore | 4 ++++ crypto_kem/kyber768/clean/Makefile.Microsoft_nmake | 14 ++++++++++++++ crypto_kem/kyber768/clean/indcpa.c | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 crypto_kem/kyber768/clean/Makefile.Microsoft_nmake diff --git a/.gitignore b/.gitignore index e0b99a16..3794b9c0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ bin/ *.a *.so *~ + +# Object and library files on Windows +*.lib +*.obj diff --git a/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake b/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake new file mode 100644 index 00000000..c7fa6449 --- /dev/null +++ b/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake @@ -0,0 +1,14 @@ +LIB=libkyber768_clean.lib + +OBJECTS=cbd.obj indcpa.obj kem.obj kex.obj ntt.obj poly.obj polyvec.obj precomp.obj reduce.obj verify.obj + +CFLAGS=/I ..\..\..\common /W1 /WX # FIXME: ideally would use /W4 instead of /W1, but too many failures in Kyber right now + +all: $(LIB) + +$(LIB): $(OBJECTS) + LIB.EXE /OUT:$@ $** + +clean: + DEL $(OBJECTS) + DEL $(LIB) diff --git a/crypto_kem/kyber768/clean/indcpa.c b/crypto_kem/kyber768/clean/indcpa.c index 528851c7..210ad1e9 100644 --- a/crypto_kem/kyber768/clean/indcpa.c +++ b/crypto_kem/kyber768/clean/indcpa.c @@ -133,7 +133,7 @@ void PQCLEAN_KYBER768_gen_matrix(polyvec *a, const unsigned char *seed, uint16_t val; unsigned int nblocks; const unsigned int maxnblocks = 4; - uint8_t buf[SHAKE128_RATE * maxnblocks]; + uint8_t buf[SHAKE128_RATE * /* maxnblocks = */ 4]; int i, j; uint64_t state[25]; // SHAKE state unsigned char extseed[KYBER_SYMBYTES + 2]; From fec2b5a97a3433eb6792bcf5c26c4676a753ee5d Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 19:26:18 -0500 Subject: [PATCH 06/14] First attempt at appveyor configuration --- appveyor.yml | 12 ++++++++++++ scripts_windows/build_all.bat | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 appveyor.yml create mode 100644 scripts_windows/build_all.bat diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..bbfc9e6a --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,12 @@ +version: 1.0.{build} + +image: Visual Studio 2017 + +build: + verbosity: minimal + +init: + - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" + +build_script: + - scripts_windows\build_all.bat diff --git a/scripts_windows/build_all.bat b/scripts_windows/build_all.bat new file mode 100644 index 00000000..44cec721 --- /dev/null +++ b/scripts_windows/build_all.bat @@ -0,0 +1,19 @@ +@ECHO OFF +SETLOCAL +SET EL=0 + +REM CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" +REM IF ERRORLEVEL 1 SET EL=1 + +FOR /D %%K IN (crypto_kem\*) DO ( + FOR /D %%L IN (%%K\*) DO ( + cd %%L + nmake /f Makefile.Microsoft_nmake clean + IF ERRORLEVEL 1 SET EL=2 + nmake /f Makefile.Microsoft_nmake + IF ERRORLEVEL 1 SET EL=3 + cd ..\..\.. + ) +) + +EXIT /b %EL% From c22d445e982b16e1f956fa038a91bd7764771870 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 20:22:59 -0500 Subject: [PATCH 07/14] Temporary check that errors really make the build fail --- crypto_kem/kyber768/clean/Makefile.Microsoft_nmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake b/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake index c7fa6449..9324898c 100644 --- a/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake +++ b/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake @@ -2,7 +2,7 @@ LIB=libkyber768_clean.lib OBJECTS=cbd.obj indcpa.obj kem.obj kex.obj ntt.obj poly.obj polyvec.obj precomp.obj reduce.obj verify.obj -CFLAGS=/I ..\..\..\common /W1 /WX # FIXME: ideally would use /W4 instead of /W1, but too many failures in Kyber right now +CFLAGS=/I ..\..\..\common /W4 /WX # FIXME: ideally would use /W4 instead of /W1, but too many failures in Kyber right now all: $(LIB) From dcc18d9b66f436f60cf6dc9b64820234bb8af894 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 20:24:26 -0500 Subject: [PATCH 08/14] Revert temporary error --- crypto_kem/kyber768/clean/Makefile.Microsoft_nmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake b/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake index 9324898c..c7fa6449 100644 --- a/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake +++ b/crypto_kem/kyber768/clean/Makefile.Microsoft_nmake @@ -2,7 +2,7 @@ LIB=libkyber768_clean.lib OBJECTS=cbd.obj indcpa.obj kem.obj kex.obj ntt.obj poly.obj polyvec.obj precomp.obj reduce.obj verify.obj -CFLAGS=/I ..\..\..\common /W4 /WX # FIXME: ideally would use /W4 instead of /W1, but too many failures in Kyber right now +CFLAGS=/I ..\..\..\common /W1 /WX # FIXME: ideally would use /W4 instead of /W1, but too many failures in Kyber right now all: $(LIB) From b6a40cebe75128b56e1a2c58c9bd0987503bd0bc Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 20:53:21 -0500 Subject: [PATCH 09/14] Update README.md with information about Makefiles and Windows CI --- README.md | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index f0efbeeb..2abd1e0c 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ # PQClean [![Build Status](https://travis-ci.com/PQClean/PQClean.svg?branch=master)](https://travis-ci.com/PQClean/PQClean) +[![Build status](https://ci.appveyor.com/api/projects/status/186ky7yb9mlqj3io?svg=true)](https://ci.appveyor.com/project/PQClean/pqclean) **PQClean**, in short, is an effort to collect **clean** implementations of the post-quantum schemes that are in the [NIST post-quantum project](https://csrc.nist.gov/projects/post-quantum-cryptography). The goal of PQClean is to provide *standalone implementations* that + * can easily be integrated into libraries such as [liboqs](https://openquantumsafe.org/#liboqs) or [libpqcrypto](https://libpqcrypto.org/); * can efficiently upstream into higher-level protocol integration efforts such as [Open Quantum Safe](https://openquantumsafe.org/#integrations); * can easily be integrated into benchmarking frameworks such as [SUPERCOP](https://bench.cr.yp.to/supercop.html); @@ -15,6 +17,7 @@ The goal of PQClean is to provide *standalone implementations* that * are suitable targets for formal verification. What PQClean is **not** aiming for is + * a build system producing an integrated library of all schemes; * including benchmarking of implementations; and * including integration into higher-level applications or protocols. @@ -33,8 +36,8 @@ _The checking of items on this list is still being developed. Checked items shou * [x] Consistent test vectors across runs * [ ] Consistent test vectors on big-endian and little-endian machines * [ ] Consistent test vectors on 32-bit and 64-bit machines -* [X] No errors/warnings reported by valgrind -* [X] No errors/warnings reported by address sanitizer +* [x] No errors/warnings reported by valgrind +* [x] No errors/warnings reported by address sanitizer * [ ] Only dependencies: * [x] `fips202.c` * [x] `sha2.c` @@ -47,12 +50,12 @@ _The checking of items on this list is still being developed. Checked items shou * [ ] No branching on secret data (dynamically checked using valgrind) * [ ] No access to secret memory locations (dynamically checked using valgrind) * [ ] Separate subdirectories (without symlinks) for each parameter set of each scheme -* [ ] Builds under Linux, MacOS, and Windows +* [x] Builds under Linux, MacOS, and Windows * [x] Linux * [x] MacOS - * [ ] Windows -* [ ] Makefile-based build for each separate scheme -* [ ] Makefile-based build for Windows (`nmake`) + * [x] Windows +* [x] Makefile-based build for each separate scheme +* [x] Makefile-based build for Windows (`nmake`) * [x] All exported symbols are namespaced with `PQCLEAN_SCHEMENAME_` * [x] Each implementation comes with a `LICENSE` file (see below) * [x] Each scheme comes with a `META.yml` file giving details about version of the algorithm, designers @@ -104,6 +107,23 @@ int crypto_sign_signature(uint8_t *sig, size_t *siglen, const uint8_t *m, size_t int crypto_sign_verify(const uint8_t *sig, size_t siglen, const uint8_t *m, size_t mlen, const uint8_t *pk); ``` +## Building PQClean + +As noted above, PQClean is **not** meant to be built as a single library: it is a collection of source code that can be easily integrated into other libraries. The PQClean repository includes various test programs which do build various files, but you should not use the resulting binaries for any purpose. + +## Using source code from PQClean in your own project + +Each implementation directory in PQClean (e.g., crypto\_kem/kyber768\clean) can be extracted for use in your own project. You will need to: + +1. Copy the source code from the implementation's directory into your project. +2. Add the files to your project's build system. +3. Provide instantiations of any of the common cryptographic algorithms used by the implementation. This likely includes `common/randombytes.h` (a cryptographic random number generator), and possibly `common/sha2.h` (the SHA-2 hash function family) and `common/fips202.h` (the SHA-3 hash function family). + +Regarding #2, adding the files to your project's build system, each implementation in PQClean is accompanied by example two makefiles that show how one could build the files for that implementation: + +- The file `GNUmakefile` which can be used with GNU Make. +- The file `Makefile.Microsoft_nmake` which can be used with Visual Studio's nmake. + ## License Each subdirectory containing implementations contains a LICENSE file stating under what license From 7ea8e508a3361c70c24172444cd586fc724f7969 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 21:02:34 -0500 Subject: [PATCH 10/14] Add Makefiles for dilithium-iii --- crypto_sign/dilithium-iii/clean/GNUmakefile | 15 +++++++++++++++ .../clean/Makefile.Microsoft_nmake | 14 ++++++++++++++ scripts_windows/build_all.bat | 18 ++++++++++-------- 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 crypto_sign/dilithium-iii/clean/GNUmakefile create mode 100644 crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake diff --git a/crypto_sign/dilithium-iii/clean/GNUmakefile b/crypto_sign/dilithium-iii/clean/GNUmakefile new file mode 100644 index 00000000..ca7d6810 --- /dev/null +++ b/crypto_sign/dilithium-iii/clean/GNUmakefile @@ -0,0 +1,15 @@ +LIB=libdilithium-iii_clean.a + +SOURCES=$(wildcard *.c) +OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) + +CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) + +all: $(LIB) + +$(LIB): $(OBJECTS) + $(AR) -r $@ $(OBJECTS) + +clean: + $(RM) $(OBJECTS) + $(RM) $(LIB) diff --git a/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake b/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake new file mode 100644 index 00000000..6a631ae4 --- /dev/null +++ b/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake @@ -0,0 +1,14 @@ +LIB=libdilithium-iii_clean.lib + +OBJECTS=ntt.c packing.c poly.c polyvec.c reduce.c rounding.c sign.c + +CFLAGS=/I ..\..\..\common /W1 /WX + +all: $(LIB) + +$(LIB): $(OBJECTS) + LIB.EXE /OUT:$@ $** + +clean: + DEL $(OBJECTS) + DEL $(LIB) diff --git a/scripts_windows/build_all.bat b/scripts_windows/build_all.bat index 44cec721..19c4ff87 100644 --- a/scripts_windows/build_all.bat +++ b/scripts_windows/build_all.bat @@ -5,14 +5,16 @@ SET EL=0 REM CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" REM IF ERRORLEVEL 1 SET EL=1 -FOR /D %%K IN (crypto_kem\*) DO ( - FOR /D %%L IN (%%K\*) DO ( - cd %%L - nmake /f Makefile.Microsoft_nmake clean - IF ERRORLEVEL 1 SET EL=2 - nmake /f Makefile.Microsoft_nmake - IF ERRORLEVEL 1 SET EL=3 - cd ..\..\.. +FOR /D %%J IN (crypto_kem, crypto_sig) DO ( + FOR /D %%K IN (%%J\*) DO ( + FOR /D %%L IN (%%K\*) DO ( + cd %%L + nmake /f Makefile.Microsoft_nmake clean + IF ERRORLEVEL 1 SET EL=2 + nmake /f Makefile.Microsoft_nmake + IF ERRORLEVEL 1 SET EL=3 + cd ..\..\.. + ) ) ) From 5eb7485a01fad37357aa15e08a2fd7f54764fc9d Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 6 Feb 2019 21:14:10 -0500 Subject: [PATCH 11/14] Fix Windows build for dilithium-iii --- .../clean/Makefile.Microsoft_nmake | 2 +- scripts_windows/build_all.bat | 18 ++++++++---------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake b/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake index 6a631ae4..6b79e019 100644 --- a/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake +++ b/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake @@ -1,6 +1,6 @@ LIB=libdilithium-iii_clean.lib -OBJECTS=ntt.c packing.c poly.c polyvec.c reduce.c rounding.c sign.c +OBJECTS=ntt.obj packing.obj poly.obj polyvec.obj reduce.obj rounding.obj sign.obj CFLAGS=/I ..\..\..\common /W1 /WX diff --git a/scripts_windows/build_all.bat b/scripts_windows/build_all.bat index 19c4ff87..5b3b3bb2 100644 --- a/scripts_windows/build_all.bat +++ b/scripts_windows/build_all.bat @@ -5,16 +5,14 @@ SET EL=0 REM CALL "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" REM IF ERRORLEVEL 1 SET EL=1 -FOR /D %%J IN (crypto_kem, crypto_sig) DO ( - FOR /D %%K IN (%%J\*) DO ( - FOR /D %%L IN (%%K\*) DO ( - cd %%L - nmake /f Makefile.Microsoft_nmake clean - IF ERRORLEVEL 1 SET EL=2 - nmake /f Makefile.Microsoft_nmake - IF ERRORLEVEL 1 SET EL=3 - cd ..\..\.. - ) +FOR /D %%K IN (crypto_kem\* crypto_sign\*) DO ( + FOR /D %%L IN (%%K\*) DO ( + cd %%L + nmake /f Makefile.Microsoft_nmake clean + IF ERRORLEVEL 1 SET EL=2 + nmake /f Makefile.Microsoft_nmake + IF ERRORLEVEL 1 SET EL=3 + cd ..\..\.. ) ) From 157977258cb36b1caeac4c77da6d9979f513537b Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Fri, 8 Feb 2019 10:06:07 -0500 Subject: [PATCH 12/14] Make makefiles for Dilithium consistent with merged Kyber makefiles --- crypto_kem/kyber768/clean/GNUmakefile | 15 --------------- crypto_kem/kyber768/clean/Makefile | 2 +- crypto_sign/dilithium-iii/clean/Makefile | 15 +++++++++++++++ .../dilithium-iii/clean/Makefile.Microsoft_nmake | 6 ++++-- 4 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 crypto_kem/kyber768/clean/GNUmakefile create mode 100644 crypto_sign/dilithium-iii/clean/Makefile diff --git a/crypto_kem/kyber768/clean/GNUmakefile b/crypto_kem/kyber768/clean/GNUmakefile deleted file mode 100644 index b7ad903a..00000000 --- a/crypto_kem/kyber768/clean/GNUmakefile +++ /dev/null @@ -1,15 +0,0 @@ -LIB=libkyber768_clean.a - -SOURCES=$(wildcard *.c) -OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) - -CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) - -all: $(LIB) - -$(LIB): $(OBJECTS) - $(AR) -r $@ $(OBJECTS) - -clean: - $(RM) $(OBJECTS) - $(RM) $(LIB) diff --git a/crypto_kem/kyber768/clean/Makefile b/crypto_kem/kyber768/clean/Makefile index 616dcbf3..30340cc6 100644 --- a/crypto_kem/kyber768/clean/Makefile +++ b/crypto_kem/kyber768/clean/Makefile @@ -1,4 +1,4 @@ -# This Makefile has been tested with GNU Make and BSD Make +# This Makefile can be used with GNU Make or BSD Make LIB=libkyber768_clean.a OBJECTS=cbd.o indcpa.o kem.o kex.o ntt.o poly.o polyvec.o precomp.o reduce.o verify.o diff --git a/crypto_sign/dilithium-iii/clean/Makefile b/crypto_sign/dilithium-iii/clean/Makefile new file mode 100644 index 00000000..39e83ed7 --- /dev/null +++ b/crypto_sign/dilithium-iii/clean/Makefile @@ -0,0 +1,15 @@ +# This Makefile can be used with GNU Make or BSD Make + +LIB=libdilithium-iii_clean.a +OBJECTS=ntt.o packing.o poly.o polyvec.o reduce.o rounding.o sign.o + +CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) + +all: $(LIB) + +$(LIB): $(OBJECTS) + $(AR) -r $@ $(OBJECTS) + +clean: + $(RM) $(OBJECTS) + $(RM) $(LIB) diff --git a/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake b/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake index 6b79e019..18cc6db9 100644 --- a/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake +++ b/crypto_sign/dilithium-iii/clean/Makefile.Microsoft_nmake @@ -1,8 +1,10 @@ -LIB=libdilithium-iii_clean.lib +# This Makefile can be used with Microsoft Visual Studio's nmake using the command: +# nmake /f Makefile.Microsoft_nmake +LIB=libdilithium-iii_clean.lib OBJECTS=ntt.obj packing.obj poly.obj polyvec.obj reduce.obj rounding.obj sign.obj -CFLAGS=/I ..\..\..\common /W1 /WX +CFLAGS=/I ..\..\..\common /W1 /WX # FIXME: ideally would use /W4 instead of /W1, but too many failures in Dilithium right now all: $(LIB) From 3203f115e57e0bec6cadba884a5894ecfc1d12b0 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Fri, 8 Feb 2019 10:07:05 -0500 Subject: [PATCH 13/14] Remove GNUmakefile for Dilithium --- crypto_sign/dilithium-iii/clean/GNUmakefile | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 crypto_sign/dilithium-iii/clean/GNUmakefile diff --git a/crypto_sign/dilithium-iii/clean/GNUmakefile b/crypto_sign/dilithium-iii/clean/GNUmakefile deleted file mode 100644 index ca7d6810..00000000 --- a/crypto_sign/dilithium-iii/clean/GNUmakefile +++ /dev/null @@ -1,15 +0,0 @@ -LIB=libdilithium-iii_clean.a - -SOURCES=$(wildcard *.c) -OBJECTS=$(patsubst %.c,%.o,$(SOURCES)) - -CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) - -all: $(LIB) - -$(LIB): $(OBJECTS) - $(AR) -r $@ $(OBJECTS) - -clean: - $(RM) $(OBJECTS) - $(RM) $(LIB) From bf17b28d9d96f283d7fcf0fe5e741b65ad59ca3c Mon Sep 17 00:00:00 2001 From: Peter Schwabe Date: Mon, 11 Feb 2019 08:26:26 +0100 Subject: [PATCH 14/14] Fixed tabs in Makefile, removed gcc-specific alignment of poly --- crypto_sign/dilithium-iii/clean/Makefile | 6 +++--- crypto_sign/dilithium-iii/clean/poly.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crypto_sign/dilithium-iii/clean/Makefile b/crypto_sign/dilithium-iii/clean/Makefile index 39e83ed7..8a1c3e9f 100644 --- a/crypto_sign/dilithium-iii/clean/Makefile +++ b/crypto_sign/dilithium-iii/clean/Makefile @@ -8,8 +8,8 @@ CFLAGS=-Wall -Wextra -Wpedantic -Werror -std=c99 -I../../../common $(EXTRAFLAGS) all: $(LIB) $(LIB): $(OBJECTS) - $(AR) -r $@ $(OBJECTS) + $(AR) -r $@ $(OBJECTS) clean: - $(RM) $(OBJECTS) - $(RM) $(LIB) + $(RM) $(OBJECTS) + $(RM) $(LIB) diff --git a/crypto_sign/dilithium-iii/clean/poly.h b/crypto_sign/dilithium-iii/clean/poly.h index c8b984f9..6fea0cfd 100644 --- a/crypto_sign/dilithium-iii/clean/poly.h +++ b/crypto_sign/dilithium-iii/clean/poly.h @@ -7,7 +7,7 @@ typedef struct { uint32_t coeffs[N]; -} poly __attribute__((aligned(32))); +} poly; void PQCLEAN_DILITHIUMIII_poly_reduce(poly *a); void PQCLEAN_DILITHIUMIII_poly_csubq(poly *a);