364 Commits

Author SHA1 Message Date
Jason Goertzen
0807ecf9af
Adding support for multiple upstream to copy_from_upstream, as well as pqclean's aarch64 kyber implementation (#1117)
* currently there is a bug where pytest doesn't work but the individual tests work... looking into it still.

* Fix an issue where run_tests tried to run tests from upstream. Fix by @DStebila

* No longer checking spdx on files copied from upstream

* pqclean's aarch64 kyber implementation is now being pulled from. Still need to clean things up.

* pqclean kyber fragment was left behind. It's now added

* Added compiler checking for gcc. Must be at least 9.4.0. Need to track down clang and appleclang

* Need to figure out how to handle commen dependencies from multiple upstreams

* Cleaned up copy_from_upstream.py a bit

* Added pqclean's aarch64 optimized kyber implementation to liboqs

* Added pqclean's aarch64 optimized kyber implementation to liboqs

* Fixed an isssue where 'empty' conditionals were added to kem_scheme.c files when there were no required flags

* reverting sabre to version prior to updated copy_from_upstream script

* stripping asimd flag for ARM64_V8 as it isn't needed and will cause errors when trying to specify it during compilation

* Fixed an issue where empty conditionals would appear when no required flags were specified

* Updated kyber docs

* Updated kyber docs with better formatting

* Adding updated kyber documentation

* Reverting documentation that was erroniously updated while updating kyber.

* Reverted ntruprime too far back by mistake

* Updated kyber doc's yml no-secret-dependent-branching-checked-by-valgrind to false

