1. 03 6月, 2015 3 次提交
  2. 28 5月, 2015 2 次提交
    • H
      crypto: aead - Add common IV generation code · 6350449f
      Herbert Xu 提交于
      This patch adds some common IV generation code currently duplicated
      by seqiv and echainiv.  For example, the setkey and setauthsize
      functions are completely identical.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      6350449f
    • H
      crypto: aead - Document behaviour of AD in destination buffer · 693b549d
      Herbert Xu 提交于
      This patch defines the behaviour of AD in the new interface more
      clearly.  In particular, it specifies that if the user must copy
      the AD to the destination manually when src != dst if they wish
      to guarantee that the destination buffer contains a copy of the
      AD.
      
      The reason for this is that otherwise every AEAD implementation
      would have to perform such a copy when src != dst.  In reality
      most users do in-place processing where src == dst so this is
      not an issue.
      
      This patch also kills some remaining references to cryptoff.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      693b549d
  3. 27 5月, 2015 3 次提交
    • S
      crypto: drbg - use Jitter RNG to obtain seed · b8ec5ba4
      Stephan Mueller 提交于
      During initialization, the DRBG now tries to allocate a handle of the
      Jitter RNG. If such a Jitter RNG is available during seeding, the DRBG
      pulls the required entropy/nonce string from get_random_bytes and
      concatenates it with a string of equal size from the Jitter RNG. That
      combined string is now the seed for the DRBG.
      
      Written differently, the initial seed of the DRBG is now:
      
      get_random_bytes(entropy/nonce) || jitterentropy (entropy/nonce)
      
      If the Jitter RNG is not available, the DRBG only seeds from
      get_random_bytes.
      
      CC: Andreas Steffen <andreas.steffen@strongswan.org>
      CC: Theodore Ts'o <tytso@mit.edu>
      CC: Sandy Harris <sandyinchina@gmail.com>
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      b8ec5ba4
    • S
      crypto: drbg - add async seeding operation · 4c787990
      Stephan Mueller 提交于
      The async seeding operation is triggered during initalization right
      after the first non-blocking seeding is completed. As required by the
      asynchronous operation of random.c, a callback function is provided that
      is triggered by random.c once entropy is available. That callback
      function performs the actual seeding of the DRBG.
      
      CC: Andreas Steffen <andreas.steffen@strongswan.org>
      CC: Theodore Ts'o <tytso@mit.edu>
      CC: Sandy Harris <sandyinchina@gmail.com>
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      4c787990
    • S
      crypto: drbg - prepare for async seeding · 3d6a5f75
      Stephan Mueller 提交于
      In order to prepare for the addition of the asynchronous seeding call,
      the invocation of seeding the DRBG is moved out into a helper function.
      
      In addition, a block of memory is allocated during initialization time
      that will be used as a scratchpad for obtaining entropy. That scratchpad
      is used for the initial seeding operation as well as by the
      asynchronous seeding call. The memory must be zeroized every time the
      DRBG seeding call succeeds to avoid entropy data lingering in memory.
      
      CC: Andreas Steffen <andreas.steffen@strongswan.org>
      CC: Theodore Ts'o <tytso@mit.edu>
      CC: Sandy Harris <sandyinchina@gmail.com>
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      3d6a5f75
  4. 25 5月, 2015 2 次提交
  5. 22 5月, 2015 7 次提交
    • H
      crypto: seqiv - Add support for new AEAD interface · 856e3f40
      Herbert Xu 提交于
      This patch converts the seqiv IV generator to work with the new
      AEAD interface where IV generators are just normal AEAD algorithms.
      
      Full backwards compatibility is paramount at this point since
      no users have yet switched over to the new interface.  Nor can
      they switch to the new interface until IV generation is fully
      supported by it.
      
      So this means we are adding two versions of seqiv alongside the
      existing one.  The first one is the one that will be used when
      the underlying AEAD algorithm has switched over to the new AEAD
      interface.  The second one handles the current case where the
      underlying AEAD algorithm still uses the old interface.
      
      Both versions export themselves through the new AEAD interface.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      856e3f40
    • H
      crypto: null - Add default null skcipher · 33023463
      Herbert Xu 提交于
      This patch adds a default null skcipher for users such as gcm
      to perform copies on SG lists.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      33023463
    • H
      crypto: aead - Add support for new AEAD implementations · 63293c61
      Herbert Xu 提交于
      This patch adds the basic structure of the new AEAD type.  Unlike
      the current version, there is no longer any concept of geniv.  IV
      generation will still be carried out by wrappers but they will be
      normal AEAD algorithms that simply take the IPsec sequence number
      as the IV.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      63293c61
    • H
      crypto: aead - Add crypto_aead_maxauthsize · f5695259
      Herbert Xu 提交于
      This patch adds the helper crypto_aead_maxauthsize to remove the
      need to directly dereference aead_alg internals by AEAD implementors.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f5695259
    • H
      crypto: aead - Rename aead_alg to old_aead_alg · 2d0f230f
      Herbert Xu 提交于
      This patch is the first step in the introduction of a new AEAD
      alg type.  Unlike normal conversions this patch only renames the
      existing aead_alg structure because there are external references
      to it.
      
      Those references will be removed after this patch.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      2d0f230f
    • H
      crypto: aead - Add new interface with single SG list · 996d98d8
      Herbert Xu 提交于
      The primary user of AEAD, IPsec includes the IV in the AD in
      most cases, except where it is implicitly authenticated by the
      underlying algorithm.
      
      The way it is currently implemented is a hack because we pass
      the data in piecemeal and the underlying algorithms try to stitch
      them back up into one piece.
      
      This is why this patch is adding a new interface that allows a
      single SG list to be passed in that contains everything so the
      algorithm implementors do not have to stitch.
      
      The new interface accepts a single source SG list and a single
      destination SG list.  Both must be laid out as follows:
      
      	AD, skipped data, plain/cipher text, ICV
      
      The ICV is not present from the source during encryption and from
      the destination during decryption.
      
      For the top-level IPsec AEAD algorithm the plain/cipher text will
      contain the generated (or received) IV.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      996d98d8
    • H
      crypto: scatterwalk - Add scatterwalk_ffwd helper · fc42bcba
      Herbert Xu 提交于
      This patch adds the scatterwalk_ffwd helper which can create an
      SG list that starts in the middle of an existing SG list.  The
      new list may either be part of the existing list or be a chain
      that latches onto part of the existing list.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      fc42bcba
  6. 18 5月, 2015 1 次提交
  7. 13 5月, 2015 4 次提交
  8. 01 5月, 2015 1 次提交
    • D
      crypto: pcomp - Constify (de)compression parameters · f94a3597
      David Howells 提交于
      In testmgr, struct pcomp_testvec takes a non-const 'params' field, which is
      pointed to a const deflate_comp_params or deflate_decomp_params object.  With
      gcc-5 this incurs the following warnings:
      
      In file included from ../crypto/testmgr.c:44:0:
      ../crypto/testmgr.h:28736:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
         .params = &deflate_comp_params,
                   ^
      ../crypto/testmgr.h:28748:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
         .params = &deflate_comp_params,
                   ^
      ../crypto/testmgr.h:28776:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
         .params = &deflate_decomp_params,
                   ^
      ../crypto/testmgr.h:28800:13: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
         .params = &deflate_decomp_params,
                   ^
      
      Fix this by making the parameters pointer const and constifying the things
      that use it.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      f94a3597
  9. 22 4月, 2015 6 次提交
  10. 21 4月, 2015 3 次提交
    • H
      crypto: rng - Introduce crypto_rng_generate · ff030b09
      Herbert Xu 提交于
      This patch adds the new top-level function crypto_rng_generate
      which generates random numbers with additional input.  It also
      extends the mid-level rng_gen_random function to take additional
      data as input.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      ff030b09
    • H
      crypto: rng - Convert crypto_rng to new style crypto_type · d0e83059
      Herbert Xu 提交于
      This patch converts the top-level crypto_rng to the "new" style.
      It was the last algorithm type added before we switched over
      to the new way of doing things exemplified by shash.
      
      All users will automatically switch over to the new interface.
      
      Note that this patch does not touch the low-level interface to
      rng implementations.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      d0e83059
    • S
      crypto: drbg - replace spinlock with mutex · 76899a41
      Stephan Mueller 提交于
      The creation of a shadow copy is intended to only hold a short term
      lock. But the drawback is that parallel users have a very similar DRBG
      state which only differs by a high-resolution time stamp.
      
      The DRBG will now hold a long term lock. Therefore, the lock is changed
      to a mutex which implies that the DRBG can only be used in process
      context.
      
      The lock now guards the instantiation as well as the entire DRBG
      generation operation. Therefore, multiple callers are fully serialized
      when generating a random number.
      
      As the locking is changed to use a long-term lock to avoid such similar
      DRBG states, the entire creation and maintenance of a shadow copy can be
      removed.
      Signed-off-by: NStephan Mueller <smueller@chronox.de>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      76899a41
  11. 10 4月, 2015 6 次提交
  12. 03 4月, 2015 1 次提交
  13. 24 3月, 2015 1 次提交