Re: svn commit: r361481 - in head: share/man/man9 sys/crypto/ccp sys/dev/cxgbe/crypto sys/dev/hifn sys/dev/safe sys/geom/eli sys/kern sys/kgssapi/krb5 sys/netipsec sys/opencrypto sys/sys

2020-05-29 Thread John Baldwin
On 5/29/20 1:34 AM, Mateusz Guzik wrote:
> This gives me tinderbox failures with mips:
> 
> _.mips.XLP64
> 
> /usr/src/sys/mips/nlm/dev/sec/nlmseclib.c:113:10: error: enumeration
> value 'CRYPTO_BUF_NONE' not handled in switch [-Werror,-Wswitch]
> switch (crp->crp_buf.cb_type) {
> 
> _.mips.OCTEON1
> _.mips.ERL
> 
>  /usr/src/sys/mips/cavium/cryptocteon/cryptocteon.c:298:10: error:
> enumeration values 'CRYPTO_BUF_NONE' and 'CRYPTO_BUF_CONTIG' not
> handled in switch [-Werror,-Wswitch]
> switch (crp->crp_buf.cb_type) {

Hmm, I got warnings when I built those but not errors.  I'll fix.

-- 
John Baldwin
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361481 - in head: share/man/man9 sys/crypto/ccp sys/dev/cxgbe/crypto sys/dev/hifn sys/dev/safe sys/geom/eli sys/kern sys/kgssapi/krb5 sys/netipsec sys/opencrypto sys/sys

2020-05-29 Thread Mateusz Guzik
This gives me tinderbox failures with mips:

_.mips.XLP64

/usr/src/sys/mips/nlm/dev/sec/nlmseclib.c:113:10: error: enumeration
value 'CRYPTO_BUF_NONE' not handled in switch [-Werror,-Wswitch]
switch (crp->crp_buf.cb_type) {

_.mips.OCTEON1
_.mips.ERL

 /usr/src/sys/mips/cavium/cryptocteon/cryptocteon.c:298:10: error:
enumeration values 'CRYPTO_BUF_NONE' and 'CRYPTO_BUF_CONTIG' not
handled in switch [-Werror,-Wswitch]
switch (crp->crp_buf.cb_type) {

On 5/26/20, John Baldwin  wrote:
> Author: jhb
> Date: Mon May 25 22:12:04 2020
> New Revision: 361481
> URL: https://svnweb.freebsd.org/changeset/base/361481
>
> Log:
>   Add support for optional separate output buffers to in-kernel crypto.
>
>   Some crypto consumers such as GELI and KTLS for file-backed sendfile
>   need to store their output in a separate buffer from the input.
>   Currently these consumers copy the contents of the input buffer into
>   the output buffer and queue an in-place crypto operation on the output
>   buffer.  Using a separate output buffer avoids this copy.
>
>   - Create a new 'struct crypto_buffer' describing a crypto buffer
> containing a type and type-specific fields.  crp_ilen is gone,
> instead buffers that use a flat kernel buffer have a cb_buf_len
> field for their length.  The length of other buffer types is
> inferred from the backing store (e.g. uio_resid for a uio).
> Requests now have two such structures: crp_buf for the input buffer,
> and crp_obuf for the output buffer.
>
>   - Consumers now use helper functions (crypto_use_*,
> e.g. crypto_use_mbuf()) to configure the input buffer.  If an output
> buffer is not configured, the request still modifies the input
> buffer in-place.  A consumer uses a second set of helper functions
> (crypto_use_output_*) to configure an output buffer.
>
>   - Consumers must request support for separate output buffers when
> creating a crypto session via the CSP_F_SEPARATE_OUTPUT flag and are
> only permitted to queue a request with a separate output buffer on
> sessions with this flag set.  Existing drivers already reject
> sessions with unknown flags, so this permits drivers to be modified
> to support this extension without requiring all drivers to change.
>
>   - Several data-related functions now have matching versions that
> operate on an explicit buffer (e.g. crypto_apply_buf,
> crypto_contiguous_subsegment_buf, bus_dma_load_crp_buf).
>
>   - Most of the existing data-related functions operate on the input
> buffer.  However crypto_copyback always writes to the output buffer
> if a request uses a separate output buffer.
>
>   - For the regions in input/output buffers, the following conventions
> are followed:
> - AAD and IV are always present in input only and their
>   fields are offsets into the input buffer.
> - payload is always present in both buffers.  If a request uses a
>   separate output buffer, it must set a new crp_payload_start_output
>   field to the offset of the payload in the output buffer.
> - digest is in the input buffer for verify operations, and in the
>   output buffer for compute operations.  crp_digest_start is relative
>   to the appropriate buffer.
>
>   - Add a crypto buffer cursor abstraction.  This is a more general form
> of some bits in the cryptosoft driver that tried to always use uio's.
> However, compared to the original code, this avoids rewalking the uio
> iovec array for requests with multiple vectors.  It also avoids
> allocate an iovec array for mbufs and populating it by instead walking
> the mbuf chain directly.
>
>   - Update the cryptosoft(4) driver to support separate output buffers
> making use of the cursor abstraction.
>
>   Sponsored by:   Netflix
>   Differential Revision:  https://reviews.freebsd.org/D24545
>
> Added:
>   head/share/man/man9/crypto_buffer.9   (contents, props changed)
> Modified:
>   head/share/man/man9/Makefile
>   head/share/man/man9/bus_dma.9
>   head/share/man/man9/crypto_driver.9
>   head/share/man/man9/crypto_request.9
>   head/share/man/man9/crypto_session.9
>   head/sys/crypto/ccp/ccp.c
>   head/sys/dev/cxgbe/crypto/t4_crypto.c
>   head/sys/dev/hifn/hifn7751.c
>   head/sys/dev/safe/safe.c
>   head/sys/geom/eli/g_eli_crypto.c
>   head/sys/geom/eli/g_eli_integrity.c
>   head/sys/geom/eli/g_eli_privacy.c
>   head/sys/kern/subr_bus_dma.c
>   head/sys/kgssapi/krb5/kcrypto_aes.c
>   head/sys/netipsec/xform_ah.c
>   head/sys/netipsec/xform_esp.c
>   head/sys/netipsec/xform_ipcomp.c
>   head/sys/opencrypto/criov.c
>   head/sys/opencrypto/crypto.c
>   head/sys/opencrypto/cryptodev.c
>   head/sys/opencrypto/cryptodev.h
>   head/sys/opencrypto/cryptosoft.c
>   head/sys/opencrypto/ktls_ocf.c
>   head/sys/sys/bus_dma.h
>
> Modified: head/share/man/man9/Makefile
> ==
> --- 

svn commit: r361481 - in head: share/man/man9 sys/crypto/ccp sys/dev/cxgbe/crypto sys/dev/hifn sys/dev/safe sys/geom/eli sys/kern sys/kgssapi/krb5 sys/netipsec sys/opencrypto sys/sys

2020-05-25 Thread John Baldwin
Author: jhb
Date: Mon May 25 22:12:04 2020
New Revision: 361481
URL: https://svnweb.freebsd.org/changeset/base/361481

Log:
  Add support for optional separate output buffers to in-kernel crypto.
  
  Some crypto consumers such as GELI and KTLS for file-backed sendfile
  need to store their output in a separate buffer from the input.
  Currently these consumers copy the contents of the input buffer into
  the output buffer and queue an in-place crypto operation on the output
  buffer.  Using a separate output buffer avoids this copy.
  
  - Create a new 'struct crypto_buffer' describing a crypto buffer
containing a type and type-specific fields.  crp_ilen is gone,
instead buffers that use a flat kernel buffer have a cb_buf_len
field for their length.  The length of other buffer types is
inferred from the backing store (e.g. uio_resid for a uio).
Requests now have two such structures: crp_buf for the input buffer,
and crp_obuf for the output buffer.
  
  - Consumers now use helper functions (crypto_use_*,
e.g. crypto_use_mbuf()) to configure the input buffer.  If an output
buffer is not configured, the request still modifies the input
buffer in-place.  A consumer uses a second set of helper functions
(crypto_use_output_*) to configure an output buffer.
  
  - Consumers must request support for separate output buffers when
creating a crypto session via the CSP_F_SEPARATE_OUTPUT flag and are
only permitted to queue a request with a separate output buffer on
sessions with this flag set.  Existing drivers already reject
sessions with unknown flags, so this permits drivers to be modified
to support this extension without requiring all drivers to change.
  
  - Several data-related functions now have matching versions that
operate on an explicit buffer (e.g. crypto_apply_buf,
crypto_contiguous_subsegment_buf, bus_dma_load_crp_buf).
  
  - Most of the existing data-related functions operate on the input
buffer.  However crypto_copyback always writes to the output buffer
if a request uses a separate output buffer.
  
  - For the regions in input/output buffers, the following conventions
are followed:
- AAD and IV are always present in input only and their
  fields are offsets into the input buffer.
- payload is always present in both buffers.  If a request uses a
  separate output buffer, it must set a new crp_payload_start_output
  field to the offset of the payload in the output buffer.
- digest is in the input buffer for verify operations, and in the
  output buffer for compute operations.  crp_digest_start is relative
  to the appropriate buffer.
  
  - Add a crypto buffer cursor abstraction.  This is a more general form
of some bits in the cryptosoft driver that tried to always use uio's.
However, compared to the original code, this avoids rewalking the uio
iovec array for requests with multiple vectors.  It also avoids
allocate an iovec array for mbufs and populating it by instead walking
the mbuf chain directly.
  
  - Update the cryptosoft(4) driver to support separate output buffers
making use of the cursor abstraction.
  
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D24545

Added:
  head/share/man/man9/crypto_buffer.9   (contents, props changed)
Modified:
  head/share/man/man9/Makefile
  head/share/man/man9/bus_dma.9
  head/share/man/man9/crypto_driver.9
  head/share/man/man9/crypto_request.9
  head/share/man/man9/crypto_session.9
  head/sys/crypto/ccp/ccp.c
  head/sys/dev/cxgbe/crypto/t4_crypto.c
  head/sys/dev/hifn/hifn7751.c
  head/sys/dev/safe/safe.c
  head/sys/geom/eli/g_eli_crypto.c
  head/sys/geom/eli/g_eli_integrity.c
  head/sys/geom/eli/g_eli_privacy.c
  head/sys/kern/subr_bus_dma.c
  head/sys/kgssapi/krb5/kcrypto_aes.c
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c
  head/sys/netipsec/xform_ipcomp.c
  head/sys/opencrypto/criov.c
  head/sys/opencrypto/crypto.c
  head/sys/opencrypto/cryptodev.c
  head/sys/opencrypto/cryptodev.h
  head/sys/opencrypto/cryptosoft.c
  head/sys/opencrypto/ktls_ocf.c
  head/sys/sys/bus_dma.h

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileMon May 25 21:14:23 2020
(r361480)
+++ head/share/man/man9/MakefileMon May 25 22:12:04 2020
(r361481)
@@ -72,6 +72,7 @@ MAN=  accept_filter.9 \
cr_seeotheruids.9 \
crypto.9 \
crypto_asym.9 \
+   crypto_buffer.9 \
crypto_driver.9 \
crypto_request.9 \
crypto_session.9 \
@@ -648,6 +649,8 @@ MLINKS+=bus_dma.9 busdma.9 \
bus_dma.9 bus_dmamap_load.9 \
bus_dma.9 bus_dmamap_load_bio.9 \
bus_dma.9 bus_dmamap_load_ccb.9 \
+   bus_dma.9 bus_dmamap_load_crp.9 \
+   bus_dma.9 bus_dmamap_load_crp_buffer.9 \
bus_dma.9