linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / s390 / crypto / sha1_s390.c
index 9d34a35..98c896b 100644 (file)
@@ -40,29 +40,28 @@ struct crypt_s390_sha1_ctx {
        u8 buffer[2 * SHA1_BLOCK_SIZE];
 };
 
-static void sha1_init(struct crypto_tfm *tfm)
+static void
+sha1_init(void *ctx)
 {
-       struct crypt_s390_sha1_ctx *ctx = crypto_tfm_ctx(tfm);
-       static const u32 initstate[5] = {
-               0x67452301,
-               0xEFCDAB89,
-               0x98BADCFE,
-               0x10325476,
-               0xC3D2E1F0
+       static const struct crypt_s390_sha1_ctx initstate = {
+               .state = {
+                       0x67452301,
+                       0xEFCDAB89,
+                       0x98BADCFE,
+                       0x10325476,
+                       0xC3D2E1F0
+               },
        };
-
-       ctx->count = 0;
-       memcpy(ctx->state, &initstate, sizeof(initstate));
-       ctx->buf_len = 0;
+       memcpy(ctx, &initstate, sizeof(initstate));
 }
 
-static void sha1_update(struct crypto_tfm *tfm, const u8 *data,
-                       unsigned int len)
+static void
+sha1_update(void *ctx, const u8 *data, unsigned int len)
 {
        struct crypt_s390_sha1_ctx *sctx;
        long imd_len;
 
-       sctx = crypto_tfm_ctx(tfm);
+       sctx = ctx;
        sctx->count += len * 8; //message bit length
 
        //anything in buffer yet? -> must be completed
@@ -111,9 +110,10 @@ pad_message(struct crypt_s390_sha1_ctx* sctx)
 }
 
 /* Add padding and return the message digest. */
-static void sha1_final(struct crypto_tfm *tfm, u8 *out)
+static void
+sha1_final(void* ctx, u8 *out)
 {
-       struct crypt_s390_sha1_ctx *sctx = crypto_tfm_ctx(tfm);
+       struct crypt_s390_sha1_ctx *sctx = ctx;
 
        //must perform manual padding
        pad_message(sctx);