Bug in key.cpp

Bug in key.cpp
2014-05-06  3:12 ` odinn.cyberguerrilla
  
From: Srintuar @ 2014-05-06  2:42 UTC (permalink / raw)
  To: bitcoin-development

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

I think i see a bug:

line 273 of key.cpp

        if (rec<0 || rec>=3)
            return false;

Afaict, 3 is a perfectly valid value, meaning 25% of sig-> key recoveries
would fail erroneously...

[-- Attachment #2: Type: text/html, Size: 316 bytes --]

 permalink raw reply	[|nested]
2014-05-06  2:42 [Bitcoin-development] Bug in key.cpp Srintuar

  2014-05-06  8:25   ` Pieter Wuille
  
From: odinn.cyberguerrilla @ 2014-05-06  3:12 UTC (permalink / raw)
  To: Srintuar;  bitcoin-development

You are right there is a bug in there.

But the value is not 25% I think.  Tinker some more. :-)

> I think i see a bug:
>
> line 273 of key.cpp
>
>         if (rec<0 || rec>=3)
>             return false;
>
> Afaict, 3 is a perfectly valid value, meaning 25% of sig-> key recoveries
> would fail erroneously...
> ------------------------------------------------------------------------------
> Is your legacy SCM system holding you back? Join Perforce May 7 to find
> out:
> &#149; 3 signs your SCM is hindering your productivity
> &#149; Requirements for releasing software faster
> &#149; Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce_______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists•sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>





 permalink raw reply	[|nested]
2014-05-06  3:12 ` odinn.cyberguerrilla

  
From: Pieter Wuille @ 2014-05-06  8:25 UTC ( / )
  To: odinn.cyberguerrilla;  Bitcoin Dev

On Tue, May 6, 2014 at 5:12 AM,  <odinn.cyberguerrilla@riseup•net> wrote:
> You are right there is a bug in there.
>
> But the value is not 25% I think.  Tinker some more. :-)
>
>>
>> Afaict, 3 is a perfectly valid value, meaning 25% of sig-> key recoveries
>> would fail erroneously...

Values 2 and 3 are only needed in theory. They together shouldn't
occur more than once in 2**127 (when the signature value is between
the group size and the field size).

That said, this is indeed a bug.

-- 
Pieter