Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp507708lqc; Fri, 8 Mar 2024 04:21:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXC2kLkWR1/C69NIRGYo3puZh8iQdZ1cGx0z7p7qaTK2AYVRrmlUJ7L/Ky00wbuIhCAFNsaKlYDlg3/loWC1WPiqelxXrSkn8Vzfv4EMA== X-Google-Smtp-Source: AGHT+IEZyu4//Upi4gWq9RYRz52ozwLSMWMc5IS7q+0JiJt5dz5yDAPYWjko+JiGMM3tJiW/9j6R X-Received: by 2002:a50:cc9e:0:b0:568:2446:64b8 with SMTP id q30-20020a50cc9e000000b00568244664b8mr1825584edi.14.1709900508002; Fri, 08 Mar 2024 04:21:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709900507; cv=pass; d=google.com; s=arc-20160816; b=WFLhgWkwmB9RpHwbfEWr37FJKWmmVFiKHNpwOnfEMkGqfutCkSLa2ALtTapc06KotQ ruTZyjy5KisnWx+xEb28/CnEF1tG54yTC11l7+/J5B6SSFPrjeU+VvdJcXtbSTQq1tGQ y3hd5/TXWc/g+GkED6JeuNT/cFsbVT6nwpS3T5XzWcvwtrxQ21BKdLUcNGrmxyRQUJIc aTALzErePFRkjJtLdSF68GOygKFkeQOFl6A+cSuzZwYVNWel7vg/xfRY4us/sKc6AgCh p76yLrWXzAV3CGzDOg+RaLr/URNiLFSiaKDye9bxeoi91R/FiAWlg1+DImhbp4d/vzEr l9pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=UAsfsXYcMiGqRElxJy9HtXhURXs3MYYs7S6xER/cnww=; fh=oaC6g1rvngpUy3NBPUH3HwPaOzR9292cM7qLBeN9XRU=; b=aV7FeyERRnG72ZOU+c0GSb3Gn/zt5Dpoau666/N9fSmUzzk0Xu6f1S+apN38yCZWuI SEqIKzyjrOHDdWkvSPHjH6ohr3sJqyioFIQhwV9WJTAviiJQ1ZcZZTxD6PMylXRmRbGu RQUoO3O2fKu9+1GSR1bSTyeliCxo1IzIqqZK18U9VgbjZ4kufdvF0/n/ymQapC56mwih CTBlBGQRwkA0GKWlJZctm9ZikOZ9MB88qWbaV5Nse55NzIxz5LwflW+fkRr8F+8AtDQ5 my5254XfXx7kC+sEpuL/3ZSRQk02mzgAYl10MTLfupxCJ7Geu2u5296a3suaQmp1oD2h q5vQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NMpBeWb2; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-96982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bx13-20020a0564020b4d00b00566728493dfsi7602622edb.493.2024.03.08.04.21.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 04:21:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=NMpBeWb2; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-96982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96982-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DE3EB1F22D90 for ; Fri, 8 Mar 2024 12:11:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2F17257887; Fri, 8 Mar 2024 12:11:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="NMpBeWb2" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB2A657880; Fri, 8 Mar 2024 12:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709899896; cv=none; b=L2gLJvqLMhcFnAUNjQ4IagyIJ9BaEIhKjm9TU58ZPaVZKtZkkegPp0v1hQwvHhq1koEHx/5UqgUF1+ZYJbhNbM4HlBf69zCQrHGuD4r/QN1XXdlhu+ONvIamfb0X9XU2Vko1I4IgiKBCaEDxfC6G7egW5Ru/EepiH0a9LsWMOkg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709899896; c=relaxed/simple; bh=ZrmhIau01iblULmsGvpRh7gT6Esf3sYRsWvciH1vB68=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ICmy6CcnIJsGBD7x8Kc4FcvOqJ0qPUtfsOrGvmKora28mXA8VcRGHnCpJ15msj7iVn3Zgy3hTDmG7S8DFG2PyuKrWsaIniBAgd9TUNECIfOVusfsSv1qReK/RGQVoOte5CRQ+k/B85YtDQbqmsZOeirm93u0ASZ4Q4ubaR8SzyA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=NMpBeWb2; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 428BCDmv007270; Fri, 8 Mar 2024 12:11:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=UAsfsXYcMiGqRElxJy9HtXhURXs3MYYs7S6xER/cnww=; b=NMpBeWb2ZX9F+03Fw90cf9zbENhL0DJKY3xRT2WXKWjGTY2wkXgc73P1Eve9kznmFfW7 7SkS1SxGo407pmzVdCEkFaRssaCQYIZSgNwDqgutbq3XPZ4HvviZ+0Dk7QDkLHZk6rGV Afz+27ASh8JslVABwp7BjBxJl/1EjdMIhyiA8Pn2bWuBXREy3b9LZTF6CobvB30SmbGk Pi0l1DxDT0OrisgghUKeX6sDRq/vDHRppPjW/1fI6uPGsvFY3Xybh6aiFZpPmwdr3gjE cbeITpg75w8XhmYNaXQBKarQghfjD8DeBWai3YdFzDvX6iKgMH/JqI6B61jsFaofLYBA +g== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wr1ke10y8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 12:11:27 +0000 Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 428B5Wvl025371; Fri, 8 Mar 2024 12:11:26 GMT Received: from smtprelay07.dal12v.mail.ibm.com ([172.16.1.9]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wmeu04ete-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 12:11:26 +0000 Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay07.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 428CBNJc23134806 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 8 Mar 2024 12:11:25 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EDC958059; Fri, 8 Mar 2024 12:11:23 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E028258043; Fri, 8 Mar 2024 12:11:22 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 8 Mar 2024 12:11:22 +0000 (GMT) Message-ID: Date: Fri, 8 Mar 2024 07:11:22 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 01/12] crypto: ecdsa - Convert byte arrays with key coordinates to digits Content-Language: en-US To: Lukas Wunner Cc: keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, linux-kernel@vger.kernel.org, saulo.alessandre@tse.jus.br References: <20240306222257.979304-1-stefanb@linux.ibm.com> <20240306222257.979304-2-stefanb@linux.ibm.com> From: Stefan Berger In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Gnf7ZvAwUzD0dPz9RqlHaUicwpqtBxkM X-Proofpoint-ORIG-GUID: Gnf7ZvAwUzD0dPz9RqlHaUicwpqtBxkM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 mlxlogscore=999 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403080097 On 3/8/24 03:41, Lukas Wunner wrote: > On Wed, Mar 06, 2024 at 05:22:46PM -0500, Stefan Berger wrote: >> +static inline void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes, >> + u64 *out, unsigned int ndigits) >> +{ >> + unsigned int o = nbytes & 7; >> + u64 msd = 0; > > My sincere apologies, I made a mistake when I proposed this: > It needs to be __be64 instead of u64... > >> + >> + if (o) { >> + memcpy((u8 *)&msd + sizeof(msd) - o, in, o); >> + out[--ndigits] = be64_to_cpu(msd); >> + in += o; >> + } > > ...otherwise sparse complains: > > crypto/ecdsa.c: note: in included file: > >> include/crypto/internal/ecc.h:74:34: sparse: sparse: cast to restricted __be64 > >> include/crypto/internal/ecc.h:74:34: sparse: sparse: cast to restricted __be64 > [...] > 66 static inline void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes, > 67 u64 *out, unsigned int ndigits) > 68 { > 69 unsigned int o = nbytes & 7; > 70 u64 msd = 0; > 71 > 72 if (o) { > 73 memcpy((u8 *)&msd + sizeof(msd) - o, in, o); > > 74 out[--ndigits] = be64_to_cpu(msd); > 75 in += o; > 76 } > 77 ecc_swap_digits(in, out, ndigits); > 78 } > 79 > > 0-day alerted me about this, it's monitoring my GitHub repo and > I've got your patches on one of my development branches. Thanks. Fixed. > > Thanks, > > Lukas >