28 Feb, 2016

4 commits


17 Feb, 2016

13 commits


09 Feb, 2016

1 commit


06 Feb, 2016

19 commits

  • Some more authenc() wrapped algorithms are FIPS compliant, tag
    them as such.

    Signed-off-by: Marcus Meissner
    Acked-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Marcus Meissner
     
  • __test_aead() reads MAX_IVLEN bytes from template[i].iv, but the
    actual length of the initialisation vector can be shorter.
    The length of the IV is already calculated earlier in the
    function. Let's just reuses that. Also the IV length is currently
    calculated several time for no reason. Let's fix that too.
    This fix an out-of-bound error detected by KASan.

    Signed-off-by: Jerome Marchand
    Signed-off-by: Herbert Xu

    Jerome Marchand
     
  • Currently the sahara driver fails to probe:

    sahara: probe of 63ff8000.crypto failed with error -22

    This happens since commit 8996eafdcbad ("crypto: ahash - ensure statesize
    is non-zero"), which requires statesize to be filled.

    Pass the statesize members for sha1 and sha256, so we can probe
    the driver successfully again.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Herbert Xu

    Fabio Estevam
     
  • Based on commit 434b421241f2d0 ("crypto: caam - avoid needlessly saving and
    restoring caam_hash_ctx") from Russell King.

    When exporting and importing the hash state, we will only export and
    import into hashes which share the same struct crypto_ahash pointer.
    (See hash_accept->af_alg_accept->hash_accept_parent.)

    This means that saving the sahara_ctx structure on export, and
    restoring it on import is a waste of resources. So, remove this code.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Herbert Xu

    Fabio Estevam
     
  • As pointed out by Herbert Xu we should not include the mutex in the
    exported state, so let's just get rid of it.

    Signed-off-by: Fabio Estevam
    Signed-off-by: Herbert Xu

    Fabio Estevam
     
  • Modify __test_hash() so that hash import/export can be tested
    from within the kernel. The test is unconditionally done when
    a struct hash_testvec has its .np > 1.

    v3: make the test unconditional
    v2: Leverage template[i].np as suggested by Tim Chen

    Signed-off-by: Rui Wang
    Signed-off-by: Herbert Xu

    Wang, Rui Y
     
  • After digsig_asymmetric.c is converted the MPIs can be now
    safely removed from the public_key_signature structure.

    Signed-off-by: Tadeusz Struk
    Signed-off-by: Herbert Xu

    Tadeusz Struk
     
  • Convert asymmetric_verify to akcipher api.

    Signed-off-by: Tadeusz Struk
    Signed-off-by: Herbert Xu

    Tadeusz Struk
     
  • This patch converts the module verification code to the new akcipher API.

    Signed-off-by: Tadeusz Struk
    Signed-off-by: Herbert Xu

    Tadeusz Struk
     
  • Use a local variable for the exported and imported state so that
    alignment is not an issue. On export, set a local variable from the
    request context and then memcpy the contents of the local variable to
    the export memory area. On import, memcpy the import memory area into
    a local variable and then use the local variable to set the request
    context.

    Cc: # 3.14.x-
    Signed-off-by: Tom Lendacky
    Signed-off-by: Herbert Xu

    Tom Lendacky
     
  • On Monday, February 1, 2016 4:18 PM, Herbert Xu wrote:
    >
    > On Wed, Jan 27, 2016 at 05:08:35PM +0800, Rui Wang wrote:
    >>
    >> +static int sha1_mb_async_import(struct ahash_request *req, const void
    >> +*in) {
    >> + struct ahash_request *mcryptd_req = ahash_request_ctx(req);
    >> + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
    >> + struct sha1_mb_ctx *ctx = crypto_ahash_ctx(tfm);
    >> + struct mcryptd_ahash *mcryptd_tfm = ctx->mcryptd_tfm;
    >> + struct crypto_shash *child = mcryptd_ahash_child(mcryptd_tfm);
    >> + struct mcryptd_hash_request_ctx *rctx;
    >> + struct shash_desc *desc;
    >> + int err;
    >> +
    >> + memcpy(mcryptd_req, req, sizeof(*req));
    >> + ahash_request_set_tfm(mcryptd_req, &mcryptd_tfm->base);
    >> + rctx = ahash_request_ctx(mcryptd_req);
    >> + desc = &rctx->desc;
    >> + desc->tfm = child;
    >> + desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
    >> +
    >> + err = crypto_shash_init(desc);
    >> + if (err)
    >> + return err;
    >
    > What is this desc for?

    Hi Herbert,

    Yeah I just realized that the call to crypto_shash_init() isn't necessary
    here. What it does is overwritten by crypto_ahash_import(). But this desc
    still needs to be initialized here because it's newly allocated by
    ahash_request_alloc(). We eventually calls the shash version of import()
    which needs desc as an argument. The real context to be imported is then
    derived from shash_desc_ctx(desc).

    desc is a sub-field of struct mcryptd_hash_request_ctx, which is again a
    sub-field of the bigger blob allocated by ahash_request_alloc(). The entire
    blob's size is set in sha1_mb_async_init_tfm(). So a better version is as
    follows:

    (just removed the call to crypto_shash_init())

    >From 4bcb73adbef99aada94c49f352063619aa24d43d Mon Sep 17 00:00:00 2001
    From: Rui Wang
    Date: Mon, 14 Dec 2015 17:22:13 +0800
    Subject: [PATCH v2 1/4] crypto x86/sha1_mb: Fix load failure

    modprobe sha1_mb fails with the following message:

    modprobe: ERROR: could not insert 'sha1_mb': No such device

    It is because it needs to set its statesize and implement its
    import() and export() interface.

    v2: remove redundant call to crypto_shash_init()

    Signed-off-by: Rui Wang
    Signed-off-by: Herbert Xu

    Wang, Rui Y
     
  • Move the helper function to common header for everybody to use.

    changes in v2:
    - move the helper to crypto/internal/aead.h
    instead of crypto/aead.h

    Signed-off-by: Tadeusz Struk
    Signed-off-by: Herbert Xu

    Tadeusz Struk
     
  • The driver for the sunxi-ss crypto engine is not entirely 64-bit safe,
    compilation on arm64 spits some warnings.
    The proper fix was deemed to involved [1], so since 64-bit SoCs won't
    have this IP block we just disable this driver for 64-bit.

    [1]: http://lists.infradead.org/pipermail/linux-arm-kernel/2016-January/399988.html
    (and the reply)

    Signed-off-by: Andre Przywara
    Acked-by: Corentin LABBE
    Signed-off-by: Herbert Xu

    Andre Przywara
     
  • This patch removes all traces of the crypto_hash interface, now
    that everyone has switched over to shash or ahash.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch replaces uses of the long obsolete hash interface with
    ahash.

    Signed-off-by: Herbert Xu
    Acked-by: Greg Kroah-Hartman

    Herbert Xu
     
  • This patch adds helpers to retrieve the alg name and driver name
    of crypto_shash and crypto_ahash objects.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The helper crypto_skcipher_driver_name was returning the alg
    name and not the driver name.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch replaces the crypto_hash example in api-intro.txt with
    crypto_ahash.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch removes the last user of the obsolete crypto_hash
    interface, tcrypt, by simply switching it over to ahash. In
    fact it already has all the code there so it's just a matter
    of calling the ahash speed test code with the right mask.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

01 Feb, 2016

3 commits

  • We're clearing the wrong memory. The memory corruption is likely
    harmless because we weren't going to use that stack memory again but not
    zeroing is a potential information leak.

    Fixes: e28facde3c39 ('crypto: keywrap - add key wrapping block chaining mode')
    Signed-off-by: Dan Carpenter
    Acked-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Dan Carpenter
     
  • Since the exported information can be exposed to user-space, instead of
    exporting the entire request context only export the minimum information
    needed.

    Cc: # 3.14.x-
    Signed-off-by: Tom Lendacky
    Signed-off-by: Herbert Xu

    Tom Lendacky
     
  • Integrate with the newly added crypto engine to make the crypto hardware
    engine underutilized as each block needs to be processed before the crypto
    hardware can start working on the next block.

    The requests from dm-crypt will be listed into engine queue and processed
    by engine automatically, so remove the 'queue' and 'queue_task' things in
    omap aes driver.

    Signed-off-by: Baolin Wang
    Signed-off-by: Herbert Xu

    Baolin Wang