Remove proposed AEAD generate
API.
This commit is contained in:
parent
d3d19d2bca
commit
c354bf6fb4
30
src/aead.rs
30
src/aead.rs
@ -25,7 +25,6 @@ use self::block::{Block, BLOCK_LEN};
|
||||
use crate::{
|
||||
constant_time, cpu, error, hkdf,
|
||||
polyfill::{self, convert::*},
|
||||
rand,
|
||||
};
|
||||
|
||||
pub use self::{
|
||||
@ -50,16 +49,6 @@ impl OpeningKey {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: docs
|
||||
#[inline]
|
||||
pub fn generate(
|
||||
algorithm: &'static Algorithm, rng: &rand::SecureRandom,
|
||||
) -> Result<Self, error::Unspecified> {
|
||||
Ok(Self {
|
||||
key: Key::generate(algorithm, rng)?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Create a new opening key.
|
||||
///
|
||||
/// `key_bytes` must be exactly `algorithm.key_len` bytes long.
|
||||
@ -186,16 +175,6 @@ impl SealingKey {
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO: docs
|
||||
#[inline]
|
||||
pub fn generate(
|
||||
algorithm: &'static Algorithm, rng: &rand::SecureRandom,
|
||||
) -> Result<Self, error::Unspecified> {
|
||||
Ok(Self {
|
||||
key: Key::generate(algorithm, rng)?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Constructs a new sealing key from `key_bytes`.
|
||||
#[inline]
|
||||
pub fn new(
|
||||
@ -301,15 +280,6 @@ impl Key {
|
||||
Self::new(algorithm, key_bytes).unwrap()
|
||||
}
|
||||
|
||||
fn generate(
|
||||
algorithm: &'static Algorithm, rng: &rand::SecureRandom,
|
||||
) -> Result<Self, error::Unspecified> {
|
||||
let mut key_bytes = [0; MAX_KEY_LEN];
|
||||
let key_bytes = &mut key_bytes[..algorithm.key_len];
|
||||
rng.fill(key_bytes)?;
|
||||
Self::new(algorithm, key_bytes)
|
||||
}
|
||||
|
||||
fn new(algorithm: &'static Algorithm, key_bytes: &[u8]) -> Result<Self, error::Unspecified> {
|
||||
let cpu_features = cpu::features();
|
||||
Ok(Self {
|
||||
|
Loading…
x
Reference in New Issue
Block a user