tpm2-rand
This crate provides a simple rand generator that uses a TPM2 device to generate random numbers. It implements the rand_core::RngCore trait, allowing it to be used seamlessly with the rand ecosystem.
Features
It simply exposes the RNG functionality from the TPM2 device, That's it.
Usage
To use this crate, add the following to your Cargo.toml:
[]
= "0"
= "7"
Then, you can use it in your code as follows:
use Tpm2Rand;
use ;
let context = new.unwrap;
let mut rng = new.unwrap;
let random_bytes = rng.;
println!;
You should check out tss-esapi documentation for more details on how to set up the TPM2 context and handle errors.
License
This crate is licensed under either the Apache License, Version 2.0, or the MIT License, at your option. See the LICENSE-APACHE and LICENSE-MIT files for details.