761 Commits

Author SHA1 Message Date
Douglas Stebila
8d7e8f5579
Consistent type in KEM decaps API (#1004) (#1005)
* Consistent type in KEM decaps API (#1004)

* uint8_t in non-PQClean KEM APIs

* uint8_t in PQCleam KEM APIs

* Additional uint8_t tweaks in PQClean KEM APIs

Co-authored-by: Sebastian <sebastianv89@users.noreply.github.com>
2021-06-01 17:49:32 -04:00
Christian Paquin
63ffa9854a
Integrated sike compressed elligator fix. (#1008)
* Integrated sike compressed elligator fix.

* Updated SIKE's github commit ref
2021-06-01 14:30:13 -04:00
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
John Schanck
530d7059b2
sha3: respect OQS_ENABLE_SHA3_xkcp_low_avx2=OFF in CMakeLists.txt (#999) 2021-05-11 21:09:34 -04:00
John Schanck
9e2044ff2d
Pull latest HQC-192 from PQClean (#992) 2021-05-06 10:18:02 -04:00
Christian Paquin
b1d07278d1
SIKE March 2021 bug fix (#981)
* SIKE March 2021 bug fix

* Reverted typo.
2021-04-29 14:35:57 -04:00
John Schanck
a89e3ac581
Improve random sources when not using OpenSSL (#976)
* rand.c: request at most 256 bytes per getentropy call

* CMake: Set OQS_HAVE_GETENTROPY

* rand.c: fopen/fread error handling

* rand.c: redundant test to silence warn_unused_result

* CMake: include CheckSymbolExists
2021-04-20 19:48:24 -04:00
jyao1
e48bc41c4f
Enable liboqs build in UEFI/EDKII. (#975)
UEFI/EDKII used openssl as crypto lib with OPENSSL_SYS_UEFI.

This patch adds OQS_SYS_UEFI macro in liboqs to indicate special build in UEFI/EDKII.
With this patch, we can start building liboqs in UEFI/EDKII.

For algorithm specific patches, we will submit one by one later.

Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
2021-04-20 08:55:31 -04:00
Douglas Stebila
a04ef8d3ca
Switch AES C implementation to PQClean's (#971)
* Switch AES C implementation to PQClean's

* Tweaks to AES C implementation
2021-04-19 15:55:25 -04:00
John Schanck
f1673911c3
KeccakP-1600times4/avx2: Switch a memmove to a memcpy for musl libc (#972) 2021-04-18 06:55:39 +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
Douglas Stebila
008ba89dc4
Don't do feature detection inside a tight loop (#969)
* Don't do feature detection inside a tight loop

* Prettyprint
2021-04-14 16:57:28 -04:00
John Schanck
aa076bb192
oqsconfig.h.cmake: add missing OQS_ENABLE_SHA3_xkcp_low_avx2 line (#968) 2021-04-12 20:16:09 -04:00
John Schanck
44fe8fd82c
SIKE/CMake: recognize both x64+BMI2 and x64+BMI2+ADX (#965)
* SIKE/CMake: recognize both x64+BMI2 and x64+BMI2+ADX

* CI: re-enable alpine
2021-04-12 15:31:38 -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
f99556ddda
Add SHA3 call dispatching (#957)
* Move copy_from_xkcp/CMakeLists.txt out of copy_from_xkcp/package.sh

* Namespace xkcp_low implementations for dist builds

* Run-time dispatching of sha3 calls

* Disable sha3 avx2 on windows
2021-04-06 10:34:45 -04:00
John Schanck
211aa22f94
Fix shake context leak in Dilithium (#960)
* Reduce concurrency in CircleCI AddressSanitizer builds

* Fix shake context leak in Dilithium

Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
2021-04-06 08:42:20 -04:00
Douglas Stebila
b1e2b44888
Sync with PQClean (#954)
* Sync with PQClean commmit e463123b92a5b315531c883d0d6b7381731e9b1c

* Sync with PQClean commit ef4ad5da02283ec0dd58b57a0684c98a1e33a531

* Reduce concurrency in CircleCI AddressSanitizer builds
2021-04-05 15:40:07 -04:00
John Schanck
7f3088232a
Manually remove fips202 files left by copy_from_upstream (#958) 2021-04-02 13:08:30 -04:00
John M. Schanck
7a5001fe12 Fix compilation of KeccakP-1600-AVX2.s on macOS 2021-04-01 10:13: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
e82b58aebf
Patch Kyber, Dilithium, and SPHINCS to use our SHA3 (#948)
* Prepare SHA3 shims for pqcrystals

* SHA3 patches for Kyber

* Apply Kyber patches

* SHA3 patches for Dilithium

* Apply Dilithium patches

* SHA3 patches for sphincs (file deletions)
2021-03-24 21:35:37 -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 M. Schanck
ac2b828193 Pull latest verison of McEliece from PQClean 2021-03-19 09:03:22 -04:00
John M. Schanck
72dfa5a31c Add Wno-language-extension-token for McEliece/avx 2021-03-19 09:03:22 -04:00
John M. Schanck
5572f76b26 Upstream patch to remove __m256i_u* casts from McEliece/avx 2021-03-19 09:03:22 -04:00
John M. Schanck
d682661514 Remove unused McEliece implementations 2021-03-19 09:03:22 -04:00
John M. Schanck
9b77b33ece Revert local McEliece changes 2021-03-19 09:03:22 -04:00
Thom Wiggers
e116748c50
these two example files got moved at some time (#938) 2021-03-12 12:06:22 +01: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
John Schanck
b5fd8aedfc
Resolve some McEliece AVX build issues (#932)
* Fix minimal build support for McEliece avx

* mceliece avx consts.S: use .hidden to avoid putting consts in GOT

* mceliece avx int32_sort.c: avoid gcc extension __m256i_u

* cmake: Use target_compile_option when setting -Wno-language-extension-token for mceliece avx
2021-03-11 21:28:07 -05:00
John Schanck
4c754a5922
picnic: compile keccak with NO_MISALIGNED_ACCESSES (#924) 2021-02-27 17:13:28 -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
Thom Wiggers
d9e025852e
Support OpenSSL on Windows (#915)
* Allow OpenSSL on Windows

See https://github.com/open-quantum-safe/liboqs-rust/issues/17
2021-02-23 06:12:06 +01:00
Christian Paquin
7ef3f41e09
Updated SIKE to v3.4 (#914)
* Upgraded to sike v3.4

* Commented out check to avoid "always false" warning/error.

* Fixes for OQS inclusion.
2021-02-18 11:23:02 -05:00
John Schanck
952c628051
Fix undefined behaviour in keccak4x (#919)
* keccak4x: Fix undefined load from improperly aligned static constant

* keccak4x: Backport some minor changes

* astyle
2021-02-17 20:38:19 -05:00
Basil Hess
405654c6ec
Kyber768 ref dependencies (#899) (#905) 2021-02-10 14:07:57 +01:00
Michael Baentsch
1256e3ba99
Mb randloop (#897)
* fixes #895

* upgrade ubuntu 20 CI

* using status/poll pattern to retry
2021-02-08 10:11:58 -05: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
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
Christian Paquin
9fb0bdd6f3
Picnic Dec 2020 update. (#872)
* Updated picnic from commit 1797ab (v3.0.3) to fcddc7.

* Added commit ca45b2, disabling OQS's non-optimized sha3 impl.

* Integrated commits up to v3.0.4 tag.
2021-01-13 13:03:43 -05: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
Christian Paquin
1fb8a3d382
Integrates frodokem Dec 2020 update (#869)
* Integrated frodokem Dec 2020 fix.

* Updated frodokem commit URL in doc
2020-12-11 17:06:12 -05:00