19 Oct, 2022

1 commit

  • Current DCP driver implementation doesn't support AES OTP CRYPTO_KEY.
    otp_unique_key & otp_crypto_key handles are generated by U-boot RNG driver
    and on each reboot cycle, device tree fix-up is done using RNG.

    OpenSSL application can input device tree fixed up 16 byte number for
    crypto operations.

    Tested on i.MX6ULL EVK with commands below.

    - Encrypt using UNIQUE_KEY:
    $ openssl aes-128-ecb -p -nosalt -nopad -K "$(hexdump -v -e '"" 1/1 "%02X"'\
    /proc/device-tree/soc/bus@2200000/crypto@2280000/otp_unique_key)" -in \
    openssl_test.txt -out my_encrypted_secret.bin

    - Decrypt using UNIQUE_KEY:
    $ openssl aes-128-ecb -d -p -nosalt -nopad -K "$(hexdump -v -e '"" 1/1 "%02X"'\
    /proc/device-tree/soc/bus@2200000/crypto@2280000/otp_unique_key)" -in \
    my_encrypted_secret.bin -out openssl_decrypt_test.txt

    - Encrypt using CRYPTO_KEY:
    $ openssl aes-128-ecb -p -nosalt -nopad -K "$(hexdump -v -e '"" 1/1 "%02X"'\
    /proc/device-tree/soc/bus@2200000/crypto@2280000/otp_crypto_key)" -in \
    openssl_test.txt -out my_encrypted_secret.bin

    - Decrypt using CRYPTO_KEY:
    $ openssl aes-128-ecb -d -p -nosalt -nopad -K "$(hexdump -v -e '"" 1/1 "%02X"'\
    /proc/device-tree/soc/bus@2200000/crypto@2280000/otp_crypto_key)" -in \
    my_encrypted_secret.bin -out openssl_decrypt_test.txt

    Signed-off-by: Kshitiz Varshney
    Reviewed by: Gaurav Jain

    Kshitiz Varshney
     

27 Sep, 2022

1 commit

  • This is the 5.15.70 stable release

    * tag 'v5.15.70': (2444 commits)
    Linux 5.15.70
    ALSA: hda/sigmatel: Fix unused variable warning for beep power change
    cgroup: Add missing cpus_read_lock() to cgroup_attach_task_all()
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6ul.dtsi
    arch/arm/mm/mmu.c
    arch/arm64/boot/dts/freescale/imx8mp-evk.dts
    drivers/gpu/drm/imx/dcss/dcss-kms.c
    drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
    drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.h
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
    drivers/soc/fsl/Kconfig
    drivers/soc/imx/gpcv2.c
    drivers/usb/dwc3/host.c
    net/dsa/slave.c
    sound/soc/fsl/imx-card.c

    Jason Liu
     

17 Aug, 2022

