Commit Graph

1168 Commits

Author SHA1 Message Date
Andrew Poelstra bf011f956e Merge pull request #2 from dpc/random_32
Simpler `random_32_bytes`.
2014-08-16 10:23:40 -07:00
Dawid Ciężarkiewicz 1ce6e3fd3b Simpler `random_32_bytes`. 2014-08-16 02:21:35 -07:00
Andrew Poelstra 6c8a72ba5d Remove allocations for Signature, use array instead
As @dpc observes, embedded systems do not necessarily have allocators, so we
should avoid using them if it is not too much hassle. (And it is no hassle at
all.)
2014-08-15 23:43:40 -07:00
Andrew Poelstra db37829904 Add CC0 license and header to all files 2014-08-11 19:26:45 -07:00
Andrew Poelstra 4be48ecb1b Move Rng failure from `Secp256k1::new` to functions that actually use randomness
Verifying signatures does not require any randomness, but requires the user
to create a `Secp256k1` object nonetheless (this is just a way to guarantee
that `init` is called --- an alternate API would be to have an independent
unsafe `verify` function). If a Rng can't be created, rather than failing
the `Secp256k1` initialization, fail the functions that actually try to use
the Rng.

This way signing and verifying, which require no randomness beyond that input
to them, will work correctly.

To avoid checking for a working Rng on each call to `generate_keypair` and
`generate_nonce` (which is probably trivial next to the cost of actually
generating the randomness, but w/e, user knows best), the user should use
the generation functions in the `key` module, which take an Rng as input.
2014-08-11 19:24:19 -07:00
Andrew Poelstra d6bf4039bd Pull out initialization code so that `PublicKey::from_secret_key` can be used safely 2014-08-11 19:24:19 -07:00
Andrew Poelstra 522bafe433 Remove VerifyResult since it is never used 2014-08-11 19:24:19 -07:00
Andrew Poelstra 80df78c9a9 Add slice methods to `Nonce` 2014-08-11 19:24:19 -07:00
Andrew Poelstra 0adc7e1ce2 Add keypair slice methods and unit tests 2014-08-11 19:24:19 -07:00
Andrew Poelstra 5b15918a9a Move FFI and constants into their own modules; replace outptrs with returns 2014-08-11 19:24:19 -07:00
Andrew Poelstra 448f4829e7 Move FFI functions into separate module; add documentation and style lints 2014-08-11 19:24:19 -07:00
Dawid Ciężarkiewicz 15e0995585 Add `LICENSE`. 2014-08-10 16:23:40 -07:00
Dawid Ciężarkiewicz 2c2a98a153 Merge pull request #1 from steveklabnik/master
Fix unused imports and add a gitignore
2014-08-04 17:04:33 -07:00
Steve Klabnik 462df41994 Add gitignore 2014-08-04 19:59:58 -04:00
Steve Klabnik 2fa6a4d38e fix unused import warning 2014-08-04 19:58:57 -04:00
Dawid Ciężarkiewicz 100fc277a6 Fix tests cases.
The way compact signatures are working was explain to me:

https://github.com/bitcoin/secp256k1/issues/45
2014-08-04 16:51:47 -07:00
Dawid Ciężarkiewicz 4c9f47e108 Update for newest Cargo 2014-07-23 16:34:04 -07:00
Dawid Ciężarkiewicz 05406515b8 Initial (failing) implementation. 2014-07-06 22:41:22 -07:00