18 Mar, 2016

1 commit

  • Pull crypto update from Herbert Xu:
    "Here is the crypto update for 4.6:

    API:
    - Convert remaining crypto_hash users to shash or ahash, also convert
    blkcipher/ablkcipher users to skcipher.
    - Remove crypto_hash interface.
    - Remove crypto_pcomp interface.
    - Add crypto engine for async cipher drivers.
    - Add akcipher documentation.
    - Add skcipher documentation.

    Algorithms:
    - Rename crypto/crc32 to avoid name clash with lib/crc32.
    - Fix bug in keywrap where we zero the wrong pointer.

    Drivers:
    - Support T5/M5, T7/M7 SPARC CPUs in n2 hwrng driver.
    - Add PIC32 hwrng driver.
    - Support BCM6368 in bcm63xx hwrng driver.
    - Pack structs for 32-bit compat users in qat.
    - Use crypto engine in omap-aes.
    - Add support for sama5d2x SoCs in atmel-sha.
    - Make atmel-sha available again.
    - Make sahara hashing available again.
    - Make ccp hashing available again.
    - Make sha1-mb available again.
    - Add support for multiple devices in ccp.
    - Improve DMA performance in caam.
    - Add hashing support to rockchip"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (116 commits)
    crypto: qat - remove redundant arbiter configuration
    crypto: ux500 - fix checks of error code returned by devm_ioremap_resource()
    crypto: atmel - fix checks of error code returned by devm_ioremap_resource()
    crypto: qat - Change the definition of icp_qat_uof_regtype
    hwrng: exynos - use __maybe_unused to hide pm functions
    crypto: ccp - Add abstraction for device-specific calls
    crypto: ccp - CCP versioning support
    crypto: ccp - Support for multiple CCPs
    crypto: ccp - Remove check for x86 family and model
    crypto: ccp - memset request context to zero during import
    lib/mpi: use "static inline" instead of "extern inline"
    lib/mpi: avoid assembler warning
    hwrng: bcm63xx - fix non device tree compatibility
    crypto: testmgr - allow rfc3686 aes-ctr variants in fips mode.
    crypto: qat - The AE id should be less than the maximal AE number
    lib/mpi: Endianness fix
    crypto: rockchip - add hash support for crypto engine in rk3288
    crypto: xts - fix compile errors
    crypto: doc - add skcipher API documentation
    crypto: doc - update AEAD AD handling
    ...

    Linus Torvalds
     

11 Mar, 2016

1 commit


17 Feb, 2016

2 commits

  • When (!ctx->bufcnt && !(ctx->flags & SHA_FLAGS_PAD)), the former source
    code used to set the SHA_FLAGS_BUSY without checking whether this flag was
    already set. If so, the hardware is already processing another hash
    request so the processing of the req argument of atmel_sha_final() should
    be delayed by queueing this request, the same way as done for the
    (ctx->bufcnt != 0) case.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     
  • Using only the digest, digcnt[], bufcnt and buffer[] fields of the
    struct atmel_sha_reqctx was not enough to import/export the request state,
    so now we use the whole structure.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     

06 Feb, 2016

2 commits

  • clk_prepare()/clk_unprepare() must not be called within atomic context.

    This patch calls clk_prepare() once for all from atmel_sha_probe() and
    clk_unprepare() from atmel_sha_remove().

    Then calls of clk_prepare_enable()/clk_disable_unprepare() were replaced
    by calls of clk_enable()/clk_disable().

    Cc: stable@vger.kernel.org
    Signed-off-by: Cyrille Pitchen
    Reported-by: Matthias Mayr
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     
  • Since atmel_sha_probe() uses devm_xxx functions to allocate resources,
    atmel_sha_remove() should no longer explicitly release them.

    Cc: stable@vger.kernel.org
    Signed-off-by: Cyrille Pitchen
    Fixes: b0e8b3417a62 ("crypto: atmel - use devm_xxx() managed function")
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     

30 Jan, 2016

1 commit

  • This patch implements the missing .import() and .export() mandatory
    hooks for asynchronous hash algorithms. It also sets the relevant, non
    zero, value for the .statesize field when declaring the supported SHA
    algorithms. Indeed a zero value of .statesize prevents the algorithm from
    being registered.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     

25 Jan, 2016

