21 Mar, 2014

10 commits

  • The crypto algorithm modules utilizing the crypto daemon could
    be used early when the system start up. Using module_init
    does not guarantee that the daemon's work queue is initialized
    when the cypto alorithm depending on crypto_wq starts. It is necessary
    to initialize the crypto work queue earlier at the subsystem
    init time to make sure that it is initialized
    when used.

    Signed-off-by: Tim Chen
    Signed-off-by: Herbert Xu

    Tim Chen
     
  • (struct caam_ctx) ctx->key_dma needs to be unmapped
    when context is cleaned up.

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • Add support for the following combinations:
    -encryption: null
    -authentication: md5, sha* (1, 224, 256, 384, 512)

    Signed-off-by: Tudor Ambarus
    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • Add test vectors for aead with null encryption and md5,
    respectively sha1 authentication.
    Input data is taken from test vectors listed in RFC2410.

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • These defines might be needed by crypto drivers.

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • Commit 61bb86bba169507a5f223b94b9176c32c84b4721
    ("crypto: caam - set descriptor sharing type to SERIAL")
    changed the descriptor sharing mode from SHARE_WAIT to SHARE_SERIAL.

    All descriptor commands that handle the "ok to share" and
    "error propagation" settings should also go away, since they have no
    meaning for SHARE_SERIAL.

    Signed-off-by: Horia Geanta
    Signed-off-by: Herbert Xu

    Horia Geanta
     
  • The ahash_def_finup() can make use of the request save/restore functions,
    thus make it so. This simplifies the code a little and unifies the code
    paths.

    Note that the same remark about free()ing the req->priv applies here, the
    req->priv can only be free()'d after the original request was restored.

    Finally, squash a bug in the invocation of completion in the ASYNC path.
    In both ahash_def_finup_done{1,2}, the function areq->base.complete(X, err);
    was called with X=areq->base.data . This is incorrect , as X=&areq->base
    is the correct value. By analysis of the data structures, we see the areq is
    of type 'struct ahash_request' , areq->base is of type 'struct crypto_async_request'
    and areq->base.completion is of type crypto_completion_t, which is defined in
    include/linux/crypto.h as:

    typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);

    This is one lead that the X should be &areq->base . Next up, we can inspect
    other code which calls the completion callback to give us kind-of statistical
    idea of how this callback is used. We can try:

    $ git grep base\.complete\( drivers/crypto/

    Finally, by inspecting ahash_request_set_callback() implementation defined
    in include/crypto/hash.h , we observe that the .data entry of 'struct
    crypto_async_request' is intended for arbitrary data, not for completion
    argument.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Herbert Xu
    Cc: Shawn Guo
    Cc: Tom Lendacky
    Signed-off-by: Herbert Xu

    Marek Vasut
     
  • The functions to save original request within a newly adjusted request
    and it's counterpart to restore the original request can be re-used by
    more code in the crypto/ahash.c file. Pull these functions out from the
    code so they're available.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Herbert Xu
    Cc: Shawn Guo
    Cc: Tom Lendacky
    Signed-off-by: Herbert Xu

    Marek Vasut
     
  • Add documentation for the pointer voodoo that is happening in crypto/ahash.c
    in ahash_op_unaligned(). This code is quite confusing, so add a beefy chunk
    of documentation.

    Moreover, make sure the mangled request is completely restored after finishing
    this unaligned operation. This means restoring all of .result, .base.data
    and .base.complete .

    Also, remove the crypto_completion_t complete = ... line present in the
    ahash_op_unaligned_done() function. This type actually declares a function
    pointer, which is very confusing.

    Finally, yet very important nonetheless, make sure the req->priv is free()'d
    only after the original request is restored in ahash_op_unaligned_done().
    The req->priv data must not be free()'d before that in ahash_op_unaligned_finish(),
    since we would be accessing previously free()'d data in ahash_op_unaligned_done()
    and cause corruption.

    Signed-off-by: Marek Vasut
    Cc: David S. Miller
    Cc: Fabio Estevam
    Cc: Herbert Xu
    Cc: Shawn Guo
    Cc: Tom Lendacky
    Signed-off-by: Herbert Xu

    Marek Vasut
     
  • Found by the kbuild test robot, the first argument to caam_init_rng
    has a spurious ampersand.

    Reported-by: kbuild test robot
    Signed-off-by: Herbert Xu

    Herbert Xu
     

10 Mar, 2014

18 commits


27 Feb, 2014

12 commits