]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Various cleanups to the software encryption transform interface.
authorJohn Baldwin <jhb@FreeBSD.org>
Wed, 20 May 2020 21:21:01 +0000 (21:21 +0000)
committerJohn Baldwin <jhb@FreeBSD.org>
Wed, 20 May 2020 21:21:01 +0000 (21:21 +0000)
commit3e9470482a1357eef90d007b27ec5d9725ae1111
treedb3cd1b049da8705d5f9328628e9ee7b8d9d9549
parent2aa1dc7e3b637876f4bfdc6b19c35253d922e10a
Various cleanups to the software encryption transform interface.

- Consistently use 'void *' for key schedules / key contexts instead
  of a mix of 'caddr_t', 'uint8_t *', and 'void *'.

- Add a ctxsize member to enc_xform similar to what auth transforms use
  and require callers to malloc/zfree the context.  The setkey callback
  now supplies the caller-allocated context pointer and the zerokey
  callback is removed.  Callers now always use zfree() to ensure
  key contexts are zeroed.

- Consistently use C99 initializers for all statically-initialized
  instances of 'struct enc_xform'.

- Change the encrypt and decrypt functions to accept separate in and
  out buffer pointers.  Almost all of the backend crypto functions
  already supported separate input and output buffers and this makes
  it simpler to support separate buffers in OCF.

- Remove xform_userland.h shim to permit transforms to be compiled in
  userland.  Transforms no longer call malloc/free directly.

Reviewed by: cem (earlier version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D24855
13 files changed:
sys/crypto/chacha20/chacha-sw.c
sys/dev/cxgbe/crypto/t4_crypto.c
sys/opencrypto/cryptosoft.c
sys/opencrypto/xform_aes_icm.c
sys/opencrypto/xform_aes_xts.c
sys/opencrypto/xform_auth.h
sys/opencrypto/xform_cml.c
sys/opencrypto/xform_comp.h
sys/opencrypto/xform_enc.h
sys/opencrypto/xform_gmac.c
sys/opencrypto/xform_null.c
sys/opencrypto/xform_rijndael.c
sys/opencrypto/xform_userland.h [deleted file]