Skip to content
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

Is there a way to use ring with os=none, for random ? #1380

Closed
jyao1 opened this issue Sep 16, 2021 · 4 comments
Closed

Is there a way to use ring with os=none, for random ? #1380

jyao1 opened this issue Sep 16, 2021 · 4 comments

Comments

@jyao1
Copy link

jyao1 commented Sep 16, 2021

Currently, the biggest problem is rand implementation (https://github.com/briansmith/ring/blob/main/src/rand.rs). It seems using target_os check the OS environment and implement different random function.

We are going to use ring in os=none. Is there any suggestion on how to enable that ?
Also, we would like to contribute patch, if update is required.

@briansmith
Copy link
Owner

We are going to use ring in os=none. Is there any suggestion on how to enable that ?

What OS-less environment are you targeting? If it is SGX or UEFI then I'm somewhat familiar with them and I have thought about how to support them.

@jyao1
Copy link
Author

jyao1 commented Sep 28, 2021

Yes. UEFI is one use case. A bare metal Trust Domain (TD) in Intel TDX (https://software.intel.com/content/www/us/en/develop/articles/intel-trust-domain-extensions.html) is another use case. Similar to SGX.

We are doing some POC work and hope to upstream step by step.

How to support Random is still an open. If you have any thought, please share with us.

@briansmith
Copy link
Owner

For the time being, we can add a less-safe-getrandom-rdrand feature that lets us use getrandom as it is for UEFI, as I suggest in my review of PR #1406. And the same for other targets where getrandom uses rdrand.

Going forward, I expect ring will provide a "userspace" CSPRNG for use within ring, including the public ring::rand API, specifically to support these targets so we don't have to read RDRAND directly. This is TBD. But the short-term solution outlined above is OK for 0.17.

@briansmith
Copy link
Owner

Closing as a duplicate of #744; I copied my comment above to that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants