forked from Argyle-Software/dilithium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rand_core trait support (Argyle-Software#2)
The API changes closely follow pqc_kyber where the trait bounds are already implemented.
- Loading branch information
Showing
14 changed files
with
147 additions
and
80 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[derive(Debug, PartialEq)] | ||
pub enum DilithiumError { | ||
Input, | ||
Verify, | ||
RandomBytesGeneration, | ||
} | ||
|
||
#[cfg(feature = "std")] | ||
impl std::error::Error for DilithiumError {} |
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 was deleted.
Oops, something went wrong.
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,16 @@ | ||
use crate::error::DilithiumError; | ||
use rand_core::*; | ||
|
||
pub fn randombytes<R>( | ||
x: &mut [u8], | ||
len: usize, | ||
rng: &mut R, | ||
) -> Result<(), DilithiumError> | ||
where | ||
R: RngCore + CryptoRng, | ||
{ | ||
match rng.try_fill_bytes(&mut x[..len]) { | ||
Ok(_) => Ok(()), | ||
Err(_) => Err(DilithiumError::RandomBytesGeneration), | ||
} | ||
} |
Oops, something went wrong.