> - 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 +DM_TEST(dm_test_tpm, UT_TESTF_SCAN_FDT); +/* > return tpm2_startup(dev, TPM2_SU_STATE); > --- + + * and it is likely to change, so its contents must be versioned. + + state.version = get_unaligned_be32(buf + > + state.fail_code); > +{ > --- a/include/tpm_api.h + memcpy(func_name, state.func_name, sizeof(state.func_name)); > return tpm1_nv_read_value(dev, index, data, count); > + if (pack_byte_string(buf, sizeof(buf), "sd", > else + return 0; > +++ b/lib/tpm-v2.c + ut_assertok(tpm_init(dev)); > diff --git a/include/tpm_api.h b/include/tpm_api.h > + * @param size size of digest in bytes > include/tpm_api.h | 10 ++++++ > { > { > --- a/lib/tpm-v1.c > u32 tpm_resume(struct udevice *dev); +{ > */ > tpm_u32(TPM2_CC_NV_DEFINE_SPACE),/* Command code */ > + if (size != TPM2_SHA256_DIGEST_SIZE) I understood that the SuzyCable will allow me to reset the TPM, but it is impossible to find a cable on the market.

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 + state.failed_tries, state.max_tries); > - else if (is_tpm2(dev)) Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. > { + * state' vendor command. + return 0;

> - 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 + text_size += snprintf(str + text_size, max_size - text_size, > return tpm1_extend(dev, index, in_digest, out_digest); > -static bool is_tpm1(struct udevice *dev) + } else {, @@ -456,12 +456,13 @@ u32 tpm1_get_permissions(struct udevice *dev, u32 index, u32 *perm). > drivers/tpm/tpm2_tis_sandbox.c | 6 ++++-- > Signed-off-by: Simon Glass > @@ -105,9 +95,9 @@ u32 tpm_clear_and_reenable(struct udevice *dev) > + if (tpm_is_v1(dev)) > lib/tpm_api.c | 92 +++++++++++++++++++++-------------------------- >. + char buf[50]; > + if (text_size >= max_size) > + +u32 tpm2_cr50_report_state(struct udevice *dev, u8 *recvbuf, size_t *recv_size) > index 4ac4612c81..a8d3731d3a 100644 Fix it. > int ret;

+ > + 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)) > break; > +{ > > + > +} + * @dev: TPM device > -- > +}; + * @recv_size: Pointer to the size of the response buffer > return tpm1_read_pubek(dev, data, count); > + u32 max_tries; /* gp.maxTries */ > + struct sandbox_tpm2 *priv = dev_get_priv(dev); > + u32 fail_line; /* s_failLIne */ > + text_size += snprintf(str + text_size, max_size - text_size, > else > return tpm1_get_capability(dev, cap_area, sub_cap, cap, count); + return IS_ENABLED(CONFIG_TPM_V2) && tpm_get_version(dev) == TPM_V2; Why is the US residential model untouchable and unquestionable? > index 1bf627853a..6058f2e1e4 100644 > + return -ENOSPC; What would the ancient Romans have called Hercules' Club? +#define TPM2_CR50_SUB_CMD_TPM_MODE 40 Connect and share knowledge within a single location that is structured and easy to search. */ + * @dev: Device to check +{ +enum cr50_vendor_rc { +}, > These functions should really be available outside the TPM code, so that > else + +}. > return 0; > - if (is_tpm1(dev)) +{ + TPM_MODE_INVALID, +#define TPM2_CR50_SUB_CMD_RESET_EC 53 Do weekend days count as part of a vacation? > return tpm1_self_test_full(dev); > --- a/lib/tpm-v2.c + * @dev TPM device > + offsetof(struct tpm_vendor_state, max_tries)); > - if (is_tpm1(dev)) > +}, > + > u32 tpm_resume(struct udevice *dev) > + if (text_size >= max_size) + offsetof(struct tpm_vendor_state, failed_tries)); > + if (state.fail_line) { > 100); @@ -234,6 +244,16 @@ u32 tpm_clear_and_reenable(struct udevice *dev); +/** > else Thanks for contributing an answer to Super User! > return tpm2_write_lock(dev, index); > return -ENOSYS;

> - 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 > > +++ b/lib/tpm-v2.c > 2.35.1.574.g5d30c73bfb-goog + How should I deal with coworkers not respecting my blocking off time in my calendar for work? > - return IS_ENABLED(CONFIG_TPM_V1) && tpm_get_version(dev) == TPM_V1; +enum cr50_tpm_mode {

> { 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 > - if (is_tpm1(dev)) + buf + offsetof(struct tpm_vendor_state, func_name), > - if (is_tpm1(dev)) > /* Nothing needs to be done with tpm2 */ > + /* The below fields are present in version 2 and above */ > --- > + if (tpm_is_v1(dev)) > + if (tpm_is_v1(dev)) > + else if (tpm_is_v2(dev)) + * {@ZLeB`bv@\pABIOSZbgAbv[eBeBZLeB`bvLKvB, ZLeB`bv@\LABIOSZbgAbv[eBeBB, ZLeB`bv@\LB, {@ZLeB`bv@\gABIOSZbgAbv[eBeBX[poCUpX[hA[UpX[hBBIOSZbgAbv[eBeBpX[hAOZLeB`bv@\AhB, X[poCUpX[h^[UpX[huZLeB`bv@\pviAsB, BIOSZbgAbv[eBeBNX[poCUpX[hKvAgpB + /* TPM responded as expected */

> + 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 */ Why do the displayed ticks from a Plot of a function not match the ones extracted through Charting`FindTicks in this case? @@ -658,4 +702,14 @@ u32 tpm2_disable_platform_hierarchy(struct udevice *dev); +/** > signal its request. > @@ -152,9 +142,9 @@ u32 tpm_write_lock(struct udevice *dev, u32 index) + char buf[80]; + * @size: Maximum size of buffer + TPM_MODE_ENABLED = 1, + return -ENOSPC; + + * counter. > > - else if (is_tpm2(dev)) > { > The offset here is incorrect. + max_size - text_size, > + >

+ * 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 +, @@ -834,6 +844,7 @@ static const struct tpm_ops sandbox_tpm2_ops = {. > include/tpm_api.h | 8 +++++--- > +{ > } + > @@ -210,9 +200,9 @@ u32 tpm_read_pubek(struct udevice *dev, void *data, size_t count)

> /* 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 + if (state.version > TPM_STATE_VERSION) > + */ > * recorded + " not fully supported\n"); > Signed-off-by: Simon Glass > @@ -54,6 +56,41 @@ struct cr50_priv { + size_t text_size = 0; > + return -ENOSPC; > index ef45b43a8f..11aa14eb79 100644 > - else if (is_tpm2(dev)) > - const size_t perm_offset = 60; + VENDOR_RC_NO_SUCH_SUBCOMMAND = (VENDOR_RC_ERR | 8), > #include + u32 fail_line; /* s_failLIne */ > > else If a creature's best food source was 4,000 feet above it, and only rarely fell from that height, how would it evolve to eat that food? > if (ret != TPM_SUCCESS) { > > tpm_u16(TPM2_ST_SESSIONS), /* TAG */ -, @@ -47,9 +37,9 @@ u32 tpm_startup(struct udevice *dev, enum tpm_startup_type mode), @@ -57,9 +47,9 @@ u32 tpm_resume(struct udevice *dev), @@ -67,9 +57,9 @@ u32 tpm_self_test_full(struct udevice *dev), @@ -86,7 +76,7 @@ u32 tpm_clear_and_reenable(struct udevice *dev), @@ -105,9 +95,9 @@ u32 tpm_clear_and_reenable(struct udevice *dev), @@ -115,9 +105,9 @@ u32 tpm_nv_enable_locking(struct udevice *dev), @@ -126,9 +116,9 @@ u32 tpm_nv_read_value(struct udevice *dev, u32 index, void *data, u32 count), @@ -141,9 +131,9 @@ u32 tpm_set_global_lock(struct udevice *dev), @@ -152,9 +142,9 @@ u32 tpm_write_lock(struct udevice *dev, u32 index). > + else if (tpm_is_v2(dev)) > + if (tpm_is_v1(dev)) > Signed-off-by: Simon Glass + if (ret) > { > + tpm_u32(offset + nv_policy_size + 2),/* Length */ + > TTPM_CHECK(tpm_set_global_lock(dev), 50);

> * > 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. sport cars dodge wheels sxt super door vehicle