Repository navigation
Intel QAT: fix a DMA copy use-after-free, DH input validation, RSA prime carry and DRBG chunking - #12029
Intel QAT: fix a DMA copy use-after-free, DH input validation, RSA prime carry and DRBG chunking#12029dgarske wants to merge 5 commits into
Conversation
|
There was a problem hiding this comment.
🟡 Changes recommended
The change can cause intermittent DH test failures and leak public-key buffers during resizing when QAT is unavailable.
2 open issues
What changed in this PR
This PR addresses memory-safety and cryptographic correctness issues in wolfCrypt’s Intel QuickAssist offload support.
Changes:
- Updates DMA-copy ownership, RSA prime carry handling, and DRBG chunking.
- Adds DH input and shared-secret validation, plus regression tests.
- Documents QAT driver rebuilds, Linux 7.0 compatibility, and memory-allocation recovery.
| File | Description |
|---|---|
wolfcrypt/test/test.c |
Adds DMA-copy ownership and invalid DH peer-value tests. |
wolfcrypt/src/port/intel/README.md |
Adds driver build and recovery guidance. |
wolfcrypt/src/port/intel/quickassist.c |
Corrects RSA carry indexing, DH output handling, and DRBG buffers. |
wolfcrypt/src/port/intel/quickassist_mem.c |
Preserves caller-owned buffers during DMA copies. |
wolfcrypt/src/dh.c |
Validates DH inputs before QAT offload. |
Review effort: Balanced
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12029
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs
Not reviewed (no scan target covers them): wolfcrypt/src/port/intel/README.md
Coverage: 4 of 4 in-scope changed file(s) opened by the reviewer
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12029
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfcrypt-port-bugs
Not reviewed (no scan target covers them): wolfcrypt/src/port/intel/README.md
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Fenrir's latest completed scan found no issues; clearing the prior automated change request.

Description
Fixes to the Intel QuickAssist port:
IntelQaRealloc(): making a DMA copy of a caller's buffer freed the caller's original, so every offloaded AES-GCM record freedssl->encrypt.nonceand later used and freed it again. Regression in 5.9.4. Only the DMA copy types now keep the caller's buffer; any other type is a normal realloc.IntelQaDhAgreeCallback()also read one byte past the output on an all-zero secret, and now rejects a zero or one secret.IntelQaGenPrime()indexed withiinstead ofj. This broke the carry and, for RSA-1024 and smaller, wrote past the candidate buffer.IntelQaDrbg()sized chunks from the previous chunk instead of the remaining length, overrunning the output for requests over 128KB. Later chunks also used a freed buffer.Fixes zd22732 (use-after-free), zd22754 and F-9981 (DH agree). DH agree reported by Md. Raisul Islam Mobin (https://mobin.tech | @mobin2021).
Testing
On a C62x with QAT 4.28:
testwolfcrypt, including new tests for the DMA copy and for invalid DH peer values, plus TLS 1.3 hybrid ML-KEM, TLS 1.3 FFDHE and TLS 1.2 DHE handshakes with renegotiation, bulk transfers, and RSA-1024 and RSA-2048 key generation. The use-after-free was confirmed with AddressSanitizer against OpenSSL 3.5 clients. The DRBG change is only built for QAT 1.7 and was not compiled or run.Checklist