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

Sign exported cdi cert with alias key. #375

Merged
Changes from all commits
Commits
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
28 changes: 6 additions & 22 deletions dpe/src/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2465,17 +2465,9 @@ fn create_dpe_cert_or_csr(
return Err(DpeErrorCode::InternalError);
}
let tbs_digest = env.crypto.hash(algs, &scratch_buf[..bytes_written])?;
let sig = match cert_type {
CertificateType::Leaf => env
.crypto
.ecdsa_sign_with_alias(DPE_PROFILE.alg_len(), &tbs_digest),
CertificateType::Exported => env.crypto.ecdsa_sign_with_derived(
DPE_PROFILE.alg_len(),
&tbs_digest,
&priv_key,
&pub_key,
),
}?;
let sig = env
.crypto
.ecdsa_sign_with_alias(DPE_PROFILE.alg_len(), &tbs_digest)?;
let mut cert_writer = CertWriter::new(output_cert_or_csr, true);
bytes_written =
cert_writer.encode_ecdsa_certificate(&scratch_buf[..bytes_written], &sig)?;
Expand Down Expand Up @@ -2509,17 +2501,9 @@ fn create_dpe_cert_or_csr(
}

let csr_digest = env.crypto.hash(algs, &csr_buffer[..bytes_written])?;
let csr_sig = match cert_type {
CertificateType::Leaf => env
.crypto
.ecdsa_sign_with_alias(DPE_PROFILE.alg_len(), &csr_digest),
CertificateType::Exported => env.crypto.ecdsa_sign_with_derived(
DPE_PROFILE.alg_len(),
&csr_digest,
&priv_key,
&pub_key,
),
}?;
let csr_sig = env
.crypto
.ecdsa_sign_with_alias(DPE_PROFILE.alg_len(), &csr_digest)?;
let sid = env.platform.get_signer_identifier()?;

let mut cms_writer = CertWriter::new(output_cert_or_csr, true);
Expand Down
Loading