1. 22 Dec, 2017 27 commits
  2. 11 Dec, 2017 13 commits
    • Kamil Konieczny's avatar
      MAINTAINERS: Add myself as co-maintainer for s5p-sss.c · 65cd9588
      Kamil Konieczny authored
      Add myself as co-maintainer for Samsung Security SubSystem driver.
      I have added major functionality to the driver [hash acceleration],
      I have access to documentation and to hardware for testing, I can
      also dedicate some of my paid time for reviewing and verifying changes
      to the driver.
      Signed-off-by: default avatarKamil Konieczny <k.konieczny@partner.samsung.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      65cd9588
    • Colin Ian King's avatar
      chcr: ensure cntrl is initialized to fix bit-wise or'ing of garabage data · df807a19
      Colin Ian King authored
      In the case where skb->ip_summed != CHECKSUM_PARTIAL then cntrl contains
      garbage value and this is possibly being bit-wise or'd and stored into
      cpl->ctrl1.  Fix this by initializing cntrl to zero.
      
      Cleans up clang warning:
      drivers/crypto/chelsio/chcr_ipsec.c:374:9: warning: The left expression
      of the compound assignment is an uninitialized value. The computed value
      will also be garbage
      
      Fixes: 6dad4e8a ("chcr: Add support for Inline IPSec")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      df807a19
    • Colin Ian King's avatar
      chcr: remove unused variables net_device, pi, adap and cntrl · 267469ea
      Colin Ian King authored
      Variables adap, pi and cntrl are assigned but are never read, hence
      they are redundant and can be removed.
      
      Cleans up various clang build warnings.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      267469ea
    • Colin Ian King's avatar
      crypto: chelsio - make arrays sgl_ent_len and dsgl_ent_len static · 8579e076
      Colin Ian King authored
      The arrays sgl_ent_len and dsgl_ent_len are local to the source and do
      not need to be in global scope, so make them static. Also re-format the
      declarations to match the following round_constant array declaration
      style.
      
      Cleans up sparse warnings:
      drivers/crypto/chelsio/chcr_algo.c:76:14: warning: symbol 'sgl_ent_len'
      was not declared. Should it be static?
      drivers/crypto/chelsio/chcr_algo.c:81:14: warning: symbol 'dsgl_ent_len'
      was not declared. Should it be static?
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8579e076
    • Colin Ian King's avatar
      crypto: cryptd - make cryptd_max_cpu_qlen module parameter static · eaf356e4
      Colin Ian King authored
      The cryptd_max_cpu_qlen module parameter is local to the source and does
      not need to be in global scope, so make it static.
      
      Cleans up sparse warning:
      crypto/cryptd.c:35:14: warning: symbol 'cryptd_max_cpu_qlen' was not
      declared. Should it be static?
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      eaf356e4
    • Corentin LABBE's avatar
      crypto: stm32 - fix module device table name · 761a6982
      Corentin LABBE authored
      This patch fix the following build failure:
        CC [M]  drivers/crypto/stm32/stm32-cryp.o
      In file included from drivers/crypto/stm32/stm32-cryp.c:11:0:
      drivers/crypto/stm32/stm32-cryp.c:1049:25: error: 'sti_dt_ids' undeclared here (not in a function)
       MODULE_DEVICE_TABLE(of, sti_dt_ids);
      
      Let's replace sti_dt_ids with stm32_dt_ids which is just declared
      before.
      Signed-off-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
      Reviewed-by: default avatarFabien Dessenne <fabien.dessenne@st.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      761a6982
    • Horia Geantă's avatar
      crypto: caam/qi - use correct print specifier for size_t · 9db09e3b
      Horia Geantă authored
      Fix below warnings on ARMv7 by using %zu for printing size_t values:
      
      drivers/crypto/caam/caamalg_qi.c: In function aead_edesc_alloc:
      drivers/crypto/caam/caamalg_qi.c:417:17: warning: format %lu expects argument of type long unsigned int, but argument 4 has type unsigned int [-Wformat=]
         sizeof(struct qm_sg_entry))
                       ^
      drivers/crypto/caam/caamalg_qi.c:672:16: note: in expansion of macro CAAM_QI_MAX_AEAD_SG
          qm_sg_ents, CAAM_QI_MAX_AEAD_SG);
                      ^
      drivers/crypto/caam/caamalg_qi.c: In function ablkcipher_edesc_alloc:
      drivers/crypto/caam/caamalg_qi.c:440:17: warning: format %lu expects argument of type long unsigned int, but argument 4 has type unsigned int [-Wformat=]
         sizeof(struct qm_sg_entry))
                       ^
      drivers/crypto/caam/caamalg_qi.c:909:16: note: in expansion of macro CAAM_QI_MAX_ABLKCIPHER_SG
          qm_sg_ents, CAAM_QI_MAX_ABLKCIPHER_SG);
                      ^
      drivers/crypto/caam/caamalg_qi.c: In function ablkcipher_giv_edesc_alloc:
      drivers/crypto/caam/caamalg_qi.c:440:17: warning: format %lu expects argument of type long unsigned int, but argument 4 has type unsigned int [-Wformat=]
         sizeof(struct qm_sg_entry))
                       ^
      drivers/crypto/caam/caamalg_qi.c:1062:16: note: in expansion of macro CAAM_QI_MAX_ABLKCIPHER_SG
          qm_sg_ents, CAAM_QI_MAX_ABLKCIPHER_SG);
                      ^
      
      Fixes: eb9ba37d ("crypto: caam/qi - handle large number of S/Gs case")
      Signed-off-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9db09e3b
    • Gomonovych, Vasyl's avatar
      crypto: arm/aes-neonbs - Use PTR_ERR_OR_ZERO() · 26d85e5f
      Gomonovych, Vasyl authored
      Fix ptr_ret.cocci warnings:
      arch/arm/crypto/aes-neonbs-glue.c:184:1-3: WARNING: PTR_ERR_OR_ZERO can be used
      arch/arm/crypto/aes-neonbs-glue.c:261:1-3: WARNING: PTR_ERR_OR_ZERO can be used
      
      Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
      
      Generated by: scripts/coccinelle/api/ptr_ret.cocci
      Signed-off-by: default avatarVasyl Gomonovych <gomonovych@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      26d85e5f
    • Hauke Mehrtens's avatar
      crypto: ecdh - fix typo in KPP dependency of CRYPTO_ECDH · b5b90077
      Hauke Mehrtens authored
      This fixes a typo in the CRYPTO_KPP dependency of CRYPTO_ECDH.
      
      Fixes: 3c4b2390 ("crypto: ecdh - Add ECDH software support")
      Cc: <stable@vger.kernel.org> # v4.8+
      Signed-off-by: default avatarHauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b5b90077
    • Stephan Mueller's avatar
      crypto: af_alg - fix race accessing cipher request · d53c5135
      Stephan Mueller authored
      When invoking an asynchronous cipher operation, the invocation of the
      callback may be performed before the subsequent operations in the
      initial code path are invoked. The callback deletes the cipher request
      data structure which implies that after the invocation of the
      asynchronous cipher operation, this data structure must not be accessed
      any more.
      
      The setting of the return code size with the request data structure must
      therefore be moved before the invocation of the asynchronous cipher
      operation.
      
      Fixes: e870456d ("crypto: algif_skcipher - overhaul memory management")
      Fixes: d887c52d ("crypto: algif_aead - overhaul memory management")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: <stable@vger.kernel.org> # v4.14+
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d53c5135
    • Sebastian Andrzej Siewior's avatar
      crypto: mcryptd - protect the per-CPU queue with a lock · 9abffc6f
      Sebastian Andrzej Siewior authored
      mcryptd_enqueue_request() grabs the per-CPU queue struct and protects
      access to it with disabled preemption. Then it schedules a worker on the
      same CPU. The worker in mcryptd_queue_worker() guards access to the same
      per-CPU variable with disabled preemption.
      
      If we take CPU-hotplug into account then it is possible that between
      queue_work_on() and the actual invocation of the worker the CPU goes
      down and the worker will be scheduled on _another_ CPU. And here the
      preempt_disable() protection does not work anymore. The easiest thing is
      to add a spin_lock() to guard access to the list.
      
      Another detail: mcryptd_queue_worker() is not processing more than
      MCRYPTD_BATCH invocation in a row. If there are still items left, then
      it will invoke queue_work() to proceed with more later. *I* would
      suggest to simply drop that check because it does not use a system
      workqueue and the workqueue is already marked as "CPU_INTENSIVE". And if
      preemption is required then the scheduler should do it.
      However if queue_work() is used then the work item is marked as CPU
      unbound. That means it will try to run on the local CPU but it may run
      on another CPU as well. Especially with CONFIG_DEBUG_WQ_FORCE_RR_CPU=y.
      Again, the preempt_disable() won't work here but lock which was
      introduced will help.
      In order to keep work-item on the local CPU (and avoid RR) I changed it
      to queue_work_on().
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9abffc6f
    • Stephan Mueller's avatar
      crypto: af_alg - wait for data at beginning of recvmsg · 11edb555
      Stephan Mueller authored
      The wait for data is a non-atomic operation that can sleep and therefore
      potentially release the socket lock. The release of the socket lock
      allows another thread to modify the context data structure. The waiting
      operation for new data therefore must be called at the beginning of
      recvmsg. This prevents a race condition where checks of the members of
      the context data structure are performed by recvmsg while there is a
      potential for modification of these values.
      
      Fixes: e870456d ("crypto: algif_skcipher - overhaul memory management")
      Fixes: d887c52d ("crypto: algif_aead - overhaul memory management")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: <stable@vger.kernel.org> # v4.14+
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      11edb555
    • Eric Biggers's avatar
      crypto: skcipher - set walk.iv for zero-length inputs · 2b4f27c3
      Eric Biggers authored
      All the ChaCha20 algorithms as well as the ARM bit-sliced AES-XTS
      algorithms call skcipher_walk_virt(), then access the IV (walk.iv)
      before checking whether any bytes need to be processed (walk.nbytes).
      
      But if the input is empty, then skcipher_walk_virt() doesn't set the IV,
      and the algorithms crash trying to use the uninitialized IV pointer.
      
      Fix it by setting the IV earlier in skcipher_walk_virt().  Also fix it
      for the AEAD walk functions.
      
      This isn't a perfect solution because we can't actually align the IV to
      ->cra_alignmask unless there are bytes to process, for one because the
      temporary buffer for the aligned IV is freed by skcipher_walk_done(),
      which is only called when there are bytes to process.  Thus, algorithms
      that require aligned IVs will still need to avoid accessing the IV when
      walk.nbytes == 0.  Still, many algorithms/architectures are fine with
      IVs having any alignment, and even for those that aren't, a misaligned
      pointer bug is much less severe than an uninitialized pointer bug.
      
      This change also matches the behavior of the older blkcipher_walk API.
      
      Fixes: 0cabf2af ("crypto: skcipher - Fix crash on zero-length input")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Cc: <stable@vger.kernel.org> # v4.14+
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2b4f27c3