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.
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.
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.
Use ::core in lieu of ::std, allowing this crate to be usable in #![no_std]
environments.
Gates features that presently depend on ::std (presently just rand) behind a
"std" cargo feature, which is enabled by default.
Switches from the "rust-crypto" crate (which is not #![no_std] compatible) to
the sha2 crate, which is factored out of the original "rust-crypto" project
and being actively maintained.