Why Bitcoin Core 0.10's release notes say “…libsecp256k1 is better than…OpenSSL”
reddit.com
reddit.com
(The bug was found via comparing the output of libsecp256k1 and OpenSSL on "specially-constructed random inputs.")
It doesn't find cases where they are both wrong, but often finds cases where one of them is wrong.
It is a very common testing strategy with maths libraries.
There idea is to do this against all the MAJOR interfaces that we all depend on TCP/IP, x86 memory model and stuff like that.
[1] http://events.ccc.de/congress/2014/Fahrplan/events/6574.html (the talk is on youtube or on ccc video streaming side)
Here is the official CCC channel: https://www.youtube.com/user/mediacccde
The official recording: http://media.ccc.de/browse/congress/2014/31c3_-_6574_-_en_-_...
The official recording on their official YT channel: https://www.youtube.com/watch?v=MBIHPLFmcgA
http://media.ccc.de/browse/congress/2014/31c3_-_6574_-_en_-_...
Not when developing crypto. You have to look at execution speed, too, to prevent timing attacks.
It doesn't matter if it takes 1s or 10s, but that it takes 10s every time (to verify a password, for example)
Particularly slide 20.
> we have reason to believe that libsecp256k1 is better tested and more thoroughly reviewed than the implementation in OpenSSL
which is something very different from generically being "better" (which has 0 information value, BTW).
1:2^128 is an incredibly low probability. Universe is only around 2^86 nanoseconds old. For all practical purposes, an event with a 1:2^128 probability is impossible.
They say that they found it with randomized testing (although one that explores "a class of rare corner cases") and dismiss the claim that this is a class of bugs that can only be found by analysis of the implementation.
I think a test that manages to find a bug like this can not be called "random" (as in, throwing random inputs to a black box). Obviously I don't know the details, but I am sure their test incorporated a great deal of detailed knowledge of algorithms used in the computation.
Surely the chance of one person running into this bug is extremely small, but what about all the people on earth combined?
Nevertheless, I think we can classify this method of testing as some sort of hybrid between brute force testing and auditing; I don't think the authors are dismissing that claim this either, but are merely stating that there are ways to make very informed test cases without looking at the code.
I just mention it because this fact means that the sufficiency of ECC security by itself doesn't mean that 2^-128 is "sufficient" against random chance.
But, course, 2^-128 is unfathomably low probability, and it's generally sufficient against 'chance'. Though chance is usually the wrong way to think about attack. For example: If I create software which takes a 256 bit input and does a "if (input == 8675309) exec_shell();" and expose it to the Internet what is the probability of that input? ... probably 1. :)
Klee or AFL would be somewhat unlikely to find this particular problem because the error was an omitted branch, so they wouldn't know there was a case left to be satisfied.
Actually no. In this case it exploits the knowledge that "low frequency inputs tend to explore more program space", It was found using numbers with a low transition probability between zero and one. This is an approach also used for digital circuit verification too.
It's true that I also know the code is full of hard to hit branches for carries, which does partially motivate that selection. But importantly, "We weren't even testing for that." the OpenSSL code in general has an entirely different algorithm than the libsecp256k1 code; and I hadn't recently looked at any OpenSSL innards.
Of course, "java-man" is probably just trolling.
of course, no amount of testing can fix a bad design. but still...