[SLOF] [PATCH v3 12/17] Add TPM firmware API call get-maximum-cmd-size

Hon c Lo lo1 at us.ibm.com
Fri Mar 4 15:32:23 AEDT 2016


Hi Stefan,

> +uint32_t tpm_get_maximum_cmd_size(void)
> +{
> +   uint32_t rc;
> +   uint32_t return_code;
> +   struct tpm_rsp_getcap_buffersize buffersize;
> +   uint32_t result;
> +
> +   if (!has_working_tpm())
> +      return 0;
> +
> +   rc = build_and_send_cmd(TPM_ORD_GET_CAPABILITY,
> +            get_capability_buffer_size,
> +            sizeof(get_capability_buffer_size),
> +            (uint8_t *)&buffersize, sizeof(buffersize),
> +            &return_code, TPM_DURATION_TYPE_SHORT);
> +
> +   if (rc || return_code)
> +      goto err_exit;
> +
> +   result = MIN(cpu_to_be32(buffersize.buffersize),

Should it be using be32_to_cpu() instead? I thought we were getting
buffersize in network-byte-order format.



> +                spapr_vtpm_get_buffersize());
> +
> +   return result;
> +
> +err_exit:
> +   dprintf("TPM malfunctioning (line %d).\n", __LINE__);
> +
> +   tpm_set_failure();
> +
> +   return 0;
> +}



Regards,
Vicky

Hon Ching (Vicky) Lo
Linux Security Development
Notes:  lo1 at us.ibm.com
Office:  845-435-8946 (T/L: 295-8946)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/slof/attachments/20160303/ee7e5b05/attachment.html>


More information about the SLOF mailing list