keyrings.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] public_key: Add a comment to public_key_signature struct definition
@ 2022-12-07 10:54 Roberto Sassu
  2023-01-20 19:21 ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Roberto Sassu @ 2022-12-07 10:54 UTC (permalink / raw)
  To: dhowells, herbert, davem
  Cc: zohar, dmitry.kasatkin, paul, jmorris, serge, ebiggers, keyrings,
	linux-crypto, linux-integrity, linux-security-module,
	linux-kernel, Roberto Sassu

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(-)

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] public_key: Add a comment to public_key_signature struct definition
  2022-12-07 10:54 [PATCH] public_key: Add a comment to public_key_signature struct definition Roberto Sassu
@ 2023-01-20 19:21 ` Paul Moore
  2023-01-20 19:43   ` Eric Biggers
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2023-01-20 19:21 UTC (permalink / raw)
  To: Roberto Sassu, dhowells
  Cc: herbert, davem, zohar, dmitry.kasatkin, jmorris, serge, ebiggers,
	keyrings, linux-crypto, linux-integrity, linux-security-module,
	linux-kernel, Roberto Sassu

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

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] public_key: Add a comment to public_key_signature struct definition
  2023-01-20 19:21 ` Paul Moore
@ 2023-01-20 19:43   ` Eric Biggers
  2023-01-20 20:16     ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Biggers @ 2023-01-20 19:43 UTC (permalink / raw)
  To: Paul Moore
  Cc: Roberto Sassu, dhowells, herbert, davem, zohar, dmitry.kasatkin,
	jmorris, serge, keyrings, linux-crypto, linux-integrity,
	linux-security-module, linux-kernel, Roberto Sassu

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] public_key: Add a comment to public_key_signature struct definition
  2023-01-20 19:43   ` Eric Biggers
@ 2023-01-20 20:16     ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2023-01-20 20:16 UTC (permalink / raw)
  To: Eric Biggers
  Cc: Roberto Sassu, dhowells, herbert, davem, zohar, dmitry.kasatkin,
	jmorris, serge, keyrings, linux-crypto, linux-integrity,
	linux-security-module, linux-kernel, Roberto Sassu

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 :)

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-20 20:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 10:54 [PATCH] public_key: Add a comment to public_key_signature struct definition Roberto Sassu
2023-01-20 19:21 ` Paul Moore
2023-01-20 19:43   ` Eric Biggers
2023-01-20 20:16     ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).