Commit 10ff9976 authored by Liu Shixin's avatar Liu Shixin Committed by Herbert Xu

crypto: api - remove CRYPTOA_U32 and related functions

According to the advice of Eric and Herbert, type CRYPTOA_U32
has been unused for over a decade, so remove the code related to
CRYPTOA_U32.

After removing CRYPTOA_U32, the type of the variable attrs can be
changed from union to struct.
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 22ca9f4a
...@@ -868,24 +868,6 @@ const char *crypto_attr_alg_name(struct rtattr *rta) ...@@ -868,24 +868,6 @@ const char *crypto_attr_alg_name(struct rtattr *rta)
} }
EXPORT_SYMBOL_GPL(crypto_attr_alg_name); EXPORT_SYMBOL_GPL(crypto_attr_alg_name);
int crypto_attr_u32(struct rtattr *rta, u32 *num)
{
struct crypto_attr_u32 *nu32;
if (!rta)
return -ENOENT;
if (RTA_PAYLOAD(rta) < sizeof(*nu32))
return -EINVAL;
if (rta->rta_type != CRYPTOA_U32)
return -EINVAL;
nu32 = RTA_DATA(rta);
*num = nu32->num;
return 0;
}
EXPORT_SYMBOL_GPL(crypto_attr_u32);
int crypto_inst_setname(struct crypto_instance *inst, const char *name, int crypto_inst_setname(struct crypto_instance *inst, const char *name,
struct crypto_alg *alg) struct crypto_alg *alg)
{ {
......
...@@ -28,16 +28,9 @@ struct cryptomgr_param { ...@@ -28,16 +28,9 @@ struct cryptomgr_param {
struct crypto_attr_type data; struct crypto_attr_type data;
} type; } type;
union { struct {
struct rtattr attr; struct rtattr attr;
struct { struct crypto_attr_alg data;
struct rtattr attr;
struct crypto_attr_alg data;
} alg;
struct {
struct rtattr attr;
struct crypto_attr_u32 data;
} nu32;
} attrs[CRYPTO_MAX_ATTRS]; } attrs[CRYPTO_MAX_ATTRS];
char template[CRYPTO_MAX_ALG_NAME]; char template[CRYPTO_MAX_ALG_NAME];
...@@ -104,12 +97,10 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) ...@@ -104,12 +97,10 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
i = 0; i = 0;
for (;;) { for (;;) {
int notnum = 0;
name = ++p; name = ++p;
for (; isalnum(*p) || *p == '-' || *p == '_'; p++) for (; isalnum(*p) || *p == '-' || *p == '_'; p++)
notnum |= !isdigit(*p); ;
if (*p == '(') { if (*p == '(') {
int recursion = 0; int recursion = 0;
...@@ -123,7 +114,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) ...@@ -123,7 +114,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
break; break;
} }
notnum = 1;
p++; p++;
} }
...@@ -131,18 +121,9 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) ...@@ -131,18 +121,9 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
if (!len) if (!len)
goto err_free_param; goto err_free_param;
if (notnum) { param->attrs[i].attr.rta_len = sizeof(param->attrs[i]);
param->attrs[i].alg.attr.rta_len = param->attrs[i].attr.rta_type = CRYPTOA_ALG;
sizeof(param->attrs[i].alg); memcpy(param->attrs[i].data.name, name, len);
param->attrs[i].alg.attr.rta_type = CRYPTOA_ALG;
memcpy(param->attrs[i].alg.data.name, name, len);
} else {
param->attrs[i].nu32.attr.rta_len =
sizeof(param->attrs[i].nu32);
param->attrs[i].nu32.attr.rta_type = CRYPTOA_U32;
param->attrs[i].nu32.data.num =
simple_strtol(name, NULL, 0);
}
param->tb[i + 1] = &param->attrs[i].attr; param->tb[i + 1] = &param->attrs[i].attr;
i++; i++;
......
...@@ -118,7 +118,6 @@ void *crypto_spawn_tfm2(struct crypto_spawn *spawn); ...@@ -118,7 +118,6 @@ void *crypto_spawn_tfm2(struct crypto_spawn *spawn);
struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb);
int crypto_check_attr_type(struct rtattr **tb, u32 type, u32 *mask_ret); int crypto_check_attr_type(struct rtattr **tb, u32 type, u32 *mask_ret);
const char *crypto_attr_alg_name(struct rtattr *rta); const char *crypto_attr_alg_name(struct rtattr *rta);
int crypto_attr_u32(struct rtattr *rta, u32 *num);
int crypto_inst_setname(struct crypto_instance *inst, const char *name, int crypto_inst_setname(struct crypto_instance *inst, const char *name,
struct crypto_alg *alg); struct crypto_alg *alg);
......
...@@ -647,7 +647,6 @@ enum { ...@@ -647,7 +647,6 @@ enum {
CRYPTOA_UNSPEC, CRYPTOA_UNSPEC,
CRYPTOA_ALG, CRYPTOA_ALG,
CRYPTOA_TYPE, CRYPTOA_TYPE,
CRYPTOA_U32,
__CRYPTOA_MAX, __CRYPTOA_MAX,
}; };
...@@ -665,10 +664,6 @@ struct crypto_attr_type { ...@@ -665,10 +664,6 @@ struct crypto_attr_type {
u32 mask; u32 mask;
}; };
struct crypto_attr_u32 {
u32 num;
};
/* /*
* Transform user interface. * Transform user interface.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment