[PATCH 0/35] Converting ahash to new style

2009-07-15 Thread Herbert Xu
Hi: This series of patches converts ahash to the new algorithm format just like shash. Note that I've incorporated a couple of the previously posted patches (notably the padlock/hmac conversion) into it. At this point all implementations are either shash or ahash. So we can now move forward to

[PATCH 1/35] crypto: shash - Export/import hash state only

2009-07-15 Thread Herbert Xu
crypto: shash - Export/import hash state only 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

[PATCH 2/35] crypto: shash - Move finup/digest null checks to registration time

2009-07-15 Thread Herbert Xu
crypto: shash - Move finup/digest null checks to registration time 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 herb...@gondor.apana.org.au --- crypto/shash.c | 10 ++ 1 file

[PATCH 4/35] crypto: sha256_generic - Use 64-bit counter like sha1

2009-07-15 Thread Herbert Xu
crypto: sha256_generic - Use 64-bit counter like sha1 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 herb...@gondor.apana.org.au --- crypto/sha256_generic.c | 65

[PATCH 7/35] crypto: sha256-s390 - Add export/import support

2009-07-15 Thread Herbert Xu
crypto: sha256-s390 - Add export/import support 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 herb...@gondor.apana.org.au ---

[PATCH 8/35] crypto: padlock - Use shash fallback for sha

2009-07-15 Thread Herbert Xu
crypto: padlock - Use shash fallback for sha This patch changes padlock sha fallback to shash instead of hash. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- drivers/crypto/padlock-sha.c | 82 +++ 1 file changed, 52 insertions(+), 30

[PATCH 10/35] crypto: async - Use kzfree for requests

2009-07-15 Thread Herbert Xu
crypto: async - Use kzfree for requests 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 herb...@gondor.apana.org.au --- include/crypto/hash.h |

[PATCH 11/35] crypto: shash - Make descsize a run-time attribute

2009-07-15 Thread Herbert Xu
crypto: shash - Make descsize a run-time attribute This patch changes descsize to a run-time attribute so that implementations can change it in their init functions. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/shash.c | 39

[PATCH 13/35] crypto: hmac - Switch to shash

2009-07-15 Thread Herbert Xu
crypto: hmac - Switch to shash This patch changes hmac to the new shash interface. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/hmac.c | 271 -- 1 file changed, 114 insertions(+), 157 deletions(-) diff --git

[PATCH 14/35] crypto: xcbc - Switch to shash

2009-07-15 Thread Herbert Xu
crypto: xcbc - Switch to shash This patch converts the xcbc algorithm to the new shash type. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/xcbc.c | 235 +- 1 file changed, 87 insertions(+), 148 deletions(-) diff --git

[PATCH 15/35] crypto: authenc - Remove reference to crypto_hash

2009-07-15 Thread Herbert Xu
crypto: authenc - Remove reference to crypto_hash Now that there are no more legacy hash implementations we can remove the reference to crypto_hash. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/authenc.c |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff

[PATCH 17/35] crypto: shash - Export async functions

2009-07-15 Thread Herbert Xu
crypto: shash - Export async functions 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 herb...@gondor.apana.org.au --- crypto/shash.c | 42 +

[PATCH 18/35] crypto: cryptd - Use shash algorithms

2009-07-15 Thread Herbert Xu
crypto: cryptd - Use shash algorithms This patch changes cryptd to use shash algorithms instead of the legacy hash interface. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/cryptd.c | 164 1 file changed, 84

[PATCH 20/35] crypto: cryptd - Use crypto_ahash_set_reqsize

2009-07-15 Thread Herbert Xu
crypto: cryptd - Use crypto_ahash_set_reqsize This patch makes cryptd use crypto_ahash_set_reqsize to avoid accessing crypto_ahash directly. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/cryptd.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git

[PATCH 21/35] crypto: crypto4xx - Use crypto_ahash_set_reqsize

2009-07-15 Thread Herbert Xu
crypto: crypto4xx - Use crypto_ahash_set_reqsize This patch makes crypto4xx use crypto_ahash_set_reqsize to avoid accessing crypto_ahash directly. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- drivers/crypto/amcc/crypto4xx_alg.c |3 ++- drivers/crypto/amcc/crypto4xx_core.c |

