Coverage Report

Created: 2026-07-10 07:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/OpenSK/libraries/opensk/src/api/rng.rs
Line
Count
Source
1
// Copyright 2023 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
pub use rand_core;
16
use rand_core::{CryptoRng, RngCore};
17
18
/// Random number generator.
19
///
20
/// Reuses the common API from `RngCore`. Implementing the marker trait `CryptoRng` asserts that
21
/// your random output is usable for sensitive key material.
22
pub trait Rng: CryptoRng + RngCore {
23
    /// Provides a random byte array.
24
    ///
25
    /// This is a convenience function, as CTAP often requires such keys or tokens.
26
1.46k
    fn gen_uniform_u8x32(&mut self) -> [u8; 32] {
27
1.46k
        let mut bytes = [0; 32];
28
1.46k
        self.fill_bytes(&mut bytes);
29
1.46k
        bytes
30
1.46k
    }
<rand::rngs::std::StdRng as opensk::api::rng::Rng>::gen_uniform_u8x32
Line
Count
Source
26
1.46k
    fn gen_uniform_u8x32(&mut self) -> [u8; 32] {
27
1.46k
        let mut bytes = [0; 32];
28
1.46k
        self.fill_bytes(&mut bytes);
29
1.46k
        bytes
30
1.46k
    }
Unexecuted instantiation: <_ as opensk::api::rng::Rng>::gen_uniform_u8x32
31
}