79 Commits

Author SHA1 Message Date
Pieter Wuille
9ab93355f2 Add a reference consistency test to ge_tests.
This adds all points used in the test together in random order, which
should result in infinity.

Suggested by Greg Maxwell.
2014-12-29 17:21:39 +01:00
Pieter Wuille
60571c6e45 Rework group tests 2014-12-29 15:38:17 +01:00
Pieter Wuille
b450c34843
Merge pull request #163
bbd5ba7 Use rfc6979 as default nonce generation function (Pieter Wuille)
b37fbc2 Implement SHA256 / HMAC-SHA256 / RFC6979. (Pieter Wuille)
c6e7f4e [API BREAK] Use a nonce-generation function instead of a nonce (Pieter Wuille)
2014-12-23 14:40:47 +01:00
Pieter Wuille
d7174edf5f Weak normalization for secp256k1_fe_equal 2014-12-20 14:38:20 +01:00
Pieter Wuille
bbd5ba7cfa Use rfc6979 as default nonce generation function 2014-12-20 14:36:13 +01:00
Pieter Wuille
b37fbc280e Implement SHA256 / HMAC-SHA256 / RFC6979. 2014-12-20 14:36:13 +01:00
Pieter Wuille
c6e7f4e8d8 [API BREAK] Use a nonce-generation function instead of a nonce 2014-12-20 14:36:11 +01:00
Pieter Wuille
603c33bc80 Make signing fail if a too small buffer is passed.
Bug discovered by Sergio Demian Lerner.
2014-12-18 01:28:06 +01:00
Pieter Wuille
cf7b2b4647 Fix ECDSA message hashes to 32 bytes 2014-12-09 12:50:47 +01:00
Pieter Wuille
ee1eaa792d
Merge pull request #141
7c6fed2 Add a few more additional tests. (Gregory Maxwell)
8d11164 Add some additional tests. (Gregory Maxwell)
2014-12-09 01:38:01 +01:00
Gregory Maxwell
7c6fed2857 Add a few more additional tests. 2014-12-08 14:15:09 -08:00
Pavel Janík
e06a9244bf Include time.h header for time(). 2014-12-08 20:48:58 +01:00
Gregory Maxwell
8d11164bc0 Add some additional tests. 2014-12-08 09:13:35 -08:00
Pieter Wuille
6a9901e15b
Merge pull request #137
39bd94d Variable time normalize (Pieter Wuille)
2014-12-07 14:35:23 +01:00
Pieter Wuille
39bd94d86d Variable time normalize 2014-12-06 18:18:28 +01:00
Pieter Wuille
2b9388b647 Remove unused secp256k1_fe_inv_all 2014-12-05 18:13:51 +01:00
Pieter Wuille
b0210a95da
Merge pull request #135
ee3eb4b Fix a memory leak and add a number of small tests. (Gregory Maxwell)
2014-12-04 19:16:09 +01:00
Gregory Maxwell
ee3eb4be9e Fix a memory leak and add a number of small tests.
This fixes a simple copy and paste induced memory leak for the ecdsa init.

