Skip to content

Improve SHA3 test - #1

Closed
mdcornu wants to merge 4 commits into
mainfrom
tests/improve_sha3_test
Closed

mdcornu wants to merge 4 commits into
mainfrom
tests/improve_sha3_test

Conversation

@mdcornu

@mdcornu mdcornu commented May 27, 2026

Copy link
Copy Markdown
Owner

Add extra test vector to SHA3 test and remove duplicated per test message vector definitions.

  • Does this PR change the input/output behaviour of a cryptographic algorithm (i.e., does it change known answer test values)? (If so, a version bump will be required from x.y.z to x.(y+1).0.)
  • Does this PR change the list of algorithms available -- either adding, removing, or renaming? Does this PR otherwise change an API? (If so, PRs in fully supported downstream projects dependent on these, i.e., oqs-provider will also need to be ready for review and merge by the time this is merged. Also, make sure to update the list of algorithms in the continuous benchmarking files: .github/workflows/kem-bench.yml and sig-bench.yml)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves SHA3/SHAKE test coverage by deduplicating shared KAT input messages and adding an additional SHA3 test vector (896-bit / 112-byte message). It also fixes a correctness/safety bug in the AVX512VL SHA3 incremental absorb path when completing a partial block and permuting.

Changes:

  • Refactor tests/test_sha3.c to share common KAT input messages across tests and add SHA3-256/384/512 KAT coverage for a 112-byte (896-bit) message, including additional incremental “chunked absorb” checks.
  • Fix AVX512VL incremental absorb logic in SHA3-AVX512VL.S to correctly decrement the remaining message length before the partial-fill-and-permute step (preventing double-absorb and potential out-of-bounds reads).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_sha3.c Centralizes shared SHA3/SHAKE test messages and adds new msg896 KATs plus chunked incremental-absorb test cases.
src/common/sha3/avx512vl_low/SHA3-AVX512VL.S Corrects the partial-fill-and-permute absorb path to maintain the correct remaining-length accounting (avoids double-absorb / OOB).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_sha3.c Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment thread tests/test_sha3.c Resolved
Comment thread tests/test_sha3.c Resolved
Comment thread tests/test_sha3.c Resolved
Comment thread tests/test_sha3.c Resolved
@mdcornu
mdcornu force-pushed the tests/improve_sha3_test branch 2 times, most recently from 34038c8 to 96ecb66 Compare May 28, 2026 15:43
@mdcornu
mdcornu requested a review from Copilot May 28, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread tests/test_sha3.c Resolved
Comment thread tests/test_sha3.c Resolved
@mdcornu

mdcornu commented May 28, 2026

Copy link
Copy Markdown
Owner Author

@tkanteck Can you have a scan of this? For some reason I can't add you as a reviewer.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 26588835144

Warning

No base build found for commit f986aea on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 82.181%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 252643
Covered Lines: 207625
Line Coverage: 82.18%
Coverage Strength: 8216708.87 hits per line

💛 - Coveralls

@tkanteck tkanteck left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool - just thinking it could potentially be a bit improved

Comment thread tests/test_sha3.c Resolved
Comment thread tests/test_sha3.c Resolved
Comment thread tests/test_sha3.c Outdated

/* Verify ctx_reset: absorb msg24, finalize, then reset and re-absorb msg24;
result must equal a fresh inc_init hash of msg24. */
uint8_t hash_fresh[48];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, there is potentially to make the code more compact and test bit more

@mdcornu
mdcornu force-pushed the tests/improve_sha3_test branch from 2ffb62f to bb3b9aa Compare May 29, 2026 14:58
@mdcornu
mdcornu requested a review from Copilot May 29, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mdcornu
mdcornu force-pushed the tests/improve_sha3_test branch from bb3b9aa to a19c60e Compare May 29, 2026 16:10
@mdcornu
mdcornu requested a review from Copilot May 29, 2026 16:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

mdcornu added 4 commits May 30, 2026 20:31
Move msg0, msg24, msg448, msg896, and msg1600 from local declarations
repeated in each of the seven test functions into static const globals.

Signed-off-by: Cornu, Marcel D <marcel.d.cornu@intel.com>
…idation

Add 896-bit NIST vector and cross-validate inc API against one-shot API.

Signed-off-by: Cornu, Marcel D <marcel.d.cornu@intel.com>
Cross-validate SHAKE inc API against one-shot using absorb and
squeeze sweep, covering all code paths and rate-boundary transitions.
Add distinct x4 lane inputs to the four-way tests.

