Commit graph

64 commits

Author SHA1 Message Date
Tony Arcieri
6e0667d429 Use ed25519 + signature interop crates
The `signature` crate provides `Signer` and `Verifier` traits generic
over signature types:

https://github.com/RustCrypto/traits/tree/master/signature

There's presently an open call to stabilize the parts of its API needed
by Ed25519 signatures and release a 1.0 version:

https://github.com/RustCrypto/traits/issues/78

The `ed25519` crate, based on the `signature` crate, provides an
`ed25519::Signature` type which can be shared across multiple Ed25519
crates (e.g. it is also used by the `yubihsm` crate):

https://github.com/RustCrypto/signatures/tree/master/ed25519

This commit integrates the `ed25519::Signature` type, and changes the
existing `sign` and `verify` methods (where applicable) to use the
`Signer` and `Verifier` traits from the `signature` crate. Additionally,
it replaces `SignatureError` with the `signature` crate's error type.

This has the drawback of requiring the `Signer` and/or `Verifier` traits
are in scope in order to create and/or verify signatures, but with the
benefit of supporting interoperability with other Ed25519 crates which
also make use of these traits.
2020-04-20 09:15:10 -07:00
Isis Lovecruft
8ca3be99e9
Switch to using zeroize rather than clear_on_drop. 2019-12-09 22:39:57 +00:00
Isis Lovecruft
1be2a65777
Maybe I should try compiling my code before showing other cryptographers?
lol
2019-11-26 22:57:24 +00:00
Isis Lovecruft
85a218ac40
Implement deterministic batch verification and synthetic nonce generation. 2019-11-22 23:29:14 +00:00
Isis Lovecruft
ee67f36ba9
Move verify_batch() to new batch module. 2019-11-21 00:31:10 +00:00
Isis Lovecruft
81f906ca30
Replace failure dependency with impls of std::error::Error. 2019-10-26 04:16:33 +00:00
Isis Lovecruft
fe782cd896
Merge remote-tracking branch 'mikelodder7/master' into develop 2019-10-25 21:50:57 +00:00
Michael Lodder
c3f4c7a67e Update to latest rand
Signed-off-by: Michael Lodder <redmike7@gmail.com>
2019-10-21 09:03:08 -06:00
Isis Lovecruft
a065bee381
Enable Rust 2018. 2019-10-07 23:01:10 +00:00
Isis Lovecruft
7dd99afb67
Remove most of the rand_os crate, which is only used for testing. 2019-10-04 02:46:02 +00:00
Isis Lovecruft
1342e2a3a4
Fix no_std+alloc builds. 2019-10-04 02:05:20 +00:00
Isis Lovecruft
d31df0aaa8
Remove sha2 dep; limit rand depends; fixes after PR#68 merge.
* ADD new "batch" feature for feature-gating ed25519 batch verification; off by
   default. The "batch" feature is the only thing which depends on all of the
   `rand` crate, since it requires the functionality of `rand::thread_rng()`.
   Without batch verification, the rest of ed25519-dalek only depends on
   `rand_os` and `rand_core`.
2019-04-02 01:46:23 +00:00
Isis Lovecruft
1bec256418
Merge remote-tracking branch 'newpavlov/rand_core' into develop 2019-03-12 22:22:19 +00:00
Isis Lovecruft
ae8764fbef
Update copyright year to 2019 and destroy capitalism. 2019-01-18 04:59:12 +00:00
Артём Павлов [Artyom Pavlov]
762eb0c470 use rand_core 2019-01-05 15:58:59 +03:00
Isis Lovecruft
0ddf39e443
Revise some module descriptions. 2018-12-30 04:27:40 +00:00
Isis Lovecruft
fa726cfdcc
Run rustfmt on src/lib.rs. 2018-12-30 04:12:33 +00:00
Isis Lovecruft
e6528bd683
Create new module for public key code. 2018-12-30 03:53:42 +00:00
Isis Lovecruft
e3d7c16aac
Make errors module private. 2018-12-30 03:53:42 +00:00
Isis Lovecruft
6fea2e1ea0
Realphabetise extern crates. 2018-12-30 03:53:42 +00:00
Isis Lovecruft
f6ec28c077
Create module for secret key types. 2018-12-30 03:53:42 +00:00
Isis Lovecruft
1cf581d67d
Add lints (and fix warnings) for Rust 2018 code. 2018-12-30 03:27:01 +00:00
Isis Lovecruft
ce857a50e7
Remove unnecessary #![allow(unused_features)] lint. 2018-12-30 03:11:28 +00:00
Isis Lovecruft
d748a41894
Create new module for Signature type. 2018-12-30 03:03:40 +00:00
Isis Lovecruft
80e72db677
Create new module for constants. 2018-12-30 02:36:49 +00:00
Isis Lovecruft
4ee77b915e
Avoid using deprecated import path for rand::rngs::OsRng. 2018-12-30 02:31:47 +00:00
Isis Lovecruft
d81d43e3ae
Hardcode use of sha2::Sha512 in most cases.
This implements https://github.com/dalek-cryptography/ed25519-dalek/issues/64

