1. 05 Oct, 2018 7 commits
    • valdis.kletnieks@vt.edu's avatar
      crypto/morus(640,1280) - make crypto_...-algs static · 90a8c78b
      valdis.kletnieks@vt.edu authored
      sparse complains thusly:
      
        CHECK   arch/x86/crypto/morus640-sse2-glue.c
      arch/x86/crypto/morus640-sse2-glue.c:38:1: warning: symbol 'crypto_morus640_sse2_algs' was not declared. Should it be static?
        CHECK   arch/x86/crypto/morus1280-sse2-glue.c
      arch/x86/crypto/morus1280-sse2-glue.c:38:1: warning: symbol 'crypto_morus1280_sse2_algs' was not declared. Should it be static?
        CHECK   arch/x86/crypto/morus1280-avx2-glue.c
      arch/x86/crypto/morus1280-avx2-glue.c:38:1: warning: symbol 'crypto_morus1280_avx2_algs' was not declared. Should it be static?
      
      and sparse is correct - these don't need to be global and polluting the namespace.
      Signed-off-by: default avatarValdis Kletnieks <valdis.kletnieks@vt.edu>
      Acked-by: default avatarOndrej Mosnacek <omosnacek@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      90a8c78b
    • Arnd Bergmann's avatar
      crypto: caam/qi2 - add CONFIG_NETDEVICES dependency · 96808c59
      Arnd Bergmann authored
      This driver implements a (part of a) network driver, and fails to
      build if we have turned off networking support:
      
      drivers/crypto/caam/caamalg_qi2.o: In function `dpaa2_caam_fqdan_cb':
      caamalg_qi2.c:(.text+0x577c): undefined reference to `napi_schedule_prep'
      caamalg_qi2.c:(.text+0x578c): undefined reference to `__napi_schedule_irqoff'
      drivers/crypto/caam/caamalg_qi2.o: In function `dpaa2_dpseci_poll':
      caamalg_qi2.c:(.text+0x59b8): undefined reference to `napi_complete_done'
      drivers/crypto/caam/caamalg_qi2.o: In function `dpaa2_caam_remove':
      caamalg_qi2.c:(.text.unlikely+0x4e0): undefined reference to `napi_disable'
      caamalg_qi2.c:(.text.unlikely+0x4e8): undefined reference to `netif_napi_del'
      drivers/crypto/caam/caamalg_qi2.o: In function `dpaa2_dpseci_setup':
      caamalg_qi2.c:(.text.unlikely+0xc98): undefined reference to `netif_napi_add'
      
      From what I can tell, CONFIG_NETDEVICES is the correct dependency here,
      and adding it fixes the randconfig failures.
      
      Fixes: 8d818c10 ("crypto: caam/qi2 - add DPAA2-CAAM driver")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      96808c59
    • Ard Biesheuvel's avatar
      crypto: qat - move temp buffers off the stack · cfa1d744
      Ard Biesheuvel authored
      Arnd reports that with Kees's latest VLA patches applied, the HMAC
      handling in the QAT driver uses a worst case estimate of 160 bytes
      for the SHA blocksize, allowing the compiler to determine the size
      of the stack frame at compile time and throw a warning:
      
        drivers/crypto/qat/qat_common/qat_algs.c: In function 'qat_alg_do_precomputes':
        drivers/crypto/qat/qat_common/qat_algs.c:257:1: error: the frame size
        of 1112 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
      
      Given that this worst case estimate is only 32 bytes larger than the
      actual block size of SHA-512, the use of a VLA here was hiding the
      excessive size of the stack frame from the compiler, and so we should
      try to move these buffers off the stack.
      
      So move the ipad/opad buffers and the various SHA state descriptors
      into the tfm context struct. Since qat_alg_do_precomputes() is only
      called in the context of a setkey() operation, this should be safe.
      Using SHA512_BLOCK_SIZE for the size of the ipad/opad buffers allows
      them to be used by SHA-1/SHA-256 as well.
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      cfa1d744
    • Wei Yongjun's avatar
      crypto: ccp - Make function sev_get_firmware() static · 5182f26f
      Wei Yongjun authored
      Fixes the following sparse warning:
      
      drivers/crypto/ccp/psp-dev.c:444:5: warning:
       symbol 'sev_get_firmware' was not declared. Should it be static?
      
      Fixes: e9372060 ("crypto: ccp - Allow SEV firmware to be chosen based on Family and Model")
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      5182f26f
    • Michael S. Tsirkin's avatar
      hwrng: core - document the quality field · fae29f13
      Michael S. Tsirkin authored
      quality field is currently documented as being 'per mill'.  In fact the
      math involved is:
      
                      add_hwgenerator_randomness((void *)rng_fillbuf, rc,
                                                 rc * current_quality * 8 >> 10);
      
      thus the actual definition is "bits of entropy per 1024 bits of input".
      
      The current documentation seems to have confused multiple people
      in the past, let's fix the documentation to match code.
      
      An alternative is to change core to match driver expectations, replacing
      	rc * current_quality * 8 >> 10
      with
      	rc * current_quality / 1000
      but that has performance costs, so probably isn't a good option.
      
      Fixes: 0f734e6e ("hwrng: add per-device entropy derating")
      Reported-by: default avatar"Dr. David Alan Gilbert" <dgilbert@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      fae29f13
    • Nathan Chancellor's avatar
      crypto: ccp - Remove forward declaration · 3512dcb4
      Nathan Chancellor authored
      Clang emits a warning about this construct:
      
      drivers/crypto/ccp/sp-platform.c:36:36: warning: tentative array
      definition assumed to have one element
      static const struct acpi_device_id sp_acpi_match[];
                                         ^
      1 warning generated.
      
      Just remove the forward declarations and move the initializations up
      so that they can be used in sp_get_of_version and sp_get_acpi_version.
      Reported-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Acked-by: default avatarGary R Hook <gary.hook@amd.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3512dcb4
    • Ard Biesheuvel's avatar
      crypto: x86/aes-ni - remove special handling of AES in PCBC mode · 944585a6
      Ard Biesheuvel authored
      For historical reasons, the AES-NI based implementation of the PCBC
      chaining mode uses a special FPU chaining mode wrapper template to
      amortize the FPU start/stop overhead over multiple blocks.
      
      When this FPU wrapper was introduced, it supported widely used
      chaining modes such as XTS and CTR (as well as LRW), but currently,
      PCBC is the only remaining user.
      
      Since there are no known users of pcbc(aes) in the kernel, let's remove
      this special driver, and rely on the generic pcbc driver to encapsulate
      the AES-NI core cipher.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      944585a6
  2. 28 Sep, 2018 33 commits