Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3123246rwb; Fri, 20 Jan 2023 11:30:11 -0800 (PST) X-Google-Smtp-Source: AMrXdXuQnzATW7M+ZL+R5j674PWZIcPiQwtLkCDh3IPTlitGM0ATGMKMHON299gEdJ7Vmms/Xcb+ X-Received: by 2002:a05:6402:4441:b0:49c:91d8:e989 with SMTP id o1-20020a056402444100b0049c91d8e989mr15071710edb.42.1674243011483; Fri, 20 Jan 2023 11:30:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674243011; cv=none; d=google.com; s=arc-20160816; b=wNe8sluAS+fL/8kuKvidqw9IXO0fYc3atrW92xD4iugaKASPEKEr7w7HvMHFniHQ3C ySPiCpYXibCl8ceZL2vF3E2DGeXzJEFvAlRCvKxbNEu6Tu8jNBAloBxY1gwlVMhvFT0I QZZs5znEP9YNOea0LNNVIpvaU6nZ5076Bjvl6y/mfEW2yvphgflcZPBmjNNGyEpRMKq1 TEpn7VeIZF1qNskn4F0t+D+Z1jqvlk8tk1KGt06aUL43cRGQYK1uaJJTU8w1qNLcZ5oL clEGXuwrDG6sP3S4ZdjET4lKhvMFN/E5Kpexf46aioUC97/NUKvZO+2NMzIBVHBGktRp mSog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=8SDRSdhk6EPykAw/g+Wl8hh3w6cuRY9QuwzZ8iaDbYE=; b=eR5HuG5nCPtoHK7vYrsaAMHCl2xEVCp9hIZPce0cQ2w2yqrwA1QMIEh5cXixp4Ehqz rMdD+7EwxL1wlZ5JBGNTLQkvkIE4qJktNLLO1oAWRsHBVQo+jej1qadL+DicGnxpnpJE TovTwoZ9PR28sf149M4Ebm3sjlFPDMPyP3zIxqHj0czv18+fsx6q7DaNk/J3DpJTtUnJ hFiXPvFc1MAQRj4dN8eskCR2uFe11NgBvBWDA1yU3XfFuP2crkx7z5B4NlBprqPRt6ff Jdm/YNpyofg5aR4vx3yTtnEHC/XPh6E0oyGOG/sXR+M7N8MeIfJQRdWpcBXHwnxGxS85 KFZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore.com header.s=google header.b="erXn/iE6"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xf7-20020a17090731c700b007825337afeesi44955756ejb.273.2023.01.20.11.29.30; Fri, 20 Jan 2023 11:30:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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; dkim=pass header.i=@paul-moore.com header.s=google header.b="erXn/iE6"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=paul-moore.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbjATTVS (ORCPT + 99 others); Fri, 20 Jan 2023 14:21:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbjATTVR (ORCPT ); Fri, 20 Jan 2023 14:21:17 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 711FDC13DD for ; Fri, 20 Jan 2023 11:21:16 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id k10-20020a17090a590a00b0022ba875a1a4so3000022pji.3 for ; Fri, 20 Jan 2023 11:21:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8SDRSdhk6EPykAw/g+Wl8hh3w6cuRY9QuwzZ8iaDbYE=; b=erXn/iE6iiZjbHA68rk3r66LhlmEmI7xCR/nOyeiE8l5IpFc7vk/4JEYq/P4spmPox uS4/kD5WPpbGZsniUvTUpGe9xZNDWMKs82nxqzsqaT1BqDz4RNqJQyJ42MfeAowuorwJ RvwxYIKQj26CjI54rPaQDEtVyzvyDffjT/cf0vhwdY539e+SZ9xQNuBaUDwx19qMtZ3L qX048waUOdaFW5AXRIgWF+NQDDYiU+TZVghGzHQGZ46YDO+rt6apX4QHcZJxSsjw7365 ZxJ0jurd8opU6xSw6LvaScv02k7JxgVPdVGmN3mSBu+vEsKFmFMNWDq5+sSEZn4W6oFq QVOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8SDRSdhk6EPykAw/g+Wl8hh3w6cuRY9QuwzZ8iaDbYE=; b=3B0WKmmVuEbRG9R5hpon60HFuWBVDq8CfQazKdlYy1yaoGFdp+WxLCRZbf+6UoV2wf dB5RgXl6uh/Od+r9oQJyWHfH/QRQUeksn6prUJe0pX5TCkD51xYgwmILsjtNZX8FUWQD aek3QDnHBkJt599+O4pJCfYS0zAG858R80TncitrP8baqgZlutvZWpkJk2X637Dyo18F q17T7h6oUU9t4HlZKb7VTSJ5n6i4V6IVY+PDVgHxx/DI9LYV0ae7qxQAoEUL0wJaRydW 2fKn9eUR+hNinqGuFuB3oNZ1bhWH2wd912H6DH6cXhoyta+wkM/t7f4KsOClaSqh763D xeNg== X-Gm-Message-State: AFqh2kpaneNU34XyPymSFpSOIbf70EKImfZRSFoTtU70rIqy7HZc//Sf BVpQQD7yLBz3loLyremA4vnn+vkQS0WlxfT4ec7L/hkVjsbv X-Received: by 2002:a17:90a:17a1:b0:229:9ffe:135b with SMTP id q30-20020a17090a17a100b002299ffe135bmr1700587pja.72.1674242475803; Fri, 20 Jan 2023 11:21:15 -0800 (PST) MIME-Version: 1.0 References: <20221207105430.248613-1-roberto.sassu@huaweicloud.com> In-Reply-To: <20221207105430.248613-1-roberto.sassu@huaweicloud.com> From: Paul Moore Date: Fri, 20 Jan 2023 14:21:04 -0500 Message-ID: Subject: Re: [PATCH] public_key: Add a comment to public_key_signature struct definition To: Roberto Sassu , dhowells@redhat.com Cc: herbert@gondor.apana.org.au, davem@davemloft.net, zohar@linux.ibm.com, dmitry.kasatkin@gmail.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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Dec 7, 2022 at 5:55 AM Roberto Sassu wrote: > > From: Roberto Sassu > > 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 > Signed-off-by: Roberto Sassu > --- > 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 > 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 -- paul-moore.com