Signed-off-by: Cornu, Marcel D <marcel.d.cornu@intel.com>
Signed-off-by: Cornu, Marcel D <marcel.d.cornu@intel.com>
@mdcornu
mdcornu force-pushed the tests/improve_sha3_test branch 2 times, most recently from 60763cf to 02bc633 Compare May 31, 2026 10:33
@mdcornu

mdcornu commented May 31, 2026

Copy link
Copy Markdown
Owner Author

Closing this and will create upstream PR.

@mdcornu mdcornu closed this May 31, 2026
xuganyu96 added a commit that referenced this pull request Jul 13, 2026
…en-quantum-safe#2460)

* Fix uninitialized encaps_derand pointer dereference for NTRU KEMs

The six NTRU KEM constructors (hps2048509, hps2048677, hps4096821,
hps40961229, hrss701, hrss1373) did not initialize the encaps_derand
function pointer in OQS_KEM, and OQS_KEM_encaps_derand did not guard
against a NULL function pointer. Calling OQS_KEM_encaps_derand on an
NTRU KEM dereferenced uninitialized heap memory, causing a crash.

Three layers of fix:

1. Add explicit OQS_KEM_ntru_<scheme>_encaps_derand stubs returning
   OQS_ERROR (matching the existing keypair_derand stubs), and wire
   them into the NTRU constructors.

2. NULL-check the function pointer in all five OQS_KEM_* API wrappers
   in src/kem/kem.c as defense in depth against future omissions.

3. Switch all KEM constructors from OQS_MEM_malloc to OQS_MEM_calloc
   so any unset field is guaranteed NULL, making the API NULL check
   reliable. The jinja template in scripts/copy_from_upstream is
   updated to match.

Reported by Arthur Chan of Ada Logics on behalf of Anthropic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>

* Apply uninitialized-pointer hardening to SIG and SIG_STFL

Following the same approach as the NTRU encaps_derand fix for KEM,
apply defense-in-depth hardening so that any future SIG/SIG_STFL
constructor that forgets to initialize a function pointer returns
OQS_ERROR instead of dereferencing uninitialized heap memory.

For SIG:
1. NULL-check the function pointer in all five OQS_SIG_* API
   wrappers in src/sig/sig.c (keypair, sign, sign_with_ctx_str,
   verify, verify_with_ctx_str).
2. Switch all SIG constructors (including the SLH-DSA template
   and the copy_from_upstream jinja template) from OQS_MEM_malloc
   to OQS_MEM_calloc so any unset function pointer is guaranteed
   NULL, making the API NULL check reliable.

For SIG_STFL:
- The API wrappers already NULL-check the function pointers, so
  only the malloc->calloc switch is applied to the XMSS/LMS
  constructors for both OQS_SIG_STFL and OQS_SIG_STFL_SECRET_KEY.

Suggested by Michael Baentsch in
open-quantum-safe/liboqs-GHSA-jr5q-r9qx-v738#1.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>

---------

Signed-off-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
xuganyu96 added a commit that referenced this pull request Jul 13, 2026
* Switched HQC upstream to xuganyu96/pqc-hqc for testing

Copied from slh dsa commit succesfully
Info: Updating KAT for HQC-128
Error: Cannot find location clean in upstream list
[{'name': 'ref', 'version': '2025-08-22', 'folder_name': '.', 'compile_opts': '-DHQC_ARCH_REF=1', 'signature_keypair': 'crypto_kem_keypair', 'signature_enc': 'crypto_kem_enc', 'signature_dec': 'crypto_kem_dec', 'sources': 'src/ref/parsing.c src/ref/gf.c src/ref/vector.c src/ref/gf2x.c src/ref/reed_solomon.c src/ref/reed_muller.c src/ref/hqc.c src/ref/vector.h src/ref/hqc-1/reed_solomon.h src/ref/hqc-1/parameters.h src/ref/hqc.h src/ref/parsing.h src/ref/data_structures.h src/ref/gf.h src/ref/gf2x.h'}]

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* replace default impl key in doc data sheet

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] copy_from_upstream can run but missing KATs and HQC-192/256

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] HQC-192 and HQC-256 can be copied

Running "tests/test_kem HQC-128" results in segmentation fault.

Build command:
cmake -GNinja \
    -DOQS_MINIMAL_BUILD="KEM_hqc_128;KEM_hqc_192;KEM_hqc_256" \
    ..
ninja

