Skip to content
Snippets Groups Projects
  1. Jan 09, 2020
    • Eric Biggers's avatar
      crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN · 674f368a
      Eric Biggers authored
      
      The CRYPTO_TFM_RES_BAD_KEY_LEN flag was apparently meant as a way to
      make the ->setkey() functions provide more information about errors.
      
      However, no one actually checks for this flag, which makes it pointless.
      
      Also, many algorithms fail to set this flag when given a bad length key.
      Reviewing just the generic implementations, this is the case for
      aes-fixed-time, cbcmac, echainiv, nhpoly1305, pcrypt, rfc3686, rfc4309,
      rfc7539, rfc7539esp, salsa20, seqiv, and xcbc.  But there are probably
      many more in arch/*/crypto/ and drivers/crypto/.
      
      Some algorithms can even set this flag when the key is the correct
      length.  For example, authenc and authencesn set it when the key payload
      is malformed in any way (not just a bad length), the atmel-sha and ccree
      drivers can set it if a memory allocation fails, and the chelsio driver
      sets it for bad auth tag lengths, not just bad key lengths.
      
      So even if someone actually wanted to start checking this flag (which
      seems unlikely, since it's been unused for a long time), there would be
      a lot of work needed to get it working correctly.  But it would probably
      be much better to go back to the drawing board and just define different
      return values, like -EINVAL if the key is invalid for the algorithm vs.
      -EKEYREJECTED if the key was rejected by a policy like "no weak keys".
      That would be much simpler, less error-prone, and easier to test.
      
      So just remove this flag.
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      674f368a
  2. Aug 15, 2019
  3. Jul 26, 2019
  4. Apr 18, 2019
    • Eric Biggers's avatar
      crypto: run initcalls for generic implementations earlier · c4741b23
      Eric Biggers authored
      
      Use subsys_initcall for registration of all templates and generic
      algorithm implementations, rather than module_init.  Then change
      cryptomgr to use arch_initcall, to place it before the subsys_initcalls.
      
      This is needed so that when both a generic and optimized implementation
      of an algorithm are built into the kernel (not loadable modules), the
      generic implementation is registered before the optimized one.
      Otherwise, the self-tests for the optimized implementation are unable to
      allocate the generic implementation for the new comparison fuzz tests.
      
      Note that on arm, a side effect of this change is that self-tests for
      generic implementations may run before the unaligned access handler has
      been installed.  So, unaligned accesses will crash the kernel.  This is
      arguably a good thing as it makes it easier to detect that type of bug.
      
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c4741b23
  5. Apr 08, 2019
  6. Nov 09, 2018
  7. Feb 11, 2017
  8. Jan 13, 2015
    • Mathias Krause's avatar
      crypto: add missing crypto module aliases · 3e14dcf7
      Mathias Krause authored
      
      Commit 5d26a105 ("crypto: prefix module autoloading with "crypto-"")
      changed the automatic module loading when requesting crypto algorithms
      to prefix all module requests with "crypto-". This requires all crypto
      modules to have a crypto specific module alias even if their file name
      would otherwise match the requested crypto algorithm.
      
      Even though commit 5d26a105 added those aliases for a vast amount of
      modules, it was missing a few. Add the required MODULE_ALIAS_CRYPTO
      annotations to those files to make them get loaded automatically, again.
      This fixes, e.g., requesting 'ecb(blowfish-generic)', which used to work
      with kernels v3.18 and below.
      
      Also change MODULE_ALIAS() lines to MODULE_ALIAS_CRYPTO(). The former
      won't work for crypto modules any more.
      
      Fixes: 5d26a105 ("crypto: prefix module autoloading with "crypto-"")
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3e14dcf7
  9. Nov 24, 2014
  10. Aug 14, 2013
  11. Aug 01, 2012
  12. Feb 16, 2010
  13. Jul 24, 2009
    • Phil Carmody's avatar
      crypto: aes - Undefined behaviour in crypto_aes_expand_key · 7b4ffcf9
      Phil Carmody authored
      
      It's undefined behaviour in C to write outside the bounds of an array.
      The key expansion routine takes a shortcut of creating 8 words at a
      time, but this creates 4 additional words which don't fit in the array.
      
      As everyone is hopefully now aware, GCC is at liberty to make any
      assumptions and optimisations it likes in situations where it can
      detect that UB has occured, up to and including nasal demons, and
      as the indices being accessed in the array are trivially calculable,
      it's rash to invite gcc to do take any liberties at all.
      
      Signed-off-by: default avatarPhil Carmody <ext-phil.2.carmody@nokia.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      7b4ffcf9
  14. Dec 25, 2008
    • Herbert Xu's avatar
      crypto: aes - Precompute tables · 0ee4a969
      Herbert Xu authored
      
      The tables used by the various AES algorithms are currently
      computed at run-time.  This has created an init ordering problem
      because some AES algorithms may be registered before the tables
      have been initialised.
      
      This patch gets around this whole thing by precomputing the tables.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0ee4a969
  15. Apr 21, 2008
  16. Jan 10, 2008
  17. Oct 10, 2007
  18. Sep 21, 2006
    • Herbert Xu's avatar
      [CRYPTO] api: Get rid of flags argument to setkey · 560c06ae
      Herbert Xu authored
      
      Now that the tfm is passed directly to setkey instead of the ctx, we no
      longer need to pass the &tfm->crt_flags pointer.
      
      This patch also gets rid of a few unnecessary checks on the key length
      for ciphers as the cipher layer guarantees that the key length is within
      the bounds specified by the algorithm.
      
      Rather than testing dia_setkey every time, this patch does it only once
      during crypto_alloc_tfm.  The redundant check from crypto_digest_setkey
      is also removed.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      560c06ae
  19. Jun 26, 2006
    • Herbert Xu's avatar
      [CRYPTO] all: Pass tfm instead of ctx to algorithms · 6c2bb98b
      Herbert Xu authored
      
      Up until now algorithms have been happy to get a context pointer since
      they know everything that's in the tfm already (e.g., alignment, block
      size).
      
      However, once we have parameterised algorithms, such information will
      be specific to each tfm.  So the algorithm API needs to be changed to
      pass the tfm structure instead of the context pointer.
      
      This patch is basically a text substitution.  The only tricky bit is
      the assembly routines that need to get the context pointer offset
      through asm-offsets.h.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6c2bb98b
  20. Mar 21, 2006
    • David McCullough's avatar
      [CRYPTO] aes: Fixed array boundary violation · 55e9dce3
      David McCullough authored
      
      The AES setkey routine writes 64 bytes to the E_KEY area even though
      there are only 60 bytes there.  It is in fact safe since E_KEY is
      immediately follwed by D_KEY which is initialised afterwards.  However,
      doing this may trigger undefined behaviour and makes Coverity unhappy.
      
      So by combining E_KEY and D_KEY into one array we sidestep this issue
      altogether.
      
      This problem was reported by Adrian Bunk.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      55e9dce3
  21. Jan 09, 2006
  22. Jul 27, 2005
  23. Apr 16, 2005
    • Linus Torvalds's avatar
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds authored
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
Loading