1. 22 Aug, 2019 4 commits
    • Ard Biesheuvel's avatar
      crypto: des/3des_ede - add new helpers to verify keys · 6ee41e54
      Ard Biesheuvel authored
      The recently added helper routine to perform key strength validation
      of triple DES keys is slightly inadequate, since it comes in two versions,
      neither of which are highly useful for anything other than skciphers (and
      many drivers still use the older blkcipher interfaces).
      
      So let's add a new helper and, considering that this is a helper function
      that is only intended to be used by crypto code itself, put it in a new
      des.h header under crypto/internal.
      
      While at it, implement a similar helper for single DES, so that we can
      start replacing the pattern of calling des_ekey() into a temp buffer
      that occurs in many drivers in drivers/crypto.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6ee41e54
    • Denis Efremov's avatar
      MAINTAINERS: nx crypto: Fix typo in a filepath · 220f6791
      Denis Efremov authored
      Fix typo in nx_debugfs.c filepath. File extension changed from .h to .c
      The file nx_debugfs.h never existed.
      
      Cc: Breno Leitão <leitao@debian.org>
      Cc: Nayna Jain <nayna@linux.ibm.com>
      Cc: Paulo Flabiano Smorigo <pfsmorigo@gmail.com>
      Cc: Dan Streetman <ddstreet@ieee.org>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: linux-crypto@vger.kernel.org
      Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      220f6791
    • Nathan Chancellor's avatar
      lib/mpi: Eliminate unused umul_ppmm definitions for MIPS · b0c091ae
      Nathan Chancellor authored
      Clang errors out when building this macro:
      
      lib/mpi/generic_mpih-mul1.c:37:24: error: invalid use of a cast in a
      inline asm context requiring an l-value: remove the cast or build with
      -fheinous-gnu-extensions
                      umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
                      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      lib/mpi/longlong.h:652:20: note: expanded from macro 'umul_ppmm'
              : "=l" ((USItype)(w0)), \
                      ~~~~~~~~~~^~~
      lib/mpi/generic_mpih-mul1.c:37:3: error: invalid output constraint '=h'
      in asm
                      umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb);
                      ^
      lib/mpi/longlong.h:653:7: note: expanded from macro 'umul_ppmm'
                   "=h" ((USItype)(w1)) \
                   ^
      2 errors generated.
      
      The C version that is used for GCC 4.4 and up works well with clang;
      however, it is not currently being used because Clang masks itself
      as GCC 4.2.1 for compatibility reasons. As Nick points out, we require
      GCC 4.6 and newer in the kernel so we can eliminate all of the
      versioning checks and just use the C version of umul_ppmm for all
      supported compilers.
      
      Link: https://github.com/ClangBuiltLinux/linux/issues/605Suggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b0c091ae
    • Stephen Boyd's avatar
      random: Support freezable kthreads in add_hwgenerator_randomness() · ff296293
      Stephen Boyd authored
      The kthread calling this function is freezable after commit 03a3bb7a
      ("hwrng: core - Freeze khwrng thread during suspend") is applied.
      Unfortunately, this function uses wait_event_interruptible() but doesn't
      check for the kthread being woken up by the fake freezer signal. When a
      user suspends the system, this kthread will wake up and if it fails the
      entropy size check it will immediately go back to sleep and not go into
      the freezer. Eventually, suspend will fail because the task never froze
      and a warning message like this may appear:
      
       PM: suspend entry (deep)
       Filesystems sync: 0.000 seconds
       Freezing user space processes ... (elapsed 0.001 seconds) done.
       OOM killer disabled.
       Freezing remaining freezable tasks ...
       Freezing of tasks failed after 20.003 seconds (1 tasks refusing to freeze, wq_busy=0):
       hwrng           R  running task        0   289      2 0x00000020
       [<c08c64c4>] (__schedule) from [<c08c6a10>] (schedule+0x3c/0xc0)
       [<c08c6a10>] (schedule) from [<c05dbd8c>] (add_hwgenerator_randomness+0xb0/0x100)
       [<c05dbd8c>] (add_hwgenerator_randomness) from [<bf1803c8>] (hwrng_fillfn+0xc0/0x14c [rng_core])
       [<bf1803c8>] (hwrng_fillfn [rng_core]) from [<c015abec>] (kthread+0x134/0x148)
       [<c015abec>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
      
      Check for a freezer signal here and skip adding any randomness if the
      task wakes up because it was frozen. This should make the kthread freeze
      properly and suspend work again.
      
      Fixes: 03a3bb7a ("hwrng: core - Freeze khwrng thread during suspend")
      Reported-by: default avatarKeerthy <j-keerthy@ti.com>
      Tested-by: default avatarKeerthy <j-keerthy@ti.com>
      Signed-off-by: default avatarStephen Boyd <swboyd@chromium.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ff296293
  2. 15 Aug, 2019 18 commits
  3. 09 Aug, 2019 18 commits