Removed <immintrin.h> from ref implementations; replaced fips202.c with
OQS_SHA3. liboqs can build, but no test cases, no NIST KAT, no test
vectors

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Sample kem_seed with OQS_randombytes instead of in-house PRNG

tests/test_kem "HQC-128" still fails with segmentation fault:

Process 3191 stopped
* thread open-quantum-safe#2, stop reason = EXC_BAD_ACCESS (code=1, address=0xc8)
    frame #0: 0x0000000100035088 test_kem`keccak_inc_squeeze(h="", outlen=16, s=0x0000000000000000, r=136) at xkcp_sha3.c:189:18
   186 	 **************************************************/
   187 	static void keccak_inc_squeeze(uint8_t *h, size_t outlen,
   188 	                               uint64_t *s, uint32_t r) {
-> 189 		while (outlen > s[25]) {
   190 			(*Keccak_ExtractBytes_ptr)(s, h, (unsigned int)(r - s[25]), (unsigned int)s[25]);
   191 			(*Keccak_Permute_ptr)(s);
   192 			h += s[25];
Target 0: (test_kem) stopped.

* thread open-quantum-safe#2, stop reason = EXC_BAD_ACCESS (code=1, address=0xc8)
  * frame #0: 0x0000000100035088 test_kem`keccak_inc_squeeze(h="", outlen=16, s=0x0000000000000000, r=136) at xkcp_sha3.c:189:18
    frame #1: 0x0000000100034d3c test_kem`SHA3_shake256_inc_squeeze(output="", outlen=16, state=0x0000000100048298) at xkcp_sha3.c:382:2
    frame open-quantum-safe#2: 0x00000001000358dc test_kem`OQS_SHA3_shake256_inc_squeeze(output="", outlen=16, state=0x0000000100048298) at sha3.c:148:2
    frame open-quantum-safe#3: 0x0000000100007924 test_kem`prng_get_bytes(output="", outlen=16) at symmetric.c:45:5
    frame open-quantum-safe#4: 0x0000000100005a54 test_kem`crypto_kem_enc(c_kem="", K="", ek_kem="'x\U00000015\x88\xf6\U0000000f\xf0\xce\U000000101\a፵e\xfe\x92~\r\xb7sSZ\xc4\U0000000e\xd2\xda\xd9%պ\x8e\xee-\xf9\xe07<@v\n\xe6w\x8d?\xe6B\xb7\xb9X\x8b\xae\x86nr@\xcdr!\xd3\U00000002'+[\U00000011\U0000001f\xb0\x8e\xcc\xd0Zl\xd3\xd8-\U00000001Im\xfft\x9b\x9d]\xa2\xd2Nu0\x83\xce}D$\\\xe8o,\x99\x99D\x8c\xb4\U00000016\xb5\xb5\xbd\xfaĸkA Ao\x94」Yb\a\xcfa\U0000001dQ:\U00000018\xe5\x8cI\xbd/\xd9U\xcb\xe9\U00000019\xb9JD\xfc\x86^\xf6W\U00000016\xa9xz3G\x95\x97Hs5\xc2\U00000001I\xa3\x9c\xd7\xf2\U0000000f\xf8\U00000005\xeb\x92{\xfc\x9fa\U00000018O\x96\xf8\xa7tH[") at kem.c:123:5
    frame open-quantum-safe#5: 0x000000010000306c test_kem`OQS_KEM_hqc_128_encaps(ciphertext="", shared_secret="", public_key="'x\U00000015\x88\xf6\U0000000f\xf0\xce\U000000101\a፵e\xfe\x92~\r\xb7sSZ\xc4\U0000000e\xd2\xda\xd9%պ\x8e\xee-\xf9\xe07<@v\n\xe6w\x8d?\xe6B\xb7\xb9X\x8b\xae\x86nr@\xcdr!\xd3\U00000002'+[\U00000011\U0000001f\xb0\x8e\xcc\xd0Zl\xd3\xd8-\U00000001Im\xfft\x9b\x9d]\xa2\xd2Nu0\x83\xce}D$\\\xe8o,\x99\x99D\x8c\xb4\U00000016\xb5\xb5\xbd\xfaĸkA Ao\x94」Yb\a\xcfa\U0000001dQ:\U00000018\xe5\x8cI\xbd/\xd9U\xcb\xe9\U00000019\xb9JD\xfc\x86^\xf6W\U00000016\xa9xz3G\x95\x97Hs5\xc2\U00000001I\xa3\x9c\xd7\xf2\U0000000f\xf8\U00000005\xeb\x92{\xfc\x9fa\U00000018O\x96\xf8\xa7tH[") at kem_hqc_128.c:61:22
    frame open-quantum-safe#6: 0x00000001000374dc test_kem`OQS_KEM_encaps(kem=0x0000000100aed6e0, ciphertext="", shared_secret="", public_key="'x\U00000015\x88\xf6\U0000000f\xf0\xce\U000000101\a፵e\xfe\x92~\r\xb7sSZ\xc4\U0000000e\xd2\xda\xd9%պ\x8e\xee-\xf9\xe07<@v\n\xe6w\x8d?\xe6B\xb7\xb9X\x8b\xae\x86nr@\xcdr!\xd3\U00000002'+[\U00000011\U0000001f\xb0\x8e\xcc\xd0Zl\xd3\xd8-\U00000001Im\xfft\x9b\x9d]\xa2\xd2Nu0\x83\xce}D$\\\xe8o,\x99\x99D\x8c\xb4\U00000016\xb5\xb5\xbd\xfaĸkA Ao\x94」Yb\a\xcfa\U0000001dQ:\U00000018\xe5\x8cI\xbd/\xd9U\xcb\xe9\U00000019\xb9JD\xfc\x86^\xf6W\U00000016\xa9xz3G\x95\x97Hs5\xc2\U00000001I\xa3\x9c\xd7\xf2\U0000000f\xf8\U00000005\xeb\x92{\xfc\x9fa\U00000018O\x96\xf8\xa7tH[") at kem.c:653:10
    frame open-quantum-safe#7: 0x00000001000014fc test_kem`kem_test_correctness(method_name="HQC-128", derand=false) at test_kem.c:253:8
    frame open-quantum-safe#8: 0x0000000100000e94 test_kem`test_wrapper(arg=0x000000016fdfe3b8) at test_kem.c:378:11
    frame open-quantum-safe#9: 0x000000018d86bc58 libsystem_pthread.dylib`_pthread_start + 136

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] Can pass some correctness tests but not all

======================================= short test summary info ========================================
FAILED tests/test_binary.py::test_namespace - AssertionError: assert 129 == 0
FAILED tests/test_code_conventions.py::test_style - AssertionError: Got unexpected return code 255
FAILED tests/test_code_conventions.py::test_spdx - assert False
FAILED tests/test_kat.py::test_kem[HQC-128] - AssertionError: assert 'xxx' == '1706aa30e811...1fa4b654b2b8e'
FAILED tests/test_kat.py::test_kem[HQC-192] - AssertionError: assert 'xxx' == '5e64abaac8f9...e8e610db31188'
FAILED tests/test_kat.py::test_kem[HQC-256] - AssertionError: assert 'xxx' == '6d0c22e3c0f0...a8ff5ce8df327'
FAILED tests/test_kat_all.py::test_kem[HQC-128] - AssertionError: assert '2d566f0a2743...c6b425f86a116' == 'f604e7edaa4c...007ce066fcd75'
FAILED tests/test_kat_all.py::test_kem[HQC-192] - AssertionError: assert '1b0137144f71...39ee740cbbc83' == '4063a6079ded...543c4acd5cb80'
FAILED tests/test_kat_all.py::test_kem[HQC-256] - AssertionError: assert 'c13dcd7fa9ec...12232a6fde81e' == '7ee833200a2e...0128d28202ca3'
======================= 9 failed, 274 passed, 4431 skipped in 147.34s (0:02:27) =======================

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Fixed HQC PRNG domain; renamed HQC-128/192/256 to HQC-1/3/5

Also: add newline at the end of kats.json

Now KATs all pass for HQC-1/3/5. Need to work on namespacing next.

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Namespacing not working yet

For the following symbols, either change to static or add prefix

. > nm -g build/lib/liboqs.a
Non-namespaced symbol: _code_decode
Non-namespaced symbol: _code_encode
Non-namespaced symbol: _fft
Non-namespaced symbol: _fft_retrieve_error_poly
Non-namespaced symbol: _gf_carryless_mul
Non-namespaced symbol: _gf_generate
Non-namespaced symbol: _gf_inverse
Non-namespaced symbol: _gf_mul
Non-namespaced symbol: _gf_square
Non-namespaced symbol: _vect_mul
Non-namespaced symbol: _hqc_pke_decrypt
Non-namespaced symbol: _hqc_pke_encrypt
Non-namespaced symbol: _hqc_pke_keygen
Non-namespaced symbol: _PQCHQC_C_crypto_kem_dec
Non-namespaced symbol: _PQCHQC_C_crypto_kem_enc
Non-namespaced symbol: _PQCHQC_C_crypto_kem_keypair
Non-namespaced symbol: _hqc_c_kem_from_string
Non-namespaced symbol: _hqc_c_kem_to_string
Non-namespaced symbol: _hqc_dk_pke_from_string
Non-namespaced symbol: _hqc_ek_pke_from_string
Non-namespaced symbol: _encode
Non-namespaced symbol: _expand_and_sum
Non-namespaced symbol: _find_peaks
Non-namespaced symbol: _hadamard
Non-namespaced symbol: _reed_muller_decode
Non-namespaced symbol: _reed_muller_encode
Non-namespaced symbol: _compute_generator_poly
Non-namespaced symbol: _reed_solomon_decode
Non-namespaced symbol: _reed_solomon_encode
Non-namespaced symbol: _prng_get_bytes
Non-namespaced symbol: _prng_init
Non-namespaced symbol: _xof_get_bytes
Non-namespaced symbol: _xof_init
Non-namespaced symbol: _vect_add
Non-namespaced symbol: _vect_compare
Non-namespaced symbol: _vect_generate_random_support1
Non-namespaced symbol: _vect_generate_random_support2
Non-namespaced symbol: _vect_print
Non-namespaced symbol: _vect_sample_fixed_weight1
Non-namespaced symbol: _vect_sample_fixed_weight2
Non-namespaced symbol: _vect_set_random
Non-namespaced symbol: _vect_truncate
Non-namespaced symbol: _vect_write_support_to_vector
Non-namespaced symbol: _code_decode
Non-namespaced symbol: _code_encode
Non-namespaced symbol: _fft
Non-namespaced symbol: _fft_retrieve_error_poly
Non-namespaced symbol: _gf_carryless_mul
Non-namespaced symbol: _gf_generate
Non-namespaced symbol: _gf_inverse
Non-namespaced symbol: _gf_mul
Non-namespaced symbol: _gf_square
Non-namespaced symbol: _vect_mul
Non-namespaced symbol: _hqc_pke_decrypt
Non-namespaced symbol: _hqc_pke_encrypt
Non-namespaced symbol: _hqc_pke_keygen
Non-namespaced symbol: _PQCHQC_C_crypto_kem_dec
Non-namespaced symbol: _PQCHQC_C_crypto_kem_enc
Non-namespaced symbol: _PQCHQC_C_crypto_kem_keypair
Non-namespaced symbol: _hqc_c_kem_from_string
Non-namespaced symbol: _hqc_c_kem_to_string
Non-namespaced symbol: _hqc_dk_pke_from_string
Non-namespaced symbol: _hqc_ek_pke_from_string
Non-namespaced symbol: _encode
Non-namespaced symbol: _expand_and_sum
Non-namespaced symbol: _find_peaks
Non-namespaced symbol: _hadamard
Non-namespaced symbol: _reed_muller_decode
Non-namespaced symbol: _reed_muller_encode
Non-namespaced symbol: _compute_generator_poly
Non-namespaced symbol: _reed_solomon_decode
Non-namespaced symbol: _reed_solomon_encode
Non-namespaced symbol: _prng_get_bytes
Non-namespaced symbol: _prng_init
Non-namespaced symbol: _xof_get_bytes
Non-namespaced symbol: _xof_init
Non-namespaced symbol: _vect_add
Non-namespaced symbol: _vect_compare
Non-namespaced symbol: _vect_generate_random_support1
Non-namespaced symbol: _vect_generate_random_support2
Non-namespaced symbol: _vect_print
Non-namespaced symbol: _vect_sample_fixed_weight1
Non-namespaced symbol: _vect_sample_fixed_weight2
Non-namespaced symbol: _vect_set_random
Non-namespaced symbol: _vect_truncate
Non-namespaced symbol: _vect_write_support_to_vector
Non-namespaced symbol: _code_decode
Non-namespaced symbol: _code_encode
Non-namespaced symbol: _fft
Non-namespaced symbol: _fft_retrieve_error_poly
Non-namespaced symbol: _gf_carryless_mul
Non-namespaced symbol: _gf_generate
Non-namespaced symbol: _gf_inverse
Non-namespaced symbol: _gf_mul
Non-namespaced symbol: _gf_square
Non-namespaced symbol: _vect_mul
Non-namespaced symbol: _hqc_pke_decrypt
Non-namespaced symbol: _hqc_pke_encrypt
Non-namespaced symbol: _hqc_pke_keygen
Non-namespaced symbol: _PQCHQC_C_crypto_kem_dec
Non-namespaced symbol: _PQCHQC_C_crypto_kem_enc
Non-namespaced symbol: _PQCHQC_C_crypto_kem_keypair
Non-namespaced symbol: _hqc_c_kem_from_string
Non-namespaced symbol: _hqc_c_kem_to_string
Non-namespaced symbol: _hqc_dk_pke_from_string
Non-namespaced symbol: _hqc_ek_pke_from_string
Non-namespaced symbol: _encode
Non-namespaced symbol: _expand_and_sum
Non-namespaced symbol: _find_peaks
Non-namespaced symbol: _hadamard
Non-namespaced symbol: _reed_muller_decode
Non-namespaced symbol: _reed_muller_encode
Non-namespaced symbol: _compute_generator_poly
Non-namespaced symbol: _reed_solomon_decode
Non-namespaced symbol: _reed_solomon_encode
Non-namespaced symbol: _prng_get_bytes
Non-namespaced symbol: _prng_init
Non-namespaced symbol: _xof_get_bytes
Non-namespaced symbol: _xof_init
Non-namespaced symbol: _vect_add
Non-namespaced symbol: _vect_compare
Non-namespaced symbol: _vect_generate_random_support1
Non-namespaced symbol: _vect_generate_random_support2
Non-namespaced symbol: _vect_print
Non-namespaced symbol: _vect_sample_fixed_weight1
Non-namespaced symbol: _vect_sample_fixed_weight2
Non-namespaced symbol: _vect_set_random
Non-namespaced symbol: _vect_truncate
Non-namespaced symbol: _vect_write_support_to_vector

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Partial fix for namespacing

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Fixed namespacing for HQC

However, incorrect namespacing may have caused some symbols from HQC-1
to pollute symbols that should have belonged to HQC-3 and HQC-5

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Still some pollution

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Revert namespace fix

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Convenience script for building and testing HQC integration

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Applied namespace; KAT hash is incorrect

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Revert OQS_fprintBstr to prevent interference with KAT checksum

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [extended tests] Fixed kat and kat_all checksums

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Namespace crypto_memset, set shake256_prng_ctx static

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [extended tests] empty commits to trigger extended tests

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [full tests] Document branching-on-secret suppressions

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [full tests] [extended tests] Cleaned up documentation

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* HQC branching-on-secret is not valgrind-validated [full tests] [extended tests]

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Move convenience script to ignored .env file

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] Fix memory leak in XOF and hash_<g|h|i|j>

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Switch HQC PRNG backend to OQS_randombytes with macro [full tests] [extended tests]

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Print kat_kem output if checksums don't match

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] debug keygen on Windows

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] Does 1UL really mean 32-bit on Windows x86?

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] disable debug_keygen

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Force 64-bit type on BITMASK [extended tests] [full tests]

