ipsec: Stop using crypto_has_alg
Stop using the obsolete crypto_has_alg helper that is type-agnostic. Instead use the type-specific helpers such as the newly added crypto_has_aead. This means that changes in the underlying type/mask values won't affect IPsec. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
534562e59f
commit
a1383e2ab1
@ -5,6 +5,7 @@
|
|||||||
* Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
|
* Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <crypto/aead.h>
|
||||||
#include <crypto/hash.h>
|
#include <crypto/hash.h>
|
||||||
#include <crypto/skcipher.h>
|
#include <crypto/skcipher.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -644,38 +645,33 @@ static inline int calg_entries(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct xfrm_algo_list {
|
struct xfrm_algo_list {
|
||||||
|
int (*find)(const char *name, u32 type, u32 mask);
|
||||||
struct xfrm_algo_desc *algs;
|
struct xfrm_algo_desc *algs;
|
||||||
int entries;
|
int entries;
|
||||||
u32 type;
|
|
||||||
u32 mask;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct xfrm_algo_list xfrm_aead_list = {
|
static const struct xfrm_algo_list xfrm_aead_list = {
|
||||||
|
.find = crypto_has_aead,
|
||||||
.algs = aead_list,
|
.algs = aead_list,
|
||||||
.entries = ARRAY_SIZE(aead_list),
|
.entries = ARRAY_SIZE(aead_list),
|
||||||
.type = CRYPTO_ALG_TYPE_AEAD,
|
|
||||||
.mask = CRYPTO_ALG_TYPE_MASK,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct xfrm_algo_list xfrm_aalg_list = {
|
static const struct xfrm_algo_list xfrm_aalg_list = {
|
||||||
|
.find = crypto_has_ahash,
|
||||||
.algs = aalg_list,
|
.algs = aalg_list,
|
||||||
.entries = ARRAY_SIZE(aalg_list),
|
.entries = ARRAY_SIZE(aalg_list),
|
||||||
.type = CRYPTO_ALG_TYPE_HASH,
|
|
||||||
.mask = CRYPTO_ALG_TYPE_HASH_MASK,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct xfrm_algo_list xfrm_ealg_list = {
|
static const struct xfrm_algo_list xfrm_ealg_list = {
|
||||||
|
.find = crypto_has_skcipher,
|
||||||
.algs = ealg_list,
|
.algs = ealg_list,
|
||||||
.entries = ARRAY_SIZE(ealg_list),
|
.entries = ARRAY_SIZE(ealg_list),
|
||||||
.type = CRYPTO_ALG_TYPE_SKCIPHER,
|
|
||||||
.mask = CRYPTO_ALG_TYPE_MASK,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct xfrm_algo_list xfrm_calg_list = {
|
static const struct xfrm_algo_list xfrm_calg_list = {
|
||||||
|
.find = crypto_has_comp,
|
||||||
.algs = calg_list,
|
.algs = calg_list,
|
||||||
.entries = ARRAY_SIZE(calg_list),
|
.entries = ARRAY_SIZE(calg_list),
|
||||||
.type = CRYPTO_ALG_TYPE_COMPRESS,
|
|
||||||
.mask = CRYPTO_ALG_TYPE_MASK,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct xfrm_algo_desc *xfrm_find_algo(
|
static struct xfrm_algo_desc *xfrm_find_algo(
|
||||||
@ -696,8 +692,7 @@ static struct xfrm_algo_desc *xfrm_find_algo(
|
|||||||
if (!probe)
|
if (!probe)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
status = crypto_has_alg(list[i].name, algo_list->type,
|
status = algo_list->find(list[i].name, 0, 0);
|
||||||
algo_list->mask);
|
|
||||||
if (!status)
|
if (!status)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user