Date: Thu, 19 Apr 2018 15:24:22 +0000 (UTC) From: Conrad Meyer <cem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332778 - head/sys/opencrypto Message-ID: <201804191524.w3JFOMoC061823@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cem Date: Thu Apr 19 15:24:21 2018 New Revision: 332778 URL: https://svnweb.freebsd.org/changeset/base/332778 Log: cryptosoft: Do not exceed crd_len around *crypt_multi When a caller passes in a uio or mbuf chain that is longer than crd_len, in tandem with a transform that supports the multi-block interface, swcr_encdec() would process the entire mbuf or uio instead of just the portion indicated by crd_len (+ crd_skip). De/encryption are performed in-place, so this would trash subsequent uio or mbuf contents. This was introduced in r331639 (mea culpa). It only affects the {de,en}crypt_multi() family of interfaces. That interface only has one consumer transform in-tree (for now): Chacha20. PR: 227605 Submitted by: Valentin Vergez <valentin.vergez AT stormshield.eu> Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Thu Apr 19 15:11:18 2018 (r332777) +++ head/sys/opencrypto/cryptosoft.c Thu Apr 19 15:24:21 2018 (r332778) @@ -253,7 +253,8 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data * size_t nb, rem; nb = blks; - rem = uio->uio_iov[ind].iov_len - k; + rem = MIN((size_t)i, + uio->uio_iov[ind].iov_len - (size_t)k); idat = (uint8_t *)uio->uio_iov[ind].iov_base + k; if (exf->reinit) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804191524.w3JFOMoC061823>