apache / incubator-teaclave-sgx-sdk

Apache Teaclave (incubating) SGX SDK helps developers to write Intel SGX applications in the Rust programming language, and also known as Rust SGX SDK.
https://teaclave.apache.org
Apache License 2.0
1.16k stars 259 forks source link

Creating `Rsa3072KeyPair` under `ucrypto` feature panics #456

Open Kailai-Wang opened 3 months ago

Kailai-Wang commented 3 months ago

I'm using the branch v2.0.0-preview-11-17, creating Rsa3072KeyPair works for tcrypto feature (within enclave) but not with ucrypto for non-enclave.

It can be reproduced by:

use sgx_crypto::rsa::Rsa3072KeyPair;
fn main() {
    let _ = Rsa3072KeyPair::create().unwrap();
}

Running it gives SGX unexpected error:

called `Result::unwrap()` on an `Err` value: Unexpected

Dependency in TOML:

[dependencies]
sgx_crypto = { git = "https://github.com/apache/incubator-teaclave-sgx-sdk", branch = "v2.0.0-preview-11-17", default-features = false, features = ["ucrypto"] }
volcano0dr commented 3 months ago

Thank you for reporting this issue. Fixed. commit

Kailai-Wang commented 3 months ago

Thanks!

Kailai-Wang commented 2 months ago

I'm trying to apply newer intel-sdk version to v2.0.0 branch and this problem seems to occur again with intel-sdk-2.21, I'm referring to this dexlabs' version on v2.0.0-sgx-emm branch

It seems I'll get Unexpected error with or without this fix.

To reproduce this, simply change the TOML dep to:

sgx_crypto = { git = "https://gitlab.com/dexlabs/incubator-teaclave-sgx-sdk", rev = "1b80455857b16fef02348a5b6db01f2888a49fd5", default-features = false, features = ["ucrypto"] }
yangfh2004 commented 2 months ago

I'm trying to apply newer intel-sdk version to v2.0.0 branch and this problem seems to occur again with intel-sdk-2.21, I'm referring to this dexlabs' version on v2.0.0-sgx-emm branch

It seems I'll get Unexpected error with or without this fix.

To reproduce this, simply change the TOML dep to:

sgx_crypto = { git = "https://gitlab.com/dexlabs/incubator-teaclave-sgx-sdk", rev = "1b80455857b16fef02348a5b6db01f2888a49fd5", default-features = false, features = ["ucrypto"] }

@Kailai-Wang Thanks for reporting, I am the maintainer for DEX Labs' fork. I am not sure that if I have rebased @volcano0dr fix to our fork. I will take a look and reply to you. Meanwhile, you are welcome to check it and report issues to the gitlab issues.

Kailai-Wang commented 1 month ago

I'm trying to apply newer intel-sdk version to v2.0.0 branch and this problem seems to occur again with intel-sdk-2.21, I'm referring to this dexlabs' version on v2.0.0-sgx-emm branch It seems I'll get Unexpected error with or without this fix. To reproduce this, simply change the TOML dep to:

sgx_crypto = { git = "https://gitlab.com/dexlabs/incubator-teaclave-sgx-sdk", rev = "1b80455857b16fef02348a5b6db01f2888a49fd5", default-features = false, features = ["ucrypto"] }

@Kailai-Wang Thanks for reporting, I am the maintainer for DEX Labs' fork. I am not sure that if I have rebased @volcano0dr fix to our fork. I will take a look and reply to you. Meanwhile, you are welcome to check it and report issues to the gitlab issues.

Thank you, that would definitely help!

I tried my branch (which includes the sgx_rand fix) but it didn't seem to work either :(

Kailai-Wang commented 3 weeks ago

I created an issue in your repo too: https://gitlab.com/dexlabs/incubator-teaclave-sgx-sdk/-/issues/4 : )

@yangfh2004