]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - crypto/algif_aead.c
crypto: algif_aead - overhaul memory management
authorStephan Mueller <smueller@chronox.de>
Sun, 25 Jun 2017 15:12:59 +0000 (17:12 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 28 Jul 2017 09:55:47 +0000 (17:55 +0800)
commitd887c52d6ae43aeebd249b5f2f1333e60236aa60
tree900c6c96a8e7fba573a3d9d6a74a9e35096364d7
parente870456d8e7c8d57c059ea479b5aadbb55ff4c3a
crypto: algif_aead - overhaul memory management

The updated memory management is described in the top part of the code.
As one benefit of the changed memory management, the AIO and synchronous
operation is now implemented in one common function. The AF_ALG
operation uses the async kernel crypto API interface for each cipher
operation. Thus, the only difference between the AIO and sync operation
types visible from user space is:

1. the callback function to be invoked when the asynchronous operation
   is completed

2. whether to wait for the completion of the kernel crypto API operation
   or not

The change includes the overhaul of the TX and RX SGL handling. The TX
SGL holding the data sent from user space to the kernel is now dynamic
similar to algif_skcipher. This dynamic nature allows a continuous
operation of a thread sending data and a second thread receiving the
data. These threads do not need to synchronize as the kernel processes
as much data from the TX SGL to fill the RX SGL.

The caller reading the data from the kernel defines the amount of data
to be processed. Considering that the interface covers AEAD
authenticating ciphers, the reader must provide the buffer in the
correct size. Thus the reader defines the encryption size.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/algif_aead.c