25 May, 2018

8 commits

  • [ Upstream commit b7007dbccd92f7b8c00e590020bee542a48c6a2c ]

    When exiting a transformation, the cra_exit() helper is called in each
    driver providing one. The Inside Secure SafeXcel driver has one, which
    is responsible of freeing some areas and of sending one invalidation
    request to the crypto engine, to invalidate the context that was used
    during the transformation.

    We could see in some setups (when lots of transformations were being
    used with a short lifetime, and hence lots of cra_exit() calls) NULL
    pointer dereferences and other weird issues. All these issues were
    coming from accessing the tfm context.

    The issue is the invalidation request completion is checked using a
    wait_for_completion_interruptible() call in both the cipher and hash
    cra_exit() helpers. In some cases this was interrupted while the
    invalidation request wasn't processed yet. And then cra_exit() returned,
    and its caller was freeing the tfm instance. Only then the request was
    being handled by the SafeXcel driver, which lead to the said issues.

    This patch fixes this by using wait_for_completion() calls in these
    specific cases.

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     
  • [ Upstream commit 7c73cf4cc2ac16465f5102437dc0a12d66671bd6 ]

    The MODULE_ALIAS is required to enable the sun4i-ss driver to load
    automatically when built at a module. Tested on a Cubietruck.

    Fixes: 6298e948215f ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
    Signed-off-by: Peter Robinson
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Peter Robinson
     
  • [ Upstream commit c1a8fa6e240ed4b99778d48ab790743565cb61c8 ]

    This patch fixes the extra cache computation when the queued data is a
    multiple of a block size. This fixes the hash support in some cases.

    Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block")
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     
  • [ Upstream commit 666a9c70b04fccabde5cea5e680ae1ae92460a62 ]

    This patch fixes the cache length computation as cache_len could end up
    being a negative value. The check between the queued size and the
    block size is updated to reflect the caching mechanism which can cache
    up to a full block size (included!).

    Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block")
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     
  • [ Upstream commit 95831ceafc0de7d94a5fe86ebb1c2042317cc2cd ]

    This patch adds a check in the SafeXcel dequeue function, to avoid
    processing request further if no hardware command was issued. This can
    happen in certain cases where the ->send() function caches all the data
    that would have been send.

    Fixes: 809778e02cd4 ("crypto: inside-secure - fix hash when length is a multiple of a block")
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     
  • [ Upstream commit 79eb382b5e06a6dca5806465d7195d686a463ab0 ]

    I don't why we need take a single write lock and disable interrupts
    while setting up debugfs. This is what what happens when we try anyway:

    |ccp 0000:03:00.2: enabling device (0000 -> 0002)
    |BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:69
    |in_atomic(): 1, irqs_disabled(): 1, pid: 3, name: kworker/0:0
    |irq event stamp: 17150
    |hardirqs last enabled at (17149): [] restore_regs_and_return_to_kernel+0x0/0x23
    |hardirqs last disabled at (17150): [] _raw_write_lock_irqsave+0x1b/0x50
    |softirqs last enabled at (17148): [] __do_softirq+0x3b8/0x4c1
    |softirqs last disabled at (17125): [] irq_exit+0xb1/0xc0
    |CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.16.0-rc2+ #30
    |Workqueue: events work_for_cpu_fn
    |Call Trace:
    | dump_stack+0x7d/0xb6
    | ___might_sleep+0x1eb/0x250
    | down_write+0x17/0x60
    | start_creating+0x4c/0xe0
    | debugfs_create_dir+0x9/0x100
    | ccp5_debugfs_setup+0x191/0x1b0
    | ccp5_init+0x8a7/0x8c0
    | ccp_dev_init+0xb8/0xe0
    | sp_init+0x6c/0x90
    | sp_pci_probe+0x26e/0x590
    | local_pci_probe+0x3f/0x90
    | work_for_cpu_fn+0x11/0x20
    | process_one_work+0x1ff/0x650
    | worker_thread+0x1d4/0x3a0
    | kthread+0xfe/0x130
    | ret_from_fork+0x27/0x50

    If any locking is required, a simple mutex will do it.

    Cc: Gary R Hook
    Signed-off-by: Sebastian Andrzej Siewior
    Acked-by: Gary R Hook
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sebastian Andrzej Siewior
     
  • [ Upstream commit 5d804a5157dbaa64872a675923ae87161165c66b ]

    The Atmel AES driver uses memzero_explicit on the keys on error, but the
    variable zeroed isn't the right one because of a typo. Fix this by using
    the right variable.

    Fixes: 89a82ef87e01 ("crypto: atmel-authenc - add support to authenc(hmac(shaX), Y(aes)) modes")
    Signed-off-by: Antoine Tenart
    Reviewed-by: Tudor Ambarus
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     
  • [ Upstream commit 4dc5475ae0375ea4f9283dfd9b2ddc91b20d4c4b ]

    This patch updates the safexcel_hmac_init_pad() function to also wait
    for completion when the digest return code is -EBUSY, as it would mean
    the request is in the backlog to be processed later.

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Suggested-by: Ofer Heifetz
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     