10 commits

  • [ Upstream commit 45f5d0176d8426cc1ab0bab84fbd8ef5c57526c6 ]

    The authentication algorithm supports a maximum of 128-byte keys.
    The allocated key memory is insufficient.

    Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2")
    Signed-off-by: Kai Ye
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Kai Ye
     
  • [ Upstream commit fa4d57b85786ec0e16565c75a51c208834b0c24d ]

    Without MODULE_DEVICE_TABLE, crypto_safexcel.ko module is not automatically
    loaded on platforms where inside-secure crypto HW is specified in device
    tree (e.g. Armada 3720). So add missing MODULE_DEVICE_TABLE for of.

    Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
    Signed-off-by: Pali Rohár
    Acked-by: Marek Behún
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Pali Rohár
     
  • [ Upstream commit 98dfa9343f37bdd4112966292751e3a93aaf2e56 ]

    The hpre encryption driver may be used to encrypt and decrypt packets
    during the rx softirq, it is not allowed to use GFP_KERNEL.

    Fixes: c8b4b477079d ("crypto: hisilicon - add HiSilicon HPRE accelerator")
    Signed-off-by: Zhengchao Shao
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Zhengchao Shao
     
  • [ Upstream commit 68740ab505431f268dc1ee26a54b871e75f0ddaa ]

    When kunpeng916 encryption driver is used to deencrypt and decrypt
    packets during the softirq, it is not allowed to use mutex lock.

    Fixes: 915e4e8413da ("crypto: hisilicon - SEC security accelerator driver")
    Signed-off-by: Zhengchao Shao
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Zhengchao Shao
     
  • [ Upstream commit 02884a4f12de11f54d4ca67a07dd1f111d96fdbd ]

    When kunpeng920 encryption driver is used to deencrypt and decrypt
    packets during the softirq, it is not allowed to use mutex lock. The
    kernel will report the following error:

    BUG: scheduling while atomic: swapper/57/0/0x00000300
    Call trace:
    dump_backtrace+0x0/0x1e4
    show_stack+0x20/0x2c
    dump_stack+0xd8/0x140
    __schedule_bug+0x68/0x80
    __schedule+0x728/0x840
    schedule+0x50/0xe0
    schedule_preempt_disabled+0x18/0x24
    __mutex_lock.constprop.0+0x594/0x5dc
    __mutex_lock_slowpath+0x1c/0x30
    mutex_lock+0x50/0x60
    sec_request_init+0x8c/0x1a0 [hisi_sec2]
    sec_process+0x28/0x1ac [hisi_sec2]
    sec_skcipher_crypto+0xf4/0x1d4 [hisi_sec2]
    sec_skcipher_encrypt+0x1c/0x30 [hisi_sec2]
    crypto_skcipher_encrypt+0x2c/0x40
    crypto_authenc_encrypt+0xc8/0xfc [authenc]
    crypto_aead_encrypt+0x2c/0x40
    echainiv_encrypt+0x144/0x1a0 [echainiv]
    crypto_aead_encrypt+0x2c/0x40
    esp_output_tail+0x348/0x5c0 [esp4]
    esp_output+0x120/0x19c [esp4]
    xfrm_output_one+0x25c/0x4d4
    xfrm_output_resume+0x6c/0x1fc
    xfrm_output+0xac/0x3c0
    xfrm4_output+0x64/0x130
    ip_build_and_send_pkt+0x158/0x20c
    tcp_v4_send_synack+0xdc/0x1f0
    tcp_conn_request+0x7d0/0x994
    tcp_v4_conn_request+0x58/0x6c
    tcp_v6_conn_request+0xf0/0x100
    tcp_rcv_state_process+0x1cc/0xd60
    tcp_v4_do_rcv+0x10c/0x250
    tcp_v4_rcv+0xfc4/0x10a4
    ip_protocol_deliver_rcu+0xf4/0x200
    ip_local_deliver_finish+0x58/0x70
    ip_local_deliver+0x68/0x120
    ip_sublist_rcv_finish+0x70/0x94
    ip_list_rcv_finish.constprop.0+0x17c/0x1d0
    ip_sublist_rcv+0x40/0xb0
    ip_list_rcv+0x140/0x1dc
    __netif_receive_skb_list_core+0x154/0x28c
    __netif_receive_skb_list+0x120/0x1a0
    netif_receive_skb_list_internal+0xe4/0x1f0
    napi_complete_done+0x70/0x1f0
    gro_cell_poll+0x9c/0xb0
    napi_poll+0xcc/0x264
    net_rx_action+0xd4/0x21c
    __do_softirq+0x130/0x358
    irq_exit+0x11c/0x13c
    __handle_domain_irq+0x88/0xf0
    gic_handle_irq+0x78/0x2c0
    el1_irq+0xb8/0x140
    arch_cpu_idle+0x18/0x40
    default_idle_call+0x5c/0x1c0
    cpuidle_idle_call+0x174/0x1b0
    do_idle+0xc8/0x160
    cpu_startup_entry+0x30/0x11c
    secondary_start_kernel+0x158/0x1e4
    softirq: huh, entered softirq 3 NET_RX 0000000093774ee4 with
    preempt_count 00000100, exited with fffffe00?

    Fixes: 416d82204df4 ("crypto: hisilicon - add HiSilicon SEC V2 driver")
    Signed-off-by: Zhengchao Shao
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Zhengchao Shao
     
  • [ Upstream commit 1b05ece0c931536c0a38a9385e243a7962e933f6 ]

    On shutdown, each CCP device instance performs shutdown processing.
    However, __sev_platform_shutdown_locked() uses the controlling psp
    structure to obtain the pointer to the sev_device structure. However,
    during driver initialization, it is possible that an error can be received
    from the firmware that results in the sev_data pointer being cleared from
    the controlling psp structure. The __sev_platform_shutdown_locked()
    function does not check for this situation and will segfault.

    While not common, this scenario should be accounted for. Add a check for a
    NULL sev_device structure before attempting to use it.

    Fixes: 5441a07a127f ("crypto: ccp - shutdown SEV firmware on kexec")
    Signed-off-by: Tom Lendacky
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Tom Lendacky
     
  • [ Upstream commit d61a7b3decf7f0cf4121a7204303deefd2c7151b ]

    There is no i decrement in while (i >= 0) loop.

    Found by Linux Verification Center (linuxtesting.org) with SVACE.

    Signed-off-by: Alexey Khoroshilov
    Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
    Acked-by: Corentin Labbe
    Tested-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Alexey Khoroshilov
     
  • [ Upstream commit d2765e1b9ac4b2d5a5d5bf17f468c9b3566c3770 ]

    These failure paths should return -ENOMEM. Currently they return
    success.

    Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV")
    Fixes: 8eec4563f152 ("crypto: sun8i-ss - do not allocate memory when handling hash requests")
    Signed-off-by: Dan Carpenter
    Acked-by: Corentin Labbe
    Tested-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Dan Carpenter
     
  • [ Upstream commit 8eec4563f152981a441693fc97c5459843dc5e6e ]

    Instead of allocate memory on each requests, it is easier to
    pre-allocate buffers.
    This made error path easier.

    Signed-off-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Corentin Labbe
     
  • commit 13dc15a3f5fd7f884e4bfa8c011a0ae868df12ae upstream.

    For some sev ioctl interfaces, input may be passed that is less than or
    equal to SEV_FW_BLOB_MAX_SIZE, but larger than the data that PSP
    firmware returns. In this case, kmalloc will allocate memory that is the
    size of the input rather than the size of the data. Since PSP firmware
    doesn't fully overwrite the buffer, the sev ioctl interfaces with the
    issue may return uninitialized slab memory.

    Currently, all of the ioctl interfaces in the ccp driver are safe, but
    to prevent future problems, change all ioctl interfaces that allocate
    memory with kmalloc to use kzalloc and memset the data buffer to zero
    in sev_ioctl_do_platform_status.

    Fixes: 38103671aad3 ("crypto: ccp: Use the stack and common buffer for status commands")
    Fixes: e799035609e15 ("crypto: ccp: Implement SEV_PEK_CSR ioctl command")
    Fixes: 76a2b524a4b1d ("crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl command")
    Fixes: d6112ea0cb344 ("crypto: ccp - introduce SEV_GET_ID2 command")
    Cc: stable@vger.kernel.org
    Reported-by: Andy Nguyen
    Suggested-by: David Rientjes
    Suggested-by: Peter Gonda
    Signed-off-by: John Allen
    Reviewed-by: Peter Gonda
    Acked-by: David Rientjes
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    John Allen
     

