Date: Wed, 15 Apr 2020 21:05:38 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359993 - head/sys/crypto/via Message-ID: <202004152105.03FL5cYx021565@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Apr 15 21:05:38 2020 New Revision: 359993 URL: https://svnweb.freebsd.org/changeset/base/359993 Log: Use crypto_contiguous_subsegment(). This driver used a home-rolled version that predated the function and didn't support mbufs. Modified: head/sys/crypto/via/padlock_cipher.c Modified: head/sys/crypto/via/padlock_cipher.c ============================================================================== --- head/sys/crypto/via/padlock_cipher.c Wed Apr 15 20:33:09 2020 (r359992) +++ head/sys/crypto/via/padlock_cipher.c Wed Apr 15 21:05:38 2020 (r359993) @@ -169,27 +169,9 @@ padlock_cipher_alloc(struct cryptop *crp, int *allocat { u_char *addr; - switch (crp->crp_buf_type) { - case CRYPTO_BUF_MBUF: - break; - case CRYPTO_BUF_UIO: { - struct uio *uio; - struct iovec *iov; - - uio = crp->crp_uio; - if (uio->uio_iovcnt != 1) - break; - iov = uio->uio_iov; - addr = (u_char *)iov->iov_base + crp->crp_payload_start; - if (((uintptr_t)addr & 0xf) != 0) /* 16 bytes aligned? */ - break; - *allocated = 0; - return (addr); - } - case CRYPTO_BUF_CONTIG: - addr = (u_char *)crp->crp_buf + crp->crp_payload_start; - if (((uintptr_t)addr & 0xf) != 0) /* 16 bytes aligned? */ - break; + addr = crypto_contiguous_subsegment(crp, crp->crp_payload_start, + crp->crp_payload_length); + if (((uintptr_t)addr & 0xf) == 0) { /* 16 bytes aligned? */ *allocated = 0; return (addr); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004152105.03FL5cYx021565>