The tests are mostly just improving coverage and aren't interesting.
2014-12-04 07:17:08 -08:00
Pieter Wuille
4d879a3a66
Merge pull request #134
29ae131 Make scalar_add_bit test's overflow detection exact (Pieter Wuille)
2014-12-04 12:21:06 +01:00
Pieter Wuille
29ae1310ce Make scalar_add_bit test's overflow detection exact 2014-12-03 18:54:01 +01:00
Pieter Wuille
ff8746d457 Add secp256k1_scalar_mul_shift_var 2014-12-02 16:50:00 +01:00
Pieter Wuille
bd313f7d6e
Merge pull request #119
597128d Make num optional (Pieter Wuille)
659b554 Make constant initializers independent from num (Pieter Wuille)
2014-12-02 16:42:50 +01:00
Pieter Wuille
24b3c65e0d Add a test case for ECDSA recomputing infinity 2014-12-01 14:45:05 +01:00
Pieter Wuille
32600e5086 Add a test for r >= order signature handling
Suggested by Greg Maxwell.
2014-12-01 14:23:09 +01:00
Pieter Wuille
597128d389 Make num optional 2014-12-01 12:38:38 +01:00
Pieter Wuille
659b554d7b Make constant initializers independent from num 2014-12-01 12:38:38 +01:00
Pieter Wuille
c76be9efa0 Remove unused num functions 2014-11-30 23:38:01 +01:00
Pieter Wuille
f24041d6aa Switch all EC/ECDSA logic from num to scalar 2014-11-30 23:38:01 +01:00
Pieter Wuille
b5c9ee756f Make test_point_times_order test meaningful again
As wnaf splitting is scalar based, multiplying with the order directly
would be reduced to multiplication with zero before even converting to
wnaf.
2014-11-30 23:38:01 +01:00
Pieter Wuille
0b73059709 Switch wnaf splitting from num-based to scalar-based 2014-11-30 23:38:01 +01:00
Pieter Wuille
1e6c77c321 Generalize secp256k1_scalar_get_bits 2014-11-30 23:38:01 +01:00
Pieter Wuille
5213207856 Add secp256k1_scalar_add_bit 2014-11-30 23:37:58 +01:00
Pieter Wuille
6e0528785d Do signature recovery/verification with 4 possible recid case 2014-11-29 10:57:50 +01:00
Pieter Wuille
d907ebc0e3 Add bounds checking to field element setters 2014-11-26 15:21:31 +01:00
Pieter Wuille
3bf029d676 Add test that recovering infinity fails 2014-11-18 13:13:17 +01:00
Gregory Maxwell
71712b27e5 Switch to C89 comments in prep for making the whole codebase C89 compatible.
This should be whitespace/comment only changes and should produce the same
object code.
2014-11-15 07:33:07 -08:00
Gregory Maxwell
f0709ac57e Avoid forward static decl of undefined functions, also fix a paren warning in the tests. 2014-11-13 01:45:49 -08:00
Gregory Maxwell
3276e7d4e2 Signed/unsigned comparisons in tests. 2014-11-12 15:47:12 -08:00
Gregory Maxwell
2cad067a36 Correct function prototypes and avoid unused parameter warnings. 2014-11-12 15:47:06 -08:00
Gregory Maxwell
a4a43d7543 Reorder static to comply with C99 and switch to the inline macro. 2014-11-12 13:07:55 -08:00
Pieter Wuille
9338dbf791 Branch-free point addition 2014-11-11 14:28:22 -08:00
Pieter Wuille
ef6f677679
Merge pull request #95
79ad6d4 Remove some dead variables in the tests. (Gregory Maxwell)
9974d86 Misc. Warning and cosmetic error cleanups. (Gregory Maxwell)
2014-11-04 23:29:08 -08:00
Gregory Maxwell
79ad6d44ea Remove some dead variables in the tests. 2014-11-04 13:47:23 -08:00
Gregory Maxwell
9974d8693e Misc. Warning and cosmetic error cleanups.
This fixes a cosmetic precedence bug in the tests along with some
 type warnings.

It also adds a dummy cast to the CHECK macro to avoid hundreds
 of statement with no effect warnings on compilers that warn about
 such things.
2014-11-04 13:17:45 -08:00
Pieter Wuille
1d52a8b155 Implementations for scalar without data-dependent branches. 2014-11-04 03:01:55 -08:00
Pieter Wuille
501d58f098 Get rid of {num,scalar,ecdsa_sig}_{init,free} 2014-11-03 01:31:04 -08:00
Pieter Wuille
79359302fb Add unit tests for scalars.
Also add a secp256k1_scalar_is_one function.
2014-10-29 02:11:07 -07:00
Pieter Wuille
eca6cdb123 Switch scalar to use get/set 32-byte arrays 2014-10-29 00:40:56 -07:00
Pieter Wuille
a9f5c8b875 Introduce secp256k1_scalar_t for future constant-time mod order operations 2014-10-28 04:33:23 -07:00
Pieter Wuille
ffffc87855 Use internal secp256k1_eckey_ prefix for functions in eckey 2014-10-27 03:01:51 -07:00