linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-integrity@vger.kernel.org, Mimi Zohar <zohar@linux.ibm.com>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	David Woodhouse <dwmw2@infradead.org>,
	keyrings@vger.kernel.org
Subject: Re: [PATCH v8 1/8] lib: add ASN.1 encoder
Date: Thu, 19 Mar 2020 13:07:37 -0700	[thread overview]
Message-ID: <1584648457.3610.42.camel@HansenPartnership.com> (raw)
In-Reply-To: <3192644.1584645125@warthog.procyon.org.uk>

On Thu, 2020-03-19 at 19:12 +0000, David Howells wrote:
> James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> 
> > > I wonder if it's worth appending a note to the comment that if
> > > indefinite length encoding is selected, then the result is not
> > > DER-compliant and may not be CER-compliant since you're
> > > advertising BER/DER/CER.
> > 
> > We only encode definite length currently, so the comment is
> > superfluous (and probably confusing if you don't know the
> > difference between DER/BER and CER).  Let's add something like this
> > iff we ever start to use indefinite lengths in the encoder.
> 
> Your code appears to actually do indefinite length encoding if -1 is
> passed as len to asn1_encode_tag().  The kdoc says:
> 
> 	To encode in place pass a NULL @string and -1 for @len; all
> this will do is add an indefinite length tag and update the data
> pointer to the place where the tag contents should be placed.
> 
> Granted, your patches might not use it, but you're making a generic
> ASN.1 encoder library.

That was a thing the other David asked for.  But actually, I think the
comment is a lie:  the first time around we encode a definite length
for the max buffer size and on the recode we do the length for the
actual buffer size, so we never actually place an indefinite length tag
there ... I think David wanted us to, to keep the ASN.1 always legal,
but the max len thing does that too so I must have changed it without
updating the comment, I'll fix that.

James


  reply	other threads:[~2020-03-19 20:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10  5:15 [PATCH v8 0/8] TPM 2.0 trusted keys with attached policy James Bottomley
2020-03-10  5:16 ` [PATCH v8 1/8] lib: add ASN.1 encoder James Bottomley
2020-03-19 19:16   ` Eric Biggers
2020-03-10  5:16 ` [PATCH v8 2/8] oid_registry: Add TCG defined OIDS for TPM keys James Bottomley
2020-03-10  5:16 ` [PATCH v8 3/8] security: keys: trusted: fix TPM2 authorizations James Bottomley
2020-03-10  5:16 ` [PATCH v8 4/8] security: keys: trusted: use ASN.1 TPM2 key format for the blobs James Bottomley
2020-03-10  5:16 ` [PATCH v8 5/8] security: keys: trusted: Make sealed key properly interoperable James Bottomley
2020-03-10  5:16 ` [PATCH v8 6/8] security: keys: trusted: add PCR policy to TPM2 keys James Bottomley
2020-03-10  5:16 ` [PATCH v8 7/8] security: keys: trusted: add ability to specify arbitrary policy James Bottomley
2020-03-10  5:16 ` [PATCH v8 8/8] security: keys: trusted: implement counter/timer policy James Bottomley
2020-03-19 16:47 ` [PATCH v8 1/8] lib: add ASN.1 encoder David Howells
2020-03-19 17:31   ` James Bottomley
2020-03-19 19:12   ` David Howells
2020-03-19 20:07     ` James Bottomley [this message]
2020-03-19 16:48 ` [PATCH v8 2/8] oid_registry: Add TCG defined OIDS for TPM keys David Howells
2020-03-19 16:57 ` [PATCH v8 6/8] security: keys: trusted: add PCR policy to TPM2 keys David Howells
2020-03-19 18:59   ` James Bottomley
  -- strict thread matches above, loose matches on Subject: below --
2020-03-10  5:09 [PATCH v8 0/8] TPM 2.0 trusted keys with attached policy James Bottomley
2020-03-10  5:09 ` [PATCH v8 1/8] lib: add ASN.1 encoder James Bottomley
2020-03-10 15:22   ` James Bottomley

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=1584648457.3610.42.camel@HansenPartnership.com \
    --to=james.bottomley@hansenpartnership.com \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@linux.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 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).