Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Feb 02, 2024
  2. Dec 07, 2023
    • Herbert Xu's avatar
      crypto: skcipher - Add internal state support · 0ae4dcc1
      Herbert Xu authored
      Unlike chaining modes such as CBC, stream ciphers other than CTR
      usually hold an internal state that must be preserved if the
      operation is to be done piecemeal.  This has not been represented
      in the API, resulting in the inability to split up stream cipher
      operations.
      
      This patch adds the basic representation of an internal state to
      skcipher and lskcipher.  In the interest of backwards compatibility,
      the default has been set such that existing users are assumed to
      be operating in one go as opposed to piecemeal.
      
      With the new API, each lskcipher/skcipher algorithm has a new
      attribute called statesize.  For skcipher, this is the size of
      the buffer that can be exported or imported similar to ahash.
      For lskcipher, instead of providing a buffer of ivsize, the user
      now has to provide a buffer of ivsize + statesize.
      
      Each skcipher operation is assumed to be final as they are now,
      but this may be overridden with a request flag.  When the override
      occurs, the user may ...
      0ae4dcc1
  3. Sep 20, 2023
  4. Jan 02, 2021
  5. Sep 11, 2020
  6. Dec 27, 2019
    • Herbert Xu's avatar
      crypto: skcipher - Add skcipher_ialg_simple helper · b3c16bfc
      Herbert Xu authored
      
      This patch introduces the skcipher_ialg_simple helper which fetches
      the crypto_alg structure from a simple skcipher instance's spawn.
      
      This allows us to remove the third argument from the function
      skcipher_alloc_instance_simple.
      
      In doing so the reference count to the algorithm is now maintained
      by the Crypto API and the caller no longer needs to drop the alg
      refcount.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b3c16bfc
  7. May 30, 2019
  8. 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
  9. Jan 11, 2019
  10. Nov 29, 2018
  11. Mar 09, 2017
    • Marcelo Cerri's avatar
      crypto: cbc - Propagate NEED_FALLBACK bit · e6c2e65c
      Marcelo Cerri authored
      
      When requesting a fallback algorithm, we should propagate the
      NEED_FALLBACK bit when search for the underlying algorithm.
      
      This will prevents drivers from allocating unnecessary fallbacks that
      are never called. For instance, currently the vmx-crypto driver will use
      the following chain of calls when calling the fallback implementation:
      
      p8_aes_cbc -> cbc(p8_aes) -> aes-generic
      
      However p8_aes will always delegate its calls to aes-generic. With this
      patch, p8_aes_cbc will be able to use cbc(aes-generic) directly as its
      fallback. The same applies to aes_s390.
      
      Signed-off-by: default avatarMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e6c2e65c
  12. Feb 11, 2017
    • Ard Biesheuvel's avatar
      crypto: algapi - make crypto_xor() and crypto_inc() alignment agnostic · db91af0f
      Ard Biesheuvel authored
      Instead of unconditionally forcing 4 byte alignment for all generic
      chaining modes that rely on crypto_xor() or crypto_inc() (which may
      result in unnecessary copying of data when the underlying hardware
      can perform unaligned accesses efficiently), make those functions
      deal with unaligned input explicitly, but only if the Kconfig symbol
      HAVE_EFFICIENT_UNALIGNED_ACCESS is set. This will allow us to drop
      the alignmasks from the CBC, CMAC, CTR, CTS, PCBC and SEQIV drivers.
      
      For crypto_inc(), this simply involves making the 4-byte stride
      conditional on HAVE_EFFICIENT_UNALIGNED_ACCESS being set, given that
      it typically operates on 16 byte buffers.
      
      For crypto_xor(), an algorithm is implemented that simply runs through
      the input using the largest strides possible if unaligned accesses are
      allowed. If they are not, an optimal sequence of memory accesses is
      emitted that takes the relative alignment of the input buffers into
      account, e.g., if th...
      db91af0f
  13. Nov 28, 2016
  14. Nov 26, 2014
  15. Feb 07, 2008
  16. Jan 10, 2008
  17. May 02, 2007
    • Herbert Xu's avatar
      [CRYPTO] templates: Pass type/mask when creating instances · ebc610e5
      Herbert Xu authored
      
      This patch passes the type/mask along when constructing instances of
      templates.  This is in preparation for templates that may support
      multiple types of instances depending on what is requested.  For example,
      the planned software async crypto driver will use this construct.
      
      For the moment this allows us to check whether the instance constructed
      is of the correct type and avoid returning success if the type does not
      match.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ebc610e5
  18. Feb 06, 2007
  19. Sep 20, 2006
    • Herbert Xu's avatar
      [CRYPTO] cipher: Added block ciphers for CBC/ECB · db131ef9
      Herbert Xu authored
      
      This patch adds two block cipher algorithms, CBC and ECB.  These
      are implemented as templates on top of existing single-block cipher
      algorithms.  They invoke the single-block cipher through the new
      encrypt_one/decrypt_one interface.
      
      This also optimises the in-place encryption and decryption to remove
      the cost of an IV copy each round.
      
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      db131ef9