Ejemplo n.º 1
0
/*
 * 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
}
struct xfrm_algo_desc *xfrm_calg_get_byidx(unsigned int idx)
{
	if (idx >= calg_entries())
		return NULL;

	return &calg_list[idx];
}
Ejemplo n.º 3
0
struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id)
{
	int i;

	for (i = 0; i < calg_entries(); i++) {
		if (calg_list[i].desc.sadb_alg_id == alg_id) {
			if (calg_list[i].available)
				return &calg_list[i];
			else
				break;
		}
	}
	return NULL;
}
struct xfrm_algo_desc *xfrm_calg_get_byname(char *name)
{
	int i;

	if (!name)
		return NULL;

	for (i=0; i < calg_entries(); i++) {
		if (strcmp(name, calg_list[i].name) == 0) {
			if (calg_list[i].available)
				return &calg_list[i];
			else
				break;
		}
	}
	return NULL;
}
Ejemplo n.º 5
0
struct xfrm_algo_desc *xfrm_calg_get_byname(char *name, int probe)
{
	return xfrm_get_byname(calg_list, calg_entries(), name, probe);
}