Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1643357pxj; Fri, 4 Jun 2021 22:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaCJZw6vFuEIwXoU4K7plwaXyi9uSEudPRuiLIGrbTMWmuWLUD+JmixRyHXVzR9lH0HWRj X-Received: by 2002:a17:906:994d:: with SMTP id zm13mr7436438ejb.427.1622869710957; Fri, 04 Jun 2021 22:08:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622869710; cv=none; d=google.com; s=arc-20160816; b=e4AZN28mrGD+Yf/iY1qBi8aI3qLQjn9H4FlU4vup5VrxNIyTQxdBmjX6DKCMut4bYO 6hYRVCTHOC7wrvF5LIjnurz+FZZkT3+5FxhSzfBOo5r+1eOHJ8wnVY6z/KG7kQ3TjPF1 8Dkqr2zEpBpMbyAoInTHIS+8o4yTllESO/txLpeP/6RW++4urlzsAGSN7zhEQhxf0fA3 CRH3wHLntyjDRUgvR7PjiW1i59V8p+KCVPuMIxVgP+4m/F28swjU3ZTP01TPXSASfSSa XSa34FIFDY5S8YIe3JNBkkxUfue/cBxVmw4B1PtsOk+1vzlQU6yHt3yOThQr6W/E2lac IBaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=F2//gNSWmg+4ylF4ok4WtkfXkc05Gcsqk20vqs/LZHA=; b=kY8JQ7ALDfm+aNBSCPrU4en6ekUiFeZp4mtvPtxYgWmGc33LAkmaXjajkdYtAgghNK xmXvTF+mxnG1WTSRd5KTDyK8eKxpiR+fYW5/bZx8TiL5HKOLomKydT2NOGGhjVBhnGnm CkxvdQSBh7WNM0njbNfBurnwLMNeGRxlyTAJ+XFu2kB1JYRh6fBzznJszJIgxJCcHTAx hJirA5tmyDBNRRMpj4j/52Wx1GPraY5OYE7w76W7p3ORinipJPzJcoi5LfdLEli/g955 F0nYWIPSlZerL2j1bip/t74Rx3N1HJx+ys8v3bDFJnTRSSB2MGdyeb6gGsDgCoT8sSNg rGDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kk19si6636902ejc.460.2021.06.04.22.07.53; Fri, 04 Jun 2021 22:08:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229665AbhFEFIm (ORCPT + 99 others); Sat, 5 Jun 2021 01:08:42 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7108 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbhFEFIm (ORCPT ); Sat, 5 Jun 2021 01:08:42 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Fxnbm0lnMzYpvc; Sat, 5 Jun 2021 13:04:04 +0800 (CST) Received: from dggpemm500009.china.huawei.com (7.185.36.225) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 5 Jun 2021 13:06:50 +0800 Received: from huawei.com (10.175.113.32) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 5 Jun 2021 13:06:50 +0800 From: Liu Shixin To: Herbert Xu , Eric Biggers , "David S. Miller" CC: , , Liu Shixin Subject: [PATCH -next] crypto: remove CRYPTOA_U32 and related functions Date: Sat, 5 Jun 2021 13:39:02 +0800 Message-ID: <20210605053902.2017295-1-liushixin2@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- crypto/algapi.c | 18 ------------------ crypto/algboss.c | 32 +++++++------------------------- include/crypto/algapi.h | 1 - include/linux/crypto.h | 5 ----- 4 files changed, 7 insertions(+), 49 deletions(-) diff --git a/crypto/algapi.c b/crypto/algapi.c index fdabf2675b63..43f999dba4dc 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -868,24 +868,6 @@ const char *crypto_attr_alg_name(struct rtattr *rta) } 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, struct crypto_alg *alg) { diff --git a/crypto/algboss.c b/crypto/algboss.c index 5ebccbd6b74e..71016a923a79 100644 --- a/crypto/algboss.c +++ b/crypto/algboss.c @@ -28,16 +28,9 @@ struct cryptomgr_param { struct crypto_attr_type data; } type; - union { + struct { struct rtattr attr; - struct { - struct rtattr attr; - struct crypto_attr_alg data; - } alg; - struct { - struct rtattr attr; - struct crypto_attr_u32 data; - } nu32; + struct crypto_attr_alg data; } attrs[CRYPTO_MAX_ATTRS]; char template[CRYPTO_MAX_ALG_NAME]; @@ -104,12 +97,10 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) i = 0; for (;;) { - int notnum = 0; - name = ++p; for (; isalnum(*p) || *p == '-' || *p == '_'; p++) - notnum |= !isdigit(*p); + ; if (*p == '(') { int recursion = 0; @@ -123,7 +114,6 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) break; } - notnum = 1; p++; } @@ -131,18 +121,10 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) if (!len) goto err_free_param; - if (notnum) { - param->attrs[i].alg.attr.rta_len = - sizeof(param->attrs[i].alg); - 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->attrs[i].attr.rta_len = + sizeof(param->attrs[i]); + param->attrs[i].attr.rta_type = CRYPTOA_ALG; + memcpy(param->attrs[i].data.name, name, len); param->tb[i + 1] = ¶m->attrs[i].attr; i++; diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 86f0748009af..41d42e649da4 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h @@ -118,7 +118,6 @@ void *crypto_spawn_tfm2(struct crypto_spawn *spawn); struct crypto_attr_type *crypto_get_attr_type(struct rtattr **tb); int crypto_check_attr_type(struct rtattr **tb, u32 type, u32 *mask_ret); 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, struct crypto_alg *alg); diff --git a/include/linux/crypto.h b/include/linux/crypto.h index da5e0d74bb2f..3b9263d6122f 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -647,7 +647,6 @@ enum { CRYPTOA_UNSPEC, CRYPTOA_ALG, CRYPTOA_TYPE, - CRYPTOA_U32, __CRYPTOA_MAX, }; @@ -665,10 +664,6 @@ struct crypto_attr_type { u32 mask; }; -struct crypto_attr_u32 { - u32 num; -}; - /* * Transform user interface. */ -- 2.18.0.huawei.25