diff options
Diffstat (limited to 'security/integrity/ima/ima_template.c')
-rw-r--r-- | security/integrity/ima/ima_template.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/security/integrity/ima/ima_template.c b/security/integrity/ima/ima_template.c index 7e86783ccf51..810042264396 100644 --- a/security/integrity/ima/ima_template.c +++ b/security/integrity/ima/ima_template.c | |||
@@ -13,15 +13,20 @@ | |||
13 | * Helpers to manage template descriptors. | 13 | * Helpers to manage template descriptors. |
14 | */ | 14 | */ |
15 | #include "ima.h" | 15 | #include "ima.h" |
16 | #include "ima_template_lib.h" | ||
16 | 17 | ||
17 | static struct ima_template_desc defined_templates[] = { | 18 | static struct ima_template_desc defined_templates[] = { |
19 | {.name = IMA_TEMPLATE_IMA_NAME,.fmt = IMA_TEMPLATE_IMA_FMT}, | ||
18 | }; | 20 | }; |
19 | 21 | ||
20 | static struct ima_template_field supported_fields[] = { | 22 | static struct ima_template_field supported_fields[] = { |
23 | {.field_id = "d",.field_init = ima_eventdigest_init, | ||
24 | .field_show = ima_show_template_digest}, | ||
25 | {.field_id = "n",.field_init = ima_eventname_init, | ||
26 | .field_show = ima_show_template_string}, | ||
21 | }; | 27 | }; |
22 | 28 | ||
23 | static struct ima_template_field *ima_lookup_template_field( | 29 | static struct ima_template_field *lookup_template_field(const char *field_id) |
24 | const char *field_id) | ||
25 | { | 30 | { |
26 | int i; | 31 | int i; |
27 | 32 | ||
@@ -32,7 +37,7 @@ static struct ima_template_field *ima_lookup_template_field( | |||
32 | return NULL; | 37 | return NULL; |
33 | } | 38 | } |
34 | 39 | ||
35 | static int ima_template_fmt_size(char *template_fmt) | 40 | static int template_fmt_size(char *template_fmt) |
36 | { | 41 | { |
37 | char c; | 42 | char c; |
38 | int template_fmt_len = strlen(template_fmt); | 43 | int template_fmt_len = strlen(template_fmt); |
@@ -53,7 +58,7 @@ static int template_desc_init_fields(char *template_fmt, | |||
53 | int *num_fields) | 58 | int *num_fields) |
54 | { | 59 | { |
55 | char *c, *template_fmt_ptr = template_fmt; | 60 | char *c, *template_fmt_ptr = template_fmt; |
56 | int template_num_fields = ima_template_fmt_size(template_fmt); | 61 | int template_num_fields = template_fmt_size(template_fmt); |
57 | int i, result = 0; | 62 | int i, result = 0; |
58 | 63 | ||
59 | if (template_num_fields > IMA_TEMPLATE_NUM_FIELDS_MAX) | 64 | if (template_num_fields > IMA_TEMPLATE_NUM_FIELDS_MAX) |
@@ -66,7 +71,7 @@ static int template_desc_init_fields(char *template_fmt, | |||
66 | } | 71 | } |
67 | for (i = 0; (c = strsep(&template_fmt_ptr, "|")) != NULL && | 72 | for (i = 0; (c = strsep(&template_fmt_ptr, "|")) != NULL && |
68 | i < template_num_fields; i++) { | 73 | i < template_num_fields; i++) { |
69 | struct ima_template_field *f = ima_lookup_template_field(c); | 74 | struct ima_template_field *f = lookup_template_field(c); |
70 | 75 | ||
71 | if (!f) { | 76 | if (!f) { |
72 | result = -ENOENT; | 77 | result = -ENOENT; |