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

Draft: libsgxstep: Raw bindings for Rust #78

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Danacus
Copy link
Contributor

@Danacus Danacus commented Feb 29, 2024

Very quick and dirty raw bindings for Rust, which enables users of SGX-Step to write userspace tools in Rust.

  • The sgx-step-sys and sgx-urts-sys crate follow the *-sys package convention, hence they do not include any fancy wrapper, only raw bindings.
  • Most bindings are generated by bindgen
  • Missing bindings (e.g. due to the use of C macro's) are added manually, but are mostly untested (they are AI-generated from the C code)
  • The path to libsgxstep must be set in the LIBSGXSTEP environment variable
  • The build feature can be disabled in order to not build and link libsgxstep (enabled by default). In that case, crates that use these bindings should link with libsgxstep manually.

Minor issues:

  • 128-bit integers don't currently have a known stable ABI, so they are not "FFI-safe". I'm not sure how to deal with this.
  • Is it libsgxstep or libsgx-step?
  • Some configuration options are hardcoded as C preprocessor constants in config.h, and they cannot be changed by applications that use libsgxstep without changing this header file.

Future things to consider:

  • Making a safe and idiomatic wrapper crate? Would be fun, but probably not a very high priority thing for me to do right now. The sgx-step-rs crate already creates some abstractions, but it's very much work-in-progress.
  • Rewriting libsgxstep in Rust would also be fun :)

@Danacus Danacus marked this pull request as draft February 29, 2024 10:04
@jovanbulck
Copy link
Owner

Thank you Daan! This is indeed very promising and would be great to merge this, but let's try to make it more stable and redesign libsgxstep (eg config.h) where needed -- TBD

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

Successfully merging this pull request may close these issues.

2 participants