> - uint offset = 10 + 8 + 13 + 14; > --- a/drivers/tpm/tpm2_tis_sandbox.c + * > + * @param in_digest 160/256-bit value representing the event to be +, @@ -104,6 +104,7 @@ obj-$(CONFIG_SYSINFO) += sysinfo.o. > + char func_name[4]; /* s_failFunction, limited to 4 chars */ + */ > return -ENOSYS; +#include
Making statements based on opinion; back them up with references or personal experience. + printf("%s\n", buf); What happens if I accidentally ground the output of an LDO regulator? + return -ENOSPC; > u32 tpm_pcr_read(struct udevice *dev, u32 index, void *data, size_t count) + func_name, + * Operations specific to the Cr50 TPM used on Chromium OS and Android devices -}
> u32 tpm_finalise_physical_presence(struct udevice *dev) > + ut_asserteq_str("init_done=0", buf); + return -ENOSPC; > + * possibly leaving non-volatile data unwritten by the TPM. + +} > + * It is transferred over the wire, so it needs to be serialized/deserialized, + return 0; > > print_byte_string(out_digest, sizeof(out_digest)); + * @dev: Device to check > - if (is_tpm1(dev))
+ * + return -EINVAL; /* This should never happen */ > - tpm_u16(12 + nv_policy_size), /* size */ > + else if (tpm_is_v2(dev)) + *recv_size -= 12; > - else if (is_tpm2(dev)) +u32 tpm2_cr50_enable_nvcommits(struct udevice *dev) By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. Super User is a question and answer site for computer enthusiasts and power users. > + return 0; > > -- +#include
> - else if (is_tpm2(dev)) > 5 files changed, 22 insertions(+), 10 deletions(-) +u32 tpm2_cr50_report_state(struct udevice *dev, u8 *recvbuf, size_t *recv_size); > 2.35.1.574.g5d30c73bfb-goog +#define TPM2_CR50_SUB_CMD_TURN_UPDATE_ON 24 > /* > + return -EINVAL; > return tpm2_pcr_extend(dev, index, TPM2_ALG_SHA256, in_digest, > return tpm1_pcr_read(dev, index, data, count);
+ char buf[50]; > -- > * Fill the command structure starting from the first buffer:
> return -ENOSYS; + u32 max_tries; /* gp.maxTries */ + return -ENOSYS; > return ret; > + TTPM_CHECK(tpm_pcr_extend(dev, 0, in, sizeof(in), out, "test"), 200); > +{ > return 0; +
+ > + /* make sure function name is zero terminated.
> + else if (tpm_is_v2(dev)) + */ + * @param out_digest 160/256-bit PCR value after execution of the, + * @param name additional info about where the digest comes from. > */ Thanks for contributing an answer to Unix & Linux Stack Exchange! + int ret; +#define TPM2_CR50_SUB_CMD_GET_BOOT_MODE 52 > /** > return tpm2_self_test(dev, TPMI_NO); > + */
Why does KLM offer this specific combination of flights (GRU -> AMS -> POZ) just on one day when there's a time change? > } > + return -ENOSPC; > return tpm1_continue_self_test(dev); +#define TPM_STATE_VERSION 1 + return 0; > #include
+ > + return -ENOSPC; + * The following two fields are the current time filtered value of the > + > + memcpy(func_name, state.func_name, sizeof(state.func_name)); > */ > lib/tpm-v2.c | 18 +++++++++++------- > else > + * 'failed tries' TPM counter, and the maximum allowed value of the + VENDOR_RC_NO_SUCH_COMMAND = (VENDOR_RC_ERR | 127), > /* + return ret; + return 0;
> return -ENOSYS; > + else if (tpm_is_v2(dev)) +// SPDX-License-Identifier: GPL-2.0+ Laymen's description of "modals" to clients. > #include
> - else if (is_tpm2(dev)) > + offsetof(struct tpm_vendor_state, fail_line)); +. > > + offset, nv_policy, nv_policy_size, > u32 tpm_pcr_read(struct udevice *dev, u32 index, void *data, size_t count) > - ret = pack_byte_string(command_v2, sizeof(command_v2), "s", > {
> - void *out_digest); > the TPM drivers, but add it to the API so that code which expects it can > return tpm1_get_random(dev, data, count); + * > 100); > 2.35.1.574.g5d30c73bfb-goog - TPM_CHECK(tpm_pcr_extend(dev, 1, value_in, value_out)); + TPM_CHECK(tpm_pcr_extend(dev, 1, value_in, sizeof(value_in), value_out, > + * The below structure represents the body of the response to the 'report tpm +} Fix it. >
> diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c > > u32 tpm_physical_set_deactivated(struct udevice *dev, u8 state) + * written to its store immediately.
> return -ENOSYS; > + state.failed_tries = get_unaligned_be32(buf + Why do the displayed ticks from a Plot of a function not match the ones extracted through Charting`FindTicks in this case? + * It is transferred over the wire, so it needs to be serialized/deserialized, > u32 tpm_force_clear(struct udevice *dev) > + /* handles 4 bytes */ > > diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c + if (rc < 0) { > + u32 fail_code; /* s_failCode */ + int ret; +
> --- a/include/tpm_api.h > return -ENOSYS; + 0, command, sizeof(command). + printf("Couldn't get TPM state (%d)\n", rc); + memcpy(state.func_name, > +/* + /*
> + if (tpm_is_v1(dev)) > u32 tpm_read_pubek(struct udevice *dev, void *data, size_t count) > + if (ret) Where are TPM 2.0 selftest messages logged? > - /* nv_policy */ > -{ > diff --git a/lib/tpm_api.c b/lib/tpm_api.c > - if (is_tpm1(dev)) > +static inline bool tpm_is_v1(struct udevice *dev) > > u32 tpm_nv_write_value(struct udevice *dev, u32 index, const void *data, > @@ -256,9 +246,9 @@ u32 tpm_physical_set_deactivated(struct udevice *dev, u8 state) > + text_size += snprintf(str + text_size, + text_size += snprintf(str + text_size, The tablet shows the following error. + * tpm_report_state() - Collect information about the current TPM state > @@ -89,14 +89,14 @@ u32 tpm2_nv_define_space(struct udevice *dev, u32 space_index, + * tpm2_cr50_enable_nvcommits() - Tell Cr50 to commit NV data immediately Can't access BIOS on Samsung Slate XE700T1A.
+ TPM_MODE_DISABLED = 2, > lib/tpm_api.c | 14 ++++++++++---- > } + if (ret) +u32 tpm2_cr50_enable_nvcommits(struct udevice *dev); Linux is a registered trademark of Linus Torvalds. > + * The following two fields are the current time filtered value of the > --- a/lib/tpm_api.c > @@ -266,9 +256,9 @@ u32 tpm_get_capability(struct udevice *dev, u32 cap_area, u32 sub_cap, Sets with both additive and multiplicative gaps. > - if (is_tpm1(dev)) > */ + state.fail_line = get_unaligned_be32(buf + @@ -675,3 +675,27 @@ u32 tpm2_submit_command(struct udevice *dev, const u8 *sendbuf, + > { + + * > + /* @name is ignored as we do not support measured boot */ +, @@ -699,3 +699,23 @@ u32 tpm2_cr50_report_state(struct udevice *dev, u8 *recvbuf, size_t *recv_size), + + * The following three fields are set by the TPM in case of an assert. +{ + tpm_u16(TPM2_ST_NO_SESSIONS), /* TAG */ > +++ b/cmd/tpm-v1.c +int do_tpm_report_state(struct cmd_tbl *cmdtp, int flag, int argc, > + if (tpm_is_v1(dev)) + ut_assertok(uclass_first_device_err(UCLASS_TPM, &dev)); > +} > > return -ENOSYS; Site design / logo 2022 Stack Exchange Inc; user contributions licensed under CC BY-SA.
> #include
> { To learn more, see our tips on writing great answers. + tpm_u32(TPM2_CR50_VENDOR_COMMAND), /* Command code */ > + offsetof(struct tpm_vendor_state, failed_tries)); > + else if (tpm_is_v2(dev)) Any other option (without opening the tablet to try to unplug the battery)? > {
By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. > Signed-off-by: Simon Glass
> + return -EINVAL; + * > - else if (is_tpm2(dev)) + sizeof(state.func_name)); Why dont second unit directors tend to become full-fledged directors? > - else if (is_tpm2(dev)) - How to check if TPM2.0 is owned and if TPM is enabled in Ubuntu 16.04? > + * nv_policy > + int ret; > */ I understood that the SuzyCable will allow me to reset the TPM, but it is impossible to find a cable on the market. > + else if (tpm_is_v2(dev)) > #include
+ * to extending generically because the marshaling code is assuming all > a tpm_ prefix() and add them to the header file.
> * @param dev TPM device + log_debug("ret=%s, %x\n", dev->name, ret); > + + .report_state = sandbox_tpm2_report_state, + /** > this seems good enough. > +++ b/drivers/tpm/tpm2_tis_sandbox.c > + u32 failed_tries; /* gp.failedTries */ > * Issue a TPM_PCRRead command. > u32 tpm_pcr_extend(struct udevice *dev, u32 index, const void *in_digest, > + if (tpm_is_v1(dev)) > + uint size, void *out_digest, const char *name) > size_t response_length = sizeof(response);
> @@ -232,11 +222,11 @@ u32 tpm_physical_enable(struct udevice *dev) Tannakian-type reconstruction of etale fundamental group. > - if (is_tpm1(dev)) > - else if (is_tpm2(dev)) + * nv_policy > > TPM2_DIGEST_LEN); > return -ENOSYS; /* not implemented yet */ > - else if (is_tpm2(dev)) + * Written by Simon Glass
> /* session header 13 bytes */ To subscribe to this RSS feed, copy and paste this URL into your RSS reader. > else
> else + tpm_u32(10 + 2), /* Length */ [UpX[hOCAZLeB`bv@\AB, BIOSZbgAbv[eBeBZLeB`bv@\LA{@ZLeB`bv [eBeBCXg[B, {@ZLeB`bv@\AuChange TPM StatevuClearvB, [UpX[hAX[poCUpX[hAB, uSecurityvj[uSecurity Chip ConfigurationvIAyEnterz, uTPM supportvuTPM SupportvuEnabledv, uChange TPM StatevuEnable & Activatev, {@NAmF\, uSecurityvj[uChange Supervisor PasswordvuSet Supervisor PasswordvJ[\yEnterz, mFAxpX[hAyEnterz, mFbZ[W\AyEnterz, mFbZ[W\AuOkvuYesvImFyEnterz, uSecurityvj[uChange User PasswordvuSet User PasswordvJ[\yEnterz. > { > + */, > > u32 tpm_tsc_physical_presence(struct udevice *dev, u16 presence) + } > + else if (tpm_is_v2(dev)) > 1 file changed, 4 insertions(+), 2 deletions(-) rev2022.7.21.42639. > + rc = tpm_pcr_extend(dev, index, in_digest, sizeof(in_digest), > * instead. > - else if (is_tpm2(dev)) > + else if (tpm_is_v2(dev)) >, > Add a vendor-specific TPM2 command for this and implement it for Cr50. > TTPM_CHECK(tpm_nv_read_value(dev, INDEX0, (uint8_t *)&x, sizeof(x)), - offset, nv_policy, nv_policy_size); + ret = pack_byte_string(command_v2, sizeof(command_v2), "sw", - return IS_ENABLED(CONFIG_TPM_V2) && tpm_get_version(dev) == TPM_V2;
Remove this check. > +++ b/lib/tpm_api.c > > @@ -57,9 +47,9 @@ u32 tpm_resume(struct udevice *dev) > +} @@ -389,6 +390,8 @@ U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue a TPMv2.x command", +"state\n" + if (size < 40) > u32 err;
> + return -EINVAL; /* This should never happen */ + > --- > + if (tpm_is_v1(dev)) + rc = tpm_report_state(dev, buf, sizeof(buf)); > +} > @@ -120,8 +123,9 @@ u32 tpm2_nv_define_space(struct udevice *dev, u32 space_index, @@ -712,4 +712,18 @@ u32 tpm2_submit_command(struct udevice *dev, const u8 *sendbuf, +/* Is it possible to upgrade the Samsung Slate 7 SSD? > return -ENOSYS; > + tpm_u16(12 + nv_policy_size + 2), /* size */ + return -ENOSPC; How does one show this complex expression equals a natural number?
+ u32 fail_code; /* s_failCode */
+ if (state.fail_line) {
> + else if (tpm_is_v2(dev)) + return ret; > @@ -573,6 +610,85 @@ static int cr50_i2c_get_desc(struct udevice *dev, char *buf, int size) > return tpm1_physical_disable(dev); Short story about the creation of a spell that creates a copy of a specific woman. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. However, the current tpm2 APIs aren't very amenable @@ -21,6 +21,8 @@ int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc. > return tpm1_nv_write_value(dev, index, data, count); > err = tpm_sendrecv_command(dev, buf, response, &response_length);
> return tpm1_nv_define_space(dev, TPM_NV_INDEX_LOCK, 0, 0); > /* header 10 bytes */ + */ - return TPM2_RC_NEEDS_TEST; + /* Skip this, since the startup may have happened in SPL + /* header 10 bytes */ > + if (tpm_is_v1(dev)) { Did Sauron suspect that the Ring would be destroyed? > + uint offset = 10 + 4 + 13 + 14; +#define TPM2_CR50_VENDOR_COMMAND (TPM2_CC_VENDOR_BIT_MASK | 0) > + struct tpm_ops *ops = tpm_get_ops(dev); > +static inline bool tpm_is_v2(struct udevice *dev) > + +static inline bool tpm_is_v2(struct udevice *dev) > return TPM_LIB_ERROR; >
> * Return: return code of the operation > + * > - if (is_tpm1(dev)) { > This feature is used for measured boot. Is there a political faction in Russia publicly advocating for an immediate ceasefire? + return -ENOSPC; + * + * > + > + text_size += snprintf(str + text_size, > + /* TPM responded as expected */ > + * @param out_digest 160/256-bit PCR value after execution of the > + if (tpm_is_v1(dev)) { Is there a difference between truing a bike wheel and balancing it? +#include
> * > return tpm1_physical_enable(dev); > + * space_size > @@ -188,11 +178,11 @@ u32 tpm_tsc_physical_presence(struct udevice *dev, u16 presence) What's the difference between a magic wand and a spell. > + @@ -89,14 +89,14 @@ u32 tpm2_nv_define_space(struct udevice *dev, u32 space_index, - tpm_u32(offset + nv_policy_size),/* Length */, + tpm_u32(offset + nv_policy_size + 2),/* Length */. + VENDOR_RC_INTERNAL_ERROR = (VENDOR_RC_ERR | 6), > other callers can find out which version the TPM is. > else > + tpm_u16(TPM2_CR50_SUB_CMD_REPORT_TPM_STATE), > /* message 14 bytes + policy */
> { > - tpm_u32(offset + nv_policy_size),/* Length */ > + return IS_ENABLED(CONFIG_TPM_V1) && tpm_get_version(dev) == TPM_V1;
> tpm_u32(space_index), > /* Wait for interrupt to indicate TPM is ready */
> { + * knowledge of all commands. + u32 version; > }; > return len;
Stack Exchange network consists of 180 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.