[PATCH 22/35] crypto: api - Remove frontend argument from extsize/init_tfm

2009-07-15 Thread Herbert Xu
crypto: api - Remove frontend argument from extsize/init_tfm As the extsize and init_tfm functions belong to the frontend the frontend argument is superfluous. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/api.c|4 ++-- crypto/pcompress.c |6 ++

[PATCH 23/35] crypto: ahash - Convert to new style algorithms

2009-07-15 Thread Herbert Xu
crypto: ahash - Convert to new style algorithms 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

[PATCH 24/35] crypto: ahash - Add instance/spawn support

2009-07-15 Thread Herbert Xu
crypto: ahash - Add instance/spawn support This patch adds support for creating ahash instances and using ahash as spawns. Signed-off-by: Herbert Xu herb...@gondor.apana.org.au --- crypto/ahash.c | 72 + include/crypto/internal/hash.h |

[PATCH 26/35] crypto: hash - Add helpers to free spawns

2009-07-15 Thread Herbert Xu
crypto: hash - Add helpers to free spawns 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 herb...@gondor.apana.org.au --- include/crypto/internal/hash.h | 10 ++ 1 file changed, 10

[PATCH 28/35] crypto: cryptd - Switch to new style ahash

2009-07-15 Thread Herbert Xu
crypto: cryptd - Switch to new style ahash 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 herb...@gondor.apana.org.au --- crypto/cryptd.c | 64

[PATCH 27/35] crypto: cryptd - Switch to template create API

2009-07-15 Thread Herbert Xu
crypto: cryptd - Switch to template create API 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 herb...@gondor.apana.org.au --- crypto/cryptd.c | 53

[PATCH 33/35] crypto: ahash - Use GFP_KERNEL in unaligned setkey

2009-07-15 Thread Herbert Xu
crypto: ahash - Use GFP_KERNEL in unaligned setkey 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 herb...@gondor.apana.org.au ---

[PATCH 31/35] crypto: hash - Zap unaligned buffers

2009-07-15 Thread Herbert Xu
crypto: hash - Zap unaligned buffers 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

[PATCH 35/35] crypto: crypto4xx - Disable SHA implementation

2009-07-15 Thread Herbert Xu
crypto: crypto4xx - Disable SHA implementation 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

[PATCH 30/35] crypto: ahash - Remove old_ahash_alg

2009-07-15 Thread Herbert Xu
crypto: ahash - Remove old_ahash_alg 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 herb...@gondor.apana.org.au --- crypto/ahash.c | 27 ---

[PATCH 32/35] crypto: shash - Fix alignment in unaligned operations

2009-07-15 Thread Herbert Xu
crypto: shash - Fix alignment in unaligned operations 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 herb...@gondor.apana.org.au ---

[PATCH 34/35] crypto: ahash - Add unaligned handling and default operations

2009-07-15 Thread Herbert Xu
crypto: ahash - Add unaligned handling and default operations 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

[PATCH 29/35] crypto: crypto4xx - Switch to new style ahash

2009-07-15 Thread Herbert Xu
crypto: crypto4xx - Switch to new style ahash 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

Re: [PATCH 27/35] crypto: cryptd - Switch to template create API

2009-07-15 Thread Steffen Klassert
On Wed, Jul 15, 2009 at 03:16:21PM +0800, Herbert Xu wrote: crypto: cryptd - Switch to template create API 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

[PATCH] cryptd: Fix uninitialized return value

2009-07-15 Thread Steffen Klassert
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.klass...@secunet.com --- crypto/cryptd.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/crypto/cryptd.c

Re: [PATCH 27/35] crypto: cryptd - Switch to template create API

2009-07-15 Thread Herbert Xu
On Wed, Jul 15, 2009 at 10:47:23AM +0200, Steffen Klassert wrote: This introduces an uninitialized return value warning. err is not initialized if cryptd_alloc_instance() fails. Good catch! Same here. I'll send a patch to fix it. Thanks. -- Visit Openswan at http://www.openswan.org/

Re: [PATCH] cryptd: Fix uninitialized return value

