Skip to content

Commit

Permalink
baloo recommended changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bhesh committed Oct 25, 2023
1 parent 73a97be commit 3093ce0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
9 changes: 2 additions & 7 deletions x509-ocsp/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,15 @@ use x509_cert::{
/// ```
///
/// [RFC 6960 Section 4.1.1]: https://datatracker.ietf.org/doc/html/rfc6960#section-4.1.1
#[derive(Clone, Debug, Copy, PartialEq, Eq, Enumerated)]
#[derive(Clone, Debug, Default, Copy, PartialEq, Eq, Enumerated)]
#[asn1(type = "INTEGER")]
#[repr(u8)]
pub enum Version {
/// Version 1 (default)
#[default]
V1 = 0,
}

impl Default for Version {
fn default() -> Self {
Self::V1
}
}

/// BasicOcspResponse structure as defined in [RFC 6960 Section 4.2.1].
///
/// ```text
Expand Down
11 changes: 3 additions & 8 deletions x509-ocsp/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,9 @@ impl Nonce {
/// ```
#[cfg(feature = "rand_core")]
pub fn generate<R: CryptoRngCore>(rng: &mut R, length: usize) -> Result<Self, der::Error> {
let mut bytes = Vec::with_capacity(length);
let mut random = [0u8; 32];
while bytes.len() < length {
rng.fill_bytes(&mut random);
bytes.extend_from_slice(&random);
}
bytes.resize(length, 0);
Ok(Self(OctetString::new(bytes)?))
let mut bytes = alloc::vec![0; length];
rng.fill_bytes(&mut bytes);
Self::new(bytes)
}
}

Expand Down

0 comments on commit 3093ce0

Please sign in to comment.