Add io and arch modules to std::os::fortanix_sgx#57119
Add io and arch modules to std::os::fortanix_sgx#57119bors merged 2 commits intorust-lang:masterfrom
io and arch modules to std::os::fortanix_sgx#57119Conversation
|
|
||
| /// Call the `EGETKEY` instruction to obtain a 128-bit secret key. | ||
| #[unstable(feature = "sgx_platform", issue = "56975")] | ||
| pub fn egetkey(request: &Align512<[u8; 512]>) -> Result<Align16<[u8; 16]>, u32> { |
There was a problem hiding this comment.
Would it be possible to use more meaningful structs here, rather than Align16<[u8; 16]>? For instance, a struct Key with the appropriate alignment and contents?
There was a problem hiding this comment.
As mentioned in the PR description:
I tried using the actual types (from the sgx-isa crate) instead of byte arrays, but that would make std dependent on the bitflags crate which I didn't want to do at this time.
There was a problem hiding this comment.
Ah, I see! I didn't realize those were the types you meant.
We do need a better solution for bitfields, in-tree.
In the meantime, would you please add a comment to these types, explicitly saying to consider a more type-safe version before stabilizing? That way it doesn't get lost.
There was a problem hiding this comment.
How about I'll add a note on the tracking issue?
|
@bors r+ |
|
📌 Commit be56561 has been approved by |
Add `io` and `arch` modules to `std::os::fortanix_sgx` This PR adds two more (unstable) modules to `std::os::fortanix_sgx` for the `x86_64-fortanix-unknown-sgx` target. ### io `io` allows conversion between raw file descriptors and Rust types, similar to `std::os::unix::io`. ### arch `arch` exposes the `ENCLU[EREPORT]` and `ENCLU[EGETKEY]` instructions. The current functions are very likely not going to be the final form of these functions (see also fortanix/rust-sgx#15), but this should be sufficient to enable experimentation in libraries. I tried using the actual types (from the [`sgx-isa` crate](https://crates.io/crates/sgx-isa)) instead of byte arrays, but that would make `std` dependent on the `bitflags` crate which I didn't want to do at this time.
|
☀️ Test successful - status-appveyor, status-travis |
This PR adds two more (unstable) modules to
std::os::fortanix_sgxfor thex86_64-fortanix-unknown-sgxtarget.io
ioallows conversion between raw file descriptors and Rust types, similar tostd::os::unix::io.arch
archexposes theENCLU[EREPORT]andENCLU[EGETKEY]instructions. The current functions are very likely not going to be the final form of these functions (see also fortanix/rust-sgx#15), but this should be sufficient to enable experimentation in libraries. I tried using the actual types (from thesgx-isacrate) instead of byte arrays, but that would makestddependent on thebitflagscrate which I didn't want to do at this time.