21 #include <linux/module.h>
23 #include <linux/types.h>
24 #include <crypto/sha.h>
25 #include <asm/byteorder.h>
34 const unsigned char *
data,
unsigned int rounds);
39 struct SHA1_CTX *sctx = shash_desc_ctx(desc);
40 memset(sctx, 0,
sizeof(*sctx));
51 unsigned int len,
unsigned int partial)
53 unsigned int done = 0;
74 static int sha1_update(
struct shash_desc *desc,
const u8 *data,
77 struct SHA1_CTX *sctx = shash_desc_ctx(desc);
87 res = __sha1_update(sctx, data, len, partial);
95 struct SHA1_CTX *sctx = shash_desc_ctx(desc);
96 unsigned int i,
index, padlen;
108 sctx->
count += padlen;
111 __sha1_update(sctx, padding, padlen, index);
113 __sha1_update(sctx, (
const u8 *)&bits,
sizeof(bits), 56);
116 for (i = 0; i < 5; i++)
120 memset(sctx, 0,
sizeof(*sctx));
125 static int sha1_export(
struct shash_desc *desc,
void *out)
127 struct SHA1_CTX *sctx = shash_desc_ctx(desc);
128 memcpy(out, sctx,
sizeof(*sctx));
133 static int sha1_import(
struct shash_desc *desc,
const void *
in)
135 struct SHA1_CTX *sctx = shash_desc_ctx(desc);
136 memcpy(sctx, in,
sizeof(*sctx));
144 .update = sha1_update,
146 .export = sha1_export,
147 .import = sha1_import,
148 .descsize =
sizeof(
struct SHA1_CTX),
149 .statesize =
sizeof(
struct SHA1_CTX),
152 .cra_driver_name=
"sha1-asm",
161 static int __init sha1_mod_init(
void)
167 static void __exit sha1_mod_fini(
void)