lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 09 Dec 2013 08:34:55 -0500
From:	Mimi Zohar <zohar@...ux.vnet.ibm.com>
To:	Roberto Sassu <roberto.sassu@...ito.it>
Cc:	linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	linux-ima-devel@...ts.sourceforge.net, zohar@...ibm.com,
	d.kasatkin@...sung.com, james.l.morris@...cle.com
Subject: Re: [PATCH-v2 2/6] ima: added new template helper
 lookup_template_desc_by_fmt()

On Tue, 2013-11-19 at 13:33 +0100, Roberto Sassu wrote: 
> This patch adds a new helper to search a template descriptor by its format.

The initial template and larger hash digest patch set was quite large.
In order not to break backward compatibility and move forward, functions
were added before they were actually used.  For future reference, we
normally define new functions and use them in the same patch.

thanks,

Mimi

> Also, the old function lookup_template_desc(), which performs the search
> by name, has been renamed to lookup_template_desc_by_name().
> 
> Signed-off-by: Roberto Sassu <roberto.sassu@...ito.it>
> ---
>  security/integrity/ima/ima_template.c | 20 ++++++++++++++++----
>  1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c
> index 33c911a..c849723 100644
> --- a/security/integrity/ima/ima_template.c
> +++ b/security/integrity/ima/ima_template.c
> @@ -38,7 +38,7 @@ static struct ima_template_field supported_fields[] = {
>  };
> 
>  static struct ima_template_desc *ima_template;
> -static struct ima_template_desc *lookup_template_desc(const char *name);
> +static struct ima_template_desc *lookup_template_desc_by_name(const char *name);
>  static struct ima_template_field *lookup_template_field(const char *field_id);
> 
>  static int __init ima_template_setup(char *str)
> @@ -53,7 +53,7 @@ static int __init ima_template_setup(char *str)
>  	 * Verify that a template with the supplied name exists.
>  	 * If not, use CONFIG_IMA_DEFAULT_TEMPLATE.
>  	 */
> -	template_desc = lookup_template_desc(str);
> +	template_desc = lookup_template_desc_by_name(str);
>  	if (!template_desc) {
>  		pr_err("IMA: template %s not found, using %s\n",
>  		       str, CONFIG_IMA_DEFAULT_TEMPLATE);
> @@ -117,7 +117,7 @@ static int __init ima_template_fmt_setup(char *str)
>  }
>  __setup("ima_template_fmt=", ima_template_fmt_setup);
> 
> -static struct ima_template_desc *lookup_template_desc(const char *name)
> +static struct ima_template_desc *lookup_template_desc_by_name(const char *name)
>  {
>  	int i;
> 
> @@ -129,6 +129,18 @@ static struct ima_template_desc *lookup_template_desc(const char *name)
>  	return NULL;
>  }
> 
> +static struct ima_template_desc *lookup_template_desc_by_fmt(const char *fmt)
> +{
> +	struct ima_template_desc *desc;
> +
> +	list_for_each_entry(desc, &defined_templates[0].list, list) {
> +		if (strcmp(desc->fmt, fmt) == 0)
> +			return desc;
> +	}
> +
> +	return NULL;
> +}
> +
>  static struct ima_template_field *lookup_template_field(const char *field_id)
>  {
>  	int i;
> @@ -232,7 +244,7 @@ struct ima_template_desc *ima_template_desc_current(void)
>  {
>  	if (!ima_template)
>  		ima_template =
> -		    lookup_template_desc(CONFIG_IMA_DEFAULT_TEMPLATE);
> +		    lookup_template_desc_by_name(CONFIG_IMA_DEFAULT_TEMPLATE);
>  	return ima_template;
>  }
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