/* * Probe for the availability of crypto algorithms, and set the available * flag for any algorithms found on the system. This is typically called by * pfkey during userspace SA add, update or register. */ void xfrm_probe_algs(void) { #ifdef CONFIG_CRYPTO int i, status; BUG_ON(in_softirq()); for (i = 0; i < aalg_entries(); i++) { status = crypto_alg_available(aalg_list[i].name, 0); if (aalg_list[i].available != status) aalg_list[i].available = status; } for (i = 0; i < ealg_entries(); i++) { status = crypto_alg_available(ealg_list[i].name, 0); if (ealg_list[i].available != status) ealg_list[i].available = status; } for (i = 0; i < calg_entries(); i++) { status = crypto_alg_available(calg_list[i].name, 0); if (calg_list[i].available != status) calg_list[i].available = status; } #endif }
static int __init ppp_mppe_init(void) { int answer; #if !defined(CONFIG_CRYPTO_ARC4) || !defined(CONFIG_CRYPTO_SHA1) /* * check for the modules if we are not completly compiled into the * kernel, PPP comes up before the crypto layer if built into the * kernel. */ if (!(crypto_alg_available("arc4", 0) && crypto_alg_available("sha1", 0))) return -ENODEV; #endif sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); if (!sha_pad) return -ENOMEM; sha_pad_init(sha_pad); answer = ppp_register_compressor(&ppp_mppe); if (answer == 0) printk(KERN_INFO "PPP MPPE Compression module registered (%s)\n", MODULE_VERSION); else kfree(sha_pad); return answer; }
static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_algo_desc *list, int entries, char *name, int probe) { int i, status; if (!name) return NULL; for (i = 0; i < entries; i++) { if (strcmp(name, list[i].name)) continue; if (list[i].available) return &list[i]; if (!probe) break; status = crypto_alg_available(name, 0); if (!status) break; list[i].available = status; return &list[i]; } return NULL; }
static struct xfrm_algo_desc *xfrm_get_byname(struct xfrm_nalgo_desc *list, int entries, char *name, u32 type, u32 mask, int probe) { int i, status; if (!name) return NULL; for (i = 0; i < entries; i++) { if (strcmp(name, list[i].name) && list[i].compat && strcmp(name, list[i].compat)) continue; if (list[i].available) return (struct xfrm_algo_desc *)&list[i]; if (!probe) break; status = type ? 1 : crypto_alg_available(name, 0); if (!status) break; list[i].available = status; return (struct xfrm_algo_desc *)&list[i]; } return NULL; }
static int __init ppp_mppe_init(void) { int answer; if (!(crypto_alg_available("arc4", 0) && crypto_alg_available("sha1", 0))) return -ENODEV; sha_pad = kmalloc(sizeof(struct sha_pad), GFP_KERNEL); if (!sha_pad) return -ENOMEM; sha_pad_init(sha_pad); answer = ppp_register_compressor(&ppp_mppe); if (answer == 0) printk(KERN_INFO "PPP MPPE Compression module registered\n"); else kfree(sha_pad); return answer; }