[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 th

[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 --- crypto/shash.c | 10 ++ 1 file changed, 6 insertions(+), 4 dele

[PATCH 3/35] crypto: sha1_generic - Add export/import support

2009-07-15 Thread Herbert Xu
crypto: sha1_generic - Add export/import support 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 --- crypto/sha1_generic.c | 41 +++

[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 --- crypto/sha256_generic.c | 65 ++-- 1 file changed,

[PATCH 5/35] crypto: sha256_generic - Add export/import support

2009-07-15 Thread Herbert Xu
crypto: sha256_generic - Add export/import support 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 --- crypto/sha256_generic.c | 37 +

[PATCH 6/35] crypto: sha1-s390 - Add export/import support

2009-07-15 Thread Herbert Xu
crypto: sha1-s390 - Add export/import support 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 --- arch/s390/crypto/sha1_s390.c | 26 ++

[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 --- arch/s390/crypto/sha256_s390.c | 26

[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 --- drivers/crypto/padlock-sha.c | 82 +++ 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/drivers/

[PATCH 9/35] crypto: shash - Move null setkey check to registration time

2009-07-15 Thread Herbert Xu
crypto: shash - Move null setkey check to registration time 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 --- crypto/shash.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cry

[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 --- include/crypto/hash.h |2 +- include/linux/crypto.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 --- crypto/shash.c | 39 --- include/crypto/hash

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

2009-07-15 Thread Herbert Xu
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 crypto_shash_init and then reliably freeing it. This is just as w

[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 --- crypto/hmac.c | 271 -- 1 file changed, 114 insertions(+), 157 deletions(-) diff --git a/crypto/hmac.c b/crypto/hmac.c inde

[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 --- crypto/xcbc.c | 235 +- 1 file changed, 87 insertions(+), 148 deletions(-) diff --git a/crypto/xcbc.c b/crypto/xc

[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 --- crypto/authenc.c |6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crypto/authenc.c b/cry

[PATCH 16/35] crypto: hash - Remove legacy hash/digest implementaion

2009-07-15 Thread Herbert Xu
crypto: hash - Remove legacy hash/digest implementaion 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 --- crypto/Makefile |3 +-- crypto/ap

[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 --- crypto/shash.c | 42 + include/crypto/internal/hash.h

[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 --- crypto/cryptd.c | 164 1 file changed, 84 insertions(+), 80 deletions(-) diff -

[PATCH 19/35] crypto: ahash - Add crypto_ahash_set_reqsize

2009-07-15 Thread Herbert Xu
crypto: ahash - Add crypto_ahash_set_reqsize 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 --- include/crypto/internal/hash.h |6 ++ 1 file changed, 6 insertions(+) diff --git a/

[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 --- crypto/cryptd.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crypto/cryptd.c b/crypto/cryptd

[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 --- drivers/crypto/amcc/crypto4xx_alg.c |3 ++- drivers/crypto/amcc/crypto4xx_core.c |3 ++- 2 files changed, 4

[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 --- crypto/api.c|4 ++-- crypto/pcompress.c |6 ++ crypto/shash.c |

[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 25/35] crypto: tcrypt - Add mask parameter

2009-07-15 Thread Herbert Xu
crypto: tcrypt - Add mask parameter 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 --- crypto/tcrypt.c |9 ++--- 1 fi

[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 --- crypto/ahash.c | 72 + include/crypto/internal/hash.h | 51 ++

[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 --- include/crypto/internal/hash.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/i

[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 --- 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 --- 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 --- crypto/ahash.c |2 +-

[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 fai

[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 --- crypto/ahash.c | 27 --- crypto/shash.c

[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 --- crypto/shash.c |6 -- 1 f

[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 operati

[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 stru

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 --- crypto/cryptd.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/crypto/cryptd.c b/crypto/cryptd.c index 5dabb7d..f

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/ E

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 Patch applied. Thanks Steffen! -- Visit Openswan at http://www.opens

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 Just found two similar bugs in xcbc and hmac. I'll fix them up. Than

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 > da

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 ~{PmV>HI~} Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://g

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 uns

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 Date: Wed Jul 15 18:37:48 2009 +0800 crypto: padlock - Fix comp

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

2009-07-15 Thread Steffen Klassert
On Wed, Jul 15, 2009 at 06:38:43PM +0800, Herbert Xu wrote: > 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. > Yes, it does. Thanks! -- To unsubscribe from this list: send th

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 Date: Wed Jul 15 20:39:05 2009 +0800 crypto: ahash - Fix setkey crash When the alignment check was made unconditional for ahash we may end up

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 Date: Wed Jul 15 21:16:05 2009 +0800 crypto: shash - Fix digest size offset When an shash algorithm is exported as ahash, ahash will access

crypto: shash - Fix async finup handling of null digest

2009-07-15 Thread Herbert Xu
Hi: commit cbc86b9161b40f95caee0e56381b68956fc28cc4 Author: Herbert Xu 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 underlying final function. This patc

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 12:06:06AM +0200, Sebastian Andrzej Siewior wrote: > * 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: Chunkin

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 Date: Thu Jul 16