09 May, 2018

1 commit

  • commit 2b1227301a8e4729409694e323b72c064c47cb6b upstream.

    For SEC 2.x+, cipher in length must contain only the ciphertext length.
    In case of using hardware ICV checking, the ICV length is provided via
    the "extent" field of the descriptor pointer.

    Cc: # 4.8+
    Fixes: 549bd8bc5987 ("crypto: talitos - Implement AEAD for SEC1 using HMAC_SNOOP_NO_AFEU")
    Reported-by: Horia Geantă
    Signed-off-by: Christophe Leroy
    Tested-by: Horia Geantă
    Signed-off-by: Herbert Xu
    [backported to 4.9.y, 4.14.y]
    Signed-off-by: Horia Geantă
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     

26 Apr, 2018

1 commit

  • [ Upstream commit 980b4c95e78e4113cb7b9f430f121dab1c814b6c ]

    Since CRYPTO_SHA384 does not exists, Kconfig should not select it.
    Anyway, all SHA384 stuff is in CRYPTO_SHA512 which is already selected.

    Fixes: a21eb94fc4d3i ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
    Signed-off-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Corentin LABBE
     

08 Apr, 2018

3 commits

  • commit 0a9eb80e643064266868bd2fb2cd608e669309b0 upstream.

    rsa-pkcs1pad uses a value returned from a RSA implementation max_size
    callback as a size of an input buffer passed to the RSA implementation for
    encrypt and sign operations.

    CCP RSA implementation uses a hardware input buffer which size depends only
    on the current RSA key length, so it should return this key length in
    the max_size callback, too.
    This also matches what the kernel software RSA implementation does.

    Previously, the value returned from this callback was always the maximum
    RSA key size the CCP hardware supports.
    This resulted in this huge buffer being passed by rsa-pkcs1pad to CCP even
    for smaller key sizes and then in a buffer overflow when ccp_run_rsa_cmd()
    tried to copy this large input buffer into a RSA key length-sized hardware
    input buffer.

    Signed-off-by: Maciej S. Szmigiero
    Fixes: ceeec0afd684 ("crypto: ccp - Add support for RSA on the CCP")
    Cc: stable@vger.kernel.org
    Acked-by: Gary R Hook
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Maciej S. Szmigiero
     
  • commit b85149f6f5d5a9279f29a73b2e95342f4d465e73 upstream.

    caam_remove already removes the debugfs entry, so we need to remove the one
    immediately before calling caam_remove.

    This fix a NULL dereference at error paths is caam_probe fail.

    Fixes: 67c2315def06 ("crypto: caam - add Queue Interface (QI) backend support")

    Tested-by: Ryan Harkin
    Cc: "Horia Geantă"
    Cc: Aymen Sghaier
    Cc: Fabio Estevam
    Cc: Peng Fan
    Cc: "David S. Miller"
    Cc: Lukas Auer
    Cc: # 4.12+
    Reviewed-by: Horia Geantă
    Signed-off-by: Rui Miguel Silva
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Rui Miguel Silva
     
  • commit f962eb46e7a9b98a58d2483f5eb216e738fec732 upstream.

    In this driver the clock is got but never put when the driver is removed
    or if there is an error in the probe.

    Using the managed version of clk_get() allows to let the kernel take care
    of it.

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto
    engine driver")
    cc: stable@vger.kernel.org
    Signed-off-by: Gregory CLEMENT
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Gregory CLEMENT
     

24 Mar, 2018

1 commit

  • [ Upstream commit 6d6e71feb183aa588c849e20e7baa47cb162928a ]

    The IV size should not include the 32 bit counter. Because we had the
    IV size set as 16 the transform only worked when the IV input was zero
    padded.

    Fixes: a21eb94fc4d3 ("crypto: axis - add ARTPEC-6/7 crypto accelerator driver")
    Signed-off-by: Lars Persson
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Lars Persson
     

19 Mar, 2018

