lkml.org 
[lkml]   [2012]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [GIT] Digital signature library bugfix
On Wed, Sep 12, 2012 at 11:34 AM, James Morris <jmorris@namei.org> wrote:
>
> - if (!err && len == hlen)
> - err = memcmp(out2, h, hlen);
> + if (err || len != hlen) {
> + err = -EINVAL;
> + goto err;
> + }
> +
> + err = memcmp(out2, h, hlen);
>
> err:

Hmm. I'll pull, but this seems to drop the error return from
pkcs_1_v1_5_decode_emsa() and always replace it with -EINVAL.

Now, I didn't look, and maybe that's the only error that the decode
thing can return, but still, it looks bad.

Wouldn't it have been better to do instead

if (err)
goto err;
err = -EINVAL;
if (len != hlen)
goto err;

and not overwrite the 'err' return with EINVAL?

Linus


\
 
 \ /
  Last update: 2012-09-12 08:21    [W:0.152 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site