21 #include <linux/module.h>
24 #include <linux/sched.h>
36 static struct sock *crypto_nlsk;
81 rcipher.min_keysize = alg->cra_cipher.cia_min_keysize;
82 rcipher.max_keysize = alg->cra_cipher.cia_max_keysize;
101 goto nla_put_failure;
108 static int crypto_report_one(
struct crypto_alg *alg,
121 goto nla_put_failure;
129 goto nla_put_failure;
134 if (alg->
cra_type->report(skb, alg))
135 goto nla_put_failure;
143 goto nla_put_failure;
148 goto nla_put_failure;
160 static int crypto_report_alg(
struct crypto_alg *alg,
176 ualg = nlmsg_data(nlh);
178 err = crypto_report_one(alg, ualg, skb);
180 nlmsg_cancel(skb, nlh);
190 static int crypto_report(
struct sk_buff *in_skb,
struct nlmsghdr *in_nlh,
202 alg = crypto_alg_match(p, 1);
215 err = crypto_report_alg(alg, &info);
219 return nlmsg_unicast(crypto_nlsk, skb,
NETLINK_CB(in_skb).portid);
239 err = crypto_report_alg(alg, &info);
255 static int crypto_update_alg(
struct sk_buff *skb,
struct nlmsghdr *nlh,
266 alg = crypto_alg_match(p, 1);
290 alg = crypto_alg_match(p, 1);
314 type = crypto_skcipher_type(type);
315 mask = crypto_skcipher_mask(mask);
334 static struct crypto_alg *crypto_user_aead_alg(
const char *name,
u32 type,
374 if (priority && !exact)
377 alg = crypto_alg_match(p, exact);
414 #define MSGSIZE(type) sizeof(struct type)
429 static struct crypto_link {
438 .dump = crypto_dump_report,
439 .done = crypto_dump_report_done},
442 static int crypto_user_rcv_msg(
struct sk_buff *skb,
struct nlmsghdr *nlh)
445 struct crypto_link *
link;
453 link = &crypto_dispatch[
type];
463 if (link->dump ==
NULL)
473 .min_dump_alloc = dump_alloc,
475 return netlink_dump_start(crypto_nlsk, skb, nlh, &c);
479 err = nlmsg_parse(nlh, crypto_msg_min[type], attrs,
CRYPTOCFGA_MAX,
484 if (link->doit ==
NULL)
487 return link->doit(skb, nlh, attrs);
490 static void crypto_netlink_rcv(
struct sk_buff *skb)
497 static int __init crypto_user_init(
void)
500 .input = crypto_netlink_rcv,
510 static void __exit crypto_user_exit(
void)