* [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
@ 2017-02-15 18:02 ` Jarkko Sakkinen
0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-15 18:02 UTC (permalink / raw)
To: tpmdd-devel
Cc: linux-security-module, Jarkko Sakkinen, Peter Huewe,
Marcel Selhorst, Jason Gunthorpe, open list
There's no need to export tpm2_get_pcr_alloation() because it is only
a helper function for tpm2_auto_startup(). For the same reason it does
not make much sense to maintain documentation for it.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
drivers/char/tpm/tpm.h | 1 -
drivers/char/tpm/tpm2-cmd.c | 94 ++++++++++++++++++++++-----------------------
2 files changed, 45 insertions(+), 50 deletions(-)
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 6b4e7aa..4937b56 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -554,5 +554,4 @@ int tpm2_auto_startup(struct tpm_chip *chip);
void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
int tpm2_probe(struct tpm_chip *chip);
-ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip);
#endif
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 10f97e6..881aea9 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -997,61 +997,13 @@ int tpm2_probe(struct tpm_chip *chip)
}
EXPORT_SYMBOL_GPL(tpm2_probe);
-/**
- * tpm2_auto_startup - Perform the standard automatic TPM initialization
- * sequence
- * @chip: TPM chip to use
- *
- * Returns 0 on success, < 0 in case of fatal error.
- */
-int tpm2_auto_startup(struct tpm_chip *chip)
-{
- int rc;
-
- rc = tpm_get_timeouts(chip);
- if (rc)
- goto out;
-
- rc = tpm2_do_selftest(chip);
- if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
- }
-
- if (rc == TPM2_RC_INITIALIZE) {
- rc = tpm2_startup(chip, TPM2_SU_CLEAR);
- if (rc)
- goto out;
-
- rc = tpm2_do_selftest(chip);
- if (rc) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
- }
- }
-
- rc = tpm2_get_pcr_allocation(chip);
-
-out:
- if (rc > 0)
- rc = -ENODEV;
- return rc;
-}
-
struct tpm2_pcr_selection {
__be16 hash_alg;
u8 size_of_select;
u8 pcr_select[3];
} __packed;
-/**
- * tpm2_get_pcr_allocation() - get TPM active PCR banks.
- *
- * @chip: TPM chip to use.
- *
- * Return: Same as with tpm_transmit_cmd.
- */
-ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
+static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
{
struct tpm2_pcr_selection pcr_selection;
struct tpm_buf buf;
@@ -1114,3 +1066,47 @@ ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
return rc;
}
+
+/**
+ * tpm2_auto_startup - Perform the standard automatic TPM initialization
+ * sequence
+ * @chip: TPM chip to use
+ *
+ * Initializes timeout values for operation and command durations, conducts
+ * a self-test and reads the list of active PCR banks.
+ *
+ * Return: 0 on success. Otherwise, a system error code is returned.
+ */
+int tpm2_auto_startup(struct tpm_chip *chip)
+{
+ int rc;
+
+ rc = tpm_get_timeouts(chip);
+ if (rc)
+ goto out;
+
+ rc = tpm2_do_selftest(chip);
+ if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
+ dev_err(&chip->dev, "TPM self test failed\n");
+ goto out;
+ }
+
+ if (rc == TPM2_RC_INITIALIZE) {
+ rc = tpm2_startup(chip, TPM2_SU_CLEAR);
+ if (rc)
+ goto out;
+
+ rc = tpm2_do_selftest(chip);
+ if (rc) {
+ dev_err(&chip->dev, "TPM self test failed\n");
+ goto out;
+ }
+ }
+
+ rc = tpm2_get_pcr_allocation(chip);
+
+out:
+ if (rc > 0)
+ rc = -ENODEV;
+ return rc;
+}
--
2.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
@ 2017-02-15 18:02 ` Jarkko Sakkinen
0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-15 18:02 UTC (permalink / raw)
To: tpmdd-devel
Cc: linux-security-module, Jarkko Sakkinen, Peter Huewe,
Marcel Selhorst, Jason Gunthorpe, open list
There's no need to export tpm2_get_pcr_alloation() because it is only
a helper function for tpm2_auto_startup(). For the same reason it does
not make much sense to maintain documentation for it.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
---
drivers/char/tpm/tpm.h | 1 -
drivers/char/tpm/tpm2-cmd.c | 94 ++++++++++++++++++++++-----------------------
2 files changed, 45 insertions(+), 50 deletions(-)
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 6b4e7aa..4937b56 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -554,5 +554,4 @@ int tpm2_auto_startup(struct tpm_chip *chip);
void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
int tpm2_probe(struct tpm_chip *chip);
-ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip);
#endif
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 10f97e6..881aea9 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -997,61 +997,13 @@ int tpm2_probe(struct tpm_chip *chip)
}
EXPORT_SYMBOL_GPL(tpm2_probe);
-/**
- * tpm2_auto_startup - Perform the standard automatic TPM initialization
- * sequence
- * @chip: TPM chip to use
- *
- * Returns 0 on success, < 0 in case of fatal error.
- */
-int tpm2_auto_startup(struct tpm_chip *chip)
-{
- int rc;
-
- rc = tpm_get_timeouts(chip);
- if (rc)
- goto out;
-
- rc = tpm2_do_selftest(chip);
- if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
- }
-
- if (rc == TPM2_RC_INITIALIZE) {
- rc = tpm2_startup(chip, TPM2_SU_CLEAR);
- if (rc)
- goto out;
-
- rc = tpm2_do_selftest(chip);
- if (rc) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
- }
- }
-
- rc = tpm2_get_pcr_allocation(chip);
-
-out:
- if (rc > 0)
- rc = -ENODEV;
- return rc;
-}
-
struct tpm2_pcr_selection {
__be16 hash_alg;
u8 size_of_select;
u8 pcr_select[3];
} __packed;
-/**
- * tpm2_get_pcr_allocation() - get TPM active PCR banks.
- *
- * @chip: TPM chip to use.
- *
- * Return: Same as with tpm_transmit_cmd.
- */
-ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
+static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
{
struct tpm2_pcr_selection pcr_selection;
struct tpm_buf buf;
@@ -1114,3 +1066,47 @@ ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
return rc;
}
+
+/**
+ * tpm2_auto_startup - Perform the standard automatic TPM initialization
+ * sequence
+ * @chip: TPM chip to use
+ *
+ * Initializes timeout values for operation and command durations, conducts
+ * a self-test and reads the list of active PCR banks.
+ *
+ * Return: 0 on success. Otherwise, a system error code is returned.
+ */
+int tpm2_auto_startup(struct tpm_chip *chip)
+{
+ int rc;
+
+ rc = tpm_get_timeouts(chip);
+ if (rc)
+ goto out;
+
+ rc = tpm2_do_selftest(chip);
+ if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
+ dev_err(&chip->dev, "TPM self test failed\n");
+ goto out;
+ }
+
+ if (rc == TPM2_RC_INITIALIZE) {
+ rc = tpm2_startup(chip, TPM2_SU_CLEAR);
+ if (rc)
+ goto out;
+
+ rc = tpm2_do_selftest(chip);
+ if (rc) {
+ dev_err(&chip->dev, "TPM self test failed\n");
+ goto out;
+ }
+ }
+
+ rc = tpm2_get_pcr_allocation(chip);
+
+out:
+ if (rc > 0)
+ rc = -ENODEV;
+ return rc;
+}
--
2.9.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
2017-02-15 18:02 ` Jarkko Sakkinen
(?)
@ 2017-02-15 18:56 ` Jason Gunthorpe
2017-02-15 19:06 ` Jarkko Sakkinen
-1 siblings, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2017-02-15 18:56 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: tpmdd-devel, linux-security-module, Peter Huewe, Marcel Selhorst,
open list
On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
> There's no need to export tpm2_get_pcr_alloation() because it is only
> a helper function for tpm2_auto_startup(). For the same reason it does
> not make much sense to maintain documentation for it.
Please stop moving these functions around, you are just breaking the
git history and git blame - there cosmetic reason of having a certain
order is not worth this damage.
Jason
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
2017-02-15 18:56 ` Jason Gunthorpe
@ 2017-02-15 19:06 ` Jarkko Sakkinen
0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-15 19:06 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: tpmdd-devel, linux-security-module, Peter Huewe, Marcel Selhorst,
open list
On Wed, Feb 15, 2017 at 11:56:43AM -0700, Jason Gunthorpe wrote:
> On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
> > There's no need to export tpm2_get_pcr_alloation() because it is only
> > a helper function for tpm2_auto_startup(). For the same reason it does
> > not make much sense to maintain documentation for it.
>
> Please stop moving these functions around, you are just breaking the
> git history and git blame - there cosmetic reason of having a certain
> order is not worth this damage.
>
> Jason
So you rather want a predeclaration?
Moving code for the right reasons is perfectly justifiable.
/Jarkko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
2017-02-15 18:02 ` Jarkko Sakkinen
(?)
(?)
@ 2017-02-17 10:24 ` Jarkko Sakkinen
2017-02-20 11:20 ` [tpmdd-devel] " Jarkko Sakkinen
2017-02-21 5:50 ` Nayna
-1 siblings, 2 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-17 10:24 UTC (permalink / raw)
To: tpmdd-devel, Nayna Jain
Cc: linux-security-module, Peter Huewe, Marcel Selhorst,
Jason Gunthorpe, open list
On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
> There's no need to export tpm2_get_pcr_alloation() because it is only
> a helper function for tpm2_auto_startup(). For the same reason it does
> not make much sense to maintain documentation for it.
>
> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Nayna, does this look good to you?
/Jarkko
> ---
> drivers/char/tpm/tpm.h | 1 -
> drivers/char/tpm/tpm2-cmd.c | 94 ++++++++++++++++++++++-----------------------
> 2 files changed, 45 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
> index 6b4e7aa..4937b56 100644
> --- a/drivers/char/tpm/tpm.h
> +++ b/drivers/char/tpm/tpm.h
> @@ -554,5 +554,4 @@ int tpm2_auto_startup(struct tpm_chip *chip);
> void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
> unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
> int tpm2_probe(struct tpm_chip *chip);
> -ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip);
> #endif
> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
> index 10f97e6..881aea9 100644
> --- a/drivers/char/tpm/tpm2-cmd.c
> +++ b/drivers/char/tpm/tpm2-cmd.c
> @@ -997,61 +997,13 @@ int tpm2_probe(struct tpm_chip *chip)
> }
> EXPORT_SYMBOL_GPL(tpm2_probe);
>
> -/**
> - * tpm2_auto_startup - Perform the standard automatic TPM initialization
> - * sequence
> - * @chip: TPM chip to use
> - *
> - * Returns 0 on success, < 0 in case of fatal error.
> - */
> -int tpm2_auto_startup(struct tpm_chip *chip)
> -{
> - int rc;
> -
> - rc = tpm_get_timeouts(chip);
> - if (rc)
> - goto out;
> -
> - rc = tpm2_do_selftest(chip);
> - if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
> - dev_err(&chip->dev, "TPM self test failed\n");
> - goto out;
> - }
> -
> - if (rc == TPM2_RC_INITIALIZE) {
> - rc = tpm2_startup(chip, TPM2_SU_CLEAR);
> - if (rc)
> - goto out;
> -
> - rc = tpm2_do_selftest(chip);
> - if (rc) {
> - dev_err(&chip->dev, "TPM self test failed\n");
> - goto out;
> - }
> - }
> -
> - rc = tpm2_get_pcr_allocation(chip);
> -
> -out:
> - if (rc > 0)
> - rc = -ENODEV;
> - return rc;
> -}
> -
> struct tpm2_pcr_selection {
> __be16 hash_alg;
> u8 size_of_select;
> u8 pcr_select[3];
> } __packed;
>
> -/**
> - * tpm2_get_pcr_allocation() - get TPM active PCR banks.
> - *
> - * @chip: TPM chip to use.
> - *
> - * Return: Same as with tpm_transmit_cmd.
> - */
> -ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
> +static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
> {
> struct tpm2_pcr_selection pcr_selection;
> struct tpm_buf buf;
> @@ -1114,3 +1066,47 @@ ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>
> return rc;
> }
> +
> +/**
> + * tpm2_auto_startup - Perform the standard automatic TPM initialization
> + * sequence
> + * @chip: TPM chip to use
> + *
> + * Initializes timeout values for operation and command durations, conducts
> + * a self-test and reads the list of active PCR banks.
> + *
> + * Return: 0 on success. Otherwise, a system error code is returned.
> + */
> +int tpm2_auto_startup(struct tpm_chip *chip)
> +{
> + int rc;
> +
> + rc = tpm_get_timeouts(chip);
> + if (rc)
> + goto out;
> +
> + rc = tpm2_do_selftest(chip);
> + if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
> + dev_err(&chip->dev, "TPM self test failed\n");
> + goto out;
> + }
> +
> + if (rc == TPM2_RC_INITIALIZE) {
> + rc = tpm2_startup(chip, TPM2_SU_CLEAR);
> + if (rc)
> + goto out;
> +
> + rc = tpm2_do_selftest(chip);
> + if (rc) {
> + dev_err(&chip->dev, "TPM self test failed\n");
> + goto out;
> + }
> + }
> +
> + rc = tpm2_get_pcr_allocation(chip);
> +
> +out:
> + if (rc > 0)
> + rc = -ENODEV;
> + return rc;
> +}
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [tpmdd-devel] [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
2017-02-17 10:24 ` Jarkko Sakkinen
@ 2017-02-20 11:20 ` Jarkko Sakkinen
2017-02-21 5:50 ` Nayna
1 sibling, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-20 11:20 UTC (permalink / raw)
To: tpmdd-devel, Nayna Jain; +Cc: linux-security-module, open list
On Fri, Feb 17, 2017 at 12:24:27PM +0200, Jarkko Sakkinen wrote:
> On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
> > There's no need to export tpm2_get_pcr_alloation() because it is only
> > a helper function for tpm2_auto_startup(). For the same reason it does
> > not make much sense to maintain documentation for it.
> >
> > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>
> Nayna, does this look good to you?
I guess I'll just include this to the pull request as it is an obvious
glitch.
/Jarkko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
@ 2017-02-21 5:50 ` Nayna
0 siblings, 0 replies; 10+ messages in thread
From: Nayna @ 2017-02-21 5:50 UTC (permalink / raw)
To: Jarkko Sakkinen, tpmdd-devel
Cc: linux-security-module, Peter Huewe, Marcel Selhorst,
Jason Gunthorpe, open list
On 02/17/2017 03:54 PM, Jarkko Sakkinen wrote:
> On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
>> There's no need to export tpm2_get_pcr_alloation() because it is only
>> a helper function for tpm2_auto_startup(). For the same reason it does
>> not make much sense to maintain documentation for it.
>>
>> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
>
> Nayna, does this look good to you?
Oops !! I don't know how it is missed. Sorry for that..My internet
connection wasn't working since my Friday evening and just started
working yesterday. So, probably somewhere got this missed and saw it today
It is fine and I already see it in PULL request. So, Thanks !!
Thanks & Regards,
- Nayna
>
> /Jarkko
>
>> ---
>> drivers/char/tpm/tpm.h | 1 -
>> drivers/char/tpm/tpm2-cmd.c | 94 ++++++++++++++++++++++-----------------------
>> 2 files changed, 45 insertions(+), 50 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
>> index 6b4e7aa..4937b56 100644
>> --- a/drivers/char/tpm/tpm.h
>> +++ b/drivers/char/tpm/tpm.h
>> @@ -554,5 +554,4 @@ int tpm2_auto_startup(struct tpm_chip *chip);
>> void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
>> unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
>> int tpm2_probe(struct tpm_chip *chip);
>> -ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip);
>> #endif
>> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
>> index 10f97e6..881aea9 100644
>> --- a/drivers/char/tpm/tpm2-cmd.c
>> +++ b/drivers/char/tpm/tpm2-cmd.c
>> @@ -997,61 +997,13 @@ int tpm2_probe(struct tpm_chip *chip)
>> }
>> EXPORT_SYMBOL_GPL(tpm2_probe);
>>
>> -/**
>> - * tpm2_auto_startup - Perform the standard automatic TPM initialization
>> - * sequence
>> - * @chip: TPM chip to use
>> - *
>> - * Returns 0 on success, < 0 in case of fatal error.
>> - */
>> -int tpm2_auto_startup(struct tpm_chip *chip)
>> -{
>> - int rc;
>> -
>> - rc = tpm_get_timeouts(chip);
>> - if (rc)
>> - goto out;
>> -
>> - rc = tpm2_do_selftest(chip);
>> - if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
>> - dev_err(&chip->dev, "TPM self test failed\n");
>> - goto out;
>> - }
>> -
>> - if (rc == TPM2_RC_INITIALIZE) {
>> - rc = tpm2_startup(chip, TPM2_SU_CLEAR);
>> - if (rc)
>> - goto out;
>> -
>> - rc = tpm2_do_selftest(chip);
>> - if (rc) {
>> - dev_err(&chip->dev, "TPM self test failed\n");
>> - goto out;
>> - }
>> - }
>> -
>> - rc = tpm2_get_pcr_allocation(chip);
>> -
>> -out:
>> - if (rc > 0)
>> - rc = -ENODEV;
>> - return rc;
>> -}
>> -
>> struct tpm2_pcr_selection {
>> __be16 hash_alg;
>> u8 size_of_select;
>> u8 pcr_select[3];
>> } __packed;
>>
>> -/**
>> - * tpm2_get_pcr_allocation() - get TPM active PCR banks.
>> - *
>> - * @chip: TPM chip to use.
>> - *
>> - * Return: Same as with tpm_transmit_cmd.
>> - */
>> -ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>> +static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>> {
>> struct tpm2_pcr_selection pcr_selection;
>> struct tpm_buf buf;
>> @@ -1114,3 +1066,47 @@ ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>>
>> return rc;
>> }
>> +
>> +/**
>> + * tpm2_auto_startup - Perform the standard automatic TPM initialization
>> + * sequence
>> + * @chip: TPM chip to use
>> + *
>> + * Initializes timeout values for operation and command durations, conducts
>> + * a self-test and reads the list of active PCR banks.
>> + *
>> + * Return: 0 on success. Otherwise, a system error code is returned.
>> + */
>> +int tpm2_auto_startup(struct tpm_chip *chip)
>> +{
>> + int rc;
>> +
>> + rc = tpm_get_timeouts(chip);
>> + if (rc)
>> + goto out;
>> +
>> + rc = tpm2_do_selftest(chip);
>> + if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
>> + dev_err(&chip->dev, "TPM self test failed\n");
>> + goto out;
>> + }
>> +
>> + if (rc == TPM2_RC_INITIALIZE) {
>> + rc = tpm2_startup(chip, TPM2_SU_CLEAR);
>> + if (rc)
>> + goto out;
>> +
>> + rc = tpm2_do_selftest(chip);
>> + if (rc) {
>> + dev_err(&chip->dev, "TPM self test failed\n");
>> + goto out;
>> + }
>> + }
>> +
>> + rc = tpm2_get_pcr_allocation(chip);
>> +
>> +out:
>> + if (rc > 0)
>> + rc = -ENODEV;
>> + return rc;
>> +}
>> --
>> 2.9.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
@ 2017-02-21 5:50 ` Nayna
0 siblings, 0 replies; 10+ messages in thread
From: Nayna @ 2017-02-21 5:50 UTC (permalink / raw)
To: Jarkko Sakkinen, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA, open list
On 02/17/2017 03:54 PM, Jarkko Sakkinen wrote:
> On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
>> There's no need to export tpm2_get_pcr_alloation() because it is only
>> a helper function for tpm2_auto_startup(). For the same reason it does
>> not make much sense to maintain documentation for it.
>>
>> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
>
> Nayna, does this look good to you?
Oops !! I don't know how it is missed. Sorry for that..My internet
connection wasn't working since my Friday evening and just started
working yesterday. So, probably somewhere got this missed and saw it today
It is fine and I already see it in PULL request. So, Thanks !!
Thanks & Regards,
- Nayna
>
> /Jarkko
>
>> ---
>> drivers/char/tpm/tpm.h | 1 -
>> drivers/char/tpm/tpm2-cmd.c | 94 ++++++++++++++++++++++-----------------------
>> 2 files changed, 45 insertions(+), 50 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
>> index 6b4e7aa..4937b56 100644
>> --- a/drivers/char/tpm/tpm.h
>> +++ b/drivers/char/tpm/tpm.h
>> @@ -554,5 +554,4 @@ int tpm2_auto_startup(struct tpm_chip *chip);
>> void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
>> unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
>> int tpm2_probe(struct tpm_chip *chip);
>> -ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip);
>> #endif
>> diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
>> index 10f97e6..881aea9 100644
>> --- a/drivers/char/tpm/tpm2-cmd.c
>> +++ b/drivers/char/tpm/tpm2-cmd.c
>> @@ -997,61 +997,13 @@ int tpm2_probe(struct tpm_chip *chip)
>> }
>> EXPORT_SYMBOL_GPL(tpm2_probe);
>>
>> -/**
>> - * tpm2_auto_startup - Perform the standard automatic TPM initialization
>> - * sequence
>> - * @chip: TPM chip to use
>> - *
>> - * Returns 0 on success, < 0 in case of fatal error.
>> - */
>> -int tpm2_auto_startup(struct tpm_chip *chip)
>> -{
>> - int rc;
>> -
>> - rc = tpm_get_timeouts(chip);
>> - if (rc)
>> - goto out;
>> -
>> - rc = tpm2_do_selftest(chip);
>> - if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
>> - dev_err(&chip->dev, "TPM self test failed\n");
>> - goto out;
>> - }
>> -
>> - if (rc == TPM2_RC_INITIALIZE) {
>> - rc = tpm2_startup(chip, TPM2_SU_CLEAR);
>> - if (rc)
>> - goto out;
>> -
>> - rc = tpm2_do_selftest(chip);
>> - if (rc) {
>> - dev_err(&chip->dev, "TPM self test failed\n");
>> - goto out;
>> - }
>> - }
>> -
>> - rc = tpm2_get_pcr_allocation(chip);
>> -
>> -out:
>> - if (rc > 0)
>> - rc = -ENODEV;
>> - return rc;
>> -}
>> -
>> struct tpm2_pcr_selection {
>> __be16 hash_alg;
>> u8 size_of_select;
>> u8 pcr_select[3];
>> } __packed;
>>
>> -/**
>> - * tpm2_get_pcr_allocation() - get TPM active PCR banks.
>> - *
>> - * @chip: TPM chip to use.
>> - *
>> - * Return: Same as with tpm_transmit_cmd.
>> - */
>> -ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>> +static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>> {
>> struct tpm2_pcr_selection pcr_selection;
>> struct tpm_buf buf;
>> @@ -1114,3 +1066,47 @@ ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
>>
>> return rc;
>> }
>> +
>> +/**
>> + * tpm2_auto_startup - Perform the standard automatic TPM initialization
>> + * sequence
>> + * @chip: TPM chip to use
>> + *
>> + * Initializes timeout values for operation and command durations, conducts
>> + * a self-test and reads the list of active PCR banks.
>> + *
>> + * Return: 0 on success. Otherwise, a system error code is returned.
>> + */
>> +int tpm2_auto_startup(struct tpm_chip *chip)
>> +{
>> + int rc;
>> +
>> + rc = tpm_get_timeouts(chip);
>> + if (rc)
>> + goto out;
>> +
>> + rc = tpm2_do_selftest(chip);
>> + if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
>> + dev_err(&chip->dev, "TPM self test failed\n");
>> + goto out;
>> + }
>> +
>> + if (rc == TPM2_RC_INITIALIZE) {
>> + rc = tpm2_startup(chip, TPM2_SU_CLEAR);
>> + if (rc)
>> + goto out;
>> +
>> + rc = tpm2_do_selftest(chip);
>> + if (rc) {
>> + dev_err(&chip->dev, "TPM self test failed\n");
>> + goto out;
>> + }
>> + }
>> +
>> + rc = tpm2_get_pcr_allocation(chip);
>> +
>> +out:
>> + if (rc > 0)
>> + rc = -ENODEV;
>> + return rc;
>> +}
>> --
>> 2.9.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
@ 2017-02-21 6:17 ` Jarkko Sakkinen
0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-21 6:17 UTC (permalink / raw)
To: Nayna
Cc: tpmdd-devel, linux-security-module, Peter Huewe, Marcel Selhorst,
Jason Gunthorpe, open list
On Tue, Feb 21, 2017 at 11:20:58AM +0530, Nayna wrote:
>
>
> On 02/17/2017 03:54 PM, Jarkko Sakkinen wrote:
> > On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
> > > There's no need to export tpm2_get_pcr_alloation() because it is only
> > > a helper function for tpm2_auto_startup(). For the same reason it does
> > > not make much sense to maintain documentation for it.
> > >
> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
> >
> > Nayna, does this look good to you?
>
> Oops !! I don't know how it is missed. Sorry for that..My internet
> connection wasn't working since my Friday evening and just started working
> yesterday. So, probably somewhere got this missed and saw it today
>
> It is fine and I already see it in PULL request. So, Thanks !!
>
> Thanks & Regards,
> - Nayna
It's fine, just a minor glitch that I wanted to fix before it goes
to release...
/Jarkko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static
@ 2017-02-21 6:17 ` Jarkko Sakkinen
0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2017-02-21 6:17 UTC (permalink / raw)
To: Nayna
Cc: open list, linux-security-module-u79uwXL29TY76Z2rM5mHXA,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
On Tue, Feb 21, 2017 at 11:20:58AM +0530, Nayna wrote:
>
>
> On 02/17/2017 03:54 PM, Jarkko Sakkinen wrote:
> > On Wed, Feb 15, 2017 at 08:02:28PM +0200, Jarkko Sakkinen wrote:
> > > There's no need to export tpm2_get_pcr_alloation() because it is only
> > > a helper function for tpm2_auto_startup(). For the same reason it does
> > > not make much sense to maintain documentation for it.
> > >
> > > Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> >
> > Nayna, does this look good to you?
>
> Oops !! I don't know how it is missed. Sorry for that..My internet
> connection wasn't working since my Friday evening and just started working
> yesterday. So, probably somewhere got this missed and saw it today
>
> It is fine and I already see it in PULL request. So, Thanks !!
>
> Thanks & Regards,
> - Nayna
It's fine, just a minor glitch that I wanted to fix before it goes
to release...
/Jarkko
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-02-21 6:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 18:02 [PATCH] tpm: declare tpm2_get_pcr_allocation() as static Jarkko Sakkinen
2017-02-15 18:02 ` Jarkko Sakkinen
2017-02-15 18:56 ` Jason Gunthorpe
2017-02-15 19:06 ` Jarkko Sakkinen
2017-02-17 10:24 ` Jarkko Sakkinen
2017-02-20 11:20 ` [tpmdd-devel] " Jarkko Sakkinen
2017-02-21 5:50 ` Nayna
2017-02-21 5:50 ` Nayna
2017-02-21 6:17 ` Jarkko Sakkinen
2017-02-21 6:17 ` Jarkko Sakkinen
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.