linux-stable/security/integrity/ima
Roberto Sassu c019e307ad ima: restore the original behavior for sending data with ima template
With the new template mechanism introduced in IMA since kernel 3.13,
the format of data sent through the binary_runtime_measurements interface
is slightly changed. Now, for a generic measurement, the format of
template data (after the template name) is:

template_len | field1_len | field1 | ... | fieldN_len | fieldN

In addition, fields containing a string now include the '\0' termination
character.

Instead, the format for the 'ima' template should be:

SHA1 digest | event name length | event name

It must be noted that while in the IMA 3.13 code 'event name length' is
'IMA_EVENT_NAME_LEN_MAX + 1' (256 bytes), so that the template digest
is calculated correctly, and 'event name' contains '\0', in the pre 3.13
code 'event name length' is exactly the string length and 'event name'
does not contain the termination character.

The patch restores the behavior of the IMA code pre 3.13 for the 'ima'
template so that legacy userspace tools obtain a consistent behavior
when receiving data from the binary_runtime_measurements interface
regardless of which kernel version is used.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Cc: <stable@vger.kernel.org> # 3.3.13: 3ce1217 ima: define template fields library
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
2014-03-07 11:32:29 -05:00
..
Kconfig Revert "ima: define '_ima' as a builtin 'trusted' keyring" 2013-11-23 16:36:35 -08:00
Makefile ima: define template fields library and new helpers 2013-10-25 17:17:05 -04:00
ima.h ima: restore the original behavior for sending data with ima template 2014-03-07 11:32:29 -05:00
ima_api.c ima: use static const char array definitions 2014-03-07 11:30:36 -05:00
ima_appraise.c ima: use static const char array definitions 2014-03-07 11:30:36 -05:00
ima_crypto.c ima: do not include field length in template digest calc for ima template 2013-11-25 07:26:28 -05:00
ima_fs.c ima: restore the original behavior for sending data with ima template 2014-03-07 11:32:29 -05:00
ima_init.c ima: use static const char array definitions 2014-03-07 11:30:36 -05:00
ima_main.c ima: extend the measurement list to include the file signature 2013-10-31 20:19:35 -04:00
ima_policy.c ima: use static const char array definitions 2014-03-07 11:30:36 -05:00
ima_queue.c ima: pass the filename argument up to ima_add_template_entry() 2013-10-25 17:17:03 -04:00
ima_template.c ima: store address of template_fmt_copy in a pointer before calling strsep 2013-11-30 13:09:53 +11:00
ima_template_lib.c ima: restore the original behavior for sending data with ima template 2014-03-07 11:32:29 -05:00
ima_template_lib.h ima: extend the measurement list to include the file signature 2013-10-31 20:19:35 -04:00