]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Various optimizations to software AES-CCM and AES-GCM.
authorjhb <jhb@FreeBSD.org>
Fri, 12 Jun 2020 23:10:30 +0000 (23:10 +0000)
committerjhb <jhb@FreeBSD.org>
Fri, 12 Jun 2020 23:10:30 +0000 (23:10 +0000)
commit7b059313600b0c0755500bf9ec90d0fabda17492
tree401baf6150423def946e17a69b3b3ec37e90bc0d
parent8435834a0445af4d6c1a02aea6e9b754b1ead494
Various optimizations to software AES-CCM and AES-GCM.

- Make use of cursors to avoid data copies for AES-CCM and AES-GCM.

  Pass pointers into the request's input and/or output buffers
  directly to the Update, encrypt, and decrypt hooks rather than
  always copying all data into a temporary block buffer on the stack.

- Move handling for partial final blocks out of the main loop.

  This removes branches from the main loop and permits using
  encrypt/decrypt_last which avoids a memset to clear the rest of the
  block on the stack.

- Shrink the on-stack buffers to assume AES block sizes and CCM/GCM
  tag lengths.

- For AAD data, pass larger chunks to axf->Update.  CCM can take each
  AAD segment in a single call.  GMAC can take multiple blocks at a
  time.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D25058
sys/opencrypto/cryptosoft.c