linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: "Lee, Chun-Yi" <joeyli.kernel@gmail.com>
Cc: dhowells@redhat.com, rusty@rustcorp.com.au,
	linux-kernel@vger.kernel.org, "Lee, Chun-Yi" <jlee@suse.com>,
	Josh Boyer <jwboyer@redhat.com>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Herbert Xu <herbert@gondor.hengli.com.au>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] X.509: Support parse long form of length octets in Authority Key Identifier
Date: Wed, 13 Feb 2013 13:47:00 +0000	[thread overview]
Message-ID: <18786.1360763220@warthog.procyon.org.uk> (raw)
In-Reply-To: <1360130301-9031-1-git-send-email-jlee@suse.com>

Lee, Chun-Yi <joeyli.kernel@gmail.com> wrote:

> Signed-off-by: Lee, Chun-Yi <jlee@suse.com>

Without the comma, please.

> +		/* Short Form length */
> +		if (vlen <= 127) {
> +
> +			if (v[1] != vlen - 2 ||

There's an unnecessary blank line there.  I would also move the comment inside
the if-body.

> +			int sub = v[1] - 0x80;

I recommend you use an unsigned int or size_t variable.

Also, you should use ASN1_INDEFINITE_LENGTH rather than writing 0x80 and 127.

> +			v += 4;
> +			key_len = v[3];

Are you sure that is correct?  You altered v before doing v[3].  I would stick
with key_len = vlen - 4.

> +			/* calculate the length from subsequent octet */

"... octets".

> +				seq_len |= v[2 + i];

Add 2 to v before entering the loop.

> +			/* check vlen should not less then length of keyid */

vlen should be exactly equal to key id, shouldn't it?  Leastways, that's what
you're checking...

> +			v += (4 + sub);
> +			key_len = v[3 + sub];

Again, this doesn't look right.  Besides, you should be able to work out
key_len from vlen, subtracting the metadata size.

David

  reply	other threads:[~2013-02-13 13:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  5:58 [PATCH] X.509: Support parse long form of length octets in Authority Key Identifier Lee, Chun-Yi
2013-02-13 13:47 ` David Howells [this message]
2013-02-14  8:08   ` joeyli
  -- strict thread matches above, loose matches on Subject: below --
2013-02-06  5:08 Lee, Chun-Yi
2013-02-06  5:59 ` joeyli

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=18786.1360763220@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.hengli.com.au \
    --cc=jlee@suse.com \
    --cc=joeyli.kernel@gmail.com \
    --cc=jwboyer@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=rusty@rustcorp.com.au \
    /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).