1. 28 7月, 2017 1 次提交
    • S
      crypto: algif_aead - overhaul memory management · d887c52d
      Stephan Mueller 提交于
      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: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      d887c52d
  2. 01 7月, 2017 1 次提交
  3. 24 4月, 2017 1 次提交
  4. 10 4月, 2017 1 次提交
    • H
      crypto: algif_aead - Fix bogus request dereference in completion function · e6534aeb
      Herbert Xu 提交于
      The algif_aead completion function tries to deduce the aead_request
      from the crypto_async_request argument.  This is broken because
      the API does not guarantee that the same request will be pased to
      the completion function.  Only the value of req->data can be used
      in the completion function.
      
      This patch fixes it by storing a pointer to sk in areq and using
      that instead of passing in sk through req->data.
      
      Fixes: 83094e5e ("crypto: af_alg - add async support to...")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      e6534aeb
  5. 02 3月, 2017 1 次提交
  6. 03 2月, 2017 1 次提交
  7. 14 12月, 2016 1 次提交
  8. 08 12月, 2016 1 次提交
  9. 07 12月, 2016 1 次提交
    • S
      crypto: algif_aead - fix AEAD tag memory handling · 0c1e16cd
      Stephan Mueller 提交于
      For encryption, the AEAD ciphers require AAD || PT as input and generate
      AAD || CT || Tag as output and vice versa for decryption. Prior to this
      patch, the AF_ALG interface for AEAD ciphers requires the buffer to be
      present as input for encryption. Similarly, the output buffer for
      decryption required the presence of the tag buffer too. This implies
      that the kernel reads / writes data buffers from/to kernel space
      even though this operation is not required.
      
      This patch changes the AF_ALG AEAD interface to be consistent with the
      in-kernel AEAD cipher requirements.
      
      Due to this handling, he changes are transparent to user space with one
      exception: the return code of recv indicates the mount of output buffer.
      That output buffer has a different size compared to before the patch
      which implies that the return code of recv will also be different.
      For example, a decryption operation uses 16 bytes AAD, 16 bytes CT and
      16 bytes tag, the AF_ALG AEAD interface before showed a recv return
      code of 48 (bytes) whereas after this patch, the return code is 32
      since the tag is not returned any more.
      Reported-by: NMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      0c1e16cd
  10. 01 12月, 2016 1 次提交
  11. 15 11月, 2016 1 次提交
  12. 05 4月, 2016 1 次提交
    • T
      crypto: af_alg - add async support to algif_aead · 83094e5e
      Tadeusz Struk 提交于
      Following the async change for algif_skcipher
      this patch adds similar async read to algif_aead.
      
      changes in v3:
      - add call to aead_reset_ctx directly from aead_put_sgl instead of calling
        them separatelly one after the other
      - remove wait from aead_sock_destruct function as it is not needed
        when sock_hold is used
      
      changes in v2:
      - change internal data structures from fixed size arrays, limited to
        RSGL_MAX_ENTRIES, to linked list model with no artificial limitation.
      - use sock_kmalloc instead of kmalloc for memory allocation
      - use sock_hold instead of separate atomic ctr to wait for outstanding
        request
      Signed-off-by: NTadeusz Struk <tadeusz.struk@intel.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      83094e5e
  13. 02 12月, 2015 1 次提交
    • E
      net: rename SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA · 9cd3e072
      Eric Dumazet 提交于
      This patch is a cleanup to make following patch easier to
      review.
      
      Goal is to move SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA
      from (struct socket)->flags to a (struct socket_wq)->flags
      to benefit from RCU protection in sock_wake_async()
      
      To ease backports, we rename both constants.
      
      Two new helpers, sk_set_bit(int nr, struct sock *sk)
      and sk_clear_bit(int net, struct sock *sk) are added so that
      following patch can change their implementation.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9cd3e072
  14. 01 12月, 2015 1 次提交
  15. 17 11月, 2015 1 次提交
  16. 25 8月, 2015 1 次提交
  17. 17 8月, 2015 1 次提交
  18. 22 6月, 2015 1 次提交
  19. 28 5月, 2015 1 次提交
  20. 18 5月, 2015 1 次提交
  21. 23 4月, 2015 1 次提交
  22. 16 4月, 2015 1 次提交
    • L
      crypto: fix mis-merge with the networking merge · eccd02f3
      Linus Torvalds 提交于
      The networking updates from David Miller removed the iocb argument from
      sendmsg and recvmsg (in commit 1b784140: "net: Remove iocb argument
      from sendmsg and recvmsg"), but the crypto code had added new instances
      of them.
      
      When I pulled the crypto update, it was a silent semantic mis-merge, and
      I overlooked the new warning messages in my test-build.  I try to fix
      those in the merge itself, but that relies on me noticing. Oh well.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      eccd02f3
  23. 04 3月, 2015 1 次提交
    • S
      crypto: algif - add AEAD support · 400c40cf
      Stephan Mueller 提交于
      This patch adds the AEAD support for AF_ALG.
      
      The implementation is based on algif_skcipher, but contains heavy
      modifications to streamline the interface for AEAD uses.
      
      To use AEAD, the user space consumer has to use the salg_type named
      "aead".
      
      The AEAD implementation includes some overhead to calculate the size of
      the ciphertext, because the AEAD implementation of the kernel crypto API
      makes implied assumption on the location of the authentication tag. When
      performing an encryption, the tag will be added to the created
      ciphertext (note, the tag is placed adjacent to the ciphertext). For
      decryption, the caller must hand in the ciphertext with the tag appended
      to the ciphertext. Therefore, the selection of the used memory
      needs to add/subtract the tag size from the source/destination buffers
      depending on the encryption type. The code is provided with comments
      explaining when and how that operation is performed.
      
      A fully working example using all aspects of AEAD is provided at
      http://www.chronox.de/libkcapi.htmlSigned-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      400c40cf