1. 11 1月, 2008 1 次提交
    • H
      [CRYPTO] ablkcipher: Add distinct ABLKCIPHER type · 332f8840
      Herbert Xu 提交于
      Up until now we have ablkcipher algorithms have been identified as
      type BLKCIPHER with the ASYNC bit set.  This is suboptimal because
      ablkcipher refers to two things.  On the one hand it refers to the
      top-level ablkcipher interface with requests.  On the other hand it
      refers to and algorithm type underneath.
      
      As it is you cannot request a synchronous block cipher algorithm
      with the ablkcipher interface on top.  This is a problem because
      we want to be able to eventually phase out the blkcipher top-level
      interface.
      
      This patch fixes this by making ABLKCIPHER its own type, just as
      we have distinct types for HASH and DIGEST.  The type it associated
      with the algorithm implementation only.
      
      Which top-level interface is used for synchronous block ciphers is
      then determined by the mask that's used.  If it's a specific mask
      then the old blkcipher interface is given, otherwise we go with the
      new ablkcipher interface.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      332f8840
  2. 11 10月, 2007 5 次提交
    • H
      [CRYPTO] blkcipher: Added blkcipher_walk_virt_block · 7607bd8f
      Herbert Xu 提交于
      This patch adds the helper blkcipher_walk_virt_block which is similar to
      blkcipher_walk_virt but uses a supplied block size instead of the block
      size of the block cipher.  This is useful for CTR where the block size is
      1 but we still want to walk by the block size of the underlying cipher.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      7607bd8f
    • H
      [CRYPTO] aead: Add authenc · 3c09f17c
      Herbert Xu 提交于
      This patch adds the authenc algorithm which constructs an AEAD algorithm
      from an asynchronous block cipher and a hash.  The construction is done
      by concatenating the encrypted result from the cipher with the output
      from the hash, as is used by the IPsec ESP protocol.
      
      The authenc algorithm exists as a template with four parameters:
      
      	authenc(auth, authsize, enc, enckeylen).
      
      The authentication algorithm, the authentication size (i.e., truncating
      the output of the authentication algorithm), the encryption algorithm,
      and the encryption key length.  Both the size field and the key length
      field are in bytes.  For example, AES-128 with SHA1-HMAC would be
      represented by
      
      	authenc(hmac(sha1), 12, cbc(aes), 16)
      
      The key for the authenc algorithm is the concatenation of the keys for
      the authentication algorithm with the encryption algorithm.  For the
      above example, if a key of length 36 bytes is given, then hmac(sha1)
      would receive the first 20 bytes while the last 16 would be given to
      cbc(aes).
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3c09f17c
    • H
      [CRYPTO] ablkcipher: Remove queue pointer from common alg object · 2de98e75
      Herbert Xu 提交于
      Since not everyone needs a queue pointer and those who need it can
      always get it from the context anyway the queue pointer in the
      common alg object is redundant.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      2de98e75
    • H
      [CRYPTO] api: Add aead crypto type · 1ae97820
      Herbert Xu 提交于
      This patch adds crypto_aead which is the interface for AEAD
      (Authenticated Encryption with Associated Data) algorithms.
      
      AEAD algorithms perform authentication and encryption in one
      step.  Traditionally users (such as IPsec) would use two
      different crypto algorithms to perform these.  With AEAD
      this comes down to one algorithm and one operation.
      
      Of course if traditional algorithms were used we'd still
      be doing two operations underneath.  However, real AEAD
      algorithms may allow the underlying operations to be
      optimised as well.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      1ae97820
    • S
      [CRYPTO] api: Add crypto_ablkcipher_ctx_aligned · aa379a6a
      Sebastian Siewior 提交于
      This is function does the same thing for ablkcipher that is done for
      blkcipher by crypto_blkcipher_ctx_aligned(): it returns an aligned
      address of the private ctx.
      Signed-off-by: NSebastian Siewior <sebastian@breakpoint.cc>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      aa379a6a
  3. 02 5月, 2007 4 次提交
  4. 07 2月, 2007 2 次提交
  5. 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