freebsd-skq/sys
John Baldwin 9c0e3d3a53 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
2020-05-25 22:12:04 +00:00
..
amd64 copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
arm copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
arm64 copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
bsm bsm: add AUE_CLOSERANGE 2020-04-24 01:27:25 +00:00
cam cam: ANSIfy 0-argument function definitions 2020-05-16 14:33:08 +00:00
cddl Don't block on the range lock in zfs_getpages(). 2020-05-20 18:29:23 +00:00
compat linuxkpi: Fix mod_timer and del_timer_sync 2020-05-25 12:46:05 +00:00
conf copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
contrib Unbreak ARM64 kernel build after r361426 2020-05-23 23:10:03 +00:00
crypto Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
ddb kernel: provide panicky version of __unreachable 2020-05-13 18:07:37 +00:00
dev Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
dts allwinner: aw_thermal: Cope with DTS changes 2020-04-14 19:05:17 +00:00
fs copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
gdb Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
geom Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
gnu dts: Import DTS from Linux 5.6 2020-04-14 18:57:00 +00:00
i386 copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
isa
kern Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
kgssapi Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
libkern libkern: Add arc4random_uniform 2020-05-23 17:51:06 +00:00
mips copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
modules Introduce support for Epson RX-8803 RTC. 2020-05-25 15:40:02 +00:00
net Move <add|del|change>_route() functions to route_ctl.c in preparation of 2020-05-23 19:06:57 +00:00
net80211 net80211: post RTM_IFINFO notification after toggling IFF_DRV_RUNNING 2020-05-22 11:25:45 +00:00
netgraph Fix Typo in ng_hci_le_connection_complete_ep struct. 2020-05-19 13:58:52 +00:00
netinet bbr: Use arc4random_uniform from libkern. 2020-05-23 19:52:20 +00:00
netinet6 Move <add|del|change>_route() functions to route_ctl.c in preparation of 2020-05-23 19:06:57 +00:00
netipsec Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
netpfil pf: Add a new zone for per-table entry counters. 2020-05-16 00:28:12 +00:00
netsmb Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
nfs Use epoch(9) for rtentries to simplify control plane operations. 2020-05-23 10:21:02 +00:00
nfsclient
nfsserver
nlm Make nfslockd depend on xdr. 2020-04-23 09:37:22 +00:00
ofed Convert OFED rtable interactions to the new routing KPI. 2020-04-15 13:06:55 +00:00
opencrypto Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
powerpc copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
riscv copystr(9): Move to deprecate (attempt #2) 2020-05-25 16:40:48 +00:00
rpc Split XDR into separate kernel module. Make krpc depend on xdr. 2020-04-17 06:04:20 +00:00
security Deduplicate fsid comparisons 2020-05-21 01:55:35 +00:00
sys Add support for optional separate output buffers to in-kernel crypto. 2020-05-25 22:12:04 +00:00
teken
tests Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many) 2020-02-26 14:26:36 +00:00
tools vfs: stop null checking routines in vop wrappers 2020-01-26 00:41:38 +00:00
ufs Update name of description of vfs.ffs.setsize in comment. 2020-05-22 17:23:43 +00:00
vm Allocate UMA per-CPU counters earlier. 2020-05-14 16:06:54 +00:00
x86 amd64: Add a knob to flush RSB on context switches if machine has SMEP. 2020-05-20 22:00:31 +00:00
xdr Split XDR into separate kernel module. Make krpc depend on xdr. 2020-04-17 06:04:20 +00:00
xen Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (16 of many) 2020-02-25 19:04:39 +00:00
Makefile Remove sparc64 kernel support 2020-02-03 17:35:11 +00:00