lkml.org 
[lkml]   [2012]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 17/23] pefile: Strip the wrapper off of the cert data block
Date
Kees Cook <keescook@chromium.org> wrote:

> > + memcpy(&wrapper, prep->data + ctx->sig_offset, 8);
>
> Instead of the literal 8, sizeof(wrapper)?

Reasonable. It was originally an array of bytes until I found out that it had
structure. Even so, I should probably have used sizeof() then.

> > + if (pkcs7[1] == 0x82 &&
> > + pkcs7[2] == (((ctx->sig_len - 4) >> 8) & 0xff) &&
> > + pkcs7[3] == ((ctx->sig_len - 4) & 0xff))
> > + return 0;
> > + if (pkcs7[1] == 0x80)
> > + return 0;
> > + if (pkcs7[1] > 0x82)
> > + return -EMSGSIZE;
>
> Can these literals be replaced with something more meaningful?

Certainly the 0x80 can. I have a patch to define ASN1_INDEFINITE_LENGTH. The
question is how to define the 0x82 since it's a flag plus a value. Maybe by
using something like:

#define ASN1_LONG_LENGTH(x) (0x80 | (x))

Anyway, thanks for the reviews!

David


\
 
 \ /
  Last update: 2012-10-31 02:41    [W:0.190 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site