Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp47648pxb; Tue, 23 Feb 2021 17:37:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJx2wxKwTNmP+CccOEaWFGnMwnOP1bxR/BkkkW1hmKnOf1QHsZbgN86y2/8A/fmPJsBGntsm X-Received: by 2002:a05:6402:2707:: with SMTP id y7mr30054259edd.5.1614130646787; Tue, 23 Feb 2021 17:37:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614130646; cv=none; d=google.com; s=arc-20160816; b=X43rPgQNmj5q29Fu8W7D83TRUB8rK+Nfp7udKUSFyRIMCA5c3S9sDj6jRGHAExAG0V nEGF/pIrmeqY92PYBD6r8qAQVf1K6zUeE8gxYQM/6TiQlVGcacXakFH3DNFgkTeLwIRa cQDimZqeuixttTbWR5NWU3stcWj7zVBADLiI0r5j6PaMrewYsPVFQ82pdTzVYzSHsbhK yanFkgRQCwv+7RC9tbEHwTyx95o/D/b6/drXoxaDp7nwxemT/468sHf6mC6wxSWkXtzv s9shAsuXAxhSuJiIKmGcYYKl0akBKun9BdPl0IwAeYK1v5Nz7GGxt9xvpo4BheWCqO9I 5muQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=pXebE0gx8+1FT5OIqKXx2FrqbkpDc+ZTDFrCDFfwvMM=; b=S3wUEoqWY+sCyU8irKyALZ5JUu9iBNe/DZ2xqR4Gvw6qGRntr5IQM4fiQqipB1+/cl 3YScHwS+TGSH1JrUFpNAjKSWwFQdS1rPnd20QRTndegrSWGNR9co6zzAuyuZkxFhiu2a eTgXpuNwhvbQCoYMSDQ6EHDGmdRcmN8hsoQPkqOfe1KBcK2O2mQOeELgf6g50vvdU6I8 BtaLtqP+nYLK4gYMwUH+Bm2qwRNAyxMx3OKWLCAHHscXu9N9kZF1XwHi8zL0ThlgrjbR Jb8P6pFIMMUwfeWujYwkBAo+vPOncZfbeyDR/Jq5t46o+Q/Odr1uOdQWPMVuva/odhay dK7w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si198085edh.31.2021.02.23.17.37.03; Tue, 23 Feb 2021 17:37:26 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbhBXBdR (ORCPT + 99 others); Tue, 23 Feb 2021 20:33:17 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:12948 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbhBXBa1 (ORCPT ); Tue, 23 Feb 2021 20:30:27 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DldbW1Q3hzjQpq; Wed, 24 Feb 2021 09:28:23 +0800 (CST) Received: from [10.67.103.10] (10.67.103.10) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Wed, 24 Feb 2021 09:29:34 +0800 Subject: Re: [PATCH v9 3/7] crypto: move curve_id of ECDH from the key to algorithm name To: , , , , , CC: , , , , References: <1614064219-40701-1-git-send-email-yumeng18@huawei.com> <1614064219-40701-4-git-send-email-yumeng18@huawei.com> <8b96c136-dca9-5b6a-2221-e906d265c40b@microchip.com> From: yumeng Message-ID: Date: Wed, 24 Feb 2021 09:29:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <8b96c136-dca9-5b6a-2221-e906d265c40b@microchip.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.10] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 在 2021/2/23 18:44, Tudor.Ambarus@microchip.com 写道: > Hi, > > On 2/23/21 9:10 AM, Meng Yu wrote: >> --- a/drivers/crypto/atmel-ecc.c >> +++ b/drivers/crypto/atmel-ecc.c >> @@ -104,7 +104,7 @@ static int atmel_ecdh_set_secret(struct crypto_kpp *tfm, const void *buf, >> return -EINVAL; >> } >> >> - ctx->n_sz = atmel_ecdh_supported_curve(params.curve_id); >> + ctx->n_sz = atmel_ecdh_supported_curve(ctx->curve_id); >> if (!ctx->n_sz || params.key_size) { >> /* fallback to ecdh software implementation */ >> ctx->do_fallback = true; > > Now that you moved the curve id info into the alg name, and it is > no longer dynamically discovered when decoding the key, does it > still make sense to keep the curve id, the key size checks, and > the fallback to the software implementation? >I think we can keep the curve id, the key size check if 'atmel-ecc' may support other curves in the future, and if you're sure P256 is the only curve 'atmel-ecc' uses, and it will be changed, we can delete it. And fallback to ecdh software implementation is needed when params.key_size is zero. > I don't have an atecc508 at hand to test the changes, but I expect > your changes won't affect the functionality. > OK, if you or your team members have an atecc508, please help test.