1. 03 Mar, 2018 1 commit
  2. 29 Dec, 2017 2 commits
  3. 05 Dec, 2017 1 commit
  4. 22 Aug, 2017 1 commit
  5. 09 Aug, 2017 2 commits
    • Stephan Mueller's avatar
      crypto: af_alg - consolidation of duplicate code · 2d97591e
      Stephan Mueller authored
      Consolidate following data structures:
      skcipher_async_req, aead_async_req -> af_alg_async_req
      skcipher_rsgl, aead_rsql -> af_alg_rsgl
      skcipher_tsgl, aead_tsql -> af_alg_tsgl
      skcipher_ctx, aead_ctx -> af_alg_ctx
      Consolidate following functions:
      skcipher_sndbuf, aead_sndbuf -> af_alg_sndbuf
      skcipher_writable, aead_writable -> af_alg_writable
      skcipher_rcvbuf, aead_rcvbuf -> af_alg_rcvbuf
      skcipher_readable, aead_readable -> af_alg_readable
      aead_alloc_tsgl, skcipher_alloc_tsgl -> af_alg_alloc_tsgl
      aead_count_tsgl, skcipher_count_tsgl -> af_alg_count_tsgl
      aead_pull_tsgl, skcipher_pull_tsgl -> af_alg_pull_tsgl
      aead_free_areq_sgls, skcipher_free_areq_sgls -> af_alg_free_areq_sgls
      aead_wait_for_wmem, skcipher_wait_for_wmem -> af_alg_wait_for_wmem
      aead_wmem_wakeup, skcipher_wmem_wakeup -> af_alg_wmem_wakeup
      aead_wait_for_data, skcipher_wait_for_data -> af_alg_wait_for_data
      aead_data_wakeup, skcipher_data_wakeup -> af_alg_data_wakeup
      aead_sendmsg, skcipher_sendmsg -> af_alg_sendmsg
      aead_sendpage, skcipher_sendpage -> af_alg_sendpage
      aead_async_cb, skcipher_async_cb -> af_alg_async_cb
      aead_poll, skcipher_poll -> af_alg_poll
      Split out the following common code from recvmsg:
      af_alg_alloc_areq: allocation of the request data structure for the
      cipher operation
      af_alg_get_rsgl: creation of the RX SGL anchored in the request data
      The following changes to the implementation without affecting the
      functionality have been applied to synchronize slightly different code
      bases in algif_skcipher and algif_aead:
      The wakeup in af_alg_wait_for_data is triggered when either more data
      is received or the indicator that more data is to be expected is
      released. The first is triggered by user space, the second is
      triggered by the kernel upon finishing the processing of data
      (i.e. the kernel is ready for more).
      af_alg_sendmsg uses size_t in min_t calculation for obtaining len.
      Return code determination is consistent with algif_skcipher. The
      scope of the variable i is reduced to match algif_aead. The type of the
      variable i is switched from int to unsigned int to match algif_aead.
      af_alg_sendpage does not contain the superfluous err = 0 from
      af_alg_async_cb requires to store the number of output bytes in
      areq->outlen before the AIO callback is triggered.
      The POLLIN / POLLRDNORM is now set when either not more data is given or
      the kernel is supplied with data. This is consistent to the wakeup from
      sleep when the kernel waits for data.
      The request data structure is extended by the field last_rsgl which
      points to the last RX SGL list entry. This shall help recvmsg
      implementation to chain the RX SGL to other SG(L)s if needed. It is
      currently used by algif_aead which chains the tag SGL to the RX SGL
      during decryption.
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    • Stephan Mueller's avatar
      crypto: algif - return error code when no data was processed · 5703c826
      Stephan Mueller authored
      If no data has been processed during recvmsg, return the error code.
      This covers all errors received during non-AIO operations.
      If any error occurs during a synchronous operation in addition to
      -EIOCBQUEUED or -EBADMSG (like -ENOMEM), it should be relayed to the
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  6. 28 Jul, 2017 1 commit
    • 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>
  7. 02 Mar, 2017 1 commit
  8. 01 Dec, 2016 1 commit
  9. 14 Nov, 2016 1 commit
  10. 06 Feb, 2016 3 commits
  11. 20 Jan, 2016 1 commit
  12. 19 Jan, 2016 1 commit
  13. 18 Jan, 2016 5 commits
  14. 22 Dec, 2015 1 commit
  15. 01 Dec, 2015 1 commit
    • Eric Dumazet's avatar
      net: rename SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA · 9cd3e072
      Eric Dumazet authored
      This patch is a cleanup to make following patch easier to
      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: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
  16. 30 Nov, 2015 1 commit
  17. 17 Nov, 2015 1 commit
  18. 17 Aug, 2015 1 commit
  19. 11 Apr, 2015 1 commit
  20. 02 Apr, 2015 1 commit
  21. 01 Apr, 2015 1 commit
  22. 25 Mar, 2015 1 commit
  23. 23 Mar, 2015 1 commit
  24. 02 Mar, 2015 1 commit
  25. 12 Feb, 2015 1 commit
  26. 11 Feb, 2015 2 commits
  27. 04 Feb, 2015 1 commit
    • Al Viro's avatar
      crypto: switch af_alg_make_sg() to iov_iter · 1d10eb2f
      Al Viro authored
      With that, all ->sendmsg() instances are converted to iov_iter primitives
      and are agnostic wrt the kind of iov_iter they are working with.
      So's the last remaining ->recvmsg() instance that wasn't kind-agnostic yet.
      All ->sendmsg() and ->recvmsg() advance ->msg_iter by the amount actually
      copied and none of them modifies the underlying iovec, etc.
      Cc: linux-crypto@vger.kernel.org
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  28. 22 Dec, 2014 1 commit
  29. 09 Dec, 2014 1 commit
    • Al Viro's avatar
      put iov_iter into msghdr · c0371da6
      Al Viro authored
      Note that the code _using_ ->msg_iter at that point will be very
      unhappy with anything other than unshifted iovec-backed iov_iter.
      We still need to convert users to proper primitives.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
  30. 02 Dec, 2014 1 commit
    • Stephan Mueller's avatar
      crypto: algif_skcipher - initialize upon init request · f26b7b80
      Stephan Mueller authored
      When using the algif_skcipher, the following call sequence causess a
      1. sendmsg with ALG_SET_OP and iov == NULL, iovlen == 0 (i.e
      initializing the cipher, but not sending data)
      2. sendmsg with msg->msg-controllen == 0 and iov != NULL (using the initalized
      cipher handle by sending data)
      In step 2, the cipher operation type (encryption or decryption) is reset
      to always decryption, because the local variable of enc is put into
      ctx->enc as ctx->user is still zero.
      The same applies when all send data is processed and ctx->used falls to
      zero followed by user space to send new data.
      This patch changes the behavior to only reset the cipher operation type
      (and the IV) if such configuration request is received.
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
  31. 01 Dec, 2014 1 commit