All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: denkenz@gmail.com
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	dhowells@redhat.com, Nathan Chancellor <natechancellor@gmail.com>,
	Eric Biggers <ebiggers@google.com>,
	zohar@linux.vnet.ibm.com, jmorris@namei.org, serge@hallyn.com,
	linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KEYS: trusted: fix -Wvarags warning
Date: Fri, 12 Oct 2018 17:02:39 +0000	[thread overview]
Message-ID: <CAKwvOdmHm_2i6bQa59hw1K1ZoTzdSx9yfNoR66WLr_UCv0Lr1w@mail.gmail.com> (raw)
In-Reply-To: <f83893d2-ed9b-613f-2768-1a975d28fe8b@gmail.com>

On Fri, Oct 12, 2018 at 5:29 AM Denis Kenzior <denkenz@gmail.com> wrote:
>
> Hi Nick,
>
> > @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
> >    */
> >   static int TSS_authhmac(unsigned char *digest, const unsigned char *key,
> >                       unsigned int keylen, unsigned char *h1,
> > -                     unsigned char *h2, unsigned char h3, ...)
> > +                     unsigned char h2, unsigned char *h3, ...)
> >   {
> >       unsigned char paramdigest[SHA1_DIGEST_SIZE];
> >       struct sdesc *sdesc;
>
> So my concern here is that this actually breaks the natural argument
> order compared to what the specification uses.  This in turn requires
> one to perform some mental gymnastics and I'm not sure that this is such
> a good idea.

Thanks for the review.

> Refer to
> https://trustedcomputinggroup.org/wp-content/uploads/TPM-Main-Part-3-Commands_v1.2_rev116_01032011.pdf
> for details.

 Can you cite the relevant section?

>
> Note that H3 is really the 'continueAuthSession' variable which is a
> bool.  In the above specification BOOL has a size of 1, and TSS_authhmac
> already assigns a h3 to 'c' which is used for the actual hashing.
>
> So can't we simply use 'bool' or uint32 as the type for h3 instead of
> re-ordering everything?

int was exactly what I originally proposed:
https://github.com/ClangBuiltLinux/linux/issues/41#issuecomment-428365339.
If that works for you and the maintainers, I can send that in patch
form.

>
> Regards,
> -Denis



-- 
Thanks,
~Nick Desaulniers

WARNING: multiple messages have this Message-ID (diff)
From: Nick Desaulniers <ndesaulniers@google.com>
To: denkenz@gmail.com
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	dhowells@redhat.com, Nathan Chancellor <natechancellor@gmail.com>,
	Eric Biggers <ebiggers@google.com>,
	zohar@linux.vnet.ibm.com, jmorris@namei.org, serge@hallyn.com,
	linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] KEYS: trusted: fix -Wvarags warning
Date: Fri, 12 Oct 2018 10:02:39 -0700	[thread overview]
Message-ID: <CAKwvOdmHm_2i6bQa59hw1K1ZoTzdSx9yfNoR66WLr_UCv0Lr1w@mail.gmail.com> (raw)
In-Reply-To: <f83893d2-ed9b-613f-2768-1a975d28fe8b@gmail.com>

