Commit Graph

30 Commits

Author SHA1 Message Date
Pieter Wuille
18c329c506 Remove the internal secp256k1_ecdsa_sig_t type 2015-07-26 16:52:17 +02:00
Pieter Wuille
74a2acdb8a Add a secp256k1_ecdsa_signature_t type 2015-07-26 16:02:20 +02:00
Pieter Wuille
a9b6595ef8 [API BREAK] Introduce explicit contexts 2015-04-11 01:01:10 -07:00
Gregory Maxwell
2632019713 Brace all the if/for/while.
Unbraced statements spanning multiple lines has been shown in many
 projects to contribute to the introduction of bugs and a failure
 to catch them in review, especially for maintenance on infrequently
 modified code.

Most, but not all, of the existing practice in the codebase were not
 cases that I would have expected to eventually result in bugs but
 applying it as a rule makes it easier for other people to safely
 contribute.

I'm not aware of any such evidence for the case with the statement
 on a single line, but some people strongly prefer to never do that
 and the opposite rule of "_always_ use a single line for single
 statement blocks" isn't a reasonable rule for formatting reasons.
 Might as well brace all these too, since that's more universally
 acceptable.

[In any case, I seem to have introduced the vast majority of the
 single-line form (as they're my preference where they fit).]

This also removes a broken test which is no longer needed.
2015-03-27 23:24:32 +00:00
Gregory Maxwell
6efd6e7777 Some comments explaining some of the constants in the code. 2015-02-07 00:22:13 +00:00
Gregory Maxwell
792bcdb015 Covert several more files to C89. 2015-01-24 23:34:09 +00:00
Gregory Maxwell
3627437d80 C89 nits and dead code removal. 2015-01-23 04:17:12 +00:00
Pieter Wuille
4732d26069 Convert the field/group/ecdsa constant initialization to static consts 2015-01-22 22:44:52 -05:00
Gregory Maxwell
d26e26f2f4 Avoid constructing an invalid signature with probability 1:2^256. 2014-12-28 19:40:40 -08:00
Pieter Wuille
13278f642c Add explanation about how inversion can be avoided 2014-12-16 22:52:07 +01:00
Pieter Wuille
ce7eb6fb3d Optimize verification: avoid field inverse
Suggested by Greg Maxwell.
2014-12-16 22:38:17 +01:00
Pieter Wuille
6a9901e15b
Merge pull request #137
39bd94d Variable time normalize (Pieter Wuille)
2014-12-07 14:35:23 +01:00
Pieter Wuille
a5759c572e Check return value of malloc 2014-12-07 02:58:24 +01:00
Pieter Wuille
39bd94d86d Variable time normalize 2014-12-06 18:18:28 +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
659b554d7b Make constant initializers independent from num 2014-12-01 12:38:38 +01:00
Pieter Wuille
f24041d6aa Switch all EC/ECDSA logic from num to scalar 2014-11-30 23:38:01 +01:00
Pieter Wuille
d907ebc0e3 Add bounds checking to field element setters 2014-11-26 15:21:31 +01:00
Pieter Wuille
4861f83686 Test whether recovered public keys are not infinity
Fixes a bug discovered by Sergio Demian Lerner.
2014-11-18 12:37:39 +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
a4a43d7543 Reorder static to comply with C99 and switch to the inline macro. 2014-11-12 13:07:55 -08:00
Pieter Wuille
da55986fdf Label variable-time functions correctly and don't use those in sign 2014-11-04 02:50:06 -08:00
Pieter Wuille
501d58f098 Get rid of {num,scalar,ecdsa_sig}_{init,free} 2014-11-03 01:31:04 -08: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
e2f71f1efe Move non-ECDSA operations from ecdsa to eckey 2014-10-27 02:58:09 -07:00
Pieter Wuille
949c1ebb5e Split up ecmult and ecmult_gen entirely 2014-10-26 03:42:24 -07:00
Gregory Maxwell
2f6c801911
Try to not leave secret data on the stack or heap.
This makes a basic effort and has not been audited.
Doesn't appear to have a measurable performance impact on bench.

It also adds a secp256k1_num_free to secp256k1_ecdsa_pubkey_create.
2014-08-14 07:06:36 -07:00
Peter Dettman
09ca4f32e2 secp256k1_fe_sqrt checks for success
- secp256k1_fe_sqrt now checks that the value it calculated is actually a square root.
- Add return values to secp256k1_fe_sqrt and secp256k1_ge_set_xo.
- Callers of secp256k1_ge_set_xo can use return value instead of explicit validity checks
- Add random value tests for secp256k1_fe_sqrt
2014-05-21 10:22:14 +07:00
Pieter Wuille
11ab562203 Move implementations from impl/*.h to *_impl.h 2014-03-12 18:40:02 +01:00