From 6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 Mon Sep 17 00:00:00 2001
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Tue, 16 May 2006 22:09:29 +1000
Subject: [CRYPTO] all: Pass tfm instead of ctx to algorithms

Up until now algorithms have been happy to get a context pointer since
they know everything that's in the tfm already (e.g., alignment, block
size).

However, once we have parameterised algorithms, such information will
be specific to each tfm.  So the algorithm API needs to be changed to
pass the tfm structure instead of the context pointer.

This patch is basically a text substitution.  The only tricky bit is
the assembly routines that need to get the context pointer offset
through asm-offsets.h.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 crypto/compress.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

(limited to 'crypto/compress.c')

diff --git a/crypto/compress.c b/crypto/compress.c
index eb36d9364da3..c12fc0c41dac 100644
--- a/crypto/compress.c
+++ b/crypto/compress.c
@@ -22,8 +22,7 @@ static int crypto_compress(struct crypto_tfm *tfm,
                             const u8 *src, unsigned int slen,
                             u8 *dst, unsigned int *dlen)
 {
-	return tfm->__crt_alg->cra_compress.coa_compress(crypto_tfm_ctx(tfm),
-	                                                 src, slen, dst,
+	return tfm->__crt_alg->cra_compress.coa_compress(tfm, src, slen, dst,
 	                                                 dlen);
 }
 
@@ -31,8 +30,7 @@ static int crypto_decompress(struct crypto_tfm *tfm,
                              const u8 *src, unsigned int slen,
                              u8 *dst, unsigned int *dlen)
 {
-	return tfm->__crt_alg->cra_compress.coa_decompress(crypto_tfm_ctx(tfm),
-	                                                   src, slen, dst,
+	return tfm->__crt_alg->cra_compress.coa_decompress(tfm, src, slen, dst,
 	                                                   dlen);
 }
 
-- 
cgit v1.2.3


From 110bf1c0e932615cbe43a8af8a07bc3750ae4295 Mon Sep 17 00:00:00 2001
From: Michal Ludvig <michal@logix.cz>
Date: Mon, 22 May 2006 08:28:06 +1000
Subject: [CRYPTO] api: Fixed incorrect passing of context instead of tfm

Fix a few omissions in passing TFM instead of CTX to algorithms.

Signed-off-by: Michal Ludvig <michal@logix.cz>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 crypto/compress.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'crypto/compress.c')

diff --git a/crypto/compress.c b/crypto/compress.c
index c12fc0c41dac..f3e07334afd0 100644
--- a/crypto/compress.c
+++ b/crypto/compress.c
@@ -44,7 +44,7 @@ int crypto_init_compress_ops(struct crypto_tfm *tfm)
 	int ret = 0;
 	struct compress_tfm *ops = &tfm->crt_compress;
 	
-	ret = tfm->__crt_alg->cra_compress.coa_init(crypto_tfm_ctx(tfm));
+	ret = tfm->__crt_alg->cra_compress.coa_init(tfm);
 	if (ret)
 		goto out;
 
@@ -57,5 +57,5 @@ out:
 
 void crypto_exit_compress_ops(struct crypto_tfm *tfm)
 {
-	tfm->__crt_alg->cra_compress.coa_exit(crypto_tfm_ctx(tfm));
+	tfm->__crt_alg->cra_compress.coa_exit(tfm);
 }
-- 
cgit v1.2.3


From c7fc05992afcf1d63d6d5fb6142c8d39094dbca9 Mon Sep 17 00:00:00 2001
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 24 May 2006 13:02:26 +1000
Subject: [CRYPTO] api: Added cra_init/cra_exit

This patch adds the hooks cra_init/cra_exit which are called during a tfm's
construction and destruction respectively.  This will be used by the instances
to allocate child tfm's.

For now this lets us get rid of the coa_init/coa_exit functions which are
used for exactly that purpose (unlike the dia_init function which is called
for each transaction).

In fact the coa_exit path is currently buggy as it may get called twice
when an error is encountered during initialisation.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 crypto/compress.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

(limited to 'crypto/compress.c')

diff --git a/crypto/compress.c b/crypto/compress.c
index f3e07334afd0..eca182aa3380 100644
--- a/crypto/compress.c
+++ b/crypto/compress.c
@@ -41,21 +41,14 @@ int crypto_init_compress_flags(struct crypto_tfm *tfm, u32 flags)
 
 int crypto_init_compress_ops(struct crypto_tfm *tfm)
 {
-	int ret = 0;
 	struct compress_tfm *ops = &tfm->crt_compress;
-	
-	ret = tfm->__crt_alg->cra_compress.coa_init(tfm);
-	if (ret)
-		goto out;
 
 	ops->cot_compress = crypto_compress;
 	ops->cot_decompress = crypto_decompress;
 	
-out:
-	return ret;
+	return 0;
 }
 
 void crypto_exit_compress_ops(struct crypto_tfm *tfm)
 {
-	tfm->__crt_alg->cra_compress.coa_exit(tfm);
 }
-- 
cgit v1.2.3