2009-07-15 Thread Herbert Xu
On Wed, Jul 15, 2009 at 10:50:09AM +0200, Steffen Klassert wrote: 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.klass...@secunet.com Patch applied. Thanks Steffen! -- Visit

Re: [PATCH] cryptd: Fix uninitialized return value

2009-07-15 Thread Herbert Xu
On Wed, Jul 15, 2009 at 10:50:09AM +0200, Steffen Klassert wrote: 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.klass...@secunet.com Just found two similar bugs in xcbc and hmac.

Re: [PATCH 12/35] crypto: padlock - Switch sha to shash

2009-07-15 Thread Steffen Klassert
On Wed, Jul 15, 2009 at 03:16:05PM +0800, Herbert Xu wrote: crypto: padlock - Switch sha to shash 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

Re: [PATCH 12/35] crypto: padlock - Switch sha to shash

2009-07-15 Thread Herbert Xu
On Wed, Jul 15, 2009 at 12:28:18PM +0200, Steffen Klassert wrote: Just FYI, I'm getting the following compiler error: Is this 32-bit or 64-bit? Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmVHI~} herb...@gondor.apana.org.au Home Page:

Re: [PATCH 12/35] crypto: padlock - Switch sha to shash

2009-07-15 Thread Steffen Klassert
On Wed, Jul 15, 2009 at 06:30:25PM +0800, Herbert Xu wrote: On Wed, Jul 15, 2009 at 12:28:18PM +0200, Steffen Klassert wrote: Just FYI, I'm getting the following compiler error: Is this 32-bit or 64-bit? It's 32-bit. One of my test systems had padlock enabled by chance. -- To

Re: [PATCH 12/35] crypto: padlock - Switch sha to shash

2009-07-15 Thread Herbert Xu
On Wed, Jul 15, 2009 at 12:36:46PM +0200, Steffen Klassert wrote: It's 32-bit. One of my test systems had padlock enabled by chance. This should fix it. commit faae890883624e14a328863eafabf54a36698774 Author: Herbert Xu herb...@gondor.apana.org.au Date: Wed Jul 15 18:37:48 2009 +0800

crypto: ahash - Fix setkey crash

2009-07-15 Thread Herbert Xu
Hi: This patch fixes a crash caused by the new ahash code and hmac. commit a70c522520d967844c01fa01459edc698fc54544 Author: Herbert Xu herb...@gondor.apana.org.au Date: Wed Jul 15 20:39:05 2009 +0800 crypto: ahash - Fix setkey crash When the alignment check was made unconditional

crypto: shash - Fix digest size offset

2009-07-15 Thread Herbert Xu
Hi: This one fixes failures when using shash algorithms through ahash. commit fa64966473830219fe74952029ddb0e981a87749 Author: Herbert Xu herb...@gondor.apana.org.au Date: Wed Jul 15 21:16:05 2009 +0800 crypto: shash - Fix digest size offset When an shash algorithm is exported as

crypto: shash - Fix async finup handling of null digest

2009-07-15 Thread Herbert Xu
Hi: commit cbc86b9161b40f95caee0e56381b68956fc28cc4 Author: Herbert Xu herb...@gondor.apana.org.au Date: Wed Jul 15 21:26:41 2009 +0800 crypto: shash - Fix async finup handling of null digest When shash_ahash_finup encounters a null request, we end up not calling the

Re: [1/9] Convert padlock sha to shash

2009-07-15 Thread Sebastian Andrzej Siewior
* Herbert Xu | 2009-07-15 08:48:47 [+0800]: Yes, that should be enough. You don't even ipsec-tools, just a manual SA setup with ip xfrm should be good enough. I did not get that far: |alg: hash: Chunking test 1 failed for sha1-padlock |: e9 95 22 0c 1b d1 0f 5f f1 fa ee 74 7d 27 cd b2

Re: [1/9] Convert padlock sha to shash

2009-07-15 Thread Herbert Xu
On Thu, Jul 16, 2009 at 10:16:01AM +0800, Herbert Xu wrote: Can you please pull my tree again? There were quite a few bugs that I fixed last night. Oh and please make sure you have this patch applied too: commit e9b25f16cda88b33fe15b30c009912e6c471edda Author: Herbert Xu