1. 12 Aug, 2021 4 commits
    • Hongbo Li's avatar
      lib/mpi: use kcalloc in mpi_resize · b6f75672
      Hongbo Li authored
      We should set the additional space to 0 in mpi_resize().
      So use kcalloc() instead of kmalloc_array().
      
      In lib/mpi/ec.c:
      /****************
       * Resize the array of A to NLIMBS. the additional space is cleared
       * (set to 0) [done by m_realloc()]
       */
      int mpi_resize(MPI a, unsigned nlimbs)
      
      Like the comment of kernel's mpi_resize() said, the additional space
      need to be set to 0, but when a->d is not NULL, it does not set.
      
      The kernel's mpi lib is from libgcrypt, the mpi resize in libgcrypt
      is _gcry_mpi_resize() which set the additional space to 0.
      
      This bug may cause mpi api which use mpi_resize() get wrong result
      under the condition of using the additional space without initiation.
      If this condition is not met, the bug would not be triggered.
      Currently in kernel, rsa, sm2 and dh use mpi lib, and they works well,
      so the bug is not triggered in these cases.
      
      add_points_edwards() use the additional space directly, so it will
      get a wrong result.
      
      Fixes: cdec9cb5 ("crypto: GnuPG based MPI lib - source files (part 1)")
      Signed-off-by: default avatarHongbo Li <herberthbli@tencent.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b6f75672
    • Sebastian Andrzej Siewior's avatar
      padata: Replace deprecated CPU-hotplug functions. · 80771c82
      Sebastian Andrzej Siewior authored
      The functions get_online_cpus() and put_online_cpus() have been
      deprecated during the CPU hotplug rework. They map directly to
      cpus_read_lock() and cpus_read_unlock().
      
      Replace deprecated CPU-hotplug functions with the official version.
      The behavior remains unchanged.
      
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Cc: Daniel Jordan <daniel.m.jordan@oracle.com>
      Cc: linux-crypto@vger.kernel.org
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      80771c82
    • Sebastian Andrzej Siewior's avatar
      crypto: virtio - Replace deprecated CPU-hotplug functions. · d01a9f70
      Sebastian Andrzej Siewior authored
      The functions get_online_cpus() and put_online_cpus() have been
      deprecated during the CPU hotplug rework. They map directly to
      cpus_read_lock() and cpus_read_unlock().
      
      Replace deprecated CPU-hotplug functions with the official version.
      The behavior remains unchanged.
      
      Cc: Gonglei <arei.gonglei@huawei.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: virtualization@lists.linux-foundation.org
      Cc: linux-crypto@vger.kernel.org
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d01a9f70
    • Jason Wang's avatar
      crypto: sun8i-ce - use kfree_sensitive to clear and free sensitive data · c391714c
      Jason Wang authored
      The kfree_sensitive is a kernel API to clear sensitive information
      that should not be leaked to other future users of the same memory
      objects and free the memory. Its function is the same as the
      combination  of memzero_explicit and kfree. Thus, we can replace the
      combination APIs with the single kfree_sensitive API.
      Signed-off-by: default avatarJason Wang <wangborong@cdjrlc.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c391714c
  2. 06 Aug, 2021 9 commits
  3. 30 Jul, 2021 17 commits
  4. 23 Jul, 2021 1 commit
  5. 16 Jul, 2021 6 commits
    • Randy Dunlap's avatar
      crypto: lib - rename 'mod_init' & 'mod_exit' functions to be module-specific · f03a3cab
      Randy Dunlap authored
      Rename module_init & module_exit functions that are named
      "mod_init" and "mod_exit" so that they are unique in both the
      System.map file and in initcall_debug output instead of showing
      up as almost anonymous "mod_init".
      
      This is helpful for debugging and in determining how long certain
      module_init calls take to execute.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: linux-crypto@vger.kernel.org
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      f03a3cab
    • Randy Dunlap's avatar
      hwrng: rename 'mod_init' & 'mod_exit' functions to be module-specific · f0d9ff8c
      Randy Dunlap authored
      Rename module_init & module_exit functions that are named
      "mod_init" and "mod_exit" so that they are unique in both the
      System.map file and in initcall_debug output instead of showing
      up as almost anonymous "mod_init".
      
      This is helpful for debugging and in determining how long certain
      module_init calls take to execute.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Andres Salomon <dilinger@queued.net>
      Cc: linux-geode@lists.infradead.org
      Cc: Matt Mackall <mpm@selenic.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: linux-crypto@vger.kernel.org
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      f0d9ff8c
    • Randy Dunlap's avatar
      crypto: arm/curve25519 - rename 'mod_init' & 'mod_exit' functions to be module-specific · cb5f09e8
      Randy Dunlap authored
      Rename module_init & module_exit functions that are named
      "mod_init" and "mod_exit" so that they are unique in both the
      System.map file and in initcall_debug output instead of showing
      up as almost anonymous "mod_init".
      
      This is helpful for debugging and in determining how long certain
      module_init calls take to execute.
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Jason A. Donenfeld <Jason@zx2c4.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: patches@armlinux.org.uk
      Acked-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      cb5f09e8
    • Sean Anderson's avatar
      crypto: mxs-dcp - Use sg_mapping_iter to copy data · 2e6d793e
      Sean Anderson authored
      This uses the sg_pcopy_from_buffer to copy data, instead of doing it
      ourselves.
      
      In addition to reducing code size, this fixes the following oops
      resulting from failing to kmap the page:
      
      [   68.896381] Unable to handle kernel NULL pointer dereference at virtual address 00000ab8
      [   68.904539] pgd = 3561adb3
      [   68.907475] [00000ab8] *pgd=00000000
      [   68.911153] Internal error: Oops: 805 [#1] ARM
      [   68.915618] Modules linked in: cfg80211 rfkill des_generic libdes arc4 libarc4 cbc ecb algif_skcipher sha256_generic libsha256 sha1_generic hmac aes_generic libaes cmac sha512_generic md5 md4 algif_hash af_alg i2c_imx i2c_core ci_hdrc_imx ci_hdrc mxs_dcp ulpi roles udc_core imx_sdma usbmisc_imx usb_common firmware_class virt_dma phy_mxs_usb nf_tables nfnetlink ip_tables x_tables ipv6 autofs4
      [   68.950741] CPU: 0 PID: 139 Comm: mxs_dcp_chan/ae Not tainted 5.10.34 #296
      [   68.958501] Hardware name: Freescale i.MX6 Ultralite (Device Tree)
      [   68.964710] PC is at memcpy+0xa8/0x330
      [   68.968479] LR is at 0xd7b2bc9d
      [   68.971638] pc : [<c053e7c8>]    lr : [<d7b2bc9d>]    psr: 000f0013
      [   68.977920] sp : c2cbbee4  ip : 00000010  fp : 00000010
      [   68.983159] r10: 00000000  r9 : c3283a40  r8 : 1a5a6f08
      [   68.988402] r7 : 4bfe0ecc  r6 : 76d8a220  r5 : c32f9050  r4 : 00000001
      [   68.994945] r3 : 00000ab8  r2 : fffffff0  r1 : c32f9050  r0 : 00000ab8
      [   69.001492] Flags: nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
      [   69.008646] Control: 10c53c7d  Table: 83664059  DAC: 00000051
      [   69.014414] Process mxs_dcp_chan/ae (pid: 139, stack limit = 0x667b57ab)
      [   69.021133] Stack: (0xc2cbbee4 to 0xc2cbc000)
      [   69.025519] bee0:          c32f9050 c3235408 00000010 00000010 00000ab8 00000001 bf10406c
      [   69.033720] bf00: 00000000 00000000 00000010 00000000 c32355d0 832fb080 00000000 c13de2fc
      [   69.041921] bf20: c3628010 00000010 c33d5780 00000ab8 bf1067e8 00000002 c21e5010 c2cba000
      [   69.050125] bf40: c32f8040 00000000 bf106a40 c32f9040 c3283a80 00000001 bf105240 c3234040
      [   69.058327] bf60: ffffe000 c3204100 c2c69800 c2cba000 00000000 bf103b84 00000000 c2eddc54
      [   69.066530] bf80: c3204144 c0140d1c c2cba000 c2c69800 c0140be8 00000000 00000000 00000000
      [   69.074730] bfa0: 00000000 00000000 00000000 c0100114 00000000 00000000 00000000 00000000
      [   69.082932] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   69.091131] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [   69.099364] [<c053e7c8>] (memcpy) from [<bf10406c>] (dcp_chan_thread_aes+0x4e8/0x840 [mxs_dcp])
      [   69.108117] [<bf10406c>] (dcp_chan_thread_aes [mxs_dcp]) from [<c0140d1c>] (kthread+0x134/0x160)
      [   69.116941] [<c0140d1c>] (kthread) from [<c0100114>] (ret_from_fork+0x14/0x20)
      [   69.124178] Exception stack(0xc2cbbfb0 to 0xc2cbbff8)
      [   69.129250] bfa0:                                     00000000 00000000 00000000 00000000
      [   69.137450] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   69.145648] bfe0: 00000000 00000000 00000000 00000000 00000013 00000000
      [   69.152289] Code: e320f000 e4803004 e4804004 e4805004 (e4806004)
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2e6d793e
    • Sean Anderson's avatar
      crypto: mxs-dcp - Check for DMA mapping errors · df6313d7
      Sean Anderson authored
      After calling dma_map_single(), we must also call dma_mapping_error().
      This fixes the following warning when compiling with CONFIG_DMA_API_DEBUG:
      
      [  311.241478] WARNING: CPU: 0 PID: 428 at kernel/dma/debug.c:1027 check_unmap+0x79c/0x96c
      [  311.249547] DMA-API: mxs-dcp 2280000.crypto: device driver failed to check map error[device address=0x00000000860cb080] [size=32 bytes] [mapped as single]
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Reviewed-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      df6313d7
    • Stephan Mueller's avatar
      crypto: drbg - select SHA512 · 5261cdf4
      Stephan Mueller authored
      With the swtich to use HMAC(SHA-512) as the default DRBG type, the
      configuration must now also select SHA-512.
      
      Fixes: 9b7b9468 "crypto: DRBG - switch to HMAC SHA512 DRBG as default
      DRBG"
      Reported-by: default avatarSachin Sant <sachinp@linux.vnet.ibm.com>
      Signed-off-by: default avatarStephan Mueller <smueller@chronox.com>
      Tested-by: default avatarSachin Sant <sachinp@linux.vnet.ibm.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      5261cdf4
  6. 11 Jul, 2021 3 commits