1. 02 5月, 2007 3 次提交
    • H
      [CRYPTO] api: Do not remove users unless new algorithm matches · a73e6996
      Herbert Xu 提交于
      As it is whenever a new algorithm with the same name is registered
      users of the old algorithm will be removed so that they can take
      advantage of the new algorithm.  This presents a problem when the
      new algorithm is not equivalent to the old algorithm.  In particular,
      the new algorithm might only function on top of the existing one.
      
      Hence we should not remove users unless they can make use of the
      new algorithm.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      a73e6996
    • H
      [CRYPTO] api: Add async blkcipher type · b5b7f088
      Herbert Xu 提交于
      This patch adds the mid-level interface for asynchronous block ciphers.
      It also includes a generic queueing mechanism that can be used by other
      asynchronous crypto operations in future.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      b5b7f088
    • H
      [CRYPTO] templates: Pass type/mask when creating instances · ebc610e5
      Herbert Xu 提交于
      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: NHerbert Xu <herbert@gondor.apana.org.au>
      ebc610e5
  2. 07 2月, 2007 2 次提交
  3. 21 9月, 2006 10 次提交
    • H
      [CRYPTO] digest: Added user API for new hash type · 055bcee3
      Herbert Xu 提交于
      The existing digest user interface is inadequate for support asynchronous
      operations.  For one it doesn't return a value to indicate success or
      failure, nor does it take a per-operation descriptor which is essential
      for the issuing of requests while other requests are still outstanding.
      
      This patch is the first in a series of steps to remodel the interface
      for asynchronous operations.
      
      For the ease of transition the new interface will be known as "hash"
      while the old one will remain as "digest".
      
      This patch also changes sg_next to allow chaining.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      055bcee3
    • H
      [CRYPTO] cipher: Added block ciphers for CBC/ECB · db131ef9
      Herbert Xu 提交于
      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: NHerbert Xu <herbert@gondor.apana.org.au>
      db131ef9
    • H
      [CRYPTO] cipher: Added block cipher type · 5cde0af2
      Herbert Xu 提交于
      This patch adds the new type of block ciphers.  Unlike current cipher
      algorithms which operate on a single block at a time, block ciphers
      operate on an arbitrarily long linear area of data.  As it is block-based,
      it will skip any data remaining at the end which cannot form a block.
      
      The block cipher has one major difference when compared to the existing
      block cipher implementation.  The sg walking is now performed by the
      algorithm rather than the cipher mid-layer.  This is needed for drivers
      that directly support sg lists.  It also improves performance for all
      algorithms as it reduces the total number of indirect calls by one.
      
      In future the existing cipher algorithm will be converted to only have
      a single-block interface.  This will be done after all existing users
      have switched over to the new block cipher type.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      5cde0af2
    • H
      [CRYPTO] scatterwalk: Prepare for block ciphers · 5c64097a
      Herbert Xu 提交于
      This patch prepares the scatterwalk code for use by the new block cipher
      type.
      
      Firstly it halves the size of scatter_walk on 32-bit platforms.  This
      is important as we allocate at least two of these objects on the stack
      for each block cipher operation.
      
      It also exports the symbols since the block cipher code can be built as
      a module.
      
      Finally there is a hack in scatterwalk_unmap that relies on progress
      being made.  Unfortunately, for hardware crypto we can't guarantee
      progress to be made since the hardware can fail.
      
      So this also gets rid of the hack by not advancing the address returned
      by scatterwalk_map.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      5c64097a
    • H
      [CRYPTO] cipher: Added encrypt_one/decrypt_one · f28776a3
      Herbert Xu 提交于
      This patch adds two new operations for the simple cipher that encrypts or
      decrypts a single block at a time.  This will be the main interface after
      the existing block operations have moved over to the new block ciphers.
      
      It also adds the crypto_cipher type which is currently only used on the
      new operations but will be extended to setkey as well once existing users
      have been converted to use block ciphers where applicable.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f28776a3
    • H
      [CRYPTO] api: Added crypto_type support · e853c3cf
      Herbert Xu 提交于
      This patch adds the crypto_type structure which will be used for all new
      crypto algorithm types, beginning with block ciphers.
      
      The primary purpose of this abstraction is to allow different crypto_type
      objects for crypto algorithms of the same type, in particular, there will
      be a different crypto_type objects for asynchronous algorithms.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      e853c3cf
    • H
      [CRYPTO] api: Add common instance initialisation code · 7fed0bf2
      Herbert Xu 提交于
      This patch adds the helpers crypto_get_attr_alg and crypto_alloc_instance
      which can be used by simple one-argument templates like hmac to process
      input parameters and allocate instances.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      7fed0bf2
    • H
      [CRYPTO] api: Added spawns · 6bfd4809
      Herbert Xu 提交于
      Spawns lock a specific crypto algorithm in place.  They can then be used
      with crypto_spawn_tfm to allocate a tfm for that algorithm.  When the base
      algorithm of a spawn is deregistered, all its spawns will be automatically
      removed.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6bfd4809
    • H
      [CRYPTO] api: Add template registration · 4cc7720c
      Herbert Xu 提交于
      A crypto_template generates a crypto_alg object when given a set of
      parameters.  this patch adds the basic data structure fo templates
      and code to handle their registration/deregistration.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4cc7720c
    • H
      [CRYPTO] api: Split out low-level API · cce9e06d
      Herbert Xu 提交于
      The crypto API is made up of the part facing users such as IPsec and the
      low-level part which is used by cryptographic entities such as algorithms.
      This patch splits out the latter so that the two APIs are more clearly
      delineated.  As a bonus the low-level API can now be modularised if all
      algorithms are built as modules.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      cce9e06d