1. 28 Jul, 2017 2 commits
    • Stephan Mueller's avatar
      crypto: algif_aead - overhaul memory management · d887c52d
      Stephan Mueller authored
      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: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d887c52d
    • Stephan Mueller's avatar
      crypto: algif_skcipher - overhaul memory management · e870456d
      Stephan Mueller authored
      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
      
      In addition, the code structure is adjusted to match the structure of
      algif_aead for easier code assessment.
      
      The user space interface changed slightly as follows: the old AIO
      operation returned zero upon success and < 0 in case of an error to user
      space. As all other AF_ALG interfaces (including the sync skcipher
      interface) returned the number of processed bytes upon success and < 0
      in case of an error, the new skcipher interface (regardless of AIO or
      sync) returns the number of processed bytes in case of success.
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e870456d
  2. 18 Jul, 2017 38 commits