1. 14 7月, 2009 2 次提交
  2. 08 7月, 2009 2 次提交
  3. 07 7月, 2009 2 次提交
  4. 25 12月, 2008 3 次提交
    • 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: 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
  5. 10 7月, 2008 2 次提交
  6. 11 1月, 2008 5 次提交
    • H
      [CRYPTO] skcipher: Remove crypto_spawn_ablkcipher · 45d44eb5
      Herbert Xu 提交于
      Now that gcm and authenc have been converted to crypto_spawn_skcipher,
      this patch removes the obsolete crypto_spawn_ablkcipher function.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      45d44eb5
    • H
      [CRYPTO] skcipher: Add crypto_grab_skcipher interface · 378f4f51
      Herbert Xu 提交于
      Note: From now on the collective of ablkcipher/blkcipher/givcipher will
      be known as skcipher, i.e., symmetric key cipher.  The name blkcipher has
      always been much of a misnomer since it supports stream ciphers too.
      
      This patch adds the function crypto_grab_skcipher as a new way of getting
      an ablkcipher spawn.  The problem is that previously we did this in two
      steps, first getting the algorithm and then calling crypto_init_spawn.
      
      This meant that each spawn user had to be aware of what type and mask to
      use for these two steps.  This is difficult and also presents a problem
      when the type/mask changes as they're about to be for IV generators.
      
      The new interface does both steps together just like crypto_alloc_ablkcipher.
      
      As a side-effect this also allows us to be stronger on type enforcement
      for spawns.  For now this is only done for ablkcipher but it's trivial
      to extend for other types.
      
      This patch also moves the type/mask logic for skcipher into the helpers
      crypto_skcipher_type and crypto_skcipher_mask.
      
      Finally this patch introduces the function crypto_require_sync to determine
      whether the user is specifically requesting a sync algorithm.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      378f4f51
    • H
      [CRYPTO] api: Add crypto_attr_alg_name · 68b6c7d6
      Herbert Xu 提交于
      This patch adds a new helper crypto_attr_alg_name which is basically the
      first half of crypto_attr_alg.  That is, it returns an algorithm name
      parameter as a string without looking it up.  The caller can then look it
      up immediately or defer it until later.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      68b6c7d6
    • H
      [CRYPTO] api: Add crypto_inc and crypto_xor · 7613636d
      Herbert Xu 提交于
      With the addition of more stream ciphers we need to curb the proliferation
      of ad-hoc xor functions.  This patch creates a generic pair of functions,
      crypto_inc and crypto_xor which does big-endian increment and exclusive or,
      respectively.
      
      For optimum performance, they both use u32 operations so alignment must be
      as that of u32 even though the arguments are of type u8 *.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      7613636d
    • 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
  7. 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
  8. 02 5月, 2007 4 次提交
  9. 07 2月, 2007 2 次提交
  10. 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