LearnBitcoin

Bitcoin Dev Archive 2014

Bug in key.cpp

3 messages, 6 May 2014. Started by Srintuar.

Srintuar, Odinn Cyberguerrilla, Pieter Wuille

Permalink Original thread on gnusha.org

Srintuar permalink original

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...

Odinn Cyberguerrilla in reply to Srintuar permalink original

You are right there is a bug in there.

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

Quoted text (20 lines)
> 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
>
Pieter Wuille in reply to Odinn Cyberguerrilla permalink original

On Tue, May 6, 2014 at 5:12 AM, <odinn.cyberguerrilla@riseup•net> wrote:

Quoted text (7 lines)
> 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.