mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-17 22:49:02 +00:00
TPM1.2 and Atmel fixes
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEgWII69YpahbL5iK5gS8AYozs+qIFAmGXVGcACgkQgS8AYozs +qLoVA/8CDEhyU20XorNzyk/+Dpy4+7s91wnRiNuQxDcwJke5dcgCtJ62cURsWI/ 69gnijt1Pif1ODPWECj9Fh8SYp0S8ZL/7YBS9JjpgHNCPvOuxoaSvO4Q0CejDBWO 7Yj2UZwR2AvUO57bD3pOVQJns5PiCyF94zt/5LO9NCCnAoXxc2dH2M2Eelxac5wA zx4PksKeX72k1HkSywQgM4uWOweWs8OzgSE5mBiGQTP/9aYCeRtPv3i7JlClqw4R uNqSGJrDEKfJnV3kmZpKAACl91vS+4g7rfQbOyB7DOL1hNpJ7/7d2++/j8P8jB17 zCXW+mK60+4/0pJ2Bk/6XddbTYvMskija+lQib1FHshAPbDrbXNbS8WrDInMFC3L RfCugrxG9fgtu3yWqy1+GyDEN3s5yATYBSo27xfOvW5919McMTEy1YGjA7R1K5l/ WLFO9oBSLYolZPZgEqi0Z7sNr2BSVmodk0KCJkcXR8J5YIc8r4dtfSRhw0lcdcD8 c/Wi5+i0PX4ZmuDrbjffjvUJ1Mz2n9igI3ADK2Xn/Lf7KVHW7oiPcQYeijqhTAVa zu9DXIw+E8o4Nq3/u4VDecTRZcGUVWR83DJYGn4U0NDMC9PCLj3TBG9KogKt/Ceo au1F50co7qxqehmtnm8Bej/He87fIJmZmbaqT388ZXNwMEVPTNo= =m8lp -----END PGP SIGNATURE----- Merge tag 'tpm-19112021' of https://source.denx.de/u-boot/custodians/u-boot-tpm TPM1.2 and Atmel fixes # gpg verification failed.
This commit is contained in:
commit
b5f2c68d5c
3 changed files with 20 additions and 23 deletions
17
cmd/tpm-v1.c
17
cmd/tpm-v1.c
|
@ -406,9 +406,9 @@ static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
void *key;
|
||||
struct udevice *dev;
|
||||
|
||||
rc = get_tpm(&dev);
|
||||
if (rc)
|
||||
return rc;
|
||||
err = get_tpm(&dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (argc < 5)
|
||||
return CMD_RET_USAGE;
|
||||
|
@ -420,7 +420,7 @@ static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
return CMD_RET_FAILURE;
|
||||
parse_byte_string(argv[4], usage_auth, NULL);
|
||||
|
||||
err = tpm_find_key_sha1(usage_auth, parent_hash, &parent_handle);
|
||||
err = tpm1_find_key_sha1(dev, usage_auth, parent_hash, &parent_handle);
|
||||
if (err) {
|
||||
printf("Could not find matching parent key (err = %d)\n", err);
|
||||
return CMD_RET_FAILURE;
|
||||
|
@ -428,7 +428,7 @@ static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
|
||||
printf("Found parent key %08x\n", parent_handle);
|
||||
|
||||
err = tpm_load_key2_oiap(parent_handle, key, key_len, usage_auth,
|
||||
err = tpm1_load_key2_oiap(dev, parent_handle, key, key_len, usage_auth,
|
||||
&key_handle);
|
||||
if (!err) {
|
||||
printf("Key handle is 0x%x\n", key_handle);
|
||||
|
@ -582,6 +582,7 @@ static int do_tpm_flush(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct udevice *dev;
|
||||
int type = 0;
|
||||
u16 res_count;
|
||||
u8 buf[288];
|
||||
|
@ -589,6 +590,10 @@ static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
int err;
|
||||
uint i;
|
||||
|
||||
err = get_tpm(&dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (argc != 2)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
|
@ -619,7 +624,7 @@ static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
}
|
||||
|
||||
/* fetch list of already loaded resources in the TPM */
|
||||
err = tpm_get_capability(TPM_CAP_HANDLE, type, buf,
|
||||
err = tpm_get_capability(dev, TPM_CAP_HANDLE, type, buf,
|
||||
sizeof(buf));
|
||||
if (err) {
|
||||
printf("tpm_get_capability returned error %d.\n", err);
|
||||
|
|
|
@ -52,7 +52,10 @@ static int tpm_atmel_twi_close(struct udevice *dev)
|
|||
*/
|
||||
static int tpm_atmel_twi_get_desc(struct udevice *dev, char *buf, int size)
|
||||
{
|
||||
return 0;
|
||||
if (size < 50)
|
||||
return -ENOSPC;
|
||||
|
||||
return snprintf(buf, size, "Atmel AT97SC3204T I2C 1.2 TPM (%s)", dev->name);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -81,22 +84,15 @@ static int tpm_atmel_twi_xfer(struct udevice *dev,
|
|||
print_buffer(0, (void *)sendbuf, 1, send_size, 0);
|
||||
#endif
|
||||
|
||||
#if !CONFIG_IS_ENABLED(DM_I2C)
|
||||
res = i2c_write(0x29, 0, 0, (uchar *)sendbuf, send_size);
|
||||
#else
|
||||
res = dm_i2c_write(dev, 0, sendbuf, send_size);
|
||||
#endif
|
||||
if (res) {
|
||||
printf("i2c_write returned %d\n", res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
start = get_timer(0);
|
||||
#if !CONFIG_IS_ENABLED(DM_I2C)
|
||||
while ((res = i2c_read(0x29, 0, 0, recvbuf, 10)))
|
||||
#else
|
||||
|
||||
while ((res = dm_i2c_read(dev, 0, recvbuf, 10)))
|
||||
#endif
|
||||
{
|
||||
/* TODO Use TIS_TIMEOUT from tpm_tis_infineon.h */
|
||||
if (get_timer(start) > ATMEL_TPM_TIMEOUT_MS) {
|
||||
|
@ -116,16 +112,11 @@ static int tpm_atmel_twi_xfer(struct udevice *dev,
|
|||
return -1;
|
||||
} else {
|
||||
*recv_len = hdr_recv_len;
|
||||
#if !CONFIG_IS_ENABLED(DM_I2C)
|
||||
res = i2c_read(0x29, 0, 0, recvbuf, *recv_len);
|
||||
#else
|
||||
res = dm_i2c_read(dev, 0, recvbuf, *recv_len);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
if (res) {
|
||||
printf("i2c_read returned %d (rlen=%d)\n", res, *recv_len);
|
||||
printf("i2c_read returned %d (rlen=%zu)\n", res, *recv_len);
|
||||
#ifdef DEBUG
|
||||
print_buffer(0, recvbuf, 1, *recv_len, 0);
|
||||
#endif
|
||||
|
@ -143,6 +134,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev,
|
|||
|
||||
static int tpm_atmel_twi_probe(struct udevice *dev)
|
||||
{
|
||||
i2c_set_chip_offset_len(dev, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -840,7 +840,7 @@ u32 tpm1_find_key_sha1(struct udevice *dev, const u8 auth[20],
|
|||
unsigned int i;
|
||||
|
||||
/* fetch list of already loaded keys in the TPM */
|
||||
err = tpm_get_capability(dev, TPM_CAP_HANDLE, TPM_RT_KEY, buf,
|
||||
err = tpm1_get_capability(dev, TPM_CAP_HANDLE, TPM_RT_KEY, buf,
|
||||
sizeof(buf));
|
||||
if (err)
|
||||
return -1;
|
||||
|
@ -852,7 +852,7 @@ u32 tpm1_find_key_sha1(struct udevice *dev, const u8 auth[20],
|
|||
/* now search a(/ the) key which we can access with the given auth */
|
||||
for (i = 0; i < key_count; ++i) {
|
||||
buf_len = sizeof(buf);
|
||||
err = tpm_get_pub_key_oiap(key_handles[i], auth, buf, &buf_len);
|
||||
err = tpm1_get_pub_key_oiap(dev, key_handles[i], auth, buf, &buf_len);
|
||||
if (err && err != TPM_AUTHFAIL)
|
||||
return -1;
|
||||
if (err)
|
||||
|
|
Loading…
Add table
Reference in a new issue