* Updated kyber markdown so that no-secret-dependent-branching-checked-by-valgrind correctly says false for the new aarch64 implementation
2021-11-10 14:22:49 -05:00
Christian Paquin
c366e19805
Updated valgrind constant time exception for picnic (new code, and updated some line numbers) (#1121) 2021-11-09 10:08:46 -05:00
Christian Paquin
70c822b590
Skip non-enabled algs in constant time tests (#1120)
* Skip non-enabled algs in constant time tests

* Deleted previous test skipping code (replaced with common function)

* Added back SKIP_ALGS checks, for enabled-but-skipped algs.
2021-11-08 12:27:20 -05:00
Michael Baentsch
6175da8246
Add S/NTRUP1277 (#1111)
* adds S/NTRUP1277

* disable McEliece for OSX shared CCI runs

* known sntrup constant_time issue suppressed
2021-10-22 09:31:47 -04:00
Basil Hess
016404076d
S390x support (#1103)
* s390x support

* - Fix for FrodoKEM-SHAKE for big endian support
- Fix unused variable in Keccak code on big endian
2021-10-12 14:39:56 -04:00
Michael Baentsch
9be13d21ed
enable true out-of-source build (#1093) 2021-09-20 10:51:00 -04:00
Michael Baentsch
2757d16854
Enabling out-of-source build-and-test (#1091)
* removes further fixed build directory dependencies

* formatting corrected

* remove cleanup code unsuitable for win

* remove include unknown in windows

* adapt mkdir to win API
2021-09-18 16:06:07 -04:00
Ted Eaton
001a3aa3c6
Adding armv8 crypto extensions to AES (#1086)
* Adding armv8 crypto extensions to AES

* Adding SPDX License identifier for aes arm files

* tidying up some whitespace in armv8 encryption functions

* Prettyprint

* Remove whitespace [skip ci]

Co-authored-by: Ted Eaton <eeaton@uwaterloo.ca>
Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
2021-09-15 19:59:02 -04:00
Michael Baentsch
86bfbf4a76
skip algorithms for constant_time tests (#1089)
* skip algorithms for constant_time tests

* skip alg tests only on haswell
2021-09-13 12:24:22 -04:00
Michael Baentsch
3bc89ee908
enabling flexible build dir name in testing (#1080) 2021-08-28 14:39:25 -04:00
Douglas Stebila
c2eedffb1f
Fix a bug where intrinsics were ignored when compiling for apple silicon (#1074)
* Found an error on apple silicon not reporting that it supports SHA2 instructions

* Update output of test_hash

Co-authored-by: Jason Goertzen <Martyrshot@gmail.com>
2021-08-09 13:02:50 -04:00
Douglas Stebila
a934455362
Update Valgrind suppression files for recent implementation changes (#1068) 2021-08-06 09:47:08 -04:00
Douglas Stebila
b72b89efdb
Add test suite comparing parameters in C with parameters in YML (#1070)
* Add test suite comparing parameters in C with parameters in YML

* Fix/bypass CI failures for test_alg_info
2021-08-05 15:32:43 -04:00
Douglas Stebila
286e68674c
Add CI job for x86 (#1058) 2021-07-30 15:23:41 -04:00
Karolin Varner
e0c7f33689
Fixes necessary to compile on raspberry pi 4 with clang (#1055)
* Make compile on raspberry pi 4 with clang

* asm -> __asm__

* Prettyprint

Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
2021-07-29 13:25:52 -04:00
Goutam Tamvada
760b3886fa
New datasheets (#1030)
* Documentation YAML files and automatic markdown generation for KEMS.

* Escape underscores

Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
2021-07-15 13:50:46 -04:00
Basil Hess
568a9df20c
Suppression file update for Dilithium (#1048)
Simple TravisCI integration for ppc64le
2021-07-08 08:36:40 +02:00
Michael Baentsch
f3caccff9e
Removing default algs (#1044)
* change to retain OQS_MINIMAL_BUILD logic

* remove default alg support
2021-07-01 11:42:12 +02:00
John Schanck
21dcba4eae
Remove old versions of BIKE (#1045)
* oqsconfig.h: CLMUL definitions

* BIKE: unhook old versions from OQS

* BIKE: improve cpu_features.h

* BIKE: update CMakeLists.txt

* BIKE: support dist build on compilers without -mvpclmulqdq

* BIKE: compile with -Wno-missing-braces -Wno-missing-field-initializers

* Manually update algorithm count
2021-07-01 07:05:49 +02:00
Michael Baentsch
a822f0e62d
PQClean / NTRU Prime update (#1039)
* updating upstream algorithms

* update Kyber upstream ref

* adding compat.h

* add SPDX

* move to PQClean shims

* alpine-breaking gcc feature check changed

* remove error case as per PR review comment
2021-06-29 15:05:34 -04:00
John Schanck
bf0e388545
Remove Picnic's compatibility layer (#1023)
* Add OQS_MEM_secure_bcmp

* Replace picnic compat.h with OQS shims

* Remove exceptions from test_namespace
2021-06-17 16:07:06 -04:00
dkostic
17d3e0bab5
Import BIKE Round-3 Additional code (#1013)
* Import BIKE Round-3 Additional code

* astyle fix

* Fix for the shared build

* Added KATs sha256sum for BIKE-L1 and BIKE-L3

* Add check if the compiler supports VPCLMUL flag (some older ones don't)

* Disable BIKE build on 32-bit ARM

* Addressing comments on the PR

Co-authored-by: Dusan Kostic <dkostic@amazon.com>
2021-06-17 11:17:22 -04:00
John Schanck
bd23977818
tests/constant_time: update SIKE suppression files [skip ci] (#1009) 2021-06-01 17:50:17 -04:00
John Schanck
1b25f45f35
tests/constant_time: update passes file for AVX2 impl of HQC [skip ci] (#994) 2021-05-06 19:51:20 -04:00
John Schanck
83af71078b
Add canaries around malloc'd regions in test_sig (#993)
* test_sig: Add canaries around malloc'd regions

* test_sig/kem: disable canary checks in test_constant_time

* test_kem: test canaries after testing malformed ciphertext
2021-05-06 19:50:53 -04:00
John Schanck
8981b7f337
tests/constant_time: SIKE issues are resolved (#987) 2021-05-06 10:52:35 -04:00
Thom Wiggers
1923b82a3b
Test without alignment (#986)
* Fix potential NULL dereference in fix_test_kem

* Test without aligned pk, sk

This changes the test_kem.c functions like those in PQClean:
* also prefix magic bytes for checking for out-of-bounds access
* use odd numbers for breaking alignment

Includes #985

* Fix style
2021-05-04 20:27:07 -04:00
Michael Baentsch
8f8bb44c2f
output CPU feature CT/RT distinction (#984) 2021-05-03 15:03:23 +02:00
Douglas Stebila
7b56fa83f8
Remove AES decryption functions (#970)
* added OQS_NO_AESDEC define

* disable _dec only subroutines

* further non-openssl _dec subroutines disabled

* Remove decryption subroutines

* Remove further AES decryption code

* Forgot one function

Co-authored-by: Michael <57787676+baentsch@users.noreply.github.com>
2021-04-15 09:50:28 -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
7efdb91322
Detect ADX instructions (#963)
* Detect x86_64 ADX extension

* Check for ADX instructions SIKE CMakeLists

* system_info.c: better instruction reporting
2021-04-06 19:15:51 -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
eccb24f21e
Fix OQS_PORTABLE_BUILD logic for upstream imports (#941)
* Fix OQS_PORTABLE_BUILD logic for schemes imported with copy_from_upstream

* Correct interpretation of pclmulqdq required flag

* Only run detect_gcc_clang_intrinsics on X86_64
2021-03-24 21:31:20 -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
0e4885b569
test_constant_time: Suppression files for AVX McEliece [skip ci] (#931) 2021-03-03 12:32:22 -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
Basil Hess
9cf6171007
Dilithium 3.1 update, partially autogenerating docs (#923)
* Updates to Dilithium 3.1 (randomized)

* Update dilithium.md, point to pqcrystals-repo

* Partially autogenerating algorithm docs
2021-02-24 06:39:08 +01:00
Michael Baentsch
6040f559ec
Update Falcon & McEliece (adding AVX) (#920)
* fixing copy_from_upstream issues (>2 optimized implementations)

* adding mceliece-avx & falcon

* alg doc added
2021-02-23 16:45:56 +01:00
Michael Baentsch
95c9c5bdf8
Changing python platform test (#902)
Fixes #901
2021-02-12 10:25:32 +01:00
John Schanck
e9348d5500
Switch back to subprocess.run (#908)
* helpers.py: switch back to subprocess.run (revert 346305fc)

* test_free: replace find|grep|xargs with python solution
2021-02-12 06:46:59 +01:00
John Schanck
1ead54fc9a
Remove round 2 Dilithium KATs (#898) 2021-02-09 07:10:27 +01:00
Basil Hess
bd4d09da75
Sync upstream with copy_from_upstram / pqcrystals pull (#891)
* Point Kyber and Dilithium to pqcrystals-repo.

* Pulls Kyber and Dilithium from PQCrystals using copy_from_upstream

* Dilithium Round 3
* Kyber round 3
* Updates Dilithium Round 3 KAT

* Updates kyber.md and dilithium.md (manual changes after running copy_from_upstream)
2021-02-04 15:46:45 +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
85597bbc6c
Rainbow Round 3 (#867) 2021-01-04 09:25:35 -05:00
Michael Baentsch
b08d581acb
add portability tests (#871)
* added portability tests only on Ubuntu, documentation added

* using Westmere as test CPU type; disable avx2 for common code other than sha3x4 on portable builds

* removed extraneous PORTABLE_BUILD guards
2020-12-17 16:10:27 +01:00
Goutam Tamvada
dd739fc8f2
OQS_BUILD_PORTABLE -> OQS_PORTABLE_BUILD and other refactoring. (#864)
* OQS_BUILD_PORTABLE -> OQS_PORTABLE_BUILD and associated changes.

* subprocess.run() -> subprocess.Popen() + subprocess.communicate().

* Changed temporary storage location used for memory benchmarking.
2020-12-09 15:03:57 -05:00
Douglas Stebila
65b3fb6e71
Sync with PQClean (Kyber Round 3) (#858)
* Delete Kyber Round 2

* Sync with PQClean

Major changes; Kyber Round 3
Minor changes: HQC and NTRU

PQClean commit 168e3625988defacdf10812642e4d412fb295dc0
2020-12-03 09:56:03 -05:00
Michael Baentsch
3ca64c35ae
enable Valgrind memory use testing (#854) 2020-12-02 21:45:30 +01:00
Douglas Stebila
1ad950ac00
Sync with PQClean (#851)
* Remove HQC round 2

* Sync with PQClean

3c8be3cb1f8ca0953f2df44ea665f118efb468d6

* Add HQC from PQClean
2020-11-24 10:04:49 -05:00