svn commit: r359993 - head/sys/crypto/via
John Baldwin
jhb at FreeBSD.org
Wed Apr 15 21:05:39 UTC 2020
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);
}
More information about the svn-src-head
mailing list