-
-
Notifications
You must be signed in to change notification settings - Fork 177
Add rng protocole #386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add rng protocole #386
Conversation
Hi guys, I would need some help with this : So I'm just trying to instantiate the |
Thanks for the PR :)
The issue here is the handle being passed to let handle = *bt
.find_handles::<Rng>()
.expect_success("Failed to get Rng handles")
.first()
.expect("No Rng handles");
let rng = bt
.open_protocol::<Rng>(
OpenProtocolParams {
handle,
agent: image,
controller: None,
},
OpenProtocolAttributes::Exclusive,
)
.expect_success("Failed to open Rng protocol"); To make this work under QEMU, you will also need to add an rng device to the virtual machine: diff --git a/xtask/src/qemu.rs b/xtask/src/qemu.rs
index 4ecb4d1..8934316 100644
--- a/xtask/src/qemu.rs
+++ b/xtask/src/qemu.rs
@@ -277,6 +277,8 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
// QEMU by defaults enables a ton of devices which slow down boot.
cmd.arg("-nodefaults");
+ cmd.args(&["-device", "virtio-rng-pci"]);
+
match arch {
UefiArch::AArch64 => {
// Use a generic ARM environment. Sadly qemu can't emulate a |
Awesome it works ! Thank you 👍 So now I just need to code the wrappers then we're good to go. |
That's it, waiting for the CI tests for last checks. If the AArch64 CI crash again, I might need some help fixing this. EDIT: There's still a TODO in the code, if I find some time I should implement an AlgorithmType Enum for better usability of EDIT2: You might want to link this PR to #371 |
Taking a look at the aarch64 error now, not sure what's going on there yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for sticking with it through all my comments :)
For some reason the CI doesn't seem to be running, but I'll figure that out and merge it once it finishes.
Glad I made it :) I will be able to present this contribution as a part of my school project. |
Nice! Thanks again for the PR |
Implementation of the EFI_RNG_PROTOCOL
For the need of a project I would need this implantation as fast as possible.
GUID
Protocol Interface Structure
Parameters
GetInfo
Returns information about the random number generationimplementation.
GetRNG
Returns the next set of random numbers.Description
This protocol allows retrieval of RNG values from an UEFI driver. The GetInfo service returns
information about the RNG algorithms the driver supports. The GetRNG service creates a RNG value
using an (optionally specified) RNG algorithm.