From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751428AbdBUFvy (ORCPT ); Tue, 21 Feb 2017 00:51:54 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50269 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750837AbdBUFvk (ORCPT ); Tue, 21 Feb 2017 00:51:40 -0500 Subject: Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static To: Jarkko Sakkinen , tpmdd-devel@lists.sourceforge.net References: <20170215180228.25650-1-jarkko.sakkinen@linux.intel.com> <20170217102427.427h3qxwajocilji@intel.com> Cc: linux-security-module@vger.kernel.org, Peter Huewe , Marcel Selhorst , Jason Gunthorpe , open list From: Nayna Date: Tue, 21 Feb 2017 11:20:58 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20170217102427.427h3qxwajocilji@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022105-0012-0000-0000-000013B6FC0D X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006655; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000204; SDB=6.00824872; UDB=6.00403833; IPR=6.00602327; BA=6.00005159; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014368; XFM=3.00000011; UTC=2017-02-21 05:51:37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022105-0013-0000-0000-00004B97CEDC Message-Id: <58ABD542.1040704@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-02-21_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702210059 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nayna Subject: Re: [PATCH] tpm: declare tpm2_get_pcr_allocation() as static Date: Tue, 21 Feb 2017 11:20:58 +0530 Message-ID: <58ABD542.1040704@linux.vnet.ibm.com> References: <20170215180228.25650-1-jarkko.sakkinen@linux.intel.com> <20170217102427.427h3qxwajocilji@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170217102427.427h3qxwajocilji-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: Jarkko Sakkinen , tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Cc: linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, open list List-Id: tpmdd-devel@lists.sourceforge.net 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 > > 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