Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/30826 )
Change subject: security/tpm/tss/tcg-2.0: Add TPM2 function tlcl_getcapability() ......................................................................
Patch Set 16:
(2 comments)
https://review.coreboot.org/#/c/30826/15/src/security/tpm/tss/tcg-2.0/tss.c File src/security/tpm/tss/tcg-2.0/tss.c:
https://review.coreboot.org/#/c/30826/15/src/security/tpm/tss/tcg-2.0/tss.c@... PS15, Line 373: * Please note that the capabilityData is not unmarshalled.
Comment is about input parameter.
Which input parameter? Isn't capabilityData purely an output parameter? (BTW the naming convention is also wrong, please don't use camelCase.)
https://review.coreboot.org/#/c/30826/15/src/security/tpm/tss/tcg-2.0/tss.c@... PS15, Line 403: sizeof(TPMI_YES_NO) - sizeof(struct tpm_header));
Need the information of the GetCapability only. […]
You're passing in a TPMS_CAPABILITY_DATA struct here, that has a well-known size. The buffer allocated for the tpm2_response also has a well-known size. You can just copy sizeof(responce->gc.cd) bytes. (You may copy a handful of zeroes at the end that wasn't actually read from the TPM, but so what? The cost for that is completely negligible compared to a whole TPM transaction, and it beats having to rip up the whole tpm_process_command() API for this.)