summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* crypto: ahash - Fix setkey crashHerbert Xu2009-07-151-4/+2
| | | | | | | | | | When the alignment check was made unconditional for ahash we may end up crashing on shash algorithms because we're always calling alg->setkey instead of tfm->setkey. This patch fixes it. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: padlock - Fix compile error on i386Herbert Xu2009-07-151-2/+4
| | | | | | | | | | The previous change to allow hashing from states other than the initial broke compilation on i386 because the inline assembly tried to squeeze a u64 into a 32-bit register. As we've already checked for 32-bit overflows we can simply truncate it to u32, or unsigned long so that we don't truncate at all on x86-64. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: xcbc - Fix incorrect error value when creating instanceHerbert Xu2009-07-151-0/+1
| | | | | | | If shash_alloc_instance() fails, we return the wrong error value. This patch fixes it. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: hmac - Fix incorrect error value when creating instanceHerbert Xu2009-07-151-0/+1
| | | | | | | If shash_alloc_instance() fails, we return the wrong error value. This patch fixes it. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: cryptd - Fix uninitialized return valueSteffen Klassert2009-07-151-0/+2
| | | | | | | | If cryptd_alloc_instance() fails, the return value is uninitialized. This patch fixes this by setting the return value. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: crypto4xx - Disable SHA implementationHerbert Xu2009-07-151-19/+0
| | | | | | | | | | The crypto4xx SHA implementation keeps the hash state in the tfm data structure. This breaks a fundamental requirement of ahash implementations that they must be reentrant. This patch disables the broken implementation. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: ahash - Add unaligned handling and default operationsHerbert Xu2009-07-154-22/+263
| | | | | | | | | | This patch exports the finup operation where available and adds a default finup operation for ahash. The operations final, finup and digest also will now deal with unaligned result pointers by copying it. Finally export/import operations are will now be exported too. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: ahash - Use GFP_KERNEL in unaligned setkeyHerbert Xu2009-07-141-1/+1
| | | | | | | | We currently use GFP_ATOMIC in the unaligned setkey function to allocate the temporary aligned buffer. Since setkey must be called in a sleepable context, we can use GFP_KERNEL instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Fix alignment in unaligned operationsHerbert Xu2009-07-141-2/+4
| | | | | | | | When we encounter an unaligned pointer we are supposed to copy it to a temporary aligned location. However the temporary buffer isn't aligned properly. This patch fixes that. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: hash - Zap unaligned buffersHerbert Xu2009-07-142-5/+12
| | | | | | | | | | | | Some unaligned buffers on the stack weren't zapped properly which may cause secret data to be leaked. This patch fixes them by doing a zero memset. It is also possible for us to place random kernel stack contents in the digest buffer if a digest operation fails. This is fixed by only copying if the operation succeeded. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: ahash - Remove old_ahash_algHerbert Xu2009-07-145-53/+1
| | | | | | | Now that all ahash implementations have been converted to the new ahash type, we can remove old_ahash_alg and its associated support. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: crypto4xx - Switch to new style ahashHerbert Xu2009-07-143-39/+77
| | | | | | | | | | | | This patch changes crypto4xx to use the new style ahash type. In particular, we now use ahash_alg to define ahash algorithms instead of crypto_alg. This is achieved by introducing a union that encapsulates the new type and the existing crypto_alg structure. They're told apart through a u32 field containing the type value. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: cryptd - Switch to new style ahashHerbert Xu2009-07-141-27/+37
| | | | | | | | This patch changes cryptd to use the new style ahash type. In particular, the instance is enlarged to encapsulate the new ahash_alg structure. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: cryptd - Switch to template create APIHerbert Xu2009-07-143-27/+32
| | | | | | | | This patch changes cryptd to use the template->create function instead of alloc in anticipation for the switch to new style ahash algorithms. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: hash - Add helpers to free spawnsHerbert Xu2009-07-141-0/+10
| | | | | | | This patch adds the helpers crypto_drop_ahash and crypto_drop_shash so that these spawns can be dropped without ugly casts. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: tcrypt - Add mask parameterHerbert Xu2009-07-141-3/+6
| | | | | | | | This patch adds a mask parameter to complement the existing type parameter. This is useful when instantiating algorithms that require a mask other than the default, e.g., ahash algorithms. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: ahash - Add instance/spawn supportHerbert Xu2009-07-142-0/+123
| | | | | | | This patch adds support for creating ahash instances and using ahash as spawns. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: ahash - Convert to new style algorithmsHerbert Xu2009-07-145-91/+148
| | | | | | | | | This patch converts crypto_ahash to the new style. The old ahash algorithm type is retained until the existing ahash implementations are also converted. All ahash users will automatically get the new crypto_ahash type. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: api - Remove frontend argument from extsize/init_tfmHerbert Xu2009-07-144-14/+8
| | | | | | | As the extsize and init_tfm functions belong to the frontend the frontend argument is superfluous. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: crypto4xx - Use crypto_ahash_set_reqsizeHerbert Xu2009-07-142-2/+4
| | | | | | | This patch makes crypto4xx use crypto_ahash_set_reqsize to avoid accessing crypto_ahash directly. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: cryptd - Use crypto_ahash_set_reqsizeHerbert Xu2009-07-141-2/+3
| | | | | | | This patch makes cryptd use crypto_ahash_set_reqsize to avoid accessing crypto_ahash directly. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: ahash - Add crypto_ahash_set_reqsizeHerbert Xu2009-07-141-0/+6
| | | | | | | This patch adds the helper crypto_ahash_set_reqsize so that implementations do not directly access the crypto_ahash structure. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: cryptd - Use shash algorithmsHerbert Xu2009-07-141-80/+84
| | | | | | | This patch changes cryptd to use shash algorithms instead of the legacy hash interface. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Export async functionsHerbert Xu2009-07-142-20/+25
| | | | | | | This patch exports the async functions so that they can be reused by cryptd when it switches over to using shash. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: hash - Remove legacy hash/digest implementaionHerbert Xu2009-07-143-34/+3
| | | | | | | | This patch removes the implementation of hash and digest now that no algorithms use them anymore. The interface though will remain until the users are converted across. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: authenc - Remove reference to crypto_hashHerbert Xu2009-07-141-5/+1
| | | | | | | Now that there are no more legacy hash implementations we can remove the reference to crypto_hash. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: xcbc - Switch to shashHerbert Xu2009-07-141-148/+87
| | | | | | This patch converts the xcbc algorithm to the new shash type. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: hmac - Switch to shashHerbert Xu2009-07-141-157/+114
| | | | | | This patch changes hmac to the new shash interface. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: padlock - Switch sha to shashHerbert Xu2009-07-142-179/+156
| | | | | | | | | | | | | | | | | | | This patch converts the padlock-sha implementation to shash. In doing so the existing mechanism of storing the data until final is no longer viable as we do not have a way of allocating data in crypto_shash_init and then reliably freeing it. This is just as well because a better way of handling the problem is to hash everything but the last chunk using normal sha code and then provide the intermediate result to the padlock device. This is good enough because the primary application of padlock-sha is IPsec and there the data is laid out in the form of an hmac header followed by the rest of the packet. In essence we can provide all the data to the padlock as the hmac header only needs to be hashed once. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Make descsize a run-time attributeHerbert Xu2009-07-143-13/+31
| | | | | | | This patch changes descsize to a run-time attribute so that implementations can change it in their init functions. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: async - Use kzfree for requestsHerbert Xu2009-07-122-3/+3
| | | | | | | | This patch changes the kfree call to kzfree for async requests. As the request may contain sensitive data it needs to be zeroed before it can be reallocated by others. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Move null setkey check to registration timeHerbert Xu2009-07-121-3/+8
| | | | | | | This patch moves the run-time null setkey check to shash_prepare_alg just like we did for finup/digest. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: padlock - Use shash fallback for shaHerbert Xu2009-07-111-30/+52
| | | | | | This patch changes padlock sha fallback to shash instead of hash. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: sha256-s390 - Add export/import supportHerbert Xu2009-07-111-0/+26
| | | | | | | | This patch adds export/import support to sha256-s390. The exported type is defined by struct sha256_state, which is basically the entire descriptor state of sha256_generic. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: sha1-s390 - Add export/import supportHerbert Xu2009-07-111-0/+26
| | | | | | | | This patch adds export/import support to sha1-s390. The exported type is defined by struct sha1_state, which is basically the entire descriptor state of sha1_generic. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: sha256_generic - Add export/import supportHerbert Xu2009-07-112-12/+31
| | | | | | | | This patch adds export/import support to sha256_generic. The exported type is defined by struct sha256_state, which is basically the entire descriptor state of sha256_generic. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: sha256_generic - Use 64-bit counter like sha1Herbert Xu2009-07-111-35/+30
| | | | | | | This patch replaces the two 32-bit counter code in sha256_generic with the simpler 64-bit counter code from sha1. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: sha1_generic - Add export/import supportHerbert Xu2009-07-112-16/+33
| | | | | | | | This patch adds export/import support to sha1_generic. The exported type is defined by struct sha1_state, which is basically the entire descriptor state of sha1_generic. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Move finup/digest null checks to registration timeHerbert Xu2009-07-111-4/+6
| | | | | | | This patch moves the run-time null finup/digest checks to the shash_prepare_alg function which is run at registration time. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Export/import hash state onlyHerbert Xu2009-07-112-15/+28
| | | | | | | | | | | | | This patch replaces the full descriptor export with an export of the partial hash state. This allows the use of a consistent export format across all implementations of a given algorithm. This is useful because a number of cases require the use of the partial hash state, e.g., PadLock can use the SHA1 hash state to get around the fact that it can only hash contiguous data chunks. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: api - Fix crypto_drop_spawn crash on blank spawnsHerbert Xu2009-07-091-0/+3
| | | | | | | | | This patch allows crypto_drop_spawn to be called on spawns that have not been initialised or have failed initialisation. This fixes potential crashes during initialisation without adding special case code. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Add shash_instance_ctxHerbert Xu2009-07-091-0/+5
| | | | | | | This patch adds the helper shash_instance_ctx which is the shash analogue of crypto_instance_ctx. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Propagate reinit return valueHerbert Xu2009-07-081-1/+1
| | | | | | | This patch fixes crypto_shash_import to propagate the value returned by reinit. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Use finup in default digestHerbert Xu2009-07-081-2/+1
| | | | | | This patch simplifies the default digest function by using finup. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Add __crypto_shash_castHerbert Xu2009-07-081-0/+5
| | | | | | | | | | | This patch adds __crypto_shash_cast which turns a crypto_tfm into crypto_shash. It's analogous to the other __crypto_*_cast functions. It hasn't been needed until now since no existing shash algorithms have had an init function. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Add crypto_shash_ctx_alignedHerbert Xu2009-07-081-0/+5
| | | | | | | This patch adds crypto_shash_ctx_aligned which will be needed by hmac after its conversion to shash. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Add shash_register_instanceHerbert Xu2009-07-082-2/+27
| | | | | | | | This patch adds shash_register_instance so that shash instances can be registered without bypassing the shash checks applied to normal algorithms. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Add shash_attr_alg2 helperHerbert Xu2009-07-082-0/+12
| | | | | | | This patch adds the helper shash_attr_alg2 which locates a shash algorithm based on the information in the given attribute. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: api - Add crypto_attr_alg2 helperHerbert Xu2009-07-084-13/+40
| | | | | | | | This patch adds the helper crypto_attr_alg2 which is similar to crypto_attr_alg but takes an extra frontend argument. This is intended to be used by new style algorithm types such as shash. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* crypto: shash - Add spawn supportHerbert Xu2009-07-082-0/+23
| | | | | | | This patch adds the functions needed to create and use shash spawns, i.e., to use shash algorithms in a template. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>