-
Notifications
You must be signed in to change notification settings - Fork 2
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
Extract PCK certificate chain from quotes #1209
Changes from 31 commits
f961716
eda5589
2884836
c7bc598
dac3595
84e0849
92a1397
3fefc22
f1fe7bf
2072ec6
dd463c6
9c4bdfd
3680d62
20d57e6
072b411
971052b
4ba9241
ee23433
546b034
7a2f36f
6f17e5b
fe7291a
d1f075f
02d0a61
0456568
5efd1ae
30a522b
a680883
dc2222c
096036e
a674da9
4c2c586
f1334e6
172d2e0
0c55178
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,10 +38,12 @@ js-sys={ version="0.3.74", optional=true } | |
tokio ={ version="1.42", features=["time"] } | ||
|
||
[dev-dependencies] | ||
serial_test ="3.2.0" | ||
sp-keyring ="34.0.0" | ||
serial_test="3.2.0" | ||
sp-keyring="34.0.0" | ||
entropy-testing-utils={ path="../testing-utils" } | ||
tdx-quote ={ version="0.0.1", features=["mock"] } | ||
tdx-quote={ git="https://github.com/entropyxyz/tdx-quote.git", branch="peg/cert-chain-parse", features=[ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm planning to re-publish this crate if this PR gets approved. Ideally i would also like to fix entropyxyz/tdx-quote#13 and entropyxyz/tdx-quote#11 before publishing. |
||
"mock", | ||
] } | ||
|
||
[features] | ||
default=["native", "full-client-native"] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,10 +165,9 @@ pub trait AttestationHandler<AccountId> { | |
fn verify_quote( | ||
attestee: &AccountId, | ||
x25519_public_key: X25519PublicKey, | ||
provisioning_certification_key: BoundedVecEncodedVerifyingKey, | ||
quote: Vec<u8>, | ||
context: QuoteContext, | ||
) -> Result<(), sp_runtime::DispatchError>; | ||
) -> Result<BoundedVecEncodedVerifyingKey, VerifyQuoteError>; | ||
ameba23 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Indicate to the attestation handler that a quote is desired. | ||
/// | ||
|
@@ -183,12 +182,37 @@ impl<AccountId> AttestationHandler<AccountId> for () { | |
fn verify_quote( | ||
_attestee: &AccountId, | ||
_x25519_public_key: X25519PublicKey, | ||
_provisioning_certification_key: BoundedVecEncodedVerifyingKey, | ||
_quote: Vec<u8>, | ||
_context: QuoteContext, | ||
) -> Result<(), sp_runtime::DispatchError> { | ||
Ok(()) | ||
) -> Result<BoundedVecEncodedVerifyingKey, VerifyQuoteError> { | ||
Ok(sp_runtime::BoundedVec::new()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may want to specify a size of |
||
} | ||
|
||
fn request_quote(_attestee: &AccountId, _nonce: [u8; 32]) {} | ||
} | ||
|
||
/// An error when verifying a quote | ||
#[cfg(not(feature = "wasm"))] | ||
#[derive(Debug, Eq, PartialEq)] | ||
pub enum VerifyQuoteError { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this custom error type because i couldn't figure out how to get the useful information out of a |
||
/// Quote could not be parsed or verified | ||
BadQuote, | ||
/// Attestation extrinsic submitted when not requested | ||
UnexpectedAttestation, | ||
/// Hashed input data does not match what was expected | ||
IncorrectInputData, | ||
/// Unacceptable VM image running | ||
BadMrtdValue, | ||
/// Cannot encode verifying key (PCK) | ||
CannotEncodeVerifyingKey, | ||
/// Cannot decode verifying key (PCK) | ||
CannotDecodeVerifyingKey, | ||
/// PCK certificate chain cannot be parsed | ||
PckCertificateParse, | ||
/// PCK certificate chain cannot be verified | ||
PckCertificateVerify, | ||
/// PCK certificate chain public key is not well formed | ||
PckCertificateBadPublicKey, | ||
/// Pck certificate could not be extracted from quote | ||
PckCertificateNoCertificate, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you do a full
cargo update
here? This seems like a lot of changesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that was an accident. I couldn't update the git version tdx-quote with
cargo update tdx-quote
because some crates were using the git version and others the release version. So i lazily just didcargo update
without thinking of the implications. Im not sure whether to revert it or just see if things still work and leave it in if the do.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end i have reverted the lockfile as there was cargo-deny related license issues popping up