Skip to content

Commit 10ff997

Browse files
Liu Shixinherbertx
authored andcommitted
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: Liu Shixin <liushixin2@huawei.com> Reviewed-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 22ca9f4 commit 10ff997

4 files changed

Lines changed: 6 additions & 49 deletions

File tree

‎crypto/algapi.c‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -868,24 +868,6 @@ const char *crypto_attr_alg_name(struct rtattr *rta)
868868
}
869869
EXPORT_SYMBOL_GPL(crypto_attr_alg_name);
870870

871-
int crypto_attr_u32(struct rtattr *rta, u32 *num)
872-
{
873-
struct crypto_attr_u32 *nu32;
874-
875-
if (!rta)
876-
return -ENOENT;
877-
if (RTA_PAYLOAD(rta) < sizeof(*nu32))
878-
return -EINVAL;
879-
if (rta->rta_type != CRYPTOA_U32)
880-
return -EINVAL;
881-
882-
nu32 = RTA_DATA(rta);
883-
*num = nu32->num;
884-
885-
return 0;
886-
}
887-
EXPORT_SYMBOL_GPL(crypto_attr_u32);
888-
889871
int crypto_inst_setname(struct crypto_instance *inst, const char *name,
890872
struct crypto_alg *alg)
891873
{

‎crypto/algboss.c‎

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,9 @@ struct cryptomgr_param {
2828
struct crypto_attr_type data;
2929
} type;
3030

31-
union {
31+
struct {
3232
struct rtattr attr;
33-
struct {
34-
struct rtattr attr;
35-
struct crypto_attr_alg data;
36-
} alg;
37-
struct {
38-
struct rtattr attr;
39-
struct crypto_attr_u32 data;
40-
} nu32;
33+
struct crypto_attr_alg data;
4134
} attrs[CRYPTO_MAX_ATTRS];
4235

4336
char template[CRYPTO_MAX_ALG_NAME];
@@ -104,12 +97,10 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
10497

10598
i = 0;
10699
for (;;) {
107-
int notnum = 0;
108-
109100
name = ++p;
110101

111102
for (; isalnum(*p) || *p == '-' || *p == '_'; p++)
112-
notnum |= !isdigit(*p);
103+
;
113104

114105
if (*p == '(') {
115106
int recursion = 0;
@@ -123,26 +114,16 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
123114
break;
124115
}
125116

126-
notnum = 1;
127117
p++;
128118
}
129119

130120
len = p - name;
131121
if (!len)
132122
goto err_free_param;
133123

134-
if (notnum) {
135-
param->attrs[i].alg.attr.rta_len =
136-
sizeof(param->attrs[i].alg);
137-
param->attrs[i].alg.attr.rta_type = CRYPTOA_ALG;
138-
memcpy(param->attrs[i].alg.data.name, name, len);
139-
} else {
140-
param->attrs[i].nu32.attr.rta_len =
141-
sizeof(param->attrs[i].nu32);
142-
param->attrs[i].nu32.attr.rta_type = CRYPTOA_U32;
143-
param->attrs[i].nu32.data.num =
144-
simple_strtol(name, NULL, 0);
145-
}
124+
param->attrs[i].attr.rta_len = sizeof(param->attrs[i]);
125+
param->attrs[i].attr.rta_type = CRYPTOA_ALG;
126+
memcpy(param->attrs[i].data.name, name, len);
146127

147128
param->tb[i + 1] = &param->attrs[i].attr;
148129
i++;

‎include/crypto/algapi.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ void *crypto_spawn_tfm2(struct crypto_spawn *spawn);
118118
struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb);
119119
int crypto_check_attr_type(struct rtattr **tb, u32 type, u32 *mask_ret);
120120
const char *crypto_attr_alg_name(struct rtattr *rta);
121-
int crypto_attr_u32(struct rtattr *rta, u32 *num);
122121
int crypto_inst_setname(struct crypto_instance *inst, const char *name,
123122
struct crypto_alg *alg);
124123

‎include/linux/crypto.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,6 @@ enum {
647647
CRYPTOA_UNSPEC,
648648
CRYPTOA_ALG,
649649
CRYPTOA_TYPE,
650-
CRYPTOA_U32,
651650
__CRYPTOA_MAX,
652651
};
653652

@@ -665,10 +664,6 @@ struct crypto_attr_type {
665664
u32 mask;
666665
};
667666

668-
struct crypto_attr_u32 {
669-
u32 num;
670-
};
671-
672667
/*
673668
* Transform user interface.
674669
*/

0 commit comments

Comments
 (0)