1. 31 3月, 2015 1 次提交
    • S
      crypto: api - prevent helper ciphers from being used · 06ca7f68
      Stephan Mueller 提交于
      Several hardware related cipher implementations are implemented as
      follows: a "helper" cipher implementation is registered with the
      kernel crypto API.
      
      Such helper ciphers are never intended to be called by normal users. In
      some cases, calling them via the normal crypto API may even cause
      failures including kernel crashes. In a normal case, the "wrapping"
      ciphers that use the helpers ensure that these helpers are invoked
      such that they cannot cause any calamity.
      
      Considering the AF_ALG user space interface, unprivileged users can
      call all ciphers registered with the crypto API, including these
      helper ciphers that are not intended to be called directly. That
      means, with AF_ALG user space may invoke these helper ciphers
      and may cause undefined states or side effects.
      
      To avoid any potential side effects with such helpers, the patch
      prevents the helpers to be called directly. A new cipher type
      flag is added: CRYPTO_ALG_INTERNAL. This flag shall be used
      to mark helper ciphers. These ciphers can only be used if the
      caller invoke the cipher with CRYPTO_ALG_INTERNAL in the type and
      mask field.
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      06ca7f68
  2. 20 1月, 2015 1 次提交
  3. 08 1月, 2015 1 次提交
  4. 24 11月, 2014 1 次提交
  5. 13 11月, 2014 6 次提交
  6. 01 8月, 2014 1 次提交
  7. 05 3月, 2012 1 次提交
    • P
      BUG: headers with BUG/BUG_ON etc. need linux/bug.h · 187f1882
      Paul Gortmaker 提交于
      If a header file is making use of BUG, BUG_ON, BUILD_BUG_ON, or any
      other BUG variant in a static inline (i.e. not in a #define) then
      that header really should be including <linux/bug.h> and not just
      expecting it to be implicitly present.
      
      We can make this change risk-free, since if the files using these
      headers didn't have exposure to linux/bug.h already, they would have
      been causing compile failures/warnings.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      187f1882
  8. 26 1月, 2012 1 次提交
  9. 13 1月, 2012 1 次提交
  10. 01 11月, 2011 1 次提交
    • P
      crypto.h: remove unused crypto_tfm_alg_modname() inline · 7c926402
      Paul Gortmaker 提交于
      The <linux/crypto.h> (which is in turn in common headers
      like tcp.h) wants to use module_name() in an inline fcn.
      But having all of <linux/module.h> along for the ride is
      overkill and slows down compiles by a measureable amount,
      since it in turn includes lots of headers.
      
      Since the inline is never used anywhere in the kernel[1],
      we can just remove it, and then also remove the module.h
      include as well.
      
      In all the many crypto modules, there were some relying on
      crypto.h including module.h -- for them we now explicitly
      call out module.h for inclusion.
      
      [1] git grep shows some staging drivers also define the same
      static inline, but they also never ever use it.
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      7c926402
  11. 21 10月, 2011 1 次提交
  12. 27 7月, 2011 1 次提交
  13. 20 5月, 2010 1 次提交
  14. 19 10月, 2009 1 次提交
  15. 14 7月, 2009 2 次提交
  16. 12 7月, 2009 1 次提交
  17. 04 3月, 2009 1 次提交
    • G
      crypto: compress - Add pcomp interface · a1d2f095
      Geert Uytterhoeven 提交于
      The current "comp" crypto interface supports one-shot (de)compression only,
      i.e. the whole data buffer to be (de)compressed must be passed at once, and
      the whole (de)compressed data buffer will be received at once.
      In several use-cases (e.g. compressed file systems that store files in big
      compressed blocks), this workflow is not suitable.
      Furthermore, the "comp" type doesn't provide for the configuration of
      (de)compression parameters, and always allocates workspace memory for both
      compression and decompression, which may waste memory.
      
      To solve this, add a "pcomp" partial (de)compression interface that provides
      the following operations:
        - crypto_compress_{init,update,final}() for compression,
        - crypto_decompress_{init,update,final}() for decompression,
        - crypto_{,de}compress_setup(), to configure (de)compression parameters
          (incl. allocating workspace memory).
      
      The (de)compression methods take a struct comp_request, which was mimicked
      after the z_stream object in zlib, and contains buffer pointer and length
      pairs for input and output.
      
      The setup methods take an opaque parameter pointer and length pair. Parameters
      are supposed to be encoded using netlink attributes, whose meanings depend on
      the actual (name of the) (de)compression algorithm.
      Signed-off-by: NGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      a1d2f095
  18. 18 2月, 2009 1 次提交
    • H
      crypto: api - Fix crypto_alloc_tfm/create_create_tfm return convention · 3f683d61
      Herbert Xu 提交于
      This is based on a report and patch by Geert Uytterhoeven.
      
      The functions crypto_alloc_tfm and create_create_tfm return a
      pointer that needs to be adjusted by the caller when successful
      and otherwise an error value.  This means that the caller has
      to check for the error and only perform the adjustment if the
      pointer returned is valid.
      
      Since all callers want to make the adjustment and we know how
      to adjust it ourselves, it's much easier to just return adjusted
      pointer directly.
      
      The only caveat is that we have to return a void * instead of
      struct crypto_tfm *.  However, this isn't that bad because both
      of these functions are for internal use only (by types code like
      shash.c, not even algorithms code).
      
      This patch also moves crypto_alloc_tfm into crypto/internal.h
      (crypto_create_tfm is already there) to reflect this.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3f683d61
  19. 05 2月, 2009 1 次提交
  20. 25 12月, 2008 6 次提交
    • H
      crypto: hash - Export shash through hash · 5f7082ed
      Herbert Xu 提交于
      This patch allows shash algorithms to be used through the old hash
      interface.  This is a transitional measure so we can convert the
      underlying algorithms to shash before converting the users across.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      5f7082ed
    • H
      crypto: hash - Add import/export interface · dec8b786
      Herbert Xu 提交于
      It is often useful to save the partial state of a hash function
      so that it can be used as a base for two or more computations.
      
      The most prominent example is HMAC where all hashes start from
      a base determined by the key.  Having an import/export interface
      means that we only have to compute that base once rather than
      for each message.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      dec8b786
    • H
      crypto: hash - Export shash through ahash · 3b2f6df0
      Herbert Xu 提交于
      This patch allows shash algorithms to be used through the ahash
      interface.  This is required before we can convert digest algorithms
      over to shash.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3b2f6df0
    • H
      crypto: hash - Add shash interface · 7b5a080b
      Herbert Xu 提交于
      The shash interface replaces the current synchronous hash interface.
      It improves over hash in two ways.  Firstly shash is reentrant,
      meaning that the same tfm may be used by two threads simultaneously
      as all hashing state is stored in a local descriptor.
      
      The other enhancement is that shash no longer takes scatter list
      entries.  This is because shash is specifically designed for
      synchronous algorithms and as such scatter lists are unnecessary.
      
      All existing hash users will be converted to shash once the
      algorithms have been completely converted.
      
      There is also a new finup function that combines update with final.
      This will be extended to ahash once the algorithm conversion is
      done.
      
      This is also the first time that an algorithm type has their own
      registration function.  Existing algorithm types will be converted
      to this way in due course.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      7b5a080b
    • H
      crypto: api - Rebirth of crypto_alloc_tfm · 7b0bac64
      Herbert Xu 提交于
      This patch reintroduces a completely revamped crypto_alloc_tfm.
      The biggest change is that we now take two crypto_type objects
      when allocating a tfm, a frontend and a backend.  In fact this
      simply formalises what we've been doing behind the API's back.
      
      For example, as it stands crypto_alloc_ahash may use an
      actual ahash algorithm or a crypto_hash algorithm.  Putting
      this in the API allows us to do this much more cleanly.
      
      The existing types will be converted across gradually.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      7b0bac64
    • H
      crypto: api - Move type exit function into crypto_tfm · 4a779486
      Herbert Xu 提交于
      The type exit function needs to undo any allocations done by the type
      init function.  However, the type init function may differ depending
      on the upper-level type of the transform (e.g., a crypto_blkcipher
      instantiated as a crypto_ablkcipher).
      
      So we need to move the exit function out of the lower-level
      structure and into crypto_tfm itself.
      
      As it stands this is a no-op since nobody uses exit functions at
      all.  However, all cases where a lower-level type is instantiated
      as a different upper-level type (such as blkcipher as ablkcipher)
      will be converted such that they allocate the underlying transform
      and use that instead of casting (e.g., crypto_ablkcipher casted
      into crypto_blkcipher).  That will need to use a different exit
      function depending on the upper-level type.
      
      This patch also allows the type init/exit functions to call (or not)
      cra_init/cra_exit instead of always calling them from the top level.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      4a779486
  21. 29 8月, 2008 3 次提交
  22. 10 7月, 2008 3 次提交
  23. 21 4月, 2008 1 次提交
  24. 11 1月, 2008 2 次提交