4 commits

  • This patch saves the value of the internal hash register at the end of an
    'update' operation then restores this value before starting the next
    'update'. This way the driver can now properly handle context switches.

    WARNING: only hardware versions from sama5d4x and later provide the
    needed interface to update the internal hash value. Especially, sama5d3x
    cannot implement this feature so context switches are still broken.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     
  • This patch adds support of hardware version 5.1.x embedded inside sama5d2x
    SoCs.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     
  • The 'done' tasklet handler used to check the 'BUSY' flag to either
    finalize the processing of a crypto request which had just completed or
    manage the crypto queue to start the next crypto request.

    On request R1 completion, the driver calls atmel_sha_finish_req(), which:
    1 - clears the 'BUSY' flag since the hardware is no longer used and is
    ready again to process new crypto requests.
    2 - notifies the above layer (the client) about the completion of the
    asynchronous crypto request R1 by calling its base.complete()
    callback.
    3 - schedules the 'done' task to check the crypto queue and start to
    process the next crypto request (the 'BUSY' flag is supposed to be
    cleared at that moment) if such a pending request exists.

    However step 2 might wake the client up so it can now ask our driver to
    process a new crypto request R2. This request is enqueued by calling the
    atmel_sha_handle_queue() function, which sets the 'BUSY' flags then
    starts to process R2.

    If the 'done' tasklet, scheduled by step 3, runs just after, it would see
    that the 'BUSY' flag is set then understand that R2 has just completed,
    which is wrong!

    So the state of 'BUSY' flag is not a proper way to detect and handle
    crypto request completion.

    This patch fixes this race condition by using two different tasklets, one
    to handle the crypto request completion events, the other to manage the
    crypto queue if needed.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     
  • This patch fixes a crash which occured during the computation of the
    digest of an empty message.

    Indeed, when processing an empty message, the atmel_sha_handle_queue()
    function was never called, hence the dd->req pointer remained
    uninitialized.

    Later, when the atmel_sha_final_req() function was called, it used
    to crash while using this uninitialized dd->req pointer.

    Hence this patch adds missing initializations of dd->req before calls of
    the atmel_sha_final_req() function.

    This bug prevented us from passing the tcrypt test suite on SHA algo.

    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Herbert Xu

    Cyrille Pitchen
     

17 Dec, 2015

1 commit


14 Oct, 2015

1 commit


08 Oct, 2015

1 commit


08 Apr, 2015

5 commits

  • The maximum source and destination burst size is 16
    according to the datasheet of Atmel DMA. And the value
    is also checked in function at_xdmac_csize of Atmel
    DMA driver. With the restrict, the value beyond maximum
    value will not be processed in DMA driver, so SHA384 and
    SHA512 will not work and the program will wait forever.

    So here change the max burst size of all the cases to 16
    in order to make SHA384 and SHA512 work and keep consistent
    with DMA driver and datasheet.

    Signed-off-by: Leilei Zhao
    Acked-by: Nicolas Ferre
    Signed-off-by: Herbert Xu

    Leilei Zhao
     
  • Kernel will report "BUG: spinlock lockup suspected on CPU#0"
    when CONFIG_DEBUG_SPINLOCK is enabled in kernel config and the
    spinlock is used at the first time. It's caused by uninitialized
    spinlock, so just initialize it in probe.

    Signed-off-by: Leilei Zhao
    Acked-by: Nicolas Ferre
    Signed-off-by: Herbert Xu

    Leilei Zhao
     
  • Having a zero length sg doesn't mean it is the end of the sg list. This
    case happens when calculating HMAC of IPSec packet.

    Signed-off-by: Leilei Zhao
    Signed-off-by: Ludovic Desroches
    Acked-by: Nicolas Ferre
    Signed-off-by: Herbert Xu

    Leilei Zhao
     
  • When a hash is requested on data bigger than the buffer allocated by the
    SHA driver, the way DMA transfers are performed is quite strange:
    The buffer is filled at each update request. When full, a DMA transfer
    is done. On next update request, another DMA transfer is done. Then we
    wait to have a full buffer (or the end of the data) to perform the dma
    transfer. Such a situation lead sometimes, on SAMA5D4, to a case where
    dma transfer is finished but the data ready irq never comes. Moreover
    hash was incorrect in this case.

    With this patch, dma transfers are only performed when the buffer is
    full or when there is no more data. So it removes the transfer whose size
    is equal the update size after the full buffer transmission.

    Signed-off-by: Ludovic Desroches
    Signed-off-by: Leilei Zhao
    Acked-by: Nicolas Ferre
    Signed-off-by: Herbert Xu

    Ludovic Desroches
     
  • Add new version of atmel-sha available with SAMA5D4 devices.

    Signed-off-by: Leilei Zhao
    Signed-off-by: Ludovic Desroches
    Acked-by: Nicolas Ferre
    Signed-off-by: Herbert Xu

    Leilei Zhao
     

04 Mar, 2015

1 commit


22 Dec, 2014

1 commit


20 Oct, 2014

1 commit


01 Aug, 2014

1 commit


13 Dec, 2013

2 commits


10 Mar, 2013

1 commit


04 Jan, 2013

1 commit

  • CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
    markings need to be removed.

    This change removes the use of __devinit, __devexit_p, __devinitdata,
    and __devexit from these drivers.

    Based on patches originally written by Bill Pemberton, but redone by me
    in order to handle some of the coding style issues better, by hand.

    Cc: Bill Pemberton
    Cc: Herbert Xu
    Cc: "David S. Miller"
    Cc: Kent Yoder
    Cc: Jamie Iles
    Cc: Kim Phillips
    Cc: Shengzhou Liu
    Cc: Alex Porosanu
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

07 Sep, 2012

1 commit


11 Jul, 2012

1 commit