Commit graph

16 commits

Author SHA1 Message Date
Isis Lovecruft
d3a5b3bd81
Remove unsafe trait impls. 2020-07-16 23:02:27 +00:00
Isis Lovecruft
7243d7151d
Fix handling of external error types. 2020-07-16 22:19:40 +00:00
Isis Lovecruft
b84f1df47b
Merge branch 'fix/ed25519ph-context' into develop 2020-07-15 17:44:54 +00:00
Isis Lovecruft
97787d3716
Remove impl of std::error::Error for SignatureError.
We're now aliasing SignatureError to the error type from the signature
crate.
2020-07-14 00:37:56 +00:00
Isis Lovecruft
989c5e4c18
Fix ed25519ph context length error handling in sign_prehashed().
RFC8032 specifies that the context cannot be greater than 255 octets,
but in the previous implementation in ed25519-dalek, this error would
only be caught by a debug_assert.  This changes the sign_prehashed()
function to return a Result so that the error can be handled at
runtime and the library no longer allows misuse by creating signatures
that other libraries cannot handle.
2020-07-14 00:25:40 +00:00
Isis Lovecruft
f1d8576f12
Impl std::error::Error for SignatureError. 2020-07-13 23:19:55 +00:00
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
8f848793f3
Merge branch 'feature/no-panics' into develop 2019-11-21 00:09:32 +00:00
Isis Lovecruft
81f906ca30
Replace failure dependency with impls of std::error::Error. 2019-10-26 04:16:33 +00:00
Isis Lovecruft
f1d4c4a732
Remove panics from batch verification API in lieu of better error handling. 2019-10-18 20:20:34 +00:00
Isis Lovecruft
ae8764fbef
Update copyright year to 2019 and destroy capitalism. 2019-01-18 04:59:12 +00:00
Isis Lovecruft
ad49d31bbc
Run rustfmt on src/errors.rs. 2018-12-30 04:10:59 +00:00
Isis Lovecruft
1cf581d67d
Add lints (and fix warnings) for Rust 2018 code. 2018-12-30 03:27:01 +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
f790bd2ce1
Update subtle and curve25519-dalek dependencies. 2018-03-26 02:13:39 +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