2 commits

  • [ Upstream commit 9db09e3bad65393dc23b0279beb7f3754d77065c ]

    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: eb9ba37dc15a ("crypto: caam/qi - handle large number of S/Gs case")
    Signed-off-by: Horia Geantă
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Horia Geantă
     
  • [ Upstream commit 87aae50af730a28dc1d8846d86dca5e9aa724a9f ]

    The object info is being leaked on an error return path, fix this
    by setting ret to -ENOMEM and exiting via the request_cleanup path
    that will free info.

    Detected by CoverityScan, CID#1408439 ("Resource Leak")

    Fixes: c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT")
    Signed-off-by: Colin Ian King
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Colin Ian King
     

03 Mar, 2018

3 commits

  • [ Upstream commit 7cad2fabd5691dbb17762877d4e7f236fe4bc181 ]

    This patch makes use of the SKCIPHER_REQUEST_ON_STACK and
    AHASH_REQUEST_ON_STACK helpers to allocate enough memory to contain both
    the crypto request structures and their embedded context (__ctx).

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Suggested-by: Ofer Heifetz
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Ténart
     
  • [ Upstream commit 0a02dcca126280595950f3ea809f77c9cb0a235c ]

    This patch frees the request private data even if its handling failed,
    as it would never be freed otherwise.

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Suggested-by: Ofer Heifetz
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Antoine Ténart
     
  • [ Upstream commit 1eb7b40386c97f6c4d1c62931bf306f4535a4bd6 ]

    When an invalidation request is needed we currently override the context
    .send and .handle_result helpers. This is wrong as under high load other
    requests can already be queued and overriding the context helpers will
    make them execute the wrong .send and .handle_result functions.

    This commit fixes this by adding a needs_inv flag in the request to
    choose the action to perform when sending requests or handling their
    results. This flag will be set when needed (i.e. when the context flag
    will be set).

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Signed-off-by: Ofer Heifetz
    [Antoine: commit message, and removed non related changes from the
    original commit]
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu

    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ofer Heifetz
     

25 Feb, 2018

