aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/crypto/sha1_s390.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-16 08:09:29 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-06-26 03:34:39 -0400
commit6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 (patch)
tree96684cd2c473cd05d651ce1fa3dd72b1b4b19b09 /arch/s390/crypto/sha1_s390.c
parent43600106e32809a4dead79fec67a63e9860e3d5d (diff)
[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/sha1_s390.c')
-rw-r--r--arch/s390/crypto/sha1_s390.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/s390/crypto/sha1_s390.c b/arch/s390/crypto/sha1_s390.c
index 36bb5346a8c4..9d34a35b1aa5 100644
--- a/arch/s390/crypto/sha1_s390.c
+++ b/arch/s390/crypto/sha1_s390.c
@@ -40,9 +40,9 @@ struct crypt_s390_sha1_ctx {
40 u8 buffer[2 * SHA1_BLOCK_SIZE]; 40 u8 buffer[2 * SHA1_BLOCK_SIZE];
41}; 41};
42 42
43static void sha1_init(void *ctx_arg) 43static void sha1_init(struct crypto_tfm *tfm)
44{ 44{
45 struct crypt_s390_sha1_ctx *ctx = ctx_arg; 45 struct crypt_s390_sha1_ctx *ctx = crypto_tfm_ctx(tfm);
46 static const u32 initstate[5] = { 46 static const u32 initstate[5] = {
47 0x67452301, 47 0x67452301,
48 0xEFCDAB89, 48 0xEFCDAB89,
@@ -56,13 +56,13 @@ static void sha1_init(void *ctx_arg)
56 ctx->buf_len = 0; 56 ctx->buf_len = 0;
57} 57}
58 58
59static void 59static void sha1_update(struct crypto_tfm *tfm, const u8 *data,
60sha1_update(void *ctx, const u8 *data, unsigned int len) 60 unsigned int len)
61{ 61{
62 struct crypt_s390_sha1_ctx *sctx; 62 struct crypt_s390_sha1_ctx *sctx;
63 long imd_len; 63 long imd_len;
64 64
65 sctx = ctx; 65 sctx = crypto_tfm_ctx(tfm);
66 sctx->count += len * 8; //message bit length 66 sctx->count += len * 8; //message bit length
67 67
68 //anything in buffer yet? -> must be completed 68 //anything in buffer yet? -> must be completed
@@ -111,10 +111,9 @@ pad_message(struct crypt_s390_sha1_ctx* sctx)
111} 111}
112 112
113/* Add padding and return the message digest. */ 113/* Add padding and return the message digest. */
114static void 114static void sha1_final(struct crypto_tfm *tfm, u8 *out)
115sha1_final(void* ctx, u8 *out)
116{ 115{
117 struct crypt_s390_sha1_ctx *sctx = ctx; 116 struct crypt_s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm);
118 117
119 //must perform manual padding 118 //must perform manual padding
120 pad_message(sctx); 119 pad_message(sctx);