public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Petr Vorel <pvorel@suse.cz>, linux-integrity@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
Subject: Re: [PATCH ima-evm-utils] Check for tsspcrread in runtime
Date: Tue, 14 Jul 2020 16:06:36 -0400	[thread overview]
Message-ID: <1594757196.12900.191.camel@linux.ibm.com> (raw)
In-Reply-To: <20200714154659.8080-1-pvorel@suse.cz>

On Tue, 2020-07-14 at 17:46 +0200, Petr Vorel wrote:
> instead of checking in build time as it's runtime dependency.
> Also log when tsspcrread not found to make debugging easier.
> 
> We search for tsspcrread unless there is tss2-esys with Esys_PCR_Read(),
> thus pcr_none.c was dropped as unneeded.
> 
> file_exist(), file_exist() and MIN() taken from LTP project.

One of these "file_exists" I assume is suppose to be "tst_get_path".

> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi Mimi,
> 
> small improvement based on the current next-testing branch
> (9638068aff2476b567185d7eb94126449ad89ca7).
> 
> I'm sorry I don't have the required setup, thus didn't test this patch.
> 
> Kind regards,
> Petr

Nice!  It works.

> diff --git a/src/pcr_tsspcrread.c b/src/pcr_tsspcrread.c
> @@ -47,8 +48,21 @@
> 
>  #include "utils.h"
> 
> -int tpm2_pcr_supported(void)
> +#define CMD "tsspcrread"
> +
> +static char path[PATH_MAX];
> +
> +int tpm2_pcr_supported(char **errmsg)
>  {
> +	int ret;
> +
> +	if (get_cmd_path(CMD, path, sizeof(path))) {
> +		ret = asprintf(errmsg, "Couldn't find '%s' in $PATH", CMD);
> +		if (ret == -1)	/* the contents of errmsg is undefined */
> +			*errmsg = NULL;
> +		return 0;
> +	}
> +

Any chance you could also emit the pathname on success as well?

>  	return 1;
>  }


  reply	other threads:[~2020-07-14 20:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 15:46 [PATCH ima-evm-utils] Check for tsspcrread in runtime Petr Vorel
2020-07-14 20:06 ` Mimi Zohar [this message]
2020-07-15  6:21   ` Petr Vorel
2020-07-15 11:47     ` Mimi Zohar
2020-07-15 13:15       ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1594757196.12900.191.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=zohar@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox