if (chip->flags & TPM_CHIP_FLAG_TPM2)
tpm2_end_auth_session(chip);
ret = tpm2_prepare_space(chip, space, buf, bufsiz); /* If the command is not implemented by the TPM, synthesize a *responsewithaTPM2_RC_COMMAND_CODEreturnforuser-space.
*/ if (ret == -EOPNOTSUPP) {
header->length = cpu_to_be32(sizeof(*header));
header->tag = cpu_to_be16(TPM2_ST_NO_SESSIONS);
header->return_code = cpu_to_be32(TPM2_RC_COMMAND_CODE |
TSS2_RESMGR_TPM_RC_LAYER);
ret = sizeof(*header);
} if (ret) goto out_rc;
len = tpm_transmit(chip, buf, bufsiz); if (len < 0)
ret = len;
if (!ret)
ret = tpm2_commit_space(chip, space, buf, &len); else
tpm2_flush_space(chip);
/* Cannot perform a write until the read has cleared either via *tpm_readorauser_read_timertimeout.Thisalsopreventssplit *bufferedwritesfromblockinghere.
*/ if ((!priv->response_read && priv->response_length) ||
priv->command_enqueued) {
ret = -EBUSY; goto out;
}
if (copy_from_user(priv->data_buffer, buf, size)) {
ret = -EFAULT; goto out;
}
if (size < 6 ||
size < be32_to_cpu(*((__be32 *)(priv->data_buffer + 2)))) {
ret = -EINVAL; goto out;
}
/* atomic tpm command send and result receive. We only hold the ops *lockduringthisperiodsothatthetpmcanbeunregisteredevenif *thechardevisheldopen.
*/ if (tpm_try_get_ops(priv->chip)) {
ret = -EPIPE; goto out;
}
ret = tpm_dev_transmit(priv->chip, priv->space, priv->data_buffer, sizeof(priv->data_buffer));
tpm_put_ops(priv->chip);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.