• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

open-quantum-safe / liboqs / 27421412329
82%

Build:
DEFAULT BRANCH: main
Ran 12 Jun 2026 03:14PM UTC
Jobs 3
Files 2892
Run time 5min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Jun 2026 02:16PM UTC coverage: 82.179% (-0.008%) from 82.187%
27421412329

push

github

web-flow
Fix uninitialized encaps_derand pointer dereference for NTRU KEMs (#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 wr... (continued)

275 of 287 new or added lines in 259 files covered. (95.82%)

28 existing lines in 10 files now uncovered.

207634 of 252661 relevant lines covered (82.18%)

8208894.9 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
91.67
-5.3% src/kem/ntru/kem_ntru_hps2048509.c
2
91.67
-5.3% src/kem/ntru/kem_ntru_hps2048677.c
2
90.0
-6.3% src/kem/ntru/kem_ntru_hps40961229.c
2
91.67
-5.3% src/kem/ntru/kem_ntru_hps4096821.c
2
90.0
-6.3% src/kem/ntru/kem_ntru_hrss1373.c
2
91.67
-5.3% src/kem/ntru/kem_ntru_hrss701.c

Coverage Regressions

Lines Coverage ∆ File
10
90.76
-8.4% src/kem/kyber/oldpqclean_kyber768_aarch64/rejsample.c
6
90.14
-4.23% src/kem/kyber/oldpqclean_kyber768_aarch64/indcpa.c
4
95.73
-0.36% src/sig/falcon/pqclean_falcon-padded-512_aarch64/keygen.c
2
71.49
-0.45% src/sig/ml_dsa/mldsa-native_ml-dsa-87_ref/mldsa/src/sign.c
1
33.33
-4.17% src/sig/ml_dsa/mldsa-native_ml-dsa-44_aarch64/mldsa/src/rounding.h
1
98.53
-1.47% src/sig/ml_dsa/mldsa-native_ml-dsa-87_x86_64/mldsa/src/packing.c
1
33.33
-4.17% src/sig/ml_dsa/mldsa-native_ml-dsa-87_x86_64/mldsa/src/rounding.h
1
60.13
-0.22% src/sig/ml_dsa/mldsa-native_ml-dsa-87_x86_64/mldsa/src/sign.c
1
93.55
-1.61% src/sig/uov/pqov_ov_Is_pkc_skc_avx2/ov.c
1
95.65
-2.17% src/sig/uov/pqov_ov_Is_ref/ov.c
Jobs
ID Job ID Ran Files Coverage
1 x64-generic - 27421412329.1 12 Jun 2026 03:34PM UTC 1265
85.28
GitHub Action Run
2 x64-distbuild - 27421412329.2 12 Jun 2026 03:35PM UTC 2355
56.43
GitHub Action Run
3 arm64-distbuild - 27421412329.3 12 Jun 2026 03:14PM UTC 1801
60.23
GitHub Action Run
Source Files on build 27421412329
  • Tree
  • List 2892
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #27421412329
  • 80ceff02 on github
  • Prev Build on main (#27421372034)
  • Next Build on main (#27442805419)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc