-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Signer/Verifier/Signature interfaces for the RSA signatures (…
…#174) Refactor the `rsa` crate to use the API defined by the signature crate. This adds `pss` and `pkcs1v15` modules, each of them providing `Signature`, `Verifier` and `Signer`/`RandomizedSigner` implementations. Add tests for pkcs1v15 and pss signature verification functions to check that verifying invalid signatures returns an error. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
- Loading branch information
Showing
7 changed files
with
731 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use rand_core::{CryptoRng, RngCore}; | ||
|
||
/// This is a dummy RNG for cases when we need a concrete RNG type | ||
/// which does not get used. | ||
#[derive(Copy, Clone)] | ||
pub(crate) struct DummyRng; | ||
|
||
impl RngCore for DummyRng { | ||
fn next_u32(&mut self) -> u32 { | ||
unimplemented!(); | ||
} | ||
|
||
fn next_u64(&mut self) -> u64 { | ||
unimplemented!(); | ||
} | ||
|
||
fn fill_bytes(&mut self, _: &mut [u8]) { | ||
unimplemented!(); | ||
} | ||
|
||
fn try_fill_bytes(&mut self, _: &mut [u8]) -> core::result::Result<(), rand_core::Error> { | ||
unimplemented!(); | ||
} | ||
} | ||
|
||
impl CryptoRng for DummyRng {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.