2 commits

  • commit c927b080c67e3e97193c81fc1d27f4251bf4e036 upstream.

    In AES-ECB mode crypt is done with key only, so any use of IV
    can cause kernel Oops. Use IV only in AES-CBC and AES-CTR.

    Signed-off-by: Kamil Konieczny
    Reported-by: Anand Moon
    Reviewed-by: Krzysztof Kozlowski
    Tested-by: Anand Moon
    Cc: stable@vger.kernel.org # can be applied after commit 8f9702aad138
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Kamil Konieczny
     
  • commit 87a81dce53b1ea61acaeefa5191a0376a2d1d721 upstream.

    Performing the hash of an empty file leads to a kernel Oops

    [ 44.504600] Unable to handle kernel paging request for data at address 0x0000000c
    [ 44.512819] Faulting instruction address: 0xc02d2be8
    [ 44.524088] Oops: Kernel access of bad area, sig: 11 [#1]
    [ 44.529171] BE PREEMPT CMPC885
    [ 44.532232] CPU: 0 PID: 491 Comm: md5sum Not tainted 4.15.0-rc8-00211-g3a968610b6ea #81
    [ 44.540814] NIP: c02d2be8 LR: c02d2984 CTR: 00000000
    [ 44.545812] REGS: c6813c90 TRAP: 0300 Not tainted (4.15.0-rc8-00211-g3a968610b6ea)
    [ 44.554223] MSR: 00009032 CR: 48222822 XER: 20000000
    [ 44.560855] DAR: 0000000c DSISR: c0000000
    [ 44.560855] GPR00: c02d28fc c6813d40 c6828000 c646fa40 00000001 00000001 00000001 00000000
    [ 44.560855] GPR08: 0000004c 00000000 c000bfcc 00000000 28222822 100280d4 00000000 10020008
    [ 44.560855] GPR16: 00000000 00000020 00000000 00000000 10024008 00000000 c646f9f0 c6179a10
    [ 44.560855] GPR24: 00000000 00000001 c62f0018 c6179a10 00000000 c6367a30 c62f0000 c646f9c0
    [ 44.598542] NIP [c02d2be8] ahash_process_req+0x448/0x700
    [ 44.603751] LR [c02d2984] ahash_process_req+0x1e4/0x700
    [ 44.608868] Call Trace:
    [ 44.611329] [c6813d40] [c02d28fc] ahash_process_req+0x15c/0x700 (unreliable)
    [ 44.618302] [c6813d90] [c02060c4] hash_recvmsg+0x11c/0x210
    [ 44.623716] [c6813db0] [c0331354] ___sys_recvmsg+0x98/0x138
    [ 44.629226] [c6813eb0] [c03332c0] __sys_recvmsg+0x40/0x84
    [ 44.634562] [c6813f10] [c03336c0] SyS_socketcall+0xb8/0x1d4
    [ 44.640073] [c6813f40] [c000d1ac] ret_from_syscall+0x0/0x38
    [ 44.645530] Instruction dump:
    [ 44.648465] 38c00001 7f63db78 4e800421 7c791b78 54690ffe 0f090000 80ff0190 2f870000
    [ 44.656122] 40befe50 2f990001 409e0210 813f01bc b39e003a 7d29c214 913e003c

    This patch fixes that Oops by checking if src is NULL.

    Fixes: 6a1e8d14156d4 ("crypto: talitos - making mapping helpers more generic")
    Cc:
    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     

22 Feb, 2018

3 commits

  • commit b399151cb48db30ad1e0e93dd40d68c6d007b637 upstream.

    x86_mask is a confusing name which is hard to associate with the
    processor's stepping.

    Additionally, correct an indent issue in lib/cpu.c.

    Signed-off-by: Jia Zhang
    [ Updated it to more recent kernels. ]
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: bp@alien8.de
    Cc: tony.luck@intel.com
    Link: http://lkml.kernel.org/r/1514771530-70829-1-git-send-email-qianyue.zj@alibaba-inc.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Jia Zhang
     
  • commit 2e7d1d61ea6c0f1c4da5eb82cafac750d55637a7 upstream.

    Lockdep detects a possible deadlock in sun4i_ss_prng_generate() and
    throws an "inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage" warning.
    Disabling softirqs to fix this.

    Fixes: b8ae5c7387ad ("crypto: sun4i-ss - support the Security System PRNG")
    Signed-off-by: Artem Savkov
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Artem Savkov
     
  • commit dd78c832ffaf86eb6434e56de4bc3bc31f03f771 upstream.

    According to crypto/rng.h generate function should return 0 on success
    and < 0 on error.

    Fixes: b8ae5c7387ad ("crypto: sun4i-ss - support the Security System PRNG")
    Signed-off-by: Artem Savkov
    Acked-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Artem Savkov
     

17 Feb, 2018

2 commits

  • commit 225ece3e7dad4cfc44cca38ce7a3a80f255ea8f1 upstream.

    In case DECO0 cannot be acquired - i.e. run_descriptor_deco0() fails
    with -ENODEV, caam_probe() enters an endless loop:

    run_descriptor_deco0
    ret -ENODEV
    -> instantiate_rng
    -ENODEV, overwritten by -EAGAIN
    ret -EAGAIN
    -> caam_probe
    -EAGAIN results in endless loop

    It turns out the error path in instantiate_rng() is incorrect,
    the checks are done in the wrong order.

    Fixes: 1005bccd7a4a6 ("crypto: caam - enable instantiation of all RNG4 state handles")
    Reported-by: Bryan O'Donoghue
    Suggested-by: Auer Lukas
    Signed-off-by: Horia Geantă
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Horia Geantă
     
  • commit a208fa8f33031b9e0aba44c7d1b7e68eb0cbd29e upstream.

    We need to consistently enforce that keyed hashes cannot be used without
    setting the key. To do this we need a reliable way to determine whether
    a given hash algorithm is keyed or not. AF_ALG currently does this by
    checking for the presence of a ->setkey() method. However, this is
    actually slightly broken because the CRC-32 algorithms implement
    ->setkey() but can also be used without a key. (The CRC-32 "key" is not
    actually a cryptographic key but rather represents the initial state.
    If not overridden, then a default initial state is used.)

    Prepare to fix this by introducing a flag CRYPTO_ALG_OPTIONAL_KEY which
    indicates that the algorithm has a ->setkey() method, but it is not
    required to be called. Then set it on all the CRC-32 algorithms.

    The same also applies to the Adler-32 implementation in Lustre.

    Also, the cryptd and mcryptd templates have to pass through the flag
    from their underlying algorithm.

    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Eric Biggers
     

04 Feb, 2018

2 commits

  • commit c957f8b3e2e54b29f53ef69decc87bbc858c9b58 upstream.

    This patch adds a parameter in the SafeXcel ahash request structure to
    keep track of the number of SG entries mapped. This allows not to call
    dma_unmap_sg() when dma_map_sg() wasn't called in the first place. This
    also removes a warning when the debugging of the DMA-API is enabled in
    the kernel configuration: "DMA-API: device driver tries to free DMA
    memory it has not allocated".

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     
  • commit 809778e02cd45d0625439fee67688f655627bb3c upstream.

    This patch fixes the hash support in the SafeXcel driver when the update
    size is a multiple of a block size, and when a final call is made just
    after with a size of 0. In such cases the driver should cache the last
    block from the update to avoid handling 0 length data on the final call
    (that's a hardware limitation).

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Signed-off-by: Antoine Tenart
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Antoine Tenart
     

10 Jan, 2018

2 commits

  • commit d042566d8c704e1ecec370300545d4a409222e39 upstream.

    Without the gf128mul library support, we can run into a link
    error:

    drivers/crypto/chelsio/chcr_algo.o: In function `chcr_update_tweak':
    chcr_algo.c:(.text+0x7e0): undefined reference to `gf128mul_x8_ble'

    This adds a Kconfig select statement for it, next to the ones we
    already have.

    Fixes: b8fd1f4170e7 ("crypto: chcr - Add ctr mode and process large sg entries for cipher")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     
  • commit 203f45003a3d03eea8fa28d74cfc74c354416fdb upstream.

    queue_cache_init is first called for the Control Word Queue
    (n2_crypto_probe). At that time, queue_cache[0] is NULL and a new
    kmem_cache will be allocated. If the subsequent n2_register_algs call
    fails, the kmem_cache will be released in queue_cache_destroy, but
    queue_cache_init[0] is not set back to NULL.

    So when the Module Arithmetic Unit gets probed next (n2_mau_probe),
    queue_cache_init will not allocate a kmem_cache again, but leave it
    as its bogus value, causing a BUG() to trigger when queue_cache[0] is
    eventually passed to kmem_cache_zalloc:

    n2_crypto: Found N2CP at /virtual-devices@100/n2cp@7
    n2_crypto: Registered NCS HVAPI version 2.0
    called queue_cache_init
    n2_crypto: md5 alg registration failed
    n2cp f028687c: /virtual-devices@100/n2cp@7: Unable to register algorithms.
    called queue_cache_destroy
    n2cp: probe of f028687c failed with error -22
    n2_crypto: Found NCP at /virtual-devices@100/ncp@6
    n2_crypto: Registered NCS HVAPI version 2.0
    called queue_cache_init
    kernel BUG at mm/slab.c:2993!
    Call Trace:
    [0000000000604488] kmem_cache_alloc+0x1a8/0x1e0
    (inlined) kmem_cache_zalloc
    (inlined) new_queue
    (inlined) spu_queue_setup
    (inlined) handle_exec_unit
    [0000000010c61eb4] spu_mdesc_scan+0x1f4/0x460 [n2_crypto]
    [0000000010c62b80] n2_mau_probe+0x100/0x220 [n2_crypto]
    [000000000084b174] platform_drv_probe+0x34/0xc0

    Signed-off-by: Jan Engelhardt
    Acked-by: David S. Miller
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Jan Engelhardt
     

25 Dec, 2017

1 commit

  • [ Upstream commit 778f81d6cdb7d25360f082ac0384d5103f04eca5 ]

    If crypto4xx is used in conjunction with dm-crypt, the available
    ring buffer elements are not enough to handle the load properly.

    On an aes-cbc-essiv:sha256 encrypted swap partition the read
    performance is abyssal: (tested with hdparm -t)

    /dev/mapper/swap_crypt:
    Timing buffered disk reads: 14 MB in 3.68 seconds = 3.81 MB/sec

    The patch increases both PPC4XX_NUM_SD and PPC4XX_NUM_PD to 256.
    This improves the performance considerably:

    /dev/mapper/swap_crypt:
    Timing buffered disk reads: 104 MB in 3.03 seconds = 34.31 MB/sec

    Furthermore, PPC4XX_LAST_SD, PPC4XX_LAST_GD and PPC4XX_LAST_PD
    can be easily calculated from their respective PPC4XX_NUM_*
    constant.

    Signed-off-by: Christian Lamparter
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Christian Lamparter
     

14 Dec, 2017

6 commits

  • commit 70d355ccea899dad47dc22d3a4406998f55143fd upstream.

    ctr-aes-talitos test fails as follows on SEC2

    [ 0.837427] alg: skcipher: Test 1 failed (invalid result) on encryption for ctr-aes-talitos
    [ 0.845763] 00000000: 16 36 d5 ee 34 f8 06 25 d7 7f 8e 56 ca 88 43 45
    [ 0.852345] 00000010: f9 3f f7 17 2a b2 12 23 30 43 09 15 82 dd e1 97
    [ 0.858940] 00000020: a7 f7 32 b5 eb 25 06 13 9a ec f5 29 25 f8 4d 66
    [ 0.865366] 00000030: b0 03 5b 8e aa 9a 42 b6 19 33 8a e2 9d 65 96 95

    This patch fixes the descriptor type which is special for CTR AES

    Fixes: 5e75ae1b3cef6 ("crypto: talitos - add new crypto modes")
    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     
  • commit fbb22137c4d9bab536958b152d096fb3f98020ea upstream.

    sg_link_tbl_len shall be used instead of cryptlen, otherwise
    SECs which perform HW CICV verification will fail.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     
  • commit 6cda075aff67a1b9b5ba1b2818091dc939643b6c upstream.

    sha224 AEAD test fails with:

    [ 2.803125] talitos ff020000.crypto: DEUISR 0x00000000_00000000
    [ 2.808743] talitos ff020000.crypto: MDEUISR 0x80100000_00000000
    [ 2.814678] talitos ff020000.crypto: DESCBUF 0x20731f21_00000018
    [ 2.820616] talitos ff020000.crypto: DESCBUF 0x0628d64c_00000010
    [ 2.826554] talitos ff020000.crypto: DESCBUF 0x0631005c_00000018
    [ 2.832492] talitos ff020000.crypto: DESCBUF 0x0628d664_00000008
    [ 2.838430] talitos ff020000.crypto: DESCBUF 0x061b13a0_00000080
    [ 2.844369] talitos ff020000.crypto: DESCBUF 0x0631006c_00000080
    [ 2.850307] talitos ff020000.crypto: DESCBUF 0x0631006c_00000018
    [ 2.856245] talitos ff020000.crypto: DESCBUF 0x063100ec_00000000
    [ 2.884972] talitos ff020000.crypto: failed to reset channel 0
    [ 2.890503] talitos ff020000.crypto: done overflow, internal time out, or rngu error: ISR 0x20000000_00020000
    [ 2.900652] alg: aead: encryption failed on test 1 for authenc-hmac-sha224-cbc-3des-talitos: ret=22

    This is due to SHA224 not being supported by the HW. Allthough for
    hash we are able to init the hash context by SW, it is not
    possible for AEAD. Therefore SHA224 AEAD has to be deactivated.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     
  • commit f384cdc4faf350fdb6ad93c5f26952b9ba7c7566 upstream.

    Crypto manager test report the following failures:
    [ 3.061081] alg: skcipher: setkey failed on test 5 for ecb-des-talitos: flags=100
    [ 3.069342] alg: skcipher-ddst: setkey failed on test 5 for ecb-des-talitos: flags=100
    [ 3.077754] alg: skcipher-ddst: setkey failed on test 5 for ecb-des-talitos: flags=100

    This is due to setkey being expected to detect weak keys.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     
  • commit e04a61bebc5da1535b6f194b464295b8d558e2fc upstream.

    On SEC2, when using the old descriptors type (hmac snoop no afeu)
    for doing IPsec, the CICV out pointeur points out of the allocated
    memory.

    [ 2.502554] =============================================================================
    [ 2.510740] BUG dma-kmalloc-256 (Not tainted): Redzone overwritten
    [ 2.516907] -----------------------------------------------------------------------------
    [ 2.516907]
    [ 2.526535] Disabling lock debugging due to kernel taint
    [ 2.531845] INFO: 0xde858108-0xde85810b. First byte 0xf8 instead of 0xcc
    [ 2.538549] INFO: Allocated in 0x806181a9 age=0 cpu=0 pid=58
    [ 2.544229] __kmalloc+0x374/0x564
    [ 2.547649] talitos_edesc_alloc+0x17c/0x48c
    [ 2.551929] aead_edesc_alloc+0x80/0x154
    [ 2.555863] aead_encrypt+0x30/0xe0
    [ 2.559368] __test_aead+0x5a0/0x1f3c
    [ 2.563042] test_aead+0x2c/0x110
    [ 2.566371] alg_test_aead+0x5c/0xf4
    [ 2.569958] alg_test+0x1dc/0x5a0
    [ 2.573305] cryptomgr_test+0x50/0x70
    [ 2.576984] kthread+0xd8/0x134
    [ 2.580155] ret_from_kernel_thread+0x5c/0x64
    [ 2.584534] INFO: Freed in ipsec_esp_encrypt_done+0x130/0x240 age=6 cpu=0 pid=0
    [ 2.591839] ipsec_esp_encrypt_done+0x130/0x240
    [ 2.596395] flush_channel+0x1dc/0x488
    [ 2.600161] talitos2_done_4ch+0x30/0x200
    [ 2.604185] tasklet_action+0xa0/0x13c
    [ 2.607948] __do_softirq+0x148/0x6cc
    [ 2.611623] irq_exit+0xc0/0x124
    [ 2.614869] call_do_irq+0x24/0x3c
    [ 2.618292] do_IRQ+0x78/0x108
    [ 2.621369] ret_from_except+0x0/0x14
    [ 2.625055] finish_task_switch+0x58/0x350
    [ 2.629165] schedule+0x80/0x134
    [ 2.632409] schedule_preempt_disabled+0x38/0xc8
    [ 2.637042] cpu_startup_entry+0xe4/0x190
    [ 2.641074] start_kernel+0x3f4/0x408
    [ 2.644741] 0x3438
    [ 2.646857] INFO: Slab 0xdffbdb00 objects=9 used=1 fp=0xde8581c0 flags=0x0080
    [ 2.653978] INFO: Object 0xde858008 @offset=8 fp=0xca4395df
    [ 2.653978]
    [ 2.661032] Redzone de858000: cc cc cc cc cc cc cc cc ........
    [ 2.669029] Object de858008: 00 00 00 02 00 00 00 02 00 6b 6b 6b 1e 83 ea 28 .........kkk...(
    [ 2.677628] Object de858018: 00 00 00 70 1e 85 80 64 ff 73 1d 21 6b 6b 6b 6b ...p...d.s.!kkkk
    [ 2.686228] Object de858028: 00 20 00 00 1e 84 17 24 00 10 00 00 1e 85 70 00 . .....$......p.
    [ 2.694829] Object de858038: 00 18 00 00 1e 84 17 44 00 08 00 00 1e 83 ea 28 .......D.......(
    [ 2.703430] Object de858048: 00 80 00 00 1e 84 f0 00 00 80 00 00 1e 85 70 10 ..............p.
    [ 2.712030] Object de858058: 00 20 6b 00 1e 85 80 f4 6b 6b 6b 6b 00 80 02 00 . k.....kkkk....
    [ 2.720629] Object de858068: 1e 84 f0 00 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ....kkkkkkkkkkkk
    [ 2.729230] Object de858078: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.737830] Object de858088: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.746429] Object de858098: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.755029] Object de8580a8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.763628] Object de8580b8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.772229] Object de8580c8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.780829] Object de8580d8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
    [ 2.789430] Object de8580e8: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 73 b0 ea 9f kkkkkkkkkkkks...
    [ 2.798030] Object de8580f8: e8 18 80 d6 56 38 44 c0 db e3 4f 71 f7 ce d1 d3 ....V8D...Oq....
    [ 2.806629] Redzone de858108: f8 bd 3e 4f ..>O
    [ 2.814279] Padding de8581b0: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
    [ 2.822283] CPU: 0 PID: 0 Comm: swapper Tainted: G B 4.9.50-g995be12679 #179
    [ 2.831819] Call Trace:
    [ 2.834301] [dffefd20] [c01aa9a8] check_bytes_and_report+0x100/0x194 (unreliable)
    [ 2.841801] [dffefd50] [c01aac3c] check_object+0x200/0x530
    [ 2.847306] [dffefd80] [c01ae584] free_debug_processing+0x290/0x690
    [ 2.853585] [dffefde0] [c01aec8c] __slab_free+0x308/0x628
    [ 2.859000] [dffefe80] [c05057f4] ipsec_esp_encrypt_done+0x130/0x240
    [ 2.865378] [dffefeb0] [c05002c4] flush_channel+0x1dc/0x488
    [ 2.870968] [dffeff10] [c05007a8] talitos2_done_4ch+0x30/0x200
    [ 2.876814] [dffeff30] [c002fe38] tasklet_action+0xa0/0x13c
    [ 2.882399] [dffeff60] [c002f118] __do_softirq+0x148/0x6cc
    [ 2.887896] [dffeffd0] [c002f954] irq_exit+0xc0/0x124
    [ 2.892968] [dffefff0] [c0013adc] call_do_irq+0x24/0x3c
    [ 2.898213] [c0d4be00] [c000757c] do_IRQ+0x78/0x108
    [ 2.903113] [c0d4be30] [c0015c08] ret_from_except+0x0/0x14
    [ 2.908634] --- interrupt: 501 at finish_task_switch+0x70/0x350
    [ 2.908634] LR = finish_task_switch+0x58/0x350
    [ 2.919327] [c0d4bf20] [c085e1d4] schedule+0x80/0x134
    [ 2.924398] [c0d4bf50] [c085e2c0] schedule_preempt_disabled+0x38/0xc8
    [ 2.930853] [c0d4bf60] [c007f064] cpu_startup_entry+0xe4/0x190
    [ 2.936707] [c0d4bfb0] [c096c434] start_kernel+0x3f4/0x408
    [ 2.942198] [c0d4bff0] [00003438] 0x3438
    [ 2.946137] FIX dma-kmalloc-256: Restoring 0xde858108-0xde85810b=0xcc
    [ 2.946137]
    [ 2.954158] FIX dma-kmalloc-256: Object at 0xde858008 not freed

    This patch reworks the handling of the CICV out in order
    to properly handle all cases.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     
  • commit ec8c7d14acc0a477429d3a6fade5dab72c996c82 upstream.

    AEAD tests fail when destination SG list has more than 1 element.

    [ 2.058752] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-aes-talitos
    [ 2.066965] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
    00000010: c0 43 ff 74 c0 43 ff e0 de 83 d1 20 de 84 8e 54
    00000020: de 83 d7 c4
    [ 2.082138] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-aes-talitos
    [ 2.090435] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
    00000010: de 84 ea 58 c0 93 1a 24 de 84 e8 59 de 84 f1 20
    00000020: 00 00 00 00
    [ 2.105721] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-3des-talitos
    [ 2.114259] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
    00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
    00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
    00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
    00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
    00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
    00000090: c0 99 74 3c
    [ 2.166410] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-3des-talitos
    [ 2.174794] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
    00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
    00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
    00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
    00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
    00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
    00000090: c0 99 74 3c
    [ 2.226486] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
    [ 2.236459] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
    [ 2.247196] alg: aead: Test 1 failed on encryption for authenc-hmac-sha224-cbc-3des-talitos
    [ 2.255555] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
    00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
    00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
    00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
    00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
    00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
    00000090: c0 99 74 3c c0 96 e5 b8
    [ 2.309004] alg: aead: Test 1 failed on encryption for authenc-hmac-sha224-cbc-3des-talitos
    [ 2.317562] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
    00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
    00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
    00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
    00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
    00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
    00000090: c0 99 74 3c c0 96 e5 b8
    [ 2.370710] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-aes-talitos
    [ 2.379177] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    [ 2.397863] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-aes-talitos
    [ 2.406134] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    [ 2.424789] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-3des-talitos
    [ 2.433491] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
    00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
    00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
    00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
    00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
    00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
    00000090: c0 99 74 3c c0 96 e5 b8 c0 96 e9 20 c0 00 3d dc
    [ 2.488832] alg: aead: Test 1 failed on encryption for authenc-hmac-sha256-cbc-3des-talitos
    [ 2.497387] 00000000: 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72 73 74
    00000010: 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63 74 65
    00000020: 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65 65 72
    00000030: 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53 72 63
    00000040: 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20 63 65
    00000050: 65 72 73 74 54 20 6f 6f 4d 20 6e 61 20 79 65 53
    00000060: 72 63 74 65 20 73 6f 54 20 6f 61 4d 79 6e 53 20
    00000070: 63 65 65 72 73 74 54 20 6f 6f 4d 20 6e 61 0a 79
    00000080: c0 50 f1 ac c0 50 f3 38 c0 50 f3 94 c0 50 f5 30
    00000090: c0 99 74 3c c0 96 e5 b8 c0 96 e9 20 c0 00 3d dc

    This patch fixes that.

    Signed-off-by: Christophe Leroy
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    LEROY Christophe
     