On certain platforms, "unsigned long" is 32-bit wide, so (1UL << x) can
overflow if x is greater than 31, such as with HQC-5.

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Check pull request readiness again [extended tests]

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [skip ci] Additional constant-time test suppression

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [full tests] [extended tests] debug logging

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [full tests] [extended tests] astyle formatting

WHY WHY WHY what is even the difference????

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [extended tests] Switch from personal fork to official repo

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* [extended tests] Replace incremental SHA3-512 API

For liboqs integration, hash_g implementation has been modified
There are some unexpected dispatch errors under liboqs/src/common/sha3
that causes intermittent GitHub Action test failures. Due to the
difficulty of debugging on GitHub action, I chose this shortcut of
replacing incremental API with a single hash over a continuous strip of
memory. There might be performance and stack memory usage penalty
associated with this approach, but I deemed it acceptable.

we need to eventually figure out what happened with Keccak dispatch
and restore the usage of incremental API

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Resolve merge conflict with main

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Remove debuglogging

`debuglogging` was a convenient debugging tool I added during the
development processs. Though it was helpful, it is not in the scope of
HQC integration, so it is removed in this branch. I will gauge interest
and implement the debuglogging feature separately.

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Revert hash_g hack

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

* Re-run copy_from_upstream after open-quantum-safe#2460 merge

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>

---------

Signed-off-by: Ganyu (Bruce) Xu <g66xu@uwaterloo.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants