summaryrefslogtreecommitdiff
path: root/src/security/tpm/tss
diff options
context:
space:
mode:
Diffstat (limited to 'src/security/tpm/tss')
-rw-r--r--src/security/tpm/tss/tcg-1.2/tss.c10
-rw-r--r--src/security/tpm/tss/tcg-2.0/tss.c52
-rw-r--r--src/security/tpm/tss/vendor/cr50/cr50.c28
-rw-r--r--src/security/tpm/tss/vendor/cr50/cr50.h8
4 files changed, 49 insertions, 49 deletions
diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c
index 9c19f7f3cb..b6527a6482 100644
--- a/src/security/tpm/tss/tcg-1.2/tss.c
+++ b/src/security/tpm/tss/tcg-1.2/tss.c
@@ -108,7 +108,7 @@ uint32_t tlcl_send_receive(const uint8_t *request, uint8_t *response,
max_length);
/* If the command fails because the self test has not completed, try it
* again after attempting to ensure that the self test has completed. */
- if (rc == TPM_E_NEEDS_SELFTEST || rc == TPM_E_DOING_SELFTEST) {
+ if (rc == TPM_NEEDS_SELFTEST || rc == TPM_DOING_SELFTEST) {
rc = tlcl_continue_self_test();
if (rc != TPM_SUCCESS)
return rc;
@@ -125,7 +125,7 @@ uint32_t tlcl_send_receive(const uint8_t *request, uint8_t *response,
do {
rc = tlcl_send_receive_no_retry(request, response,
max_length);
- } while (rc == TPM_E_DOING_SELFTEST);
+ } while (rc == TPM_DOING_SELFTEST);
#endif
}
return rc;
@@ -238,7 +238,7 @@ uint32_t tlcl_read(uint32_t index, void *data, uint32_t length)
uint8_t *nv_read_cursor = response + kTpmResponseHeaderLength;
from_tpm_uint32(nv_read_cursor, &result_length);
if (result_length > length)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
nv_read_cursor += sizeof(uint32_t);
memcpy(data, nv_read_cursor, result_length);
}
@@ -301,7 +301,7 @@ uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags)
return rc;
from_tpm_uint32(response + kTpmResponseHeaderLength, &size);
if (size != sizeof(TPM_PERMANENT_FLAGS))
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
memcpy(pflags, response + kTpmResponseHeaderLength + sizeof(size),
sizeof(TPM_PERMANENT_FLAGS));
return rc;
@@ -338,7 +338,7 @@ uint32_t tlcl_extend(int pcr_num, const uint8_t *digest_data,
uint8_t response[kTpmResponseHeaderLength + kPcrDigestLength];
if (digest_algo != VB2_HASH_SHA1)
- return TPM_E_INVALID_ARG;
+ return TPM_CB_INVALID_ARG;
memcpy(&cmd, &tpm_extend_cmd, sizeof(cmd));
to_tpm_uint32(cmd.buffer + tpm_extend_cmd.pcrNum, pcr_num);
diff --git a/src/security/tpm/tss/tcg-2.0/tss.c b/src/security/tpm/tss/tcg-2.0/tss.c
index d228c7f6a8..5b9aab82bf 100644
--- a/src/security/tpm/tss/tcg-2.0/tss.c
+++ b/src/security/tpm/tss/tcg-2.0/tss.c
@@ -57,7 +57,7 @@ static uint32_t tlcl_send_startup(TPM_SU type)
/* IO error, tpm2_response pointer is empty. */
if (!response) {
printk(BIOS_ERR, "%s: TPM communication error\n", __func__);
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
}
printk(BIOS_INFO, "%s: Startup return code is %x\n",
@@ -66,13 +66,13 @@ static uint32_t tlcl_send_startup(TPM_SU type)
switch (response->hdr.tpm_code) {
case TPM_RC_INITIALIZE:
/* TPM already initialized. */
- return TPM_E_INVALID_POSTINIT;
+ return TPM_INVALID_POSTINIT;
case TPM2_RC_SUCCESS:
return TPM_SUCCESS;
}
- /* Collapse any other errors into TPM_E_IOERROR. */
- return TPM_E_IOERROR;
+ /* Collapse any other errors into TPM_IOERROR. */
+ return TPM_IOERROR;
}
uint32_t tlcl_resume(void)
@@ -91,7 +91,7 @@ static uint32_t tlcl_send_shutdown(TPM_SU type)
/* IO error, tpm2_response pointer is empty. */
if (!response) {
printk(BIOS_ERR, "%s: TPM communication error\n", __func__);
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
}
printk(BIOS_INFO, "%s: Shutdown return code is %x\n",
@@ -100,8 +100,8 @@ static uint32_t tlcl_send_shutdown(TPM_SU type)
if (response->hdr.tpm_code == TPM2_RC_SUCCESS)
return TPM_SUCCESS;
- /* Collapse any other errors into TPM_E_IOERROR. */
- return TPM_E_IOERROR;
+ /* Collapse any other errors into TPM_IOERROR. */
+ return TPM_IOERROR;
}
uint32_t tlcl_save_state(void)
@@ -144,7 +144,7 @@ uint32_t tlcl_extend(int pcr_num, const uint8_t *digest_data,
alg = tpmalg_from_vb2_hash(digest_type);
if (alg == TPM_ALG_ERROR)
- return TPM_E_HASH_ERROR;
+ return TPM_CB_HASH_ERROR;
pcr_ext_cmd.pcrHandle = HR_PCR + pcr_num;
pcr_ext_cmd.digests.count = 1;
@@ -158,7 +158,7 @@ uint32_t tlcl_extend(int pcr_num, const uint8_t *digest_data,
printk(BIOS_INFO, "%s: response is %x\n",
__func__, response ? response->hdr.tpm_code : -1);
if (!response || response->hdr.tpm_code)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
return TPM_SUCCESS;
}
@@ -179,7 +179,7 @@ uint32_t tlcl_force_clear(void)
__func__, response ? response->hdr.tpm_code : -1);
if (!response || response->hdr.tpm_code)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
return TPM_SUCCESS;
}
@@ -196,7 +196,7 @@ uint32_t tlcl_clear_control(bool disable)
__func__, response ? response->hdr.tpm_code : -1);
if (!response || response->hdr.tpm_code)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
return TPM_SUCCESS;
}
@@ -244,7 +244,7 @@ uint32_t tlcl_read(uint32_t index, void *data, uint32_t length)
/* Need to map tpm error codes into internal values. */
if (!response)
- return TPM_E_READ_FAILURE;
+ return TPM_CB_READ_FAILURE;
printk(BIOS_INFO, "%s:%d index %#x return code %x\n",
__FILE__, __LINE__, index, response->hdr.tpm_code);
@@ -259,20 +259,20 @@ uint32_t tlcl_read(uint32_t index, void *data, uint32_t length)
* hasn't been defined.
*/
case TPM_RC_CR50_NV_UNDEFINED:
- return TPM_E_BADINDEX;
+ return TPM_BADINDEX;
case TPM_RC_NV_RANGE:
- return TPM_E_RANGE;
+ return TPM_CB_RANGE;
default:
- return TPM_E_READ_FAILURE;
+ return TPM_CB_READ_FAILURE;
}
if (length > response->nvr.buffer.t.size)
- return TPM_E_RESPONSE_TOO_LARGE;
+ return TPM_CB_RESPONSE_TOO_LARGE;
if (length < response->nvr.buffer.t.size)
- return TPM_E_READ_EMPTY;
+ return TPM_CB_READ_EMPTY;
memcpy(data, response->nvr.buffer.t.buffer, length);
@@ -306,7 +306,7 @@ uint32_t tlcl_lock_nv_write(uint32_t index)
__func__, response ? response->hdr.tpm_code : -1);
if (!response || response->hdr.tpm_code)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
return TPM_SUCCESS;
}
@@ -334,7 +334,7 @@ uint32_t tlcl_write(uint32_t index, const void *data, uint32_t length)
/* Need to map tpm error codes into internal values. */
if (!response || response->hdr.tpm_code)
- return TPM_E_WRITE_FAILURE;
+ return TPM_CB_WRITE_FAILURE;
return TPM_SUCCESS;
}
@@ -357,7 +357,7 @@ uint32_t tlcl_set_bits(uint32_t index, uint64_t bits)
/* Need to map tpm error codes into internal values. */
if (!response || response->hdr.tpm_code)
- return TPM_E_WRITE_FAILURE;
+ return TPM_CB_WRITE_FAILURE;
return TPM_SUCCESS;
}
@@ -392,16 +392,16 @@ uint32_t tlcl_define_space(uint32_t space_index, size_t space_size,
response ? response->hdr.tpm_code : -1);
if (!response)
- return TPM_E_NO_DEVICE;
+ return TPM_CB_NO_DEVICE;
/* Map TPM2 return codes into common vboot representation. */
switch (response->hdr.tpm_code) {
case TPM2_RC_SUCCESS:
return TPM_SUCCESS;
case TPM2_RC_NV_DEFINED:
- return TPM_E_NV_DEFINED;
+ return TPM_CB_NV_DEFINED;
default:
- return TPM_E_INTERNAL_INCONSISTENCY;
+ return TPM_CB_INTERNAL_INCONSISTENCY;
}
}
@@ -448,7 +448,7 @@ uint32_t tlcl_disable_platform_hierarchy(void)
response = tpm_process_command(TPM2_Hierarchy_Control, &hc);
if (!response || response->hdr.tpm_code)
- return TPM_E_INTERNAL_INCONSISTENCY;
+ return TPM_CB_INTERNAL_INCONSISTENCY;
return TPM_SUCCESS;
}
@@ -467,14 +467,14 @@ uint32_t tlcl_get_capability(TPM_CAP capability, uint32_t property,
if (property_count > 1) {
printk(BIOS_ERR, "%s: property_count more than one not "
"supported yet\n", __func__);
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
}
response = tpm_process_command(TPM2_GetCapability, &cmd);
if (!response) {
printk(BIOS_ERR, "%s: Command Failed\n", __func__);
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
}
memcpy(capability_data, &response->gc.cd, sizeof(TPMS_CAPABILITY_DATA));
diff --git a/src/security/tpm/tss/vendor/cr50/cr50.c b/src/security/tpm/tss/vendor/cr50/cr50.c
index 57d0b61a24..5dbf0148bb 100644
--- a/src/security/tpm/tss/vendor/cr50/cr50.c
+++ b/src/security/tpm/tss/vendor/cr50/cr50.c
@@ -24,7 +24,7 @@ uint32_t tlcl_cr50_enable_nvcommits(void)
response->hdr.tpm_code);
else
printk(BIOS_INFO, "%s: failed\n", __func__);
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
}
return TPM_SUCCESS;
}
@@ -42,7 +42,7 @@ uint32_t tlcl_cr50_enable_update(uint16_t timeout_ms,
response = tpm_process_command(TPM2_CR50_VENDOR_COMMAND, command_body);
if (!response || response->hdr.tpm_code)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
*num_restored_headers = response->vcr.num_restored_headers;
return TPM_SUCCESS;
@@ -58,7 +58,7 @@ uint32_t tlcl_cr50_get_recovery_button(uint8_t *recovery_button_state)
response = tpm_process_command(TPM2_CR50_VENDOR_COMMAND, &sub_command);
if (!response || response->hdr.tpm_code)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
*recovery_button_state = response->vcr.recovery_button_state;
return TPM_SUCCESS;
@@ -75,7 +75,7 @@ uint32_t tlcl_cr50_get_tpm_mode(uint8_t *tpm_mode)
response = tpm_process_command(TPM2_CR50_VENDOR_COMMAND, &mode_command);
if (!response)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
if (response->hdr.tpm_code == VENDOR_RC_INTERNAL_ERROR) {
/*
@@ -83,7 +83,7 @@ uint32_t tlcl_cr50_get_tpm_mode(uint8_t *tpm_mode)
* is disabled. The Cr50 requires a reboot to re-enable the key
* ladder.
*/
- return TPM_E_MUST_REBOOT;
+ return TPM_CB_MUST_REBOOT;
}
if (response->hdr.tpm_code == VENDOR_RC_NO_SUCH_COMMAND ||
@@ -91,12 +91,12 @@ uint32_t tlcl_cr50_get_tpm_mode(uint8_t *tpm_mode)
/*
* Explicitly inform caller when command is not supported
*/
- return TPM_E_NO_SUCH_COMMAND;
+ return TPM_CB_NO_SUCH_COMMAND;
}
if (response->hdr.tpm_code) {
/* Unexpected return code from Cr50 */
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
}
/* TPM command completed without error */
@@ -115,16 +115,16 @@ uint32_t tlcl_cr50_get_boot_mode(uint8_t *boot_mode)
response = tpm_process_command(TPM2_CR50_VENDOR_COMMAND, &mode_command);
if (!response)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
if (response->hdr.tpm_code == VENDOR_RC_NO_SUCH_COMMAND ||
response->hdr.tpm_code == VENDOR_RC_NO_SUCH_SUBCOMMAND)
/* Explicitly inform caller when command is not supported */
- return TPM_E_NO_SUCH_COMMAND;
+ return TPM_CB_NO_SUCH_COMMAND;
if (response->hdr.tpm_code)
/* Unexpected return code from Cr50 */
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
*boot_mode = response->vcr.boot_mode;
@@ -145,7 +145,7 @@ uint32_t tlcl_cr50_immediate_reset(uint16_t timeout_ms)
&reset_command_body);
if (!response)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
return TPM_SUCCESS;
}
@@ -160,16 +160,16 @@ uint32_t tlcl_cr50_reset_ec(void)
response = tpm_process_command(TPM2_CR50_VENDOR_COMMAND, &reset_cmd);
if (!response)
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
if (response->hdr.tpm_code == VENDOR_RC_NO_SUCH_COMMAND ||
response->hdr.tpm_code == VENDOR_RC_NO_SUCH_SUBCOMMAND)
/* Explicitly inform caller when command is not supported */
- return TPM_E_NO_SUCH_COMMAND;
+ return TPM_CB_NO_SUCH_COMMAND;
if (response->hdr.tpm_code)
/* Unexpected return code from Cr50 */
- return TPM_E_IOERROR;
+ return TPM_IOERROR;
printk(BIOS_DEBUG, "EC reset coming up...\n");
halt();
diff --git a/src/security/tpm/tss/vendor/cr50/cr50.h b/src/security/tpm/tss/vendor/cr50/cr50.h
index 0028e80b3c..ee6b30f6d5 100644
--- a/src/security/tpm/tss/vendor/cr50/cr50.h
+++ b/src/security/tpm/tss/vendor/cr50/cr50.h
@@ -72,9 +72,9 @@ uint32_t tlcl_cr50_get_recovery_button(uint8_t *recovery_button_state);
*
* Returns TPM_SUCCESS if TPM mode command completed, the Cr50 does not need a
* reboot, and the tpm_mode parameter is set to the current TPM mode.
- * Returns TPM_E_MUST_REBOOT if TPM mode command completed, but the Cr50
+ * Returns TPM_CB_MUST_REBOOT if TPM mode command completed, but the Cr50
* requires a reboot.
- * Returns TPM_E_NO_SUCH_COMMAND if the Cr50 does not support the command.
+ * Returns TPM_CB_NO_SUCH_COMMAND if the Cr50 does not support the command.
* Other returns value indicate a failure accessing the TPM.
*/
uint32_t tlcl_cr50_get_tpm_mode(uint8_t *tpm_mode);
@@ -83,7 +83,7 @@ uint32_t tlcl_cr50_get_tpm_mode(uint8_t *tpm_mode);
* CR50 specific TPM command sequence to query the current boot mode.
*
* Returns TPM_SUCCESS if boot mode is successfully retrieved.
- * Returns TPM_E_* for errors.
+ * Returns TPM_* for errors.
*/
uint32_t tlcl_cr50_get_boot_mode(uint8_t *boot_mode);
@@ -99,7 +99,7 @@ uint32_t tlcl_cr50_immediate_reset(uint16_t timeout_ms);
/**
* CR50 specific TPM command sequence to issue an EC reset.
*
- * Returns TPM_E_* for errors.
+ * Returns TPM_* for errors.
* On Success, this function invokes halt() and does not return.
*/
uint32_t tlcl_cr50_reset_ec(void);