ima: add Kconfig default measurement list template
authorMimi Zohar <zohar@linux.vnet.ibm.com>
Fri, 7 Jun 2013 10:16:34 +0000 (12:16 +0200)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Sun, 27 Oct 2013 01:32:54 +0000 (21:32 -0400)
This patch adds a Kconfig option to select the default IMA
measurement list template.  The 'ima' template limited the
filedata hash to 20 bytes and the pathname to 255 charaters.
The 'ima-ng' measurement list template permits larger hash
digests and longer pathnames.

Changelog:
- keep 'select CRYPTO_HASH_INFO' in 'config IMA' section (Kconfig)
  (Roberto Sassu);
- removed trailing whitespaces (Roberto Sassu).
- Lindent fixes

Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
security/integrity/ima/Kconfig
security/integrity/ima/ima_template.c

index e6628e783df14a3eb923ef59a25ad233272a4d0b..de26cc873ae6b3feac18ab220a84eca4bbcb9227 100644 (file)
@@ -46,6 +46,31 @@ config IMA_LSM_RULES
        help
          Disabling this option will disregard LSM based policy rules.
 
+choice
+       prompt "Default template"
+       default IMA_NG_TEMPLATE
+       depends on IMA
+       help
+         Select the default IMA measurement template.
+
+         The original 'ima' measurement list template contains a
+         hash, defined as 20 bytes, and a null terminated pathname,
+         limited to 255 characters.  The 'ima-ng' measurement list
+         template permits both larger hash digests and longer
+         pathnames.
+
+       config IMA_TEMPLATE
+               bool "ima"
+       config IMA_NG_TEMPLATE
+               bool "ima-ng (default)"
+endchoice
+
+config IMA_DEFAULT_TEMPLATE
+       string
+       depends on IMA
+       default "ima" if IMA_TEMPLATE
+       default "ima-ng" if IMA_NG_TEMPLATE
+
 config IMA_APPRAISE
        bool "Appraise integrity measurements"
        depends on IMA
index 1c4cf194592c40e9f99bf1e99026779f8880f3ca..c28ff9bf8f327e6d19c7c25025a728bdc6d00716 100644 (file)
@@ -127,8 +127,8 @@ static int init_defined_templates(void)
 struct ima_template_desc *ima_template_desc_current(void)
 {
        if (!ima_template)
-               ima_template = lookup_template_desc(IMA_TEMPLATE_IMA_NAME);
-
+               ima_template =
+                   lookup_template_desc(CONFIG_IMA_DEFAULT_TEMPLATE);
        return ima_template;
 }
 
This page took 0.025232 seconds and 5 git commands to generate.