Date: Wed, 29 Jul 2026 17:50:07 +0000 From: Mark Johnston <markj@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: John Baldwin <jhb@FreeBSD.org> Subject: git: d7ad56decf8f - releng/15.0 - wg(4): Check for crypto operation errors Message-ID: <6a6a3d4f.3af54.7b9ec193@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/15.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d7ad56decf8f6302be6ecda9652a039c8e3c8e11 commit d7ad56decf8f6302be6ecda9652a039c8e3c8e11 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2026-07-27 15:36:55 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2026-07-28 17:34:59 +0000 wg(4): Check for crypto operation errors In particular, handle authentication errors due to bad MACs when decrypting packets. Since the current dispatch code assumes synchronous OCF sessions by design, explicitly reject any created OCF session that is not synchronous. Software sessions are always synchronous in practice, so this should be a nop. Approved by: so Security: FreeBSD-SA-26:52.if_wg Security: CVE-2026-58085 Reviewed by: markj Sponsored by: Chelsio Communications --- sys/dev/wg/wg_crypto.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/dev/wg/wg_crypto.c b/sys/dev/wg/wg_crypto.c index 53441ef25b40..82b80c7fd451 100644 --- a/sys/dev/wg/wg_crypto.c +++ b/sys/dev/wg/wg_crypto.c @@ -230,6 +230,8 @@ chacha20poly1305_encrypt_mbuf(struct mbuf *m, const uint64_t nonce, crp.crp_cipher_key = key; crp.crp_callback = crypto_callback; ret = crypto_dispatch(&crp); + if (ret == 0) + ret = crp.crp_etype; crypto_destroyreq(&crp); return (ret); } @@ -253,6 +255,8 @@ chacha20poly1305_decrypt_mbuf(struct mbuf *m, const uint64_t nonce, crp.crp_cipher_key = key; crp.crp_callback = crypto_callback; ret = crypto_dispatch(&crp); + if (ret == 0) + ret = crp.crp_etype; crypto_destroyreq(&crp); if (ret) return (ret); @@ -270,9 +274,14 @@ crypto_init(void) .csp_cipher_klen = CHACHA20POLY1305_KEY_SIZE, .csp_flags = CSP_F_SEPARATE_AAD | CSP_F_SEPARATE_OUTPUT }; - int ret = crypto_newsession(&chacha20_poly1305_sid, &csp, CRYPTOCAP_F_SOFTWARE); + int ret = crypto_newsession(&chacha20_poly1305_sid, &csp, + CRYPTOCAP_F_SOFTWARE); if (ret != 0) return (ret); + if (!CRYPTO_SESS_SYNC(chacha20_poly1305_sid)) { + crypto_freesession(chacha20_poly1305_sid); + return (ENXIO); + } return (0); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6a3d4f.3af54.7b9ec193>