21 Nov, 2017

1 commit

  • commit f0e2ce58f853634d7ad1a418a49bd5fbd556227c upstream.

    Add support to explicity ACK mailbox message
    because after sending message we can know
    the send status via error attribute of brcm_message.

    This is needed to support "txdone_ack" supported in
    mailbox controller driver.

    Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")
    Signed-off-by: Raveendra Padasalagi
    Reviewed-by: Anup Patel
    Reviewed-by: Scott Branden
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    raveendra padasalagi
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

07 Oct, 2017

1 commit

  • gcc warns that the length for the extra unaligned data in the hash
    function may be used unaligned. In theory this could happen if
    we pass a zero-length sg_list, or if sg_is_last() was never true:

    In file included from drivers/crypto/stm32/stm32-hash.c:23:
    drivers/crypto/stm32/stm32-hash.c: In function 'stm32_hash_one_request':
    include/uapi/linux/kernel.h:12:49: error: 'ncp' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))

    Neither of these can happen in practice, so the warning is harmless.

    However while trying to suppress the warning, I noticed multiple
    problems with that code:

    - On big-endian kernels, we byte-swap the data like we do for
    register accesses, however this is a data stream and almost
    certainly needs to use a single writesl() instead of series
    of writel() to give the correct hash.

    - If the length is not a multiple of four bytes, we skip the
    last word entirely, since we write the truncated length
    using stm32_hash_set_nblw().

    - If we change the code to round the length up rather than
    down, the last bytes contain stale data, so it needs some
    form of padding.

    This tries to address all four problems, by correctly
    initializing the length to zero, using endian-safe copy
    functions, adding zero-padding and passing the padded length.

    I have done no testing on this patch, so please review
    carefully and if possible test with an unaligned length
    and big-endian kernel builds.

    Fixes: 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Herbert Xu

    Arnd Bergmann