lkml.org 
[lkml]   [2013]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] X.509: Support parse long form of length octets in Authority Key Identifier
Date
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


\
 
 \ /
  Last update: 2013-02-13 15:21    [W:0.051 / U:0.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site