예제 #1
0
파일: xfrm_algo.c 프로젝트: me-oss/me-linux
/*
 * 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
}
예제 #2
0
파일: xfrm_algo.c 프로젝트: me-oss/me-linux
struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx)
{
	if (idx >= ealg_entries())
		return NULL;

	return &ealg_list[idx];
}
예제 #3
0
파일: xfrm_algo.c 프로젝트: me-oss/me-linux
int xfrm_count_enc_supported(void)
{
	int i, n;

	for (i = 0, n = 0; i < ealg_entries(); i++)
		if (ealg_list[i].available)
			n++;
	return n;
}
예제 #4
0
파일: xfrm_algo.c 프로젝트: me-oss/me-linux
struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id)
{
	int i;

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

	if (!name)
		return NULL;

	for (i=0; i < ealg_entries(); i++) {
		if (strcmp(name, ealg_list[i].name) == 0) {
			if (ealg_list[i].available)
				return &ealg_list[i];
			else
				break;
		}
	}
	return NULL;
}
예제 #6
0
파일: xfrm_algo.c 프로젝트: me-oss/me-linux
struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe)
{
	return xfrm_get_byname(ealg_list, ealg_entries(), name, probe);
}
예제 #7
0
struct xfrm_algo_desc *xfrm_ealg_get_byname(char *name, int probe)
{
	return xfrm_get_byname(ealg_list, ealg_entries(), name,
			       NCRYPTO_ALG_TYPE_BLKCIPHER,
			       NCRYPTO_ALG_TYPE_MASK, probe);
}