-
Notifications
You must be signed in to change notification settings - Fork 11.4k
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
feat: minor tweaks on verify function #21549
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -366,7 +375,7 @@ impl CoseSign1 { | |||
Value::Bytes(vec![]), | |||
Value::Bytes(self.payload.as_slice().to_vec()), | |||
]); | |||
let mut bytes = Vec::with_capacity(self.protected.len() + self.payload.len()); | |||
let mut bytes = Vec::with_capacity(self.protected.len() + self.payload.len() + 17); |
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.
pls document why 17
"timestamp not found".to_string(), | ||
))? | ||
.as_integer() | ||
.and_then(|integer| u64::try_from(integer).ok()) |
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.
is it safe?
) | ||
})?; | ||
|
||
for i in [0, 1, 2, 3, 4, 8] { |
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.
should we return error if we see, e.g., pcr 5?
} | ||
let mut certs = Vec::with_capacity(arr.len()); | ||
for cert in arr.iter() { | ||
let cert_bytes = cert.as_bytes().unwrap(); |
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.
can we use except
with a description
.ok_or(NitroAttestationVerifyError::InvalidAttestationDoc( | ||
"cabundle not found".to_string(), | ||
))? | ||
.as_array() |
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.
can there be more than one cert chain?
|
||
let document_map = match document_data { | ||
ciborium::value::Value::Map(map) => map, | ||
let document_map: HashMap<String, Value> = match document_data { |
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.
is there a reasonable length limit on payload we can use?
document_map: &HashMap<String, Value>, | ||
) -> Result<AttestationDocument, NitroAttestationVerifyError> { | ||
let module_id = document_map | ||
.get("module_id") |
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.
just making sure it's the case - .get()
is implemented as a map in O(1) query time, and not using a linear search.
Description
Describe the changes or additions included in this PR.
Test plan
How did you test the new or updated feature?
Release notes
Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.