2023-01-20 19:30:11

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH] public_key: Add a comment to public_key_signature struct definition

On Wed, Dec 7, 2022 at 5:55 AM Roberto Sassu
<[email protected]> wrote:
>
> From: Roberto Sassu <[email protected]>
>
> 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/[email protected]/
> Suggested-by: Eric Biggers <[email protected]>
> Signed-off-by: Roberto Sassu <[email protected]>
> ---
> 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 <[email protected]>

> 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


2023-01-20 19:48:25

by Eric Biggers

[permalink] [raw]
Subject: Re: [PATCH] public_key: Add a comment to public_key_signature struct definition

On Fri, Jan 20, 2023 at 02:21:04PM -0500, Paul Moore wrote:
> On Wed, Dec 7, 2022 at 5:55 AM Roberto Sassu
> <[email protected]> wrote:
> >
> > From: Roberto Sassu <[email protected]>
> >
> > 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/[email protected]/
> > Suggested-by: Eric Biggers <[email protected]>
> > Signed-off-by: Roberto Sassu <[email protected]>
> > ---
> > 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 <[email protected]>
>
> > 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/[email protected]).

- Eric

2023-01-20 20:18:19

by Paul Moore

[permalink] [raw]
Subject: Re: [PATCH] public_key: Add a comment to public_key_signature struct definition

On Fri, Jan 20, 2023 at 2:43 PM Eric Biggers <[email protected]> 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
> > <[email protected]> wrote:
> > >
> > > From: Roberto Sassu <[email protected]>
> > >
> > > 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/[email protected]/
> > > Suggested-by: Eric Biggers <[email protected]>
> > > Signed-off-by: Roberto Sassu <[email protected]>
> > > ---
> > > 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 <[email protected]>
> >
> > > 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/[email protected]).

Well nevermind then :)

--
paul-moore.com