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

Switch from ias to dcap #1375

Merged
merged 74 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7fa07f2
Switch from ias to dcap
mosonyi Jun 21, 2023
2cb5acf
Mount sgx qcnl
mosonyi Jun 22, 2023
9fd7048
Mount sgx qcnl
mosonyi Jun 22, 2023
805cc6c
Start aesmd in the background
mosonyi Jun 22, 2023
5df34b8
Fix apt install
mosonyi Jun 22, 2023
35ca397
Fix apt install
mosonyi Jun 22, 2023
2444637
Fix entrypoint
mosonyi Jun 22, 2023
5eac438
Fix lib path
mosonyi Jun 22, 2023
5fe22bf
Remove starting aesmd
mosonyi Jun 22, 2023
bbcc44f
Try with entrypoint
mosonyi Jun 22, 2023
15f8277
Move WORKDIR down
mosonyi Jun 22, 2023
4f7854d
only ignore yaml files
mosonyi Jun 22, 2023
fcdb3c5
Move back WORKDIR
mosonyi Jun 22, 2023
dc53558
Addedd qcnl sgx conf
mosonyi Jun 23, 2023
402f40f
change entrypoint to command
mosonyi Jun 23, 2023
0729b22
change entrypoint to command
mosonyi Jun 23, 2023
4b4bb40
Don't run aesmd service in cli
mosonyi Jun 23, 2023
3e7c49b
Try to remove IAS_SPID envs
mosonyi Jun 23, 2023
9f0c6f8
Do not use ias version of the node
mosonyi Jun 26, 2023
02ba8bc
Do not use ias version of the node
mosonyi Jun 26, 2023
1734e93
Add back ias node
mosonyi Jun 28, 2023
d142527
attestation-service: enable SGX DCAP QPL logging
OverOrion Jun 28, 2023
2c89ca1
docker: add missing DCAP packages
OverOrion Jun 29, 2023
a5bcf10
attestation: rename function used in MURA to distingiuish between DCA…
OverOrion Jun 29, 2023
40f240f
attestation: preparing for DCAP MURA
OverOrion Jun 29, 2023
b3310f3
attestation: prepare for DCAP
OverOrion Jun 29, 2023
5ff25de
move qe_get_* to the worker
OverOrion Jun 29, 2023
0d34a4a
backup, linker error
OverOrion Jun 30, 2023
f6d5fd8
testing
OverOrion Jun 30, 2023
de9709c
Merge remote-tracking branch 'in/szp/fix-dcap-mura' into zm/dcapci
OverOrion Jun 30, 2023
82ae036
dcap-mura: fix DCAP API calls order
OverOrion Jun 30, 2023
7546a69
Merge remote-tracking branch 'in/szp/fix-dcap-mura' into zm/dcapci
OverOrion Jun 30, 2023
d7c3c1c
enclave-runtime: add dcap feature flag to it as well
OverOrion Jun 30, 2023
89c1775
fixup! enclave-runtime: add dcap feature flag to it as well
OverOrion Jun 30, 2023
8574acd
attestation-handler: return private_key as well from generate_dcap_ra…
OverOrion Jun 30, 2023
bf02e7c
add logging
OverOrion Jun 30, 2023
d52b935
fix logging
OverOrion Jun 30, 2023
eaf9007
mura-dcap: add target to provisioning as well
OverOrion Jun 30, 2023
f0f5772
MURA: use the same target
OverOrion Jun 30, 2023
5bdc1b2
add printing for cert_der
OverOrion Jun 30, 2023
db74d86
to be dropped
OverOrion Jul 3, 2023
e0ef516
mura: base64 encode the payload
OverOrion Jul 3, 2023
d842039
fixup! mura: base64 encode the payload
OverOrion Jul 3, 2023
9ce9ac5
fixup! mura: base64 encode the payload
OverOrion Jul 3, 2023
3d0b6d7
mura: basically disable it with dcap
OverOrion Jul 4, 2023
a0af555
gha: add back clippy
OverOrion Jul 4, 2023
462550b
attestation-handler: remove build.rs
OverOrion Jul 4, 2023
842c2a2
attestation-handler: remove commented out code
OverOrion Jul 4, 2023
6f6e009
attestation-handler: add debug log
OverOrion Jul 4, 2023
f0890ef
fix typo
OverOrion Jul 4, 2023
252ac36
enclave-runtime: fix clippy
OverOrion Jul 4, 2023
3da293a
build: revert dcap lib linking
OverOrion Jul 7, 2023
6c57018
build: revert cargo verbosity
OverOrion Jul 7, 2023
7ae7998
docker: remove epid leftover files
OverOrion Jul 7, 2023
85efade
attestation-handler: return error if base64 decoding fails
OverOrion Jul 7, 2023
a0273b6
docker: fix typo in network name
OverOrion Jul 7, 2023
766469f
local-setup: print worker command as well
OverOrion Jul 7, 2023
df7fa3a
dcap with sw mode: fix
OverOrion Jul 7, 2023
5d0ea05
gha/build: remove worker_features_arg
OverOrion Jul 7, 2023
8ff7d52
dcap with sw mode: fix integration tests
OverOrion Jul 7, 2023
8034e58
cli: add a note regarding dcap
OverOrion Jul 7, 2023
d32aecc
clippy: fix
OverOrion Jul 7, 2023
3acf659
mura: fix dcap related parameter references
OverOrion Jul 10, 2023
967bc33
fixup! mura: fix dcap related parameter references
OverOrion Jul 10, 2023
1681a81
docker: enable debug logging
OverOrion Jul 10, 2023
f141e03
add more logs
OverOrion Jul 10, 2023
28620c6
fixup! add more logs
OverOrion Jul 10, 2023
cd1784f
mura: make sure enclave gets the correct reference
OverOrion Jul 10, 2023
1d9b1db
Revert "docker: enable debug logging"
OverOrion Jul 11, 2023
80f3a7e
Revert "add more logs"
OverOrion Jul 11, 2023
e635403
service: remove potentially unnecessary clone()
OverOrion Jul 11, 2023
401e1e1
attestation-handler: remove enum variant import
OverOrion Jul 17, 2023
21d1756
attestation-handler: add TODO for MURA removal
OverOrion Jul 17, 2023
a8d9266
enclave-runtime/attestation: remove obsolete todo
OverOrion Jul 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.github
.idea
ci/
docker/
docker/*yml
docs/
local-setup/
scripts/
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ jobs:
mode: sidechain
host: integritee-builder-sgx
sgx_mode: HW
additional_features: dcap
- flavor_id: offchain-worker
mode: offchain-worker
host: integritee-builder-sgx
sgx_mode: HW
additional_features: dcap
- flavor_id: teeracle
mode: teeracle
host: integritee-builder-sgx
sgx_mode: HW
additional_features: dcap
- flavor_id: sidechain-evm
mode: sidechain
additional_features: evm
additional_features: evm,dcap
host: integritee-builder-sgx
sgx_mode: HW

Expand All @@ -60,7 +63,7 @@ jobs:
echo "FINGERPRINT=$fingerprint" >> $GITHUB_ENV
if [[ ${{ matrix.sgx_mode }} == 'HW' ]]; then
echo "DOCKER_DEVICES=--device=/dev/sgx/enclave --device=/dev/sgx/provision" >> $GITHUB_ENV
echo "DOCKER_VOLUMES=--volume /var/run/aesmd:/var/run/aesmd" >> $GITHUB_ENV
echo "DOCKER_VOLUMES=--volume /var/run/aesmd:/var/run/aesmd --volume /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf" >> $GITHUB_ENV
else
echo "DOCKER_DEVICES=" >> $GITHUB_ENV
echo "DOCKER_VOLUMES=" >> $GITHUB_ENV
Expand Down Expand Up @@ -189,8 +192,8 @@ jobs:
WORKER_IMAGE_TAG: integritee-worker:dev
CLIENT_IMAGE_TAG: integritee-cli:dev
COINMARKETCAP_KEY: ${{ secrets.COINMARKETCAP_KEY }}
IAS_EPID_SPID: ${{ secrets.IAS_SPID }}
IAS_EPID_KEY: ${{ secrets.IAS_PRIMARY_KEY }}
# IAS_EPID_SPID: ${{ secrets.IAS_SPID }}
# IAS_EPID_KEY: ${{ secrets.IAS_PRIMARY_KEY }}
TEERACLE_INTERVAL_SECONDS: 10

strategy:
Expand Down Expand Up @@ -254,6 +257,7 @@ jobs:
echo "SGX_PROVISION=/dev/sgx/provision" >> $GITHUB_ENV
echo "SGX_ENCLAVE=/dev/sgx/enclave" >> $GITHUB_ENV
echo "AESMD=/var/run/aesmd" >> $GITHUB_ENV
echo "SGX_QCNL=/etc/sgx_default_qcnl.conf" >> $GITHUB_ENV
fi

echo "LOG_DIR=./logs-$version" >> $GITHUB_ENV
Expand Down Expand Up @@ -367,7 +371,7 @@ jobs:
- flavor_id: teeracle
mode: teeracle
sgx_mode: HW
worker_features: dcap
additional_features: dcap

steps:
- uses: actions/checkout@v3
Expand All @@ -384,7 +388,7 @@ jobs:
echo "FINGERPRINT=$fingerprint" >> $GITHUB_ENV
if [[ ${{ matrix.sgx_mode }} == 'HW' ]]; then
echo "DOCKER_DEVICES=--device=/dev/sgx/enclave --device=/dev/sgx/provision" >> $GITHUB_ENV
echo "DOCKER_VOLUMES=--volume /var/run/aesmd:/var/run/aesmd" >> $GITHUB_ENV
echo "DOCKER_VOLUMES=--volume /var/run/aesmd:/var/run/aesmd --volume /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf" >> $GITHUB_ENV
else
echo "DOCKER_DEVICES=" >> $GITHUB_ENV
echo "DOCKER_VOLUMES=" >> $GITHUB_ENV
Expand Down Expand Up @@ -423,7 +427,7 @@ jobs:
run: >
docker build -t integritee/${{ matrix.flavor_id }}:${{ github.ref_name }}
--target deployed-worker
--build-arg WORKER_MODE_ARG=${{ matrix.mode }} --build-arg SGX_COMMERCIAL_KEY=enclave-runtime/intel_sgx.pem --build-arg SGX_PASSFILE=enclave-runtime/passfile.txt --build-arg SGX_PRODUCTION=1 --build-arg WORKER_FEATURES_ARG=${{ matrix.worker_features }} --build-arg ADDITIONAL_FEATURES_ARG=${{ matrix.additional_features }} --build-arg SGX_MODE=${{ matrix.sgx_mode }}
--build-arg WORKER_MODE_ARG=${{ matrix.mode }} --build-arg SGX_COMMERCIAL_KEY=enclave-runtime/intel_sgx.pem --build-arg SGX_PASSFILE=enclave-runtime/passfile.txt --build-arg SGX_PRODUCTION=1 --build-arg ADDITIONAL_FEATURES_ARG=${{ matrix.additional_features }} --build-arg SGX_MODE=${{ matrix.sgx_mode }}
-f build.Dockerfile .

- name: Save released teeracle
Expand Down
26 changes: 21 additions & 5 deletions build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ ENV SGX_MODE=$SGX_MODE
ARG SGX_PRODUCTION=0
ENV SGX_PRODUCTION=$SGX_PRODUCTION

ARG WORKER_FEATURES_ARG
ENV WORKER_FEATURES=$WORKER_FEATURES_ARG

ENV WORKHOME=/home/ubuntu/work
ENV HOME=/home/ubuntu
Expand Down Expand Up @@ -80,6 +78,19 @@ RUN --mount=type=cache,id=cargo-registry-cache,target=/opt/rust/registry/cache,s
FROM oasisprotocol/aesmd:master AS runner
ENV SGX_SDK /opt/sgxsdk
ENV LD_LIBRARY_PATH "${SGX_SDK}/sdk_libs"
RUN apt-get install -y \
libsgx-aesm-ecdsa-plugin \
libsgx-ae-qve \
libsgx-aesm-quote-ex-plugin \
libsgx-dcap-default-qpl \
libsgx-dcap-ql \
libsgx-dcap-quote-verify \
libsgx-epid \
libsgx-headers \
libsgx-quote-ex \
libsgx-ra-network \
libsgx-ra-uefi \
libsgx-uae-service

### Deployed CLI client
##################################################
Expand Down Expand Up @@ -116,14 +127,19 @@ COPY --from=builder /home/ubuntu/work/worker/bin/* ./
COPY --from=builder /lib/x86_64-linux-gnu/libsgx* /lib/x86_64-linux-gnu/
COPY --from=builder /lib/x86_64-linux-gnu/libdcap* /lib/x86_64-linux-gnu/

RUN touch spid.txt key.txt
RUN chmod +x /usr/local/bin/integritee-service
RUN ls -al /usr/local/bin

# checks
ENV SGX_SDK /opt/sgxsdk
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:$SGX_SDK/sdk_libs
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/sgx-aesm-service/aesm:$SGX_SDK/sdk_libs
ENV AESM_PATH=/opt/intel/sgx-aesm-service/aesm

COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh


RUN ldd /usr/local/bin/integritee-service && \
/usr/local/bin/integritee-service --version

ENTRYPOINT ["/usr/local/bin/integritee-service"]
ENTRYPOINT ["/entrypoint.sh"]
2 changes: 2 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ teeracle = []
sidechain = []
offchain-worker = []
production = []
# dcap feature flag is not used in this crate, but for easier build purposes only it present here as well
dcap = []
OverOrion marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion core-primitives/attestation-handler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ sgx_rand = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sd
sgx_tcrypto = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_tse = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git", optional = true }
sgx_tstd = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = ["untrusted_fs", "net", "backtrace"], optional = true }
sgx_types = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git" }
sgx_types = { branch = "master", git = "https://github.com/apache/teaclave-sgx-sdk.git", features = ["extra_traits"] }
clangenb marked this conversation as resolved.
Show resolved Hide resolved

# local deps
itp-ocall-api = { path = "../ocall-api", default-features = false }
Expand Down
132 changes: 79 additions & 53 deletions core-primitives/attestation-handler/src/attestation_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use sgx_tcrypto::{rsgx_sha256_slice, SgxEccHandle};
use sgx_tse::{rsgx_create_report, rsgx_verify_report};
use sgx_types::{
c_int, sgx_epid_group_id_t, sgx_quote_nonce_t, sgx_quote_sign_type_t, sgx_report_data_t,
sgx_spid_t, sgx_status_t, sgx_target_info_t, SgxResult, *,
sgx_spid_t, sgx_status_t, sgx_status_t::SGX_ERROR_UNEXPECTED, sgx_target_info_t, SgxResult, *,
clangenb marked this conversation as resolved.
Show resolved Hide resolved
};
use sp_core::{ed25519, Pair};
use std::{
Expand Down Expand Up @@ -82,15 +82,15 @@ pub trait AttestationHandler {
/// but instead generate a mock certificate.
fn generate_ias_ra_cert(&self, skip_ra: bool) -> EnclaveResult<Vec<u8>>;

/// Returns the DER encoded certificate and the raw DCAP quote.
/// Returns the DER encoded private_key, DER encoded certificate and the raw DCAP quote.
/// If skip_ra is set, it will not perform a remote attestation via IAS
/// but instead generate a mock certificate.
fn generate_dcap_ra_cert(
&self,
quoting_enclave_target_info: &sgx_target_info_t,
quote_size: u32,
quoting_enclave_target_info: Option<&sgx_target_info_t>,
quote_size: Option<&u32>,
skip_ra: bool,
) -> EnclaveResult<(Vec<u8>, Vec<u8>)>;
) -> EnclaveResult<(Vec<u8>, Vec<u8>, Vec<u8>)>;

/// Get the measurement register value of the enclave
fn get_mrenclave(&self) -> EnclaveResult<[u8; MR_ENCLAVE_SIZE]>;
Expand All @@ -107,7 +107,7 @@ pub trait AttestationHandler {

/// Create the remote attestation report and encapsulate it in a DER certificate
/// Returns a pair consisting of (private key DER, certificate DER)
fn create_ra_report_and_signature(
fn create_epid_ra_report_and_signature(
&self,
sign_type: sgx_quote_sign_type_t,
skip_ra: bool,
Expand All @@ -119,6 +119,35 @@ pub struct IntelAttestationHandler<OCallApi, SigningKeyRepo> {
pub(crate) signing_key_repo: Arc<SigningKeyRepo>,
}

impl<OCallApi, AccessSigningKey> IntelAttestationHandler<OCallApi, AccessSigningKey>
where
OCallApi: EnclaveAttestationOCallApi,
AccessSigningKey: AccessKey<KeyType = ed25519::Pair>,
{
fn create_payload_epid(
&self,
pub_k: &[u8; 32],
sign_type: sgx_quote_sign_type_t,
) -> EnclaveResult<String> {
info!(" [Enclave] Create attestation report");
let (attn_report, sig, cert) = match self.create_epid_attestation_report(&pub_k, sign_type)
{
Ok(r) => r,
Err(e) => {
error!(" [Enclave] Error in create_attestation_report: {:?}", e);
return Err(e.into())
},
};
println!(" [Enclave] Create attestation report successful");
debug!(" attn_report = {:?}", attn_report);
debug!(" sig = {:?}", sig);
debug!(" cert = {:?}", cert);

// concat the information
Ok(attn_report + "|" + &sig + "|" + &cert)
}
}

impl<OCallApi, AccessSigningKey> AttestationHandler
for IntelAttestationHandler<OCallApi, AccessSigningKey>
where
Expand All @@ -132,7 +161,7 @@ where
// FIXME: should call `create_ra_report_and_signature` in skip_ra mode as well:
// https://github.com/integritee-network/worker/issues/321.
let cert_der = if !skip_ra {
match self.create_ra_report_and_signature(sign_type, skip_ra) {
match self.create_epid_ra_report_and_signature(sign_type, skip_ra) {
Ok((_key_der, cert_der)) => cert_der,
Err(e) => return Err(e),
}
Expand All @@ -154,7 +183,8 @@ where
// our certificate is unlinkable
let sign_type = sgx_quote_sign_type_t::SGX_UNLINKABLE_SIGNATURE;

let (_key_der, cert_der) = match self.create_ra_report_and_signature(sign_type, false) {
let (_key_der, cert_der) = match self.create_epid_ra_report_and_signature(sign_type, false)
{
Ok(r) => r,
Err(e) => return Err(e),
};
Expand All @@ -175,11 +205,14 @@ where
quoting_enclave_target_info: &sgx_target_info_t,
quote_size: u32,
) -> EnclaveResult<()> {
let (_cert_der, dcap_quote) =
match self.generate_dcap_ra_cert(quoting_enclave_target_info, quote_size, false) {
Ok(r) => r,
Err(e) => return Err(e),
};
let (_priv_key_der, _cert_der, dcap_quote) = match self.generate_dcap_ra_cert(
Some(quoting_enclave_target_info),
Some(&quote_size),
false,
) {
Ok(r) => r,
Err(e) => return Err(e),
};

if let Err(err) = io::write(&dcap_quote, RA_DUMP_CERT_DER_FILE) {
error!(
Expand All @@ -192,7 +225,7 @@ where
Ok(())
}

fn create_ra_report_and_signature(
fn create_epid_ra_report_and_signature(
&self,
sign_type: sgx_quote_sign_type_t,
skip_ra: bool,
Expand All @@ -209,36 +242,20 @@ where
debug!(" pubkey Y is {:02x}", pub_k.gy.iter().format(""));

let payload = if !skip_ra {
info!(" [Enclave] Create attestation report");
let (attn_report, sig, cert) =
match self.create_attestation_report(&chain_signer.public().0, sign_type) {
Ok(r) => r,
Err(e) => {
error!(" [Enclave] Error in create_attestation_report: {:?}", e);
return Err(e.into())
},
};
println!(" [Enclave] Create attestation report successful");
debug!(" attn_report = {:?}", attn_report);
debug!(" sig = {:?}", sig);
debug!(" cert = {:?}", cert);

// concat the information
attn_report + "|" + &sig + "|" + &cert
self.create_payload_epid(&chain_signer.public().0, sign_type)?
} else {
Default::default()
};

// generate an ECC certificate
info!(" [Enclave] Generate ECC Certificate");
let (key_der, cert_der) =
match cert::gen_ecc_cert(&payload.into_bytes(), &prv_k, &pub_k, &ecc_handle) {
Ok(r) => r,
Err(e) => {
error!(" [Enclave] gen_ecc_cert failed: {:?}", e);
return Err(e.into())
},
};
let (key_der, cert_der) = match cert::gen_ecc_cert(&payload, &prv_k, &pub_k, &ecc_handle) {
Ok(r) => r,
Err(e) => {
error!(" [Enclave] gen_ecc_cert failed: {:?}", e);
return Err(e.into())
},
};

let _ = ecc_handle.close();
info!(" [Enclave] Generate ECC Certificate successful");
Expand All @@ -247,10 +264,14 @@ where

fn generate_dcap_ra_cert(
&self,
quoting_enclave_target_info: &sgx_target_info_t,
quote_size: u32,
quoting_enclave_target_info: Option<&sgx_target_info_t>,
quote_size: Option<&u32>,
skip_ra: bool,
) -> EnclaveResult<(Vec<u8>, Vec<u8>)> {
) -> EnclaveResult<(Vec<u8>, Vec<u8>, Vec<u8>)> {
if !skip_ra && quoting_enclave_target_info.is_none() && quote_size.is_none() {
error!("Enclave Attestation] remote attestation not skipped, but Quoting Enclave (QE) data is not available");
clangenb marked this conversation as resolved.
Show resolved Hide resolved
return Err(EnclaveError::Sgx(sgx_status_t::SGX_ERROR_UNEXPECTED))
}
let chain_signer = self.signing_key_repo.retrieve_key()?;
info!("[Enclave Attestation] Ed25519 signer pub key: {:?}", chain_signer.public().0);

Expand All @@ -262,8 +283,8 @@ where
let qe_quote = if !skip_ra {
let qe_quote = match self.retrieve_qe_dcap_quote(
&chain_signer.public().0,
quoting_enclave_target_info,
quote_size,
quoting_enclave_target_info.unwrap(),
*quote_size.unwrap(),
) {
Ok(quote) => quote,
Err(e) => {
Expand All @@ -276,20 +297,25 @@ where
Default::default()
};

let qe_quote_base_64 = base64::encode(&qe_quote[..]);
// generate an ECC certificate
debug!("[Enclave] Generate ECC Certificate");
let (_key_der, cert_der) = match cert::gen_ecc_cert(&qe_quote, &prv_k, &pub_k, &ecc_handle)
{
Ok(r) => r,
Err(e) => {
error!("[Enclave] gen_ecc_cert failed: {:?}", e);
return Err(e.into())
},
};
let (key_der, cert_der) =
match cert::gen_ecc_cert(&qe_quote_base_64, &prv_k, &pub_k, &ecc_handle) {
Ok(r) => r,
Err(e) => {
error!("[Enclave] gen_ecc_cert failed: {:?}", e);
return Err(e.into())
},
};

let _ = ecc_handle.close();

Ok((cert_der, qe_quote))
debug!("[Enclave] Generated ECC cert info:");
trace!("[Enclave] Generated ECC cert info: key_der={:#?}", &key_der);
trace!("[Enclave] Generated ECC cert info: cert_der={:#?}", &cert_der);
trace!("[Enclave] Generated ECC cert info: qe_quote={:#?}", &qe_quote);
OverOrion marked this conversation as resolved.
Show resolved Hide resolved
Ok((key_der, cert_der, qe_quote))
}
}

Expand Down Expand Up @@ -511,7 +537,7 @@ where
+ (u32::from(array[3]) << 24)
}

fn create_attestation_report(
fn create_epid_attestation_report(
&self,
pub_k: &[u8; 32],
sign_type: sgx_quote_sign_type_t,
Expand Down
Loading