01 Aug, 2022

1 commit

  • - Since, soc_device_attribute will be probed later as part of
    EdgeLock Enclave kernel driver.
    - If the caam driver probed earlier, then returning -EPROBE_DEFER is
    needed after calling soc_device_match() in the file:
    "drivers/crypto/caam/ctrl.c".
    - As for i.MX8ULP, if soc_device_match returning NULL, it can be
    considered that the EdgeLock Enclave kernel driver has not been
    probed yet, so it returns -EPROBE_DEFER directly.

    Signed-off-by: Pankaj Gupta
    Reviewed-by: Dong Aisheng
    Reviewed-by: Horia Geanta
    Acked-by: Peng Fan

    Pankaj Gupta
     

29 Jul, 2022

10 commits

  • [ Upstream commit d09144745959bf7852ccafd73243dd7d1eaeb163 ]

    Re-enable the registration of algorithms after fixes to (1) use
    pre-allocated buffers in the datapath and (2) support the
    CRYPTO_TFM_REQ_MAY_BACKLOG flag.

    This reverts commit 8893d27ffcaf6ec6267038a177cb87bcde4dd3de.

    Cc: stable@vger.kernel.org
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Marco Chiappero
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 2acbb8771f6ac82422886e63832ee7a0f4b1635b ]

    Reject requests with a source buffer that is bigger than the size of the
    key. This is to prevent a possible integer underflow that might happen
    when copying the source scatterlist into a linear buffer.

    Cc: stable@vger.kernel.org
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 9714061423b8b24b8afb31b8eb4df977c63f19c4 ]

    Reject requests with a source buffer that is bigger than the size of the
    key. This is to prevent a possible integer underflow that might happen
    when copying the source scatterlist into a linear buffer.

    Cc: stable@vger.kernel.org
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 029aa4624a7fe35233bdd3d1354dc7be260380bf ]

    The functions qat_dh_compute_value() allocates memory with
    dma_alloc_coherent() if the source or the destination buffers are made
    of multiple flat buffers or of a size that is not compatible with the
    hardware.
    This memory is then freed with dma_free_coherent() in the context of a
    tasklet invoked to handle the response for the corresponding request.

    According to Documentation/core-api/dma-api-howto.rst, the function
    dma_free_coherent() cannot be called in an interrupt context.

    Replace allocations with dma_alloc_coherent() in the function
    qat_dh_compute_value() with kmalloc() + dma_map_single().

    Cc: stable@vger.kernel.org
    Fixes: c9839143ebbf ("crypto: qat - Add DH support")
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 3dfaf0071ed74d7a9c6b3c9ea4df7a6f8e423c2a ]

    After commit f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP"), if
    the algorithms are enabled, the driver crashes with a BUG_ON while
    executing vunmap() in the context of a tasklet. This is due to the fact
    that the function dma_free_coherent() cannot be called in an interrupt
    context (see Documentation/core-api/dma-api-howto.rst).

    The functions qat_rsa_enc() and qat_rsa_dec() allocate memory with
    dma_alloc_coherent() if the source or the destination buffers are made
    of multiple flat buffers or of a size that is not compatible with the
    hardware.
    This memory is then freed with dma_free_coherent() in the context of a
    tasklet invoked to handle the response for the corresponding request.

    Replace allocations with dma_alloc_coherent() in the functions
    qat_rsa_enc() and qat_rsa_dec() with kmalloc() + dma_map_single().

    Cc: stable@vger.kernel.org
    Fixes: a990532023b9 ("crypto: qat - Add support for RSA algorithm")
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 80a52e1ee7757b742f96bfb0d58f0c14eb6583d0 ]

    When an RSA key represented in form 2 (as defined in PKCS #1 V2.1) is
    used, some components of the private key persist even after the TFM is
    released.
    Replace the explicit calls to free the buffers in qat_rsa_exit_tfm()
    with a call to qat_rsa_clear_ctx() which frees all buffers referenced in
    the TFM context.

    Cc: stable@vger.kernel.org
    Fixes: 879f77e9071f ("crypto: qat - Add RSA CRT mode")
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 38682383973280e5be2802ba8a8d4a636d36cb19 ]

    The implementations of the crypto algorithms (aead, skcipher, etc) in
    the QAT driver do not properly support requests with the
    CRYPTO_TFM_REQ_MAY_BACKLOG flag set. If the HW queue is full, the driver
    returns -EBUSY but does not enqueue the request. This can result in
    applications like dm-crypt waiting indefinitely for the completion of a
    request that was never submitted to the hardware.

    Fix this by adding a software backlog queue: if the ring buffer is more
    than eighty percent full, then the request is enqueued to a backlog
    list and the error code -EBUSY is returned back to the caller.
    Requests in the backlog queue are resubmitted at a later time, in the
    context of the callback of a previously submitted request.
    The request for which -EBUSY is returned is then marked as -EINPROGRESS
    once submitted to the HW queues.

    The submission loop inside the function qat_alg_send_message() has been
    modified to decide which submission policy to use based on the request
    flags. If the request does not have the CRYPTO_TFM_REQ_MAY_BACKLOG set,
    the previous behaviour has been preserved.

    Based on a patch by
    Vishnu Das Ramachandran

    Cc: stable@vger.kernel.org
    Fixes: d370cec32194 ("crypto: qat - Intel(R) QAT crypto interface")
    Reported-by: Mikulas Patocka
    Reported-by: Kyle Sanderson
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Marco Chiappero
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit af88d3c109aa5edfaa11c9a26d9c0ff21ddf501c ]

    All the algorithms in qat_algs.c and qat_asym_algs.c use the same
    pattern to submit messages to the HW queues. Move the submission loop
    to a new function, qat_alg_send_message(), and share it between the
    symmetric and the asymmetric algorithms.

    As part of this rework, since the number of retries before returning an
    error is inconsistent between the symmetric and asymmetric
    implementations, set it to a value that works for both (i.e. 20, was 10
    in qat_algs.c and 100 in qat_asym_algs.c)

    In addition fix the return code reported when the HW queues are full.
    In that case return -ENOSPC instead of -EBUSY.

    Including stable in CC since (1) the error code returned if the HW queues
    are full is incorrect and (2) to facilitate the backport of the next fix
    "crypto: qat - add backlog mechanism".

    Cc: stable@vger.kernel.org
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Marco Chiappero
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit e0831e7af4e03f2715de102e18e9179ec0a81562 ]

    In order to do DMAs, the QAT device requires that the scatterlist
    structures are mapped and translated into a format that the firmware can
    understand. This is defined as the composition of a scatter gather list
    (SGL) descriptor header, the struct qat_alg_buf_list, plus a variable
    number of flat buffer descriptors, the struct qat_alg_buf.

    The allocation and mapping of these data structures is done each time a
    request is received from the skcipher and aead APIs.
    In an OOM situation, this behaviour might lead to a dead-lock if an
    allocation fails.

    Based on the conversation in [1], increase the size of the aead and
    skcipher request contexts to include an SGL descriptor that can handle
    a maximum of 4 flat buffers.
    If requests exceed 4 entries buffers, memory is allocated dynamically.

    [1] https://lore.kernel.org/linux-crypto/20200722072932.GA27544@gondor.apana.org.au/

    Cc: stable@vger.kernel.org
    Fixes: d370cec32194 ("crypto: qat - Intel(R) QAT crypto interface")
    Reported-by: Mikulas Patocka
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Marco Chiappero
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 1731160ff7c7bbb11bb1aacb14dd25e18d522779 ]

    Set to zero the context buffers containing the DH key before they are
    freed.
    This is a defense in depth measure that avoids keys to be recovered from
    memory in case the system is compromised between the free of the buffer
    and when that area of memory (containing keys) gets overwritten.

    Cc: stable@vger.kernel.org
    Fixes: c9839143ebbf ("crypto: qat - Add DH support")
    Signed-off-by: Giovanni Cabiddu
    Reviewed-by: Adam Guerin
    Reviewed-by: Wojciech Ziemba
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     

