* Check for NULL dereference before using secure free
Signed-off-by: Hussain1811 <Sadiq.Hussain.M@ibm.com>
* Skip failing CI test (#2157)
* Skip failing CI test
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
* Fix typo
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
---------
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
---------
Signed-off-by: Hussain1811 <Sadiq.Hussain.M@ibm.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Hussain1811 <Sadiq.Hussain.M@ibm.com>
Co-authored-by: Douglas Stebila <dstebila@users.noreply.github.com>
* Use OQS_MEM_cleanse() instead of memset()
This is needed for secret objects as memset
maybe optimized out by the compiler.
Signed-off-by: Hussain1811 <Sadiq.Hussain.M@ibm.com>
* Skip failing CI test (#2157)
* Skip failing CI test
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
* Fix typo
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
---------
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
---------
Signed-off-by: Hussain1811 <Sadiq.Hussain.M@ibm.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Hussain1811 <Sadiq.Hussain.M@ibm.com>
Co-authored-by: Douglas Stebila <dstebila@users.noreply.github.com>
* Initial derive keypair commit
Signed-off-by: Eddy Kim <Eddy.M.Kim@outlook.com>
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Add pqcrystals-ml_kem_ipd.patch
Signed-off-by: Eddy Kim <Eddy.M.Kim@outlook.com>
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Fix encaps key in scheme and revert whitespace changes
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Hopefully corrected patch file
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Corrected missing derand in kem_scheme
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Fix indentation
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Run copy_from_upstream
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
derand testing tentative changes
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Add missing function declarations
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Add template for avx2 derand functions
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Run copy_from_upstream
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
WIP: Add changes for coin length
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Update patch to include coin lengths
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Bootstrap
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Conditional copy
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Run copy_from_upstream
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Separate coins variable into two distinct variables
Signed-off-by: Eddy Kim <Eddy.M.Kim@outlook.com>
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Add derand fixes
- Add support for BIKE, FrodoKEM, sntrup
- Add hooks for testing
- Add missing kem comment to documentation
- Don't run decaps() in test_kem_derand if encaps_derand() fails
- Add markdown documentation changes
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
WIP trying to fix build errors
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Fix remaining build issues
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Resolve unused parameter issues for BIKE
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Resolve unused paramter issues for FrodoKEM
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Fix whitespace inconsistency
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Fix whitepace issue
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Insert unused attributes
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Void all unused parameters
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Use tab instead of spaces in kem_scheme
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Run copy_from_upstream
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Fix kem_derand python tests
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Initialize coins in test_kem_derand
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Update patch to work with mlkem-native
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Update docs generation and templating
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Run copy_from_upstream [full tests] [extended tests]
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Don't call randombytes on zero-length arrays
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Run format script
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Remove encaps_derand support
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Run copy_from_upstream
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Skip encaps/decaps in test_kem_derand
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Refactor test code
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* s/coins/seed/g
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Improve output
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Improve formatting [full tests] [extended tests]
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
---------
Signed-off-by: Eddy Kim <e84kim@uwaterloo.ca>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Co-authored-by: Eddy Kim <Eddy.M.Kim@outlook.com>
* Update example files to use ML-KEM and ML-DSA
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Call example_sig_stfl in test_cmdline.py
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
---------
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Remove hardcoded build paths
This fixes#2018 using `helpers.get_current_build_dir_name()`
Signed-off-by: Iyán Méndez Veiga <me@iyanmv.com>
* Use a random build path in the basic build test
Signed-off-by: Iyán Méndez Veiga <me@iyanmv.com>
---------
Signed-off-by: Iyán Méndez Veiga <me@iyanmv.com>
* Add defines for OQS version components
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
* Set OQS_VERSION_TEXT based on new OQS_VERSION_* macros
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Signed-off-by: Douglas Stebila <dstebila@users.noreply.github.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
* Make OQS_VERSION_PRE_RELEASE optionally defined
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Signed-off-by: Douglas Stebila <dstebila@users.noreply.github.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
* Add documentation about OQS_VERSION macros
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
* Clarify wording about definition of OQS_VERSION_PRE_RELEASE
Signed-off-by: Douglas Stebila <dstebila@users.noreply.github.com>
---------
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
Signed-off-by: Douglas Stebila <dstebila@users.noreply.github.com>
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Pull ML-DSA from pq-crystals upstream.
* Removes ML-DSA-ipd
* Adds support for context strings to OQS SIG API.
* Adding _with_ctx_str APIs, templating
* Adds ACVP tests for ML-DSA
* export symbols for acvp tests (dynamic linking)
* remove IPD intermediate values
* adds flag for ctx support
* Update constant-time passes after line nubmer and function name changes
* Update KATs
* API with checks for signatures without ctx support
* Additional test for signatures with ctx
* Change alg_version to FIPS204
* Update ML-DSA security claim to SUF-CMA, according to FIPS204
* Update src/sig/sig.h
* Fix test_alg_info
---------
Signed-off-by: Basil Hess <bhe@zurich.ibm.com>
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Add new API to clean up OpenSSL threads.
Signed-off-by: Norman Ashley <nashley@cisco.com>
* Updates per review comments.
Signed-off-by: Norman Ashley <nashley@cisco.com>
* Update format
Signed-off-by: Norman Ashley <nashley@cisco.com>
* Apply suggestions from code review
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Signed-off-by: Norman Ashley <nashley@cisco.com>
---------
Signed-off-by: Norman Ashley <nashley@cisco.com>
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Add speed_sig_stfl
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* Fix speed_sig_stfl.c: limit timing with max sig ops & provide required secure keystore with dummy keystore
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* Cleanup speed_sig_stfl.c
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* speed_sig_stfl: fix for LMS (secure store context must not be NULL), refresh key when out of sigs for sig benchmark
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* tests/speed_sig_stfl.c: astyle fix
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* tests/speed_sig_stfl.c: stfl sig benchmarks require intermittent resetting of secret key
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* speed_sig_stfl: add speed_sig_stfl to: README scripts/nogress.sh tests/test_speed.py
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* test_speed.py: limit testing of stfl sigs to parameters with 2^10 max sigs
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* scripts/nogress.sh: limit regression tests on stfl sigs to only algorithms with 2^10 max sigs
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* speed_sig_stfl.c: astyle fix
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* speed_sig_stfl: 1) fix use-after-free bug. 2) Simply return success if keygen and sign are not enabled.
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
---------
Signed-off-by: cr-marcstevens <github@marc-stevens.nl>
* [#1823] replace malloc/calloc/strdup/free with openssl allocator
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* [#1823] update memory allocator for copy_from_upstream
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* [#1823] Use OpenSSL Memory Allocator for BIKE, FrodoKEM, and NTRUPrime
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* [#1823] Add Comments for Doxygen
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* include openssl/crypto.h and resolve conflict varible for ntru
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Add openssl version check to fix build error
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Fix build for OQS_DLOPEN_OPENSSL
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* remove OQS_MEM_free
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Add allocator check in tests/test_code_conventions.py
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Add IGNORE memory-check
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Delect checked allocation functions
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Revert back p_param to p for sntrup
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Add allocator check for '.c', '.h', '.fragment'
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Add NULL for previous checked allocation
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* Add fprintf error for abort cases
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
* use OQS_EXIT_IF_NULLPTR for checked malloc cases
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
---------
Signed-off-by: Songling Han <shan@paloaltonetworks.com>
If a user has passed a custom build path to cmake, and then calls for
example `ninja -C <custom_build_path> run_tests`, the script
test_acvp_vectors.py fails due to having "build" harcoded in the calls.
Instead, let's use `helpers.get_current_build_dir_name()` to get the build
path and use that instead. This is already done in other scripts (e.g.,
test_binary.py)
Signed-off-by: Iyán Méndez Veiga <me@iyanmv.com>
* Refactor liboqs CI to utilize reusable workflows
* Add CI.md documentation file
* Update all Focal jobs to Noble (the latest Ubuntu LTS)
* Minor fixes to address issues related to the update (CT files / syntax / static analysis)
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
* Add script to format code in a CI container
* Update CONTRIBUTING.md to document script
---------
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
make server astyle happy
update xmss.yml
update algorithm list and README
clean up
[trigger downstream]
Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>
Add support for LMS and XMSS. Key generation and signing are disabled behind a feature flag labelled "hazardous experimental."
---------
Signed-off-by: Duc Tri Nguyen <dnguye69@gmu.edu>
Signed-off-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Signed-off-by: Norman Ashley <nashley@cisco.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Duc Tri Nguyen <dnguye69@gmu.edu>
Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Duc Nguyen <106774416+ducnguyen-sb@users.noreply.github.com>
Co-authored-by: Douglas Stebila <dstebila@users.noreply.github.com>
Co-authored-by: Duc Nguyen <ductri.nguyen@sandboxquantum.com>
Co-authored-by: Spencer Wilson <spencer.wilson@uwaterloo.ca>
Co-authored-by: Jason Goertzen <133878263+jgoertzen-sb@users.noreply.github.com>
The kat_kem and kat_sig programs could not be linked when building natively on windows. This was caused by multiple definitions of symbols. By using the /FORCE:MULTIPLE compiler option, this is allowed, similar in spirit to what was already used for cross-compiling to Windows.
Fixes#1749
Signed-off-by: Mattias Lindblad <matlin@gmail.com>
* sha2: Use EVP_MD_CTX_free instead of EVP_MD_CTX_destroy
According to the manual page, EVP_MD_CTX_destroy has been renamed to
EVP_MD_CTX_free in OpenSSL 1.1.0 and only provided as a compatibility
macro in later OpenSSL releases:
https://www.openssl.org/docs/man1.1.1/man3/EVP_MD_CTX_free.html
Signed-off-by: Daiki Ueno <dueno@redhat.com>
* ossl_helpers: Use pthread_once instead of CRYPTO_THREAD_run_once
Throughout the code base, liboqs uses pthread_once for one-shot
initialization and falls back to thread-unsafe code if it is not
supported nor enabled on the system. For consistency and to remove
additional dependency on OpenSSL, this switches the use of
CRYPTO_THREAD_run_once with that.
Signed-off-by: Daiki Ueno <dueno@redhat.com>
* Make common algorithms pluggable
This allows applications to replace the implementation of common
cryptographic algorithms at runtime, by setting callback functions for
each operations with OQS_AES_set_callbacks, OQS_SHA2_set_callbacks,
OQS_SHA3_set_callbacks, and OQS_SHA3_x4_callbacks. Those functions
may be called once before OQS_init; otherwise the default
implementation will be used.
Signed-off-by: Daiki Ueno <dueno@redhat.com>
* Add option to dynamically load libcrypto.so.*
This adds OQS_DLOPEN_OPENSSL build option to use OpenSSL through
dynamically loaded libcrypto.so.* with dlopen, instead of linking to
the library at build time.
That way the applications could use their favorite implementation of
common cryptographic primitives without pulling in the OpenSSL as a
hard dependency.
Signed-off-by: Daiki Ueno <dueno@redhat.com>
* Add tests for OQS_*_set_callbacks
This adds tests that exercise OQS_*_set_callbacks by overriding one of
the function of each and ensuring the wrapper function is called.
Signed-off-by: Daiki Ueno <dueno@redhat.com>
---------
Signed-off-by: Daiki Ueno <dueno@redhat.com>
* Ensure aliases are activated with cmake
* Updates alg_support fragments: ensure that dependencies (aliases and platform-specific code) are activated after applying filter_algs
* Adds bike_l5 to NIST_R4 algorithms
* add CI test for aliases
* remove ml_kem ipds from STD filter_algs
* decouple name and alias
* fixing vector tests
Pulls ML-DSA-ipd and ML-KEM-ipd
Adds test cases with NIST supplied test vectors for ML-DSA/ML-KEM
Adds aliases (ML-<name> are aliases of ML-<name>-ipd)
[trigger downstream]