55 Commits

Author SHA1 Message Date
Michael Baentsch
3a56677a93
fix for #865 (#1002) 2021-05-21 15:52:03 -04:00
Michael Baentsch
92e6418b35
BIKE and Picnic enablement for cygwin (#1001)
* BIKE and Picnic enablement for cygwin

* no doxygen support for cygwin
2021-05-18 08:17:05 +02:00
Douglas Stebila
5f28a2af5d liboqs 0.6.0-rc1 2021-04-25 16:43:56 -04:00
John Schanck
efd7b1926a
Speed up ARM jobs in CI (#964)
* CMake: ARM toolchain files

* CI: Cross compile for ARM instead of emulating the entire build

* CMake: do not use mcpu=native when cross compiling

* CI: Disable testapproval [skip ci]

* CI: Disable armel tests

* CI: Disable test_mem on ARM
2021-04-08 14:49:56 -04:00
John Schanck
b36ff9f17c
Replace OQS_PORTABLE_BUILD and OQS_USE_CPU_EXTENSIONS (#951)
* Replace OQS_PORTABLE_BUILD with OQS_DIST_BUILD

Also introduces OQS_OPT_TARGET and removes OQS_USE_CPU_EXTENSIONS

* Only compile sha3 avx2 code on Linux|Darwin

* Use new ARCH_ARM[X] flags in SIKE CMakeLists

* Update test_portability and rename to test_distbuild

* Update documentation for building Windows AMD64 from Ubuntu Bionic

* Update scripts/build-android.sh

* More specific CMAKE_SYSTEM_PROCESSOR for rasppi toolchain

* CI: Use OQS_DIST_BUILD in some jobs

* Replace OQS_get_available_CPU_extensions by OQS_CPU_has_extension

* ARM64v8/ARM32v7 runtime cpu feature detection

* Compile-time detection of some ARM features

* Toolchain files to cross compile for ARM32v7 and ARM64v8

* Remove unnecessary references to CMAKE_BUILD_TYPE=Release

* Use OQS_DIST_BUILD=ON on Windows
2021-03-31 16:30:54 -04:00
John Schanck
3f2da47b36
Pull latest SPHINCS from PQClean; bump liboqs version to 0.6.0-dev (#950) 2021-03-27 14:11:00 -04:00
John Schanck
7dc4b378d6
Refactor SHA3 implementations and improve API (#922)
* sha3: remove old implementations

* sha3: new implementations

* picnic: use liboqs sha3 and sha3x4

* frodo: use new sha3x4 interface

* sphincs: use liboqs sha3x4

* fixup

* skip test_spdx on xkcp_low directory
* xkcp_sha3: explicit casts to avoid narrowing warnings
* xkcp_sha3x4: explicit casts to avoid narrowing warnings
* sha3: disable platform specific xkcp if OQS_PORTABLE_BUILD
* sha3: fix Wcast-qual warnings on clang-9
* fix 'reset' functions
* xkcp_sha3: skip fastloop call if input is not long enough
* xkcp_low: Enable lane complementing for plain-64bits
* xkcp_low: remove Kravatte definitions from times4/avx2

* Add common OQS_MEM_aligned_alloc and OQS_MEM_aligned_free

* Require both OQS_USE_OPENSSL and OQS_USE_SHA3_OPENSSL to enable OpenSSL's SHA3

* Fix some undefined behaviour in KeccakP-1600/plain-64bits

* Fix some undefined behaviour in KeccakP-1600times4/avx2

* Expand shake tests

* Add sha3x4.h include to oqs.h

* Add xkcp_low license info to readme [skip-ci]

* Add copy_from_xkcp scripts [skip-ci]

* SPDX License Info for new scripts [skip-ci]
2021-03-22 19:54:32 -04:00
John Schanck
4b1a9e23ee
Make OQS_USE_CPU_EXTENSIONS imply OQS_PORTABLE_BUILD=OFF; alternative to #939 (#942) 2021-03-14 15:32:52 -04:00
John Schanck
707750e034
Fix OQS_PORTABLE_BUILD logic for Frodo (#927)
* Fix OQS_PORTABLE_BUILD logic for Frodo

* Refine 'OQS_PORTABLE_BUILD' by general architecture, e.g. x86_64

* Use CMake to define ARCH_X86_64 and ARCH_ARM_ANY used in common.{c,h}

* Avoid triggering portable build on ARM

* Set OQS_USE_CPU_EXTENSIONS even on MSVC

* Compile AES-NI code in portable x86_64 builds
2021-03-11 21:31:26 -05:00
Douglas Stebila
0ab1d1d95b Switch to 0.5.1-dev [skip ci] 2021-03-10 13:33:25 -05:00
Douglas Stebila
af1b14e7b6 liboqs 0.5.0 release 2021-03-10 13:30:25 -05:00
Douglas Stebila
5b2ed97f08
liboqs 0.5.0 release candidate 1 (#926)
* liboqs 0.5.0 release candidate 1

* picnic: compile keccak with NO_MISALIGNED_ACCESSES (#924)

* liboqs 0.5.0 release candidate 1

Co-authored-by: John Schanck <jschanck@uwaterloo.ca>
2021-02-27 22:42:11 -05:00
John Schanck
fa9c2671ec
Use valgrind to check for secret-dependent branching on 'audit' branches (#904)
* Constant time checks using Valgrind and suppression files

* Suppression file for Kyber (ref+avx), HQC, SIKE, NTRUPrime, McEliece, SIDH, Falcon (ref+avx), SPHINCS, Dilithium r2+r3, picnic

* mark all BIKE implementations as vartime

* Set OQS_DEBUG_BUILD in oqsconfig.h if CMAKE_BUILD_TYPE=Debug

* Add OQS_ENABLE_TEST_CONSTANT_TIME to oqsconfig.h

* Check build options before running

* test_{kem,sig}: avoid direct call to OQS_randombytes_system

* Remove picnic3 issue based on review #889

* fix Kyber namespacing

* Missing BIKE error type, skip BIKE

* Resolve SIDH/SIKE bingcd issue as per #888

* Mark Falcon hash_to_point_vartime issue as resolved

* Disable CI tests
2021-02-25 06:51:01 +01:00
John Schanck
f4c1ef9ba5
Add OQS_MINIMAL_BUILD option and redefine CI workflow (#903)
* Add OQS_MINIMAL_BUILD option that builds only the default KEM/SIG

* CI: add buildcheck job, which uses minimal build

* Add buildcheck and testapproval to CI workflow

* CI: Only run address-sanitizer on audit branches

* CI: Disable centos-8 and debian-buster
2021-02-13 16:53:06 +01:00
Basil Hess
fc35e09a14
Update copy_from_pqclean / copy_from_upstream (#883)
* Update copy_from_pqclean / copy_from_upstream (#880)

* Renames copy_from_pqclean to copy_from_upstream.

* Adds 'upstreams' field to copy_from_upstream.yml, allowing to specify upstream repositories, branches and commits.

* Modifies "copy" command in copy_from_upstream: sources are pulled from specified git-repositories. Implementation folders in $LIBOQS_DIR/src will be prefixed with the upstream-name.

* Adds "verify" command in copy_from_upstream: Implementations in $LIBOQS_DIR/src are compared with expected upstream versions.

* Prepares for copying pqclean, pqcrystals-kyber and pqcrystals-dilithium from upstream.

* Updates copy_from_upstream to process common dependencies from an upstream.

* Adds reminder text to manually update algorithm docs .md files after copying
2021-02-03 18:43:02 +01:00
Douglas Stebila
fb5484cda6
FrodoKEM portable build with CPU feature detection (#878)
* Make `OQS_SHA3_shake128_4x` always available

* Simplify FrodoKEM SHA3

* Fix prettyprint

* Make SHAKE128 x4 always available and use CPU feature detection

Move contents of sha3x4.c into sha3x4_avx2.c

* CPU feature detection for FrodoKEM sa+e operation

Separate out the 4 versions (C, AVX2) x (AES, SHAKE) and then select 
appropriate one

* Missing braces for single-line for statement

* Reorganize FrodoKEM AVX2 code into separate compilation units

* Move as+e so compiler can apply AVX2 optimizations

There isn't an explicit separate AVX2 implementation since Patrick 
observed that the compiler can optimize this code well enough without 
hand-written usage of intrinsics.  This commit reorganizes the code so 
that the compiler can separately compile a version with -mavx2 options 
provided.
2021-01-18 10:13:11 -05:00
Douglas Stebila
46693cf93a
Add NTRU-Prime from PQClean (#848) 2020-11-03 13:36:24 -05:00
Douglas Stebila
1a923c79e0
Sync with PQClean (#846)
* Change BMI1 and add PCLMUL

* Copy from PQClean

Commit b4078aae55f9efbc7b3ab7b3c702be376f7a7987, excluding HQC

* Update algorithm datasheets

* Prettyprint

* Update version to 0.5.0-dev
2020-10-29 19:46:39 -04:00
Goutam Tamvada
3f89b987c7
Refactored CI. (#829) 2020-09-24 11:16:23 -04:00
Douglas Stebila
226b4637d9
Remove non-Round 3 algorithms (NewHope, ThreeBears, MQDSS, qTesla) (#810) 2020-08-17 13:25:08 -04:00
Douglas Stebila
02fddd9353 0.4.0 release 2020-08-11 20:30:00 -04:00
Douglas Stebila
477ef3f60c 0.4.0-rc1 2020-08-04 20:25:59 -04:00
Douglas Stebila
adac989932
Added HQC from PQClean. (#805) 2020-08-04 13:22:45 -04:00
Douglas Stebila
ed1baf3d27 Change to 0.4.0-dev and some cleanup 2020-07-24 20:38:46 -04:00
Douglas Stebila
34ec4b83a7
Re-add AES-NI with CPU feature detection (#770)
* Start re-adding AES-NI with CPU feature detection

* Follow Goutam's feedback on CPU feature detection

* Macrify CPU feature detection logic in AES

* AES128 and AES256 using NI based on Romain Dolbeau's public domain code

* Fewer calls to C_OR_NI

* Restricting setting of OQS_USE_CPU_EXTENSIONS.

* Unroll AES loops

Co-authored-by: xvzcf <xvzcf@users.noreply.github.com>
2020-07-24 13:53:14 -04:00
Douglas Stebila
cafb8667c4 Bump to 0.3.1-dev 2020-06-10 12:00:26 -04:00
Douglas Stebila
f6ca3dca5e liboqs 0.3.0 2020-06-10 11:57:51 -04:00
Douglas Stebila
44618b71f6 liboqs 0.3.0 release candidate 2 2020-06-05 19:16:22 -04:00
Douglas Stebila
ffae460a71
Remove LEDAcrypt v2.1 temporarily (#756)
Due to attack in https://eprint.iacr.org/2020/455
2020-05-26 14:11:11 -04:00
Douglas Stebila
6516da6651 liboqs 0.3.0 release candidate 1 2020-05-14 17:38:28 -04:00
Douglas Stebila
6e0b0d79a9
Add SPDX-License-Identifier headers (#749)
* Add SPDX-License-Identifier in src/common

* Add SPDX-License-Identifier in FrodoKEM

* Add SPDX-License-Identifier in SIKE

* Add SPDX-License-Identifier in BIKE

* Add SPDX-License-Identifier in OQS headers

* Add SPDX-License-Identifier in files generated during copy-from-pqclean

* Add SPDX-License-Identifier in Picnic

* Add SPDX-License-Identifier in qTesla

* Add SPDX-License-Identifier in CMake files

* Update license info in README

* Add SPDX-License-Identifier in scripts

* Add SPDX-License-Info to CMakeLists

* Add SPDX-License-Info in tests

* Add SPDX-License-Info to various files

* Prettyprint

* Add test for SPDX-License-Identifier headers

* Updated license identifiers for CPU extension detection code.

* Use conjunction for SPDX in file with two licenses

Co-authored-by: xvzcf <xvzcf@users.noreply.github.com>
2020-05-12 11:45:37 -04:00
xvzcf
e69bdcbd32
Broadened OQS_BUILD_TESTS to OQS_BUILD_ONLY_LIB and removed side-effecting asserts. (#741) 2020-04-28 15:05:00 -04:00
xvzcf
8950275409
Removed non-standard CMake build types and fixed other bugs. (#726)
* Removed non-standard CMake build types and introduced new variables to customize the build.

* Added handling for new build variables to all KEMS and signatures and updated CI.

* Added clang-9 test to CI.
2020-04-16 13:53:04 -04:00
xvzcf
722ca648a1
Overhauled compiler-time CPU-extension detection. (#713)
Refactored .CMake/alg_support.cmake, and kem/ and sig/ CMakeLists.txt files.

Refactored copy_from_pqclean/ templating.

Added custom x64 CPU extension detection code and removed cpu_features.

Removed duplicate Kyber source directories.
2020-04-14 07:58:41 +02:00
Michael Baentsch
9507608882
Optimized build refactoring. (#683) 2020-04-01 11:33:59 -04:00
Nikita Karpey
438fecf289
Use cpu_features instead of __builtin_cpu (#654). 2020-03-24 15:12:06 -04:00
xvzcf
57f2bcf91f
Replaced add_compile_options(-fPIC) with set(CMAKE_POSITION_INDEPENDENT_CODE ON) (#672)
* Use POSITION_INDEPENDENT_CODE property instead of add_compile_options(-fPIC).

* Fixing CircleCI.
2020-03-19 20:07:58 -04:00
Douglas Stebila
4c3016f43e
Add Rainbow from PQClean (#662)
* Add Rainbow from PQClean

* Adapt CircleCI config to handle larger number of local files
2020-03-15 20:25:42 -04:00
Douglas Stebila
eaec7972ba
Add Classic McEliece from PQClean (#661)
* Add Classic McEliece from PQClean

* Enlarge stack size on Windows

* Enlarge stack size with Mingw/Cygwin
2020-03-15 08:54:55 -04:00
Douglas Stebila
795c1b7932
Add Falcon from PQClean (#660)
* More cleanup after replaced dashes in filenames

* Add Falcon from PQClean and sync with latest PQClean commits

* Try to fix type punning warning in Falcon

* Missed templating

* Formatting change
2020-03-14 10:56:42 -04:00
xvzcf
adcfe2744c Replaced dashes in filenames with underscores for consistency. 2020-03-11 15:06:26 -04:00
xvzcf
9f4cffbfda Moved the contents of src/crypto into src/common. 2020-03-11 15:06:26 -04:00
xvzcf
0d39a601b1
CMake refactoring. (#652)
* Overhauled the propagation of compiler flags

* Added "Dependency" CMake build type

* Removed src/common/CMakeLists.txt and src/crypto/CMakeLists.txt

* Set default build type to exclude CPU extension-based optimizations
2020-03-11 10:48:28 -04:00
Nikita Karpey
cd24c784a3
Improved support for Mingw-w64 (#648)
* Build fixed through Mingw-w64

* Initial try to build using appveyor and MSYS2
2020-03-10 11:06:52 -04:00
Nir Drucker
fc1bd942a3
Fixing BIKE CMAKE compilation when using Clang-3.9 and on an AVX512 platform (#655) 2020-03-10 11:06:33 -04:00
Douglas Stebila
63b4c6552b
Clear compiler warnings (#633)
* Fix clang on macOS warnings

* Clear gcc-9 on macOS warnings

* Work around gcc-4.9 warnings

* Disable one Picnic compiler warning

* Fix compiler warning on WSL
2020-03-05 11:01:10 -05:00
Nick Fulton
24eb40f121
Enable cross-compilation for Android (#627)
* Update CMakeLists.txt

Prevent breaking options on Android compilation

* Create build-android.sh

Created build script for Android cross-compilation.
2020-02-29 16:05:57 -05:00
Michael Baentsch
8f78156dfa
Added generic optimized build type. (#631) 2020-02-27 15:03:41 -05:00
Nikita Karpey
785c9dc24e
Fixed detection processor architecture (#629) 2020-02-25 12:30:49 -05:00
xvzcf
9c01847b21
Refactored oqsconfig.h.cmake (#628)
* Added OQS_ prefix and assigned values to all #defines in oqsconfig.h.cmake

* Updated CI and templating scripts
2020-02-24 18:04:01 -05:00