30 Jun, 2022

2 commits

  • This is the 5.15.50 stable release

    * tag 'v5.15.50': (1395 commits)
    Linux 5.15.50
    arm64: mm: Don't invalidate FROM_DEVICE buffers at start of DMA transfer
    serial: core: Initialize rs485 RTS polarity already on probe
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    drivers/bus/fsl-mc/fsl-mc-bus.c
    drivers/crypto/caam/ctrl.c
    drivers/pci/controller/dwc/pci-imx6.c
    drivers/spi/spi-fsl-qspi.c
    drivers/tty/serial/fsl_lpuart.c
    include/uapi/linux/dma-buf.h

    Jason Liu
     
  • This is the 5.15.41 stable release

    * tag 'v5.15.41': (1977 commits)
    Linux 5.15.41
    usb: gadget: uvc: allow for application to cleanly shutdown
    usb: gadget: uvc: rename function to be more consistent
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi
    arch/arm64/configs/defconfig
    drivers/clk/imx/clk-imx8qxp-lpcg.c
    drivers/dma/imx-sdma.c
    drivers/gpu/drm/bridge/nwl-dsi.c
    drivers/mailbox/imx-mailbox.c
    drivers/net/phy/at803x.c
    drivers/tty/serial/fsl_lpuart.c
    security/keys/trusted-keys/trusted_core.c

    Jason Liu
     

