summaryrefslogtreecommitdiff
path: root/arch/s390/crypto/sha256_s390.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-16 12:09:29 (GMT)
committerHerbert Xu <herbert@gondor.apana.org.au>2006-06-26 07:34:39 (GMT)
commit6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 (patch)
tree96684cd2c473cd05d651ce1fa3dd72b1b4b19b09 /arch/s390/crypto/sha256_s390.c
parent43600106e32809a4dead79fec67a63e9860e3d5d (diff)
downloadlinux-6c2bb98bc33ae33c7a33a133a4cd5a06395fece5.tar.xz
[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>
Diffstat (limited to 'arch/s390/crypto/sha256_s390.c')
-rw-r--r--arch/s390/crypto/sha256_s390.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
index 2c76e7b..f573df3 100644
--- a/arch/s390/crypto/sha256_s390.c
+++ b/arch/s390/crypto/sha256_s390.c
@@ -31,9 +31,9 @@ struct s390_sha256_ctx {
u8 buf[2 * SHA256_BLOCK_SIZE];
};
-static void sha256_init(void *ctx)
+static void sha256_init(struct crypto_tfm *tfm)
{
- struct s390_sha256_ctx *sctx = ctx;
+ struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm);
sctx->state[0] = 0x6a09e667;
sctx->state[1] = 0xbb67ae85;
@@ -46,9 +46,10 @@ static void sha256_init(void *ctx)
sctx->count = 0;
}
-static void sha256_update(void *ctx, const u8 *data, unsigned int len)
+static void sha256_update(struct crypto_tfm *tfm, const u8 *data,
+ unsigned int len)
{
- struct s390_sha256_ctx *sctx = ctx;
+ struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm);
unsigned int index;
int ret;
@@ -107,9 +108,9 @@ static void pad_message(struct s390_sha256_ctx* sctx)
}
/* Add padding and return the message digest */
-static void sha256_final(void* ctx, u8 *out)
+static void sha256_final(struct crypto_tfm *tfm, u8 *out)
{
- struct s390_sha256_ctx *sctx = ctx;
+ struct s390_sha256_ctx *sctx = crypto_tfm_ctx(tfm);
/* must perform manual padding */
pad_message(sctx);