gnutls-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnutls-dev] bug in _gnutls_pkcs1_rsa_encrypt


From: Matthias Urlichs
Subject: Re: [gnutls-dev] bug in _gnutls_pkcs1_rsa_encrypt
Date: Thu, 19 Aug 2004 10:29:28 +0200
User-agent: Mutt/1.5.6+20040722i

Hi,

Werner Koch:
> The loop does now read:
> 
It's still wrong.

>       k += 3; /* better get some more */  /* <========= */

No, what I meant was

>       k += 3+(k/128); /* better get some more, plus safety margin */

That should be adequate; a quick run-through with B() in OpenOffice says
that it is the 99.5% solution.


Anyway, your code is still broken (think about it... in fact it's even
worse: if this version hits a zero byte in pp you effectively stop doing
*anything* in the current iteration!):

>       for(j=0; j < i && k ; j++)
>           if( !p[j] && pp[k-1] )          /* <========= */
>               p[j] = pp[--k];

Replace with:

>       for(j=0; j < i && k ; )
>           if(! p[j])
>               p[j] = pp[--k];
>           if(p[j])
>               j++;
>       if (k)
>           break; /* we know we got them all */

> Does this look better?

NOW it does.  ;-)

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  address@hidden

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]