* [PATCH] tpm: Remove redundant function grub_tpm_measure
@ 2020-05-13 8:53 Tianjia Zhang
2020-05-13 12:45 ` Daniel Kiper
0 siblings, 1 reply; 3+ messages in thread
From: Tianjia Zhang @ 2020-05-13 8:53 UTC (permalink / raw)
To: grub-devel; +Cc: tianjia.zhang
The grub_tpm_measure() is only used by tpm.c, and this function
is the simple wrapper of grub_tpm_event_log(). So remove it and
keep the code cleaner.
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
grub-core/commands/tpm.c | 12 ++----------
include/grub/tpm.h | 2 --
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/grub-core/commands/tpm.c b/grub-core/commands/tpm.c
index 1441c494d..cbe4116ec 100644
--- a/grub-core/commands/tpm.c
+++ b/grub-core/commands/tpm.c
@@ -29,13 +29,6 @@
GRUB_MOD_LICENSE ("GPLv3+");
-grub_err_t
-grub_tpm_measure (unsigned char *buf, grub_size_t size, grub_uint8_t pcr,
- const char *description)
-{
- return grub_tpm_log_event (buf, size, pcr, description);
-}
-
static grub_err_t
grub_tpm_verify_init (grub_file_t io,
enum grub_file_type type __attribute__ ((unused)),
@@ -49,7 +42,7 @@ grub_tpm_verify_init (grub_file_t io,
static grub_err_t
grub_tpm_verify_write (void *context, void *buf, grub_size_t size)
{
- return grub_tpm_measure (buf, size, GRUB_BINARY_PCR, context);
+ return grub_tpm_log_event (buf, size, GRUB_BINARY_PCR, context);
}
static grub_err_t
@@ -77,8 +70,7 @@ grub_tpm_verify_string (char *str, enum grub_verify_string_type type)
grub_memcpy (description, prefix, grub_strlen (prefix));
grub_memcpy (description + grub_strlen (prefix), str,
grub_strlen (str) + 1);
- status =
- grub_tpm_measure ((unsigned char *) str, grub_strlen (str),
+ status = grub_tpm_log_event ((unsigned char *) str, grub_strlen (str),
GRUB_STRING_PCR, description);
grub_free (description);
return status;
diff --git a/include/grub/tpm.h b/include/grub/tpm.h
index dfcbe8372..8a686214a 100644
--- a/include/grub/tpm.h
+++ b/include/grub/tpm.h
@@ -72,8 +72,6 @@ typedef struct
grub_uint8_t outDigest[SHA1_DIGEST_SIZE];
} GRUB_PACKED ExtendOutgoing;
-grub_err_t grub_tpm_measure (unsigned char *buf, grub_size_t size,
- grub_uint8_t pcr, const char *description);
grub_err_t grub_tpm_init (void);
grub_err_t grub_tpm_execute (PassThroughToTPM_InputParamBlock *inbuf,
PassThroughToTPM_OutputParamBlock *outbuf);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tpm: Remove redundant function grub_tpm_measure
2020-05-13 8:53 [PATCH] tpm: Remove redundant function grub_tpm_measure Tianjia Zhang
@ 2020-05-13 12:45 ` Daniel Kiper
2020-05-13 13:08 ` Tianjia Zhang
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Kiper @ 2020-05-13 12:45 UTC (permalink / raw)
To: Tianjia Zhang; +Cc: grub-devel
On Wed, May 13, 2020 at 04:53:53PM +0800, Tianjia Zhang wrote:
> The grub_tpm_measure() is only used by tpm.c, and this function
> is the simple wrapper of grub_tpm_event_log(). So remove it and
> keep the code cleaner.
>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
I would prefer if you drop existing grub_tpm_measure() and rename
grub_tpm_log_event() to grub_tpm_measure().
Daniel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tpm: Remove redundant function grub_tpm_measure
2020-05-13 12:45 ` Daniel Kiper
@ 2020-05-13 13:08 ` Tianjia Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Tianjia Zhang @ 2020-05-13 13:08 UTC (permalink / raw)
To: Daniel Kiper; +Cc: grub-devel
On 2020/5/13 20:45, Daniel Kiper wrote:
> On Wed, May 13, 2020 at 04:53:53PM +0800, Tianjia Zhang wrote:
>> The grub_tpm_measure() is only used by tpm.c, and this function
>> is the simple wrapper of grub_tpm_event_log(). So remove it and
>> keep the code cleaner.
>>
>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
>
> I would prefer if you drop existing grub_tpm_measure() and rename
> grub_tpm_log_event() to grub_tpm_measure().
>
> Daniel
>
Yes, this is a good idea, I will make another v2 patch.
Thanks and best,
Tianjia
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-13 13:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 8:53 [PATCH] tpm: Remove redundant function grub_tpm_measure Tianjia Zhang
2020-05-13 12:45 ` Daniel Kiper
2020-05-13 13:08 ` Tianjia Zhang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.