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

Support Intel SDK 2.21 against rust-sdk v2.0.0 #2813

Conversation

Kailai-Wang
Copy link
Collaborator

@Kailai-Wang Kailai-Wang commented Jun 15, 2024

Context

The target branch of this PR is p-430-try-out-rust-sgx-sdk-200-branch, not dev.

CI run: https://github.com/litentry/litentry-parachain/actions/runs/9526558116

Rust SDK revision: https://github.com/Kailai-Wang/incubator-teaclave-sgx-sdk/tree/v2.0.0-sdk-2.21, it is based on https://gitlab.com/dexlabs/incubator-teaclave-sgx-sdk/-/tree/v2.0.0-sgx-emm?ref_type=heads

Tested on a newly installed ubuntu 22 with Intel SDK 2.21, both HW and SW mode.

Notes

  1. It's found that sgx_crypto has some problems under ucrypto feature, so that the RsaKeyPair creation/de-/encryption will panic for untrusted (non-enclave) part, the trusted part looks good though.

Thus this PR tries to use a lc-rsa-wrapper crate to call rsa crate under the hood. It's mainly used in unit-tests and CLI

  1. when experimenting with HW mode, I found that the current enclave config file caused initialisation failure - mainly the TCSNum configuration. I had to decrease it to 256 to make it work (512 wouldn't work), and the number of threads in the vc-task threadpool is down to 128 accordingly.

Edit:
It seems having 960 threads in vc-task-handler why keeping TCSNum = 256 still works (= compiles and runs), I don't know the exact performance penalty though.. I guess we'll need a follow-up issue for that

From ChatGPT:

In summary, you can run more threads in a thread pool than the number of TCSs, but only TCSNum threads will be able to execute concurrently inside the enclave. The excess threads will have to wait for a TCS to become available, which requires careful management to ensure efficient execution and to avoid performance bottlenecks.

Copy link

linear bot commented Jun 15, 2024

@Kailai-Wang Kailai-Wang self-assigned this Jun 15, 2024
Copy link
Contributor

@silva-fj silva-fj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Kailai-Wang Kailai-Wang merged commit 787502c into p-430-try-out-rust-sgx-sdk-200-branch Jun 18, 2024
31 of 33 checks passed
@Kailai-Wang Kailai-Wang deleted the p-668-upgrade-the-supported-intel-sdk-to-219 branch June 18, 2024 19:52
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.

None yet

3 participants