The branch main has been updated by markj:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=98bbfef2ea33a42b7f06ad3a64c892108ede8871

commit 98bbfef2ea33a42b7f06ad3a64c892108ede8871
Author:     John Baldwin <[email protected]>
AuthorDate: 2026-07-27 15:36:22 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-07-29 17:45:02 +0000

    OCF: Add a fail point to inject EBADMSG decryption errors
    
    Approved by:    so
    Security:       FreeBSD-SA-26:52.if_wg
    Security:       CVE-2026-58085
    Reviewed by:    markj
    Sponsored by:   Chelsio Communications
---
 sys/opencrypto/crypto.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index c3ae5e8a9ff8..9fa017902a19 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -61,6 +61,7 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/counter.h>
+#include <sys/fail.h>
 #include <sys/kernel.h>
 #include <sys/kthread.h>
 #include <sys/linker.h>
@@ -145,6 +146,9 @@ static      struct mtx crypto_q_mtx;
 SYSCTL_NODE(_kern, OID_AUTO, crypto, CTLFLAG_RW, 0,
     "In-kernel cryptography");
 
+static SYSCTL_NODE(_debug_fail_point, OID_AUTO, crypto, CTLFLAG_RW, 0,
+    "OCF fail points");
+
 /*
  * Taskqueue used to dispatch the crypto requests submitted with
  * crypto_dispatch_async .
@@ -1666,6 +1670,17 @@ crypto_clonereq(struct cryptop *crp, crypto_session_t 
cses, int how)
 void
 crypto_done(struct cryptop *crp)
 {
+       if (crp->crp_etype == 0) {
+               switch (crp->crp_session->csp.csp_mode) {
+               case CSP_MODE_DIGEST:
+               case CSP_MODE_AEAD:
+                       if ((crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) != 0)
+                               KFAIL_POINT_CODE(_debug_fail_point_crypto,
+                                   inject_badmsg, crp->crp_etype = EBADMSG);
+                       break;
+               }
+       }
+
        if (crp->crp_etype != 0)
                CRYPTOSTAT_INC(cs_errs);
 

Reply via email to