14 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18 #include <linux/module.h>
21 #include <linux/types.h>
34 struct md5_state *mctx = shash_desc_ctx(desc);
45 static void __md5_sparc64_update(
struct md5_state *sctx,
const u8 *
data,
46 unsigned int len,
unsigned int partial)
48 unsigned int done = 0;
69 struct md5_state *sctx = shash_desc_ctx(desc);
77 __md5_sparc64_update(sctx, data, len, partial);
85 struct md5_state *sctx = shash_desc_ctx(desc);
86 unsigned int i,
index, padlen;
102 __md5_sparc64_update(sctx, padding, padlen, index);
104 __md5_sparc64_update(sctx, (
const u8 *)&bits,
sizeof(bits), 56);
108 dst[i] = sctx->
hash[i];
111 memset(sctx, 0,
sizeof(*sctx));
116 static int md5_sparc64_export(
struct shash_desc *desc,
void *out)
118 struct md5_state *sctx = shash_desc_ctx(desc);
120 memcpy(out, sctx,
sizeof(*sctx));
125 static int md5_sparc64_import(
struct shash_desc *desc,
const void *
in)
127 struct md5_state *sctx = shash_desc_ctx(desc);
129 memcpy(sctx, in,
sizeof(*sctx));
136 .init = md5_sparc64_init,
137 .update = md5_sparc64_update,
138 .final = md5_sparc64_final,
139 .export = md5_sparc64_export,
140 .import = md5_sparc64_import,
145 .cra_driver_name=
"md5-sparc64",
153 static bool __init sparc64_has_md5_opcode(
void)
160 __asm__ __volatile__(
"rd %%asr26, %0" :
"=r" (cfr));
167 static int __init md5_sparc64_mod_init(
void)
169 if (sparc64_has_md5_opcode()) {
170 pr_info(
"Using sparc64 md5 opcode optimized MD5 implementation\n");
173 pr_info(
"sparc64 md5 opcode not available.\n");
177 static void __exit md5_sparc64_mod_fini(
void)