On Fri, Oct 12, 2018 at 5:29 AM Denis Kenzior <denkenz@gmail.com> wrote:
>
> Hi Nick,
>
> > @@ -123,7 +123,7 @@ static int TSS_rawhmac(unsigned char *digest, const unsigned char *key,
> >    */
> >   static int TSS_authhmac(unsigned char *digest, const unsigned char *key,
> >                       unsigned int keylen, unsigned char *h1,
> > -                     unsigned char *h2, unsigned char h3, ...)
> > +                     unsigned char h2, unsigned char *h3, ...)
> >   {
> >       unsigned char paramdigest[SHA1_DIGEST_SIZE];
> >       struct sdesc *sdesc;
>
> So my concern here is that this actually breaks the natural argument
> order compared to what the specification uses.  This in turn requires
> one to perform some mental gymnastics and I'm not sure that this is such
> a good idea.

Thanks for the review.

> Refer to
> https://trustedcomputinggroup.org/wp-content/uploads/TPM-Main-Part-3-Commands_v1.2_rev116_01032011.pdf
> for details.

 Can you cite the relevant section?

>
> Note that H3 is really the 'continueAuthSession' variable which is a
> bool.  In the above specification BOOL has a size of 1, and TSS_authhmac
> already assigns a h3 to 'c' which is used for the actual hashing.
>
> So can't we simply use 'bool' or uint32 as the type for h3 instead of
> re-ordering everything?

int was exactly what I originally proposed:
https://github.com/ClangBuiltLinux/linux/issues/41#issuecomment-428365339.
If that works for you and the maintainers, I can send that in patch
form.

>
> Regards,
> -Denis



-- 
Thanks,
~Nick Desaulniers

  parent reply	other threads:[~2018-10-12 17:02 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 22:11 undefined behavior (-Wvarargs) in security/keys/trusted.c#TSS_authhmac() Nick Desaulniers
2018-10-09 22:11 ` Nick Desaulniers
2018-10-11 16:02 ` Arnd Bergmann
2018-10-11 16:02   ` Arnd Bergmann
2018-10-11 16:10   ` James Bottomley
2018-10-11 16:10     ` James Bottomley
2018-10-11 20:31     ` [PATCH] KEYS: trusted: fix -Wvarags warning ndesaulniers
2018-10-11 20:31       ` ndesaulniers
2018-10-12  1:50       ` Nathan Chancellor
2018-10-12  1:50         ` Nathan Chancellor
2018-10-12 16:55         ` Nick Desaulniers
2018-10-12 16:55           ` Nick Desaulniers
2018-10-12 17:03           ` Nathan Chancellor
2018-10-12 17:03             ` Nathan Chancellor
2018-10-12 12:29       ` Denis Kenzior
2018-10-12 12:29         ` Denis Kenzior
2018-10-12 15:05         ` James Bottomley
2018-10-12 15:05           ` James Bottomley
2018-10-12 15:13           ` Denis Kenzior
2018-10-12 15:13             ` Denis Kenzior
2018-10-12 15:22             ` James Bottomley
2018-10-12 15:22               ` James Bottomley
2018-10-12 15:44               ` Denis Kenzior
2018-10-12 15:44                 ` Denis Kenzior
2018-10-12 15:46                 ` James Bottomley
2018-10-12 15:46                   ` James Bottomley
2018-10-12 15:53                   ` Denis Kenzior
2018-10-12 15:53                     ` Denis Kenzior
2018-10-12 16:01                     ` James Bottomley
2018-10-12 16:01                       ` James Bottomley
2018-10-12 17:14                       ` Nick Desaulniers
2018-10-12 17:14                         ` Nick Desaulniers
2018-10-12 15:25             ` James Bottomley
2018-10-12 15:25               ` James Bottomley
2018-10-12 17:05             ` Nick Desaulniers
2018-10-12 17:05               ` Nick Desaulniers
2018-10-12 17:17               ` Nick Desaulniers
2018-10-12 17:17                 ` Nick Desaulniers
2018-10-12 17:27               ` Denis Kenzior
2018-10-12 17:27                 ` Denis Kenzior
2018-10-12 18:39                 ` Nick Desaulniers
2018-10-12 18:39                   ` Nick Desaulniers
2018-10-12 17:02         ` Nick Desaulniers [this message]
2018-10-12 17:02           ` Nick Desaulniers
2018-10-12 17:15           ` Denis Kenzior
2018-10-12 17:15             ` Denis Kenzior
2018-10-15  9:26       ` David Laight
2018-10-15  9:26         ` David Laight
2018-10-15  9:26         ` David Laight
2018-10-15 21:53         ` Nick Desaulniers
2018-10-15 21:53           ` Nick Desaulniers
2018-10-16  8:13           ` David Laight
2018-10-16  8:13             ` David Laight
2018-10-16  8:13             ` David Laight
2018-10-22 23:43             ` [PATCH v2] " ndesaulniers
2018-10-22 23:43               ` ndesaulniers
2018-10-23  0:00               ` Nathan Chancellor
2018-10-23  0:00                 ` Nathan Chancellor
2018-10-24  8:36               ` Jarkko Sakkinen
2018-10-24  8:36                 ` Jarkko Sakkinen
2018-10-29 17:54                 ` Nick Desaulniers
2018-10-29 17:54                   ` Nick Desaulniers
2019-02-11 18:36                   ` Nick Desaulniers
2019-02-11 18:36                     ` Nick Desaulniers
2019-02-12 23:12                     ` Jarkko Sakkinen
2019-02-12 23:12                       ` Jarkko Sakkinen
2019-02-14 10:52                       ` Jarkko Sakkinen
2019-02-14 10:52                         ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKwvOdmHm_2i6bQa59hw1K1ZoTzdSx9yfNoR66WLr_UCv0Lr1w@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=denkenz@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=ebiggers@google.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=serge@hallyn.com \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.