09 Jun, 2022

9 commits

  • [ Upstream commit c149e4763d28bb4c0e5daae8a59f2c74e889f407 ]

    sun8i-ss does not handle well the possible zero sized sg.

    Fixes: d9b45418a917 ("crypto: sun8i-ss - support hash algorithms")
    Signed-off-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Corentin Labbe
     
  • [ Upstream commit 359e893e8af456be2fefabe851716237df289cbf ]

    sun8i-ss fail handling IVs when doing decryption of multiple SGs in-place.
    It should backup the last block of each SG source for using it later as
    IVs.
    In the same time remove allocation on requests path for storing all
    IVs.

    Fixes: f08fcced6d00 ("crypto: allwinner - Add sun8i-ss cryptographic offloader")
    Signed-off-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Corentin Labbe
     
  • [ Upstream commit 4ffa1763622ae5752961499588f3f8874315f974 ]

    The DES3 ECB has an IV size set but ECB does not need one.

    Fixes: 4ada483978237 ("crypto: marvell/cesa - add Triple-DES support")
    Signed-off-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Corentin Labbe
     
  • [ Upstream commit 0eaa51543273fd0f4ba9bea83638f7033436e5eb ]

    The capability detection logic clears bits for the features that are
    disabled in a certain SKU. For example, if the bit associate to
    compression is not present in the LEGFUSE register, the correspondent
    bit is cleared in the capability mask.
    This change adds the compression capability to the mask as this was
    missing in the commit that enhanced the capability detection logic.

    Fixes: cfe4894eccdc ("crypto: qat - set COMPRESSION capability for QAT GEN2")
    Signed-off-by: Giovanni Cabiddu
    Signed-off-by: Marco Chiappero
    Reviewed-by: Marco Chiappero
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 6a23804cb8bcb85c6998bf193d94d4036db26f51 ]

    Set the CIPHER capability for QAT DH895XCC devices if the hardware supports
    it. This is done if both the CIPHER and the AUTHENTICATION engines are
    available on the device.

    Fixes: ad1332aa67ec ("crypto: qat - add support for capability detection")
    Signed-off-by: Giovanni Cabiddu
    Signed-off-by: Marco Chiappero
    Reviewed-by: Marco Chiappero
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit cfe4894eccdc7fa5cd35bf34e918614d06ecce38 ]

    Enhance the device capability detection for QAT GEN2 devices to detect if
    a device supports the compression service.

    This is done by checking both the fuse and the strap registers for c62x
    and c3xxx and only the fuse register for dh895xcc.

    Signed-off-by: Giovanni Cabiddu
    Signed-off-by: Marco Chiappero
    Reviewed-by: Fiona Trahe
    Reviewed-by: Marco Chiappero
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit 547bde7bd4ecd78f36f98744e6c9a0999e52da5a ]

    Set the CIPHER capability for QAT GEN2 devices if the hardware supports
    it. This is done if both the CIPHER and the AUTHENTICATION engines are
    available on the device.

    Signed-off-by: Giovanni Cabiddu
    Signed-off-by: Marco Chiappero
    Reviewed-by: Fiona Trahe
    Reviewed-by: Marco Chiappero
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Giovanni Cabiddu
     
  • [ Upstream commit c127d130f6d59fa81701f6b04023cf7cd1972fb3 ]

    In init_winctx_regs(), __pa() is called on winctx->rx_fifo and this
    function is called to initialize registers for receive and fault
    windows. But the real address is passed in winctx->rx_fifo for
    receive windows and the virtual address for fault windows which
    causes errors with DEBUG_VIRTUAL enabled. Fixes this issue by
    assigning only real address to rx_fifo in vas_rx_win_attr struct
    for both receive and fault windows.

    Reported-by: Michael Ellerman
    Signed-off-by: Haren Myneni
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/338e958c7ab8f3b266fa794a1f80f99b9671829e.camel@linux.ibm.com
    Signed-off-by: Sasha Levin

    Haren Myneni
     
  • [ Upstream commit a260436c98171cd825955a84a7f6e62bc8f4f00d ]

    Use a fine grained specification of DMA mapping directions
    in certain cases, allowing both a more optimized operation
    as well as shushing out a harmless, though persky
    dma-debug warning.

    Signed-off-by: Gilad Ben-Yossef
    Reported-by: Corentin Labbe
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Gilad Ben-Yossef
     