You can still choose the "prehash" algorithm, as long as it has 64 bytes of
output.  Otherwise, everything is hardcoded to use sha2::Sha512.  To use a
different implementation you'll need a [patch.crates-io] section in cargo
config.
2018-12-30 00:40:01 +00:00
Isis Lovecruft
80ae5d0683
Cleanup RNG usage after merging #57. 2018-12-22 12:20:59 +00:00
isis agora lovecruft
85285576a7
Merge pull request #57 from IronCoreLabs/rand-0.6
Rand 0.6 version bump
2018-12-18 01:33:57 +00:00
Colt Frederickson
42b5d6ada9 Rand 0.6 version bump 2018-11-14 17:08:32 -07:00
Greg Fitzgerald
82948f0dd6 Fix serde doc tests
And let latest rustfmt reorder imports.
2018-11-09 10:12:32 -07:00
Isis Lovecruft
b97fa08900
Update curve25519-dalek dependency to 1.0.0-pre.0. 2018-11-06 01:40:21 +00:00
Henry de Valence
1e8b9f962b Remove unused features 2018-09-26 11:38:41 -07:00
Isis Lovecruft
318898fac1
Merge branch 'feature/drop-with-clear' into develop 2018-07-27 03:56:13 +00:00
Isis Lovecruft
a92a5b73a1
It's 2018 and nothing's gotten any better outside. 2018-07-27 03:48:37 +00:00
Isis Lovecruft
6513d4980a
Implement Drop for secret key material using clear_on_drop. 2018-07-20 23:08:08 +00:00
Henry de Valence
030eff547f Make verify return a Result.
This also simplifies the verification logic.  Because the verification check
happens in variable time, we don't need to do a constant-time eq check at the
end, so we can drop the `subtle` dependency entirely.

The `DecodingError` type becomes `SignatureError` and is also used to
signal failing verifications.
2018-07-15 13:07:58 -07:00
Isis Lovecruft
47c1d869ec
Make key generation work with no_std. 2018-05-16 22:09:31 +00:00
Isis Lovecruft
f6a631c229
WIP Update curve25519-dalek dependency to 0.17. 2018-05-15 23:34:01 +00:00
Isis Lovecruft
c7b69c6562
Expand boats' error types to give more detailed reasons for failures.
This code was significantly based off without boats' error types in
commit 6c1acaca7c, and also upon
conversation with them.  Please target them with praise, and blame me
for whatever mistakes I might have made.
2017-12-24 00:16:52 +00:00
Isis Lovecruft
510a1f89c0
Merge remote-tracking branch 'withoutboats/custom-error-type' into develop 2017-12-09 02:12:39 +00:00
Without Boats
6c1acaca7c
Use failure instead of std::error::Error.
failure is no_std compatible, whereas std::error::Error is not.
2017-12-06 15:25:12 -08:00
Without Boats
b5b295e414
Use a custom error type instead of &'static str.
Advantages of a custom error type:

- It can be more easily integrated into other error types by clients;
  they can implement From<FromBytesError> for their error types, or
  they can use a library like failure.
- It is a zero-sized type, which can enable some representational
  optimizations.
- It can be easier and more stable to test for.
2017-12-05 18:13:43 -08:00
Isis Lovecruft
9d89e2f660
Upgrade to using curve25519-dalek-0.14.0. 2017-12-04 17:47:06 +00:00
Isis Lovecruft
8d0dda0847
Implement serde serialisation support and pre-expanded secret keys.
* ADD support for serialisation with serde.
 * ADD a new pre-expanded secret key type, `ExpandedSecretKey`.
 * FIXES Issue #13:
   https://github.com/isislovecruft/ed25519-dalek/issues/13
2017-11-06 03:51:07 +00:00
Isis Lovecruft
3596e5ec87
Add licence. 2017-10-05 06:19:55 +00:00
Isis Lovecruft
e706b35d92
Merge remote-tracking branch 'greyspectrum/license-typo' into develop 2017-10-05 06:12:03 +00:00
Zaki Manian
8accff36b3
Replaces the depracted rustc_serialize with hex 2017-10-05 05:20:24 +00:00
greyspectrum
52ecf1669e Fix a small typo in the license url. 2017-09-06 13:31:52 -04:00
Isis Lovecruft
27753235ae
Upgrade curve25519-dalek, generic-array, and digest dependencies.
As well as adding a dependency on subtle and upgrading dev-dependency sha2.
2017-08-01 18:05:58 +00:00