-
Notifications
You must be signed in to change notification settings - Fork 57
Adds the attest structures #293
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
Adds the attest structures #293
Conversation
b9432cb
to
5ec75dd
Compare
5ec75dd
to
fb8202d
Compare
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.
🤯 That's a lot of new types, thanks!! Looks pretty good overall, had just a few comments/questions.
I'm also curious, I thought there was at least one place where one of the FFI types is used, TPM2B_ATTEST
, I think. Did you not want to update that yet?
48d6c62
to
90f2172
Compare
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.
Quite a nice collection of types.
They are currently not used by any context methods? Just curious how would they fit in the larger scheme of things here...
90f2172
to
ed50c4a
Compare
From a pure functionality point of view there is little difference. But the new traits are more explicit, the data they produce and consumes are not just any bytes it is specifically the bytes that are produced or consumed by the Tss2_MU_* functions for each individual type. |
Good point. Thanks for the explanation @Superhepper and @ionut-arm 👍! |
The types will be used later by context method implementation of |
ed50c4a
to
b211927
Compare
I was so focused on the Attest type and all the info types that I did not even think of to check if the TPM2B_ATTEST or TPMS_ATTEST was used any where. But I fixed that now. |
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.
👍🏻
- Adds YesNo interface type that corresponds to the TPMI_YES_NO. It can be used to correct convert interface type to YseNo or to bool. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the AttestationType as a structure tags interface type. This corresponds to the TPMI_ST_ATTEST Type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the AttestBuffer strucuture this corresponds to the TPM2B_ATTEST structure. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the ClockInfo type this corresponds to the TPMS_CLOCK_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Added CertifyInfo type this corresponds to the TPMS_CERTIFY_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the QuoteInfo type, this corresponds to the TPMS_QUOTE_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the TimeInfo type, this corresponds to the TPMS_TIME_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the TimeAttestInfo type, this corresponds to the TPMS_TIME_ATTEST_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the CommandAuditInfo type, this corresponds to the TPMS_COMMAND_AUDIT_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the SessionAuditInfo type, this corresponds to the TPMS_SESSION_AUDIT_INFO structure. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the CreationInfo type, this corresponds to the TPMS_CREATION_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the NvCertifyInfo type, this corresponds to the TPMS_NV_CERTIFY_INFO type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the NvDigestCertifyInfo type, this corresponds to the TPMS_NV_DIGEST_CERTIFY_INFO type that was added in the 3.1.0 version of the tpm2-tss library. And in the r1.59 version of the TPM 2.0 specification. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Adds the Attest and AttestInfo types. The Attest type corresponds to the TPMS_ATTEST and the AttestInfo type corresponds somewhat to the TPMU_ATTEST type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
cf34229
to
bcfa6ef
Compare
@wiktor-k: Is there something you would like to be changed before this can be merged? |
I've re-read it all and the only place I'm less-than-super-positive is If you think it's good as it is I won't block it though :) |
Well truncate wont work here because the vector can in this case not know the number of bytes that have been written to it. What can be done is to allocate an array with a maximum size and write the data to it and then convert a slice of that array into an vector. It would require some extra copying. But it might be worth it in order to avoid the unsafe part. |
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.
Nah, I think it's fine it just looks weird on first sight. The same issue happens in cryptoki that you're supposed to pass a buffer big enough end then cut it. I was also thinking about running drop on elements outside of len but since this is just u8s then there's nothing to worry about.
This is good for me after your explanations, not sure if rewriting to use arrays would be the best use of your time :)
I actually come up with a way to use truncate instead. Will change it in one sec. |
- Adds Marshall trait for types that can be marshalled into TPM marshalled data. - Adds UnMarshall trait for types that can be un marshalled from TPM marshalled data. - Implemented Marshall and UnMarshall trait for the Attest type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
- Changes the retur type of the Context method quote from TPM2B_ATTEST to the new Attest type. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
bcfa6ef
to
d66d3b5
Compare
Ha, very cool! One less unsafe thing to worry about. Thanks for taking the extra steps for safety @Superhepper. 👍 |
Fixed Clippy and compile errors that occured when upgrading to version 1.57 of the rust compiler. Signed-off-by: Jesper Brynolf <jesper.brynolf@gmail.com>
f8e425b
to
0185a3c
Compare
Adds the Attest type and all the different attest info types.