1. 13 Nov, 2016 18 commits
    • Horia Geantă's avatar
      crypto: caam - move sec4_sg_entry to sg_sw_sec4.h · e25ff92e
      Horia Geantă authored
      sec4_sg_entry structure is used only by helper functions in sg_sw_sec4.h.
      Since SEC HW S/G entries are to be manipulated only indirectly, via these
      functions, move sec4_sg_entry to the corresponding header.
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e25ff92e
    • Horia Geantă's avatar
      Revert "crypto: caam - get rid of tasklet" · 2b163b5b
      Horia Geantă authored
      This reverts commit 66d2e202.
      
      Quoting from Russell's findings:
      https://www.mail-archive.com/linux-crypto@vger.kernel.org/msg21136.html
      
      [quote]
      Okay, I've re-tested, using a different way of measuring, because using
      openssl speed is impractical for off-loaded engines.  I've decided to
      use this way to measure the performance:
      
      dd if=/dev/zero bs=1048576 count=128 | /usr/bin/time openssl dgst -md5
      
      For the threaded IRQs case gives:
      
      0.05user 2.74system 0:05.30elapsed 52%CPU (0avgtext+0avgdata 2400maxresident)k
      0.06user 2.52system 0:05.18elapsed 49%CPU (0avgtext+0avgdata 2404maxresident)k
      0.12user 2.60system 0:05.61elapsed 48%CPU (0avgtext+0avgdata 2460maxresident)k
      	=> 5.36s => 25.0MB/s
      
      and the tasklet case:
      
      0.08user 2.53system 0:04.83elapsed 54%CPU (0avgtext+0avgdata 2468maxresident)k
      0.09user 2.47system 0:05.16elapsed 49%CPU (0avgtext+0avgdata 2368maxresident)k
      0.10user 2.51system 0:04.87elapsed 53%CPU (0avgtext+0avgdata 2460maxresident)k
      	=> 4.95 => 27.1MB/s
      
      which corresponds to an 8% slowdown for the threaded IRQ case.  So,
      tasklets are indeed faster than threaded IRQs.
      
      [...]
      
      I think I've proven from the above that this patch needs to be reverted
      due to the performance regression, and that there _is_ most definitely
      a deterimental effect of switching from tasklets to threaded IRQs.
      [/quote]
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2b163b5b
    • Horia Geantă's avatar
      crypto: caam - fix DMA API mapping leak in ablkcipher code · c73e36e8
      Horia Geantă authored
      alkcipher_edesc_alloc() and ablkcipher_giv_edesc_alloc() don't
      free / unmap resources on error path:
      - dmap_map_sg() could fail, thus make sure the return value is checked
      - unmap DMA mappings in case of error
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c73e36e8
    • Horia Geantă's avatar
      crypto: caam - remove unreachable code in report_ccb_status() · 9305dff7
      Horia Geantă authored
      ERRID is a 4-bit field.
      Since err_id values are in [0..15] and err_id_list array size is 16,
      the condition "err_id < ARRAY_SIZE(err_id_list)" is always true.
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9305dff7
    • Horia Geantă's avatar
      crypto: caam - trivial code clean-up · 4ca7c7d8
      Horia Geantă authored
      -replace offsetof with container_of
      -remove unused "assoc_nents", "iv_dma" from aead_edesc
      and fix comments
      -remove unused CAAM_MAX_IV_LENGTH #define
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4ca7c7d8
    • Horia Geantă's avatar
      crypto: caam - remove unused command from aead givencrypt · 1b008eed
      Horia Geantă authored
      REG3 no longer needs to be updated, since it's not used after that.
      This shared descriptor command is a leftover of the conversion to
      AEAD interface.
      
      Fixes: 479bcc7c "crypto: caam - Convert authenc to new AEAD interface"
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1b008eed
    • Horia Geantă's avatar
      crypto: caam - remove unused may_sleep in dbg_dump_sg() · 00fef2b2
      Horia Geantă authored
      Fixes: 5ecf8ef9 "crypto: caam - fix sg dump"
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      00fef2b2
    • Horia Geantă's avatar
      crypto: caam - fix smatch warnings · c530e341
      Horia Geantă authored
      Fix the following smatch warnings:
      
      drivers/crypto/caam/caamalg.c:2350 aead_edesc_alloc() warn: we tested 'src_nents' before and it was 'true'
      drivers/crypto/caam/caamrng.c:351 caam_rng_init() error: no modifiers for allocation.
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c530e341
    • Horia Geantă's avatar
      crypto: caam - fix sparse warnings · 8439e94f
      Horia Geantă authored
      Fix the following sparse warning (note that endianness issues
      are not not addressed in current patch):
      
      drivers/crypto/caam/ctrl.c:388:24: warning: incorrect type in argument 1 (different address spaces)
      drivers/crypto/caam/ctrl.c:388:24:    expected void [noderef] <asn:2>*reg
      drivers/crypto/caam/ctrl.c:388:24:    got unsigned int *<noident>
      drivers/crypto/caam/ctrl.c:390:24: warning: incorrect type in argument 1 (different address spaces)
      drivers/crypto/caam/ctrl.c:390:24:    expected void [noderef] <asn:2>*reg
      drivers/crypto/caam/ctrl.c:390:24:    got unsigned int *<noident>
      drivers/crypto/caam/ctrl.c:548:24: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:548:24:    expected struct caam_ctrl [noderef] <asn:2>*ctrl
      drivers/crypto/caam/ctrl.c:548:24:    got struct caam_ctrl *<noident>
      drivers/crypto/caam/ctrl.c:550:30: warning: cast removes address space of expression
      drivers/crypto/caam/ctrl.c:549:26: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:549:26:    expected struct caam_assurance [noderef] <asn:2>*assure
      drivers/crypto/caam/ctrl.c:549:26:    got struct caam_assurance *<noident>
      drivers/crypto/caam/ctrl.c:554:28: warning: cast removes address space of expression
      drivers/crypto/caam/ctrl.c:553:24: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:553:24:    expected struct caam_deco [noderef] <asn:2>*deco
      drivers/crypto/caam/ctrl.c:553:24:    got struct caam_deco *<noident>
      drivers/crypto/caam/ctrl.c:634:48: warning: cast removes address space of expression
      drivers/crypto/caam/ctrl.c:633:44: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:633:44:    expected struct caam_job_ring [noderef] <asn:2>*<noident>
      drivers/crypto/caam/ctrl.c:633:44:    got struct caam_job_ring *<noident>
      drivers/crypto/caam/ctrl.c:648:34: warning: cast removes address space of expression
      drivers/crypto/caam/ctrl.c:647:30: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:647:30:    expected struct caam_queue_if [noderef] <asn:2>*qi
      drivers/crypto/caam/ctrl.c:647:30:    got struct caam_queue_if *<noident>
      drivers/crypto/caam/ctrl.c:806:37: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:806:37:    expected void *data
      drivers/crypto/caam/ctrl.c:806:37:    got unsigned int [noderef] <asn:2>*
      drivers/crypto/caam/ctrl.c:814:38: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:814:38:    expected void *data
      drivers/crypto/caam/ctrl.c:814:38:    got unsigned int [noderef] <asn:2>*
      drivers/crypto/caam/ctrl.c:822:38: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/ctrl.c:822:38:    expected void *data
      drivers/crypto/caam/ctrl.c:822:38:    got unsigned int [noderef] <asn:2>*
      drivers/crypto/caam/jr.c:492:23: warning: incorrect type in assignment (different address spaces)
      drivers/crypto/caam/jr.c:492:23:    expected struct caam_job_ring [noderef] <asn:2>*rregs
      drivers/crypto/caam/jr.c:492:23:    got struct caam_job_ring *<noident>
      drivers/crypto/caam/caampkc.c:398:35: warning: Using plain integer as NULL pointer
      drivers/crypto/caam/caampkc.c:444:35: warning: Using plain integer as NULL pointer
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8439e94f
    • Horia Geantă's avatar
      crypto: caam - desc.h fixes · 2090456a
      Horia Geantă authored
      1. fix HDR_START_IDX_MASK, HDR_SD_SHARE_MASK, HDR_JD_SHARE_MASK
      Define HDR_START_IDX_MASK consistently with the other masks:
      mask = bitmask << offset
      
      2. OP_ALG_TYPE_CLASS1 and OP_ALG_TYPE_CLASS2 must be shifted.
      
      3. fix FIFO_STORE output data type value for AFHA S-Box
      
      4. fix OPERATION pkha modular arithmetic source mask
      
      5. rename LDST_SRCDST_WORD_CLASS1_ICV_SZ to
      LDST_SRCDST_WORD_CLASS1_IV_SZ (it refers to IV, not ICV).
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2090456a
    • Horia Geantă's avatar
      crypto: caam - completely remove error propagation handling · 39957c8e
      Horia Geantă authored
      Commit 4464a7d4
      ("crypto: caam - remove error propagation handling")
      removed error propagation handling only from caamalg.
      
      Do this in all other places: caamhash, caamrng.
      Update descriptors' lengths appropriately.
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      39957c8e
    • Alex Porosanu's avatar
      crypto: caam - fix AEAD givenc descriptors · d128af17
      Alex Porosanu authored
      The AEAD givenc descriptor relies on moving the IV through the
      output FIFO and then back to the CTX2 for authentication. The
      SEQ FIFO STORE could be scheduled before the data can be
      read from OFIFO, especially since the SEQ FIFO LOAD needs
      to wait for the SEQ FIFO LOAD SKIP to finish first. The
      SKIP takes more time when the input is SG than when it's
      a contiguous buffer. If the SEQ FIFO LOAD is not scheduled
      before the STORE, the DECO will hang waiting for data
      to be available in the OFIFO so it can be transferred to C2.
      In order to overcome this, first force transfer of IV to C2
      by starting the "cryptlen" transfer first and then starting to
      store data from OFIFO to the output buffer.
      
      Fixes: 1acebad3 ("crypto: caam - faster aead implementation")
      Cc: <stable@vger.kernel.org> # 3.2+
      Signed-off-by: default avatarAlex Porosanu <alexandru.porosanu@nxp.com>
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d128af17
    • Alex Cope's avatar
      crypto: gf128mul - remove dead gf128mul_64k_lle code · d266f44b
      Alex Cope authored
      This code is unlikely to be useful in the future because transforms
      don't know how often keys will be changed, new algorithms are unlikely
      to use lle representation, and tables should be replaced with
      carryless multiplication instructions when available.
      Signed-off-by: default avatarAlex Cope <alexcope@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d266f44b
    • Mat Martineau's avatar
      crypto: dh - Consistenly return negative error codes · 8edda7d2
      Mat Martineau authored
      Fix the single instance where a positive EINVAL was returned.
      Signed-off-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8edda7d2
    • Jason A. Donenfeld's avatar
      crypto: poly1305 - Use unaligned access where required · 109e23bd
      Jason A. Donenfeld authored
      By using the unaligned access helpers, we drastically improve
      performance on small MIPS routers that have to go through the exception
      fix-up handler for these unaligned accesses.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
      Acked-by: default avatarMartin Willi <martin@strongswan.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      109e23bd
    • Nadim almas's avatar
      Crypto: mv_cesa - Switch to using managed resources · 650d4a97
      Nadim almas authored
      Switch to resource-managed function devm_kzalloc instead
      of kzalloc and remove unneeded kfree
      
      Also, remove kfree in probe function and remove
      function, mv_remove as it is now has nothing to do.
      The Coccinelle semantic patch used to make this change is as follows:
      //<smpl>
      @platform@
      identifier p, probefn, removefn;
      @@
      struct platform_driver p = {
      .probe = probefn,
      .remove = removefn,
      };
      
      @prb@
      identifier platform.probefn, pdev;
      expression e, e1, e2;
      @@
      probefn(struct platform_device *pdev, ...) {
      <+...
      - e = kzalloc(e1, e2)
      + e = devm_kzalloc(&pdev->dev, e1, e2)
      ...
      ?-kfree(e);
      ...+>
      }
      @rem depends on prb@
      identifier platform.removefn;
      expression prb.e;
      @@
      removefn(...) {
      <...
      - kfree(e);
      ...>
      }
      //</smpl>
      Signed-off-by: default avatarNadim Almas <nadim.902@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      650d4a97
    • Colin Ian King's avatar
      crypto: talitos - fix spelling mistake · 4d9b3a5b
      Colin Ian King authored
      Trivial fix to spelling mistake "pointeur" to "pointer"
      in dev_err message
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4d9b3a5b
    • Gary R Hook's avatar
      crypto: ccp - Fix handling of RSA exponent on a v5 device · e6414b13
      Gary R Hook authored
      The exponent size in the ccp_op structure is in bits. A v5
      CCP requires the exponent size to be in bytes, so convert
      the size from bits to bytes when populating the descriptor.
      
      The current code references the exponent in memory, but
      these fields have not been set since the exponent is
      actually store in the LSB. Populate the descriptor with
      the LSB location (address).
      Signed-off-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e6414b13
  2. 01 Nov, 2016 9 commits
  3. 25 Oct, 2016 13 commits