06 Jun, 2022

1 commit

  • commit 4ee4cdad368a26de3967f2975806a9ee2fa245df upstream.

    Since commit 358ba762d9f1 ("crypto: caam - enable prediction resistance
    in HRWNG") the following CAAM errors can be seen on i.MX6SX:

    caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error
    hwrng: no data available

    This error is due to an incorrect entropy delay for i.MX6SX.

    Fix it by increasing the minimum entropy delay for i.MX6SX
    as done in U-Boot:
    https://patchwork.ozlabs.org/project/uboot/patch/20220415111049.2565744-1-gaurav.jain@nxp.com/

    As explained in the U-Boot patch:

    "RNG self tests are run to determine the correct entropy delay.
    Such tests are executed with different voltages and temperatures to identify
    the worst case value for the entropy delay. For i.MX6SX, it was determined
    that after adding a margin value of 1000 the minimum entropy delay should be
    at least 12000."

    Cc:
    Fixes: 358ba762d9f1 ("crypto: caam - enable prediction resistance in HRWNG")
    Signed-off-by: Fabio Estevam
    Reviewed-by: Horia Geantă
    Reviewed-by: Vabhav Sharma
    Reviewed-by: Gaurav Jain
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Fabio Estevam
     

31 May, 2022

1 commit


25 May, 2022

2 commits

  • commit 16287397ec5c08aa58db6acf7dbc55470d78087d upstream.

    The commit referenced in the Fixes tag removed the 'break' from the else
    branch in qcom_rng_read(), causing an infinite loop whenever 'max' is
    not a multiple of WORD_SZ. This can be reproduced e.g. by running:

    kcapi-rng -b 67 >/dev/null

    There are many ways to fix this without adding back the 'break', but
    they all seem more awkward than simply adding it back, so do just that.

    Tested on a machine with Qualcomm Amberwing processor.

    Fixes: a680b1832ced ("crypto: qcom-rng - ensure buffer for generate is completely filled")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ondrej Mosnacek
    Reviewed-by: Brian Masney
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Ondrej Mosnacek
     
  • [ Upstream commit e9a36feecee0ee5845f2e0656f50f9942dd0bed3 ]

    pm_runtime_get_sync() will increment pm usage counter even it
    failed. Forgetting to call pm_runtime_put_noidle will result
    in reference leak in stm32_crc_remove, so we should fix it.

    Signed-off-by: Zheng Yongjun
    Signed-off-by: Herbert Xu
    Signed-off-by: Sasha Levin

    Zheng Yongjun
     

20 May, 2022

1 commit

  • This patch fixes a bug in scatterlist processing that may cause incorrect AES block encryption/decryption.

    Fixes: 2e6d793e1bf0 ("crypto: mxs-dcp - Use sg_mapping_iter to copy data")
    Signed-off-by: Tomas Paukrt
    Signed-off-by: Herbert Xu
    (cherry picked from commit 28e9b6d8199a3f124682b143800c2dacdc3d70dd)

    Tomas Paukrt
     

05 May, 2022

1 commit

  • Since commit 358ba762d9f1 ("crypto: caam - enable prediction resistance
    in HRWNG") the following CAAM errors can be seen on i.MX6SX:

    caam_jr 2101000.jr: 20003c5b: CCB: desc idx 60: RNG: Hardware error
    hwrng: no data available

    This error is due to an incorrect entropy delay for i.MX6SX.

    Fix it by increasing the minimum entropy delay for i.MX6SX
    as done in U-Boot:
    https://patchwork.ozlabs.org/project/uboot/patch/20220415111049.2565744-1-gaurav.jain@nxp.com/

    As explained in the U-Boot patch:

    "RNG self tests are run to determine the correct entropy delay.
    Such tests are executed with different voltages and temperatures to identify
    the worst case value for the entropy delay. For i.MX6SX, it was determined
    that after adding a margin value of 1000 the minimum entropy delay should be
    at least 12000."

    Cc:
    Fixes: 358ba762d9f1 ("crypto: caam - enable prediction resistance in HRWNG")
    Signed-off-by: Fabio Estevam
    Reviewed-by: Horia Geanta
    Reviewed-by: Vabhav Sharma
    Reviewed-by: Gaurav Jain
    Signed-off-by: Herbert Xu
    ---
    v2:
    -Applied the patch manually due to merge conflict

    Fabio Estevam