Message ID | 20221207105430.248613-1-roberto.sassu@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp109767wrr; Wed, 7 Dec 2022 02:59:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Vp4n0b/iF2zAw9WuvHcQqkBKviIFrvam6FHhlib1Zozruq740Lfs6WFG15fk598je9zHn X-Received: by 2002:a17:906:830f:b0:7c0:a3c6:e788 with SMTP id j15-20020a170906830f00b007c0a3c6e788mr13670429ejx.476.1670410790786; Wed, 07 Dec 2022 02:59:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670410790; cv=none; d=google.com; s=arc-20160816; b=UVBe2p7n9PnymGs+Q90UJrqrbB4NySBwDksoViVXLOU9gf/bY2BMGGwkQmeD70Ilo2 eIYYEd3XjlT2Q9gnWLkuEmUJVSQZYWrk6ey8V+sQLhSaHKGNaxStd/rV1+/+hfntIHQ7 Jm2cz//Ew6ULriP9mY/SzrjuQ+2I4ttkG4iATR2sMaxymcKowtXrwg4nR8QbmuzrG+xX raRxqLnjI/F5UVOwcS79a03s8B2tI+PVY3+0NbLMU3fiqRLPl3UkgRdOuyu6oSnfgowf UdHYgQb+eytpJd+0u3QTsA7wuVz1JcM2NSHMVKpxWVuTD0P5abUae8G1nfigwNNvEKu7 jaMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ex6PV2y4TDVLMvO83AJGct5cdq9LDLnFp9J/rHgBCCc=; b=W42a6Y43DlhBDl+hGpQb34hIF6TwzBf6Ekf7v/5+EMamuYDGhmXZreV90lwlwBUPTN mVJsGauNR4AsQdyG/vvKhbOKPJXqBQDe5Rqy0yD1VkK4musaQXplRv/Oyjc+gC3wIHW4 uPZUpdtnZHbgP8ZoznVaBog5rsZkVy7S/2uYovT6MDKR+twhTVT99rPTBewhUZ46AnvT oMFL63RwxtnfJWD3BVANDdxG02GUaJ2u6/aNB3y/PAzzdqayZ2/R6XWPF7nq7ezYqpBb VYlWBB9rhPh2ccEuJ5x8RTtNPOo+E38GVow3XHOHohgViGMktwt/LHIZIQ8L3sFCIMLl +bEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm5-20020a170907948500b007a46fa50b26si16336254ejc.517.2022.12.07.02.59.27; Wed, 07 Dec 2022 02:59:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229656AbiLGKza (ORCPT <rfc822;b08248@gmail.com> + 99 others); Wed, 7 Dec 2022 05:55:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbiLGKz1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 7 Dec 2022 05:55:27 -0500 Received: from frasgout13.his.huawei.com (frasgout13.his.huawei.com [14.137.139.46]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6223611C21; Wed, 7 Dec 2022 02:55:19 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.229]) by frasgout13.his.huawei.com (SkyGuard) with ESMTP id 4NRvBy3lkhz9yF8q; Wed, 7 Dec 2022 18:48:10 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwAnDvrycJBjWe_HAA--.20736S2; Wed, 07 Dec 2022 11:54:53 +0100 (CET) From: Roberto Sassu <roberto.sassu@huaweicloud.com> To: dhowells@redhat.com, herbert@gondor.apana.org.au, davem@davemloft.net Cc: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, ebiggers@kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Roberto Sassu <roberto.sassu@huawei.com> Subject: [PATCH] public_key: Add a comment to public_key_signature struct definition Date: Wed, 7 Dec 2022 11:54:30 +0100 Message-Id: <20221207105430.248613-1-roberto.sassu@huaweicloud.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GxC2BwAnDvrycJBjWe_HAA--.20736S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Cw4xJw4DCw4rKr4rXF13urg_yoW8GF4UpF s3Gr1rKryjgrn3AFs7C3WfC34rGa1UCr17Ww4DZ3y3uanxXw1kCw4Ika13W3Z5XrWkXay7 ArZFgw1Yvw15Z3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUk2b4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lFIxGxcIEc7CjxVA2Y2ka0xkIwI1l42xK82IY c2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s 026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF 0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0x vE42xK8VAvwI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E 87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUOyCJDUUUU X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAgATBF1jj4Jj+AACs- X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751552665031202210?= X-GMAIL-MSGID: =?utf-8?q?1751552665031202210?= |
Series |
public_key: Add a comment to public_key_signature struct definition
|
|
Commit Message
Roberto Sassu
Dec. 7, 2022, 10:54 a.m. UTC
From: Roberto Sassu <roberto.sassu@huawei.com> public_key_verify_signature() calls sg_set_buf() to set the signature and digest for the signature verification. As sg_set_buf() requires the buffer to be in physically contiguous memory, see commit ac4e97abce9b8 ("scatterlist: sg_set_buf() argument must be in linear mapping"), mention that in a comment for the signature and digest fields of the public_key_signature structure. Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/ Suggested-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> --- include/crypto/public_key.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Wed, Dec 7, 2022 at 5:55 AM Roberto Sassu <roberto.sassu@huaweicloud.com> wrote: > > From: Roberto Sassu <roberto.sassu@huawei.com> > > public_key_verify_signature() calls sg_set_buf() to set the signature and > digest for the signature verification. > > As sg_set_buf() requires the buffer to be in physically contiguous memory, > see commit ac4e97abce9b8 ("scatterlist: sg_set_buf() argument must be in > linear mapping"), mention that in a comment for the signature and digest > fields of the public_key_signature structure. > > Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/ > Suggested-by: Eric Biggers <ebiggers@kernel.org> > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> > --- > include/crypto/public_key.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) This seems especially important considering the BUG_ON that could be triggered. David, are you going to pick this up? Reviewed-by: Paul Moore <paul@paul-moore.com> > diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h > index 68f7aa2a7e55..6d623e063034 100644 > --- a/include/crypto/public_key.h > +++ b/include/crypto/public_key.h > @@ -37,8 +37,8 @@ extern void public_key_free(struct public_key *key); > */ > struct public_key_signature { > struct asymmetric_key_id *auth_ids[3]; > - u8 *s; /* Signature */ > - u8 *digest; > + u8 *s; /* Signature (in physically contiguous mem) */ > + u8 *digest; /* Digest (in physically contiguous mem) */ > u32 s_size; /* Number of bytes in signature */ > u32 digest_size; /* Number of bytes in digest */ > const char *pkey_algo; > -- > 2.25.1
On Fri, Jan 20, 2023 at 02:21:04PM -0500, Paul Moore wrote: > On Wed, Dec 7, 2022 at 5:55 AM Roberto Sassu > <roberto.sassu@huaweicloud.com> wrote: > > > > From: Roberto Sassu <roberto.sassu@huawei.com> > > > > public_key_verify_signature() calls sg_set_buf() to set the signature and > > digest for the signature verification. > > > > As sg_set_buf() requires the buffer to be in physically contiguous memory, > > see commit ac4e97abce9b8 ("scatterlist: sg_set_buf() argument must be in > > linear mapping"), mention that in a comment for the signature and digest > > fields of the public_key_signature structure. > > > > Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/ > > Suggested-by: Eric Biggers <ebiggers@kernel.org> > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> > > --- > > include/crypto/public_key.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > This seems especially important considering the BUG_ON that could be triggered. > > David, are you going to pick this up? > > Reviewed-by: Paul Moore <paul@paul-moore.com> > > > diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h > > index 68f7aa2a7e55..6d623e063034 100644 > > --- a/include/crypto/public_key.h > > +++ b/include/crypto/public_key.h > > @@ -37,8 +37,8 @@ extern void public_key_free(struct public_key *key); > > */ > > struct public_key_signature { > > struct asymmetric_key_id *auth_ids[3]; > > - u8 *s; /* Signature */ > > - u8 *digest; > > + u8 *s; /* Signature (in physically contiguous mem) */ > > + u8 *digest; /* Digest (in physically contiguous mem) */ > > u32 s_size; /* Number of bytes in signature */ > > u32 digest_size; /* Number of bytes in digest */ > > const char *pkey_algo; > > -- > > 2.25.1 This patch has been superseded by "KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()" (https://lore.kernel.org/r/20221227142740.2807136-1-roberto.sassu@huaweicloud.com). - Eric
On Fri, Jan 20, 2023 at 2:43 PM Eric Biggers <ebiggers@kernel.org> wrote: > On Fri, Jan 20, 2023 at 02:21:04PM -0500, Paul Moore wrote: > > On Wed, Dec 7, 2022 at 5:55 AM Roberto Sassu > > <roberto.sassu@huaweicloud.com> wrote: > > > > > > From: Roberto Sassu <roberto.sassu@huawei.com> > > > > > > public_key_verify_signature() calls sg_set_buf() to set the signature and > > > digest for the signature verification. > > > > > > As sg_set_buf() requires the buffer to be in physically contiguous memory, > > > see commit ac4e97abce9b8 ("scatterlist: sg_set_buf() argument must be in > > > linear mapping"), mention that in a comment for the signature and digest > > > fields of the public_key_signature structure. > > > > > > Link: https://lore.kernel.org/linux-integrity/Y4pIpxbjBdajymBJ@sol.localdomain/ > > > Suggested-by: Eric Biggers <ebiggers@kernel.org> > > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> > > > --- > > > include/crypto/public_key.h | 4 ++-- > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > This seems especially important considering the BUG_ON that could be triggered. > > > > David, are you going to pick this up? > > > > Reviewed-by: Paul Moore <paul@paul-moore.com> > > > > > diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h > > > index 68f7aa2a7e55..6d623e063034 100644 > > > --- a/include/crypto/public_key.h > > > +++ b/include/crypto/public_key.h > > > @@ -37,8 +37,8 @@ extern void public_key_free(struct public_key *key); > > > */ > > > struct public_key_signature { > > > struct asymmetric_key_id *auth_ids[3]; > > > - u8 *s; /* Signature */ > > > - u8 *digest; > > > + u8 *s; /* Signature (in physically contiguous mem) */ > > > + u8 *digest; /* Digest (in physically contiguous mem) */ > > > u32 s_size; /* Number of bytes in signature */ > > > u32 digest_size; /* Number of bytes in digest */ > > > const char *pkey_algo; > > > -- > > > 2.25.1 > > This patch has been superseded by > "KEYS: asymmetric: Copy sig and digest in public_key_verify_signature()" > (https://lore.kernel.org/r/20221227142740.2807136-1-roberto.sassu@huaweicloud.com). Well nevermind then :)
diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h index 68f7aa2a7e55..6d623e063034 100644 --- a/include/crypto/public_key.h +++ b/include/crypto/public_key.h @@ -37,8 +37,8 @@ extern void public_key_free(struct public_key *key); */ struct public_key_signature { struct asymmetric_key_id *auth_ids[3]; - u8 *s; /* Signature */ - u8 *digest; + u8 *s; /* Signature (in physically contiguous mem) */ + u8 *digest; /* Digest (in physically contiguous mem) */ u32 s_size; /* Number of bytes in signature */ u32 digest_size; /* Number of bytes in digest */ const char *pkey_algo;