Commit Graph

17 Commits

Author SHA1 Message Date
Gregory Maxwell 3d2302257f Constant-time behaviour test using valgrind memtest.
Valgrind does bit-level tracking of the "uninitialized" status of memory,
 property tracks memory which is tainted by any uninitialized memory, and
 warns if any branch or array access depends on an uninitialized bit.

That is exactly the verification we need on secret data to test for
 constant-time behaviour. All we need to do is tell valgrind our
 secret key is actually uninitialized memory.

This adds a valgrind_ctime_test which is compiled if valgrind is installed:

Run it with libtool --mode=execute:
$ libtool --mode=execute valgrind ./valgrind_ctime_test
2020-02-24 18:59:30 +00:00
Tony Rizko cb32940df3 Add bench_ecmult to .gitignore 2017-12-30 19:59:17 -08:00
Andrew Poelstra 20b8877be1 Add exhaustive test for group functions on a low-order subgroup
We observe that when changing the b-value in the elliptic curve formula
`y^2 = x^3 + ax + b`, the group law is unchanged. Therefore our functions
for secp256k1 will be correct if and only if they are correct when applied
to the curve defined by `y^2 = x^3 + 4` defined over the same field. This
curve has a point P of order 199.

This commit adds a test which computes the subgroup generated by P and
exhaustively checks that addition of every pair of points gives the correct
result.

Unfortunately we cannot test const-time scalar multiplication by the same
mechanism. The reason is that these ecmult functions both compute a wNAF
representation of the scalar, and this representation is tied to the order
of the group.

Testing with the incomplete version of gej_add_ge (found in 5de4c5dff^)
shows that this detects the incompleteness when adding P - 106P, which
is exactly what we expected since 106 is a cube root of 1 mod 199.
2016-11-25 20:45:29 +00:00
upgradeadvice 70141a85d0 Update .gitignore
Don't ignore everything under build-aux
2016-02-16 16:59:00 -06:00
Pieter Wuille 14727fd9e1 Use correct name in gitignore 2015-08-03 22:40:00 +02:00
Pieter Wuille a5a66c70b6 Add support for custom EC-Schnorr-SHA256 signatures 2015-08-03 20:08:51 +02:00
Andrew Poelstra 91c0ce95ca Add benchmarks for ECDH and const-time multiplication 2015-08-01 10:57:36 -05:00
Thomas Daede fbecc38a89 Add ability to use a statically generated ecmult context.
This vastly shrinks the size of the context required for signing on devices with
memory-mapped Flash.

Tables are generated by the new gen_context tool into a header.
2015-07-13 18:00:03 -07:00
Gregory Maxwell c146b4a446 Add bench_internal to gitignore. 2015-04-22 19:11:19 +00:00
Pavel Janík 6a59012f04 Make git ignore bench_recover when configured with benchmark enabled 2014-12-16 07:43:19 +01:00
Phillip Mienk 8ca6a9c06f Correct .gitignore to correctly account for build-aux. 2014-11-15 19:47:03 -08:00
Pieter Wuille 8f9a307818 Better .gitignore for bench binaries 2014-11-01 06:01:40 -07:00
Cory Fields d40908763a build: add autogen. How was this missing? 2014-06-19 14:56:23 -04:00
Cory Fields 4212f7d7cb packaging: add pkg-config file to gitignore 2014-05-20 21:04:31 -04:00
Cory Fields 78cd96b151 autotools: autotools'ify libsecp256k1 2014-01-17 23:24:12 -05:00
Pieter Wuille a16c3a905b Add obj/ directory 2013-04-11 12:46:39 +02:00
Pieter Wuille f0c89aadc6 Revamp makefile 2013-04-07 01:39:57 +02:00