Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 1 | From 2dec9199f8a8a2c84b25a3d3e7e2f41b71e07834 Mon Sep 17 00:00:00 2001 |
| 2 | From: Patrick Ohly <patrick.ohly@intel.com> |
| 3 | Date: Wed, 17 Jun 2015 14:28:18 +0200 |
| 4 | Subject: [PATCH 20/20] evmctl.c: do not depend on xattr.h with IMA defines |
| 5 | |
| 6 | Compilation on older Linux distros (like Ubuntu 12.04) fails |
| 7 | because linux/xattr.h does not yet have the IMA defines. Compiling |
| 8 | there makes sense when only the tools are needed, for example when |
| 9 | signing an image in cross-compile mode. |
| 10 | |
| 11 | To support this, add fallbacks for the two defines which are needed. |
| 12 | Their value is part of the Linux ABI and thus fixed. |
| 13 | |
| 14 | Upstream-status: Submitted [linux-ima-devel@lists.sourceforge.net] |
| 15 | |
| 16 | Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> |
| 17 | |
| 18 | --- |
| 19 | src/evmctl.c | 12 ++++++++++++ |
| 20 | 1 file changed, 12 insertions(+) |
| 21 | |
| 22 | diff --git a/src/evmctl.c b/src/evmctl.c |
| 23 | index c54efbb..23cf54c 100644 |
| 24 | --- a/src/evmctl.c |
| 25 | +++ b/src/evmctl.c |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 26 | @@ -57,6 +57,18 @@ |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 27 | #include <termios.h> |
Brad Bishop | 26bdd44 | 2019-08-16 17:08:17 -0400 | [diff] [blame] | 28 | #include <assert.h> |
Brad Bishop | 15ae250 | 2019-06-18 21:44:24 -0400 | [diff] [blame] | 29 | |
| 30 | +/* |
| 31 | + * linux/xattr.h might be old to have this. Allow compilation on older |
| 32 | + * Linux distros (like Ubuntu 12.04) by falling back to our own |
| 33 | + * definition. |
| 34 | + */ |
| 35 | +#ifndef XATTR_IMA_SUFFIX |
| 36 | +# define XATTR_IMA_SUFFIX "ima" |
| 37 | +#endif |
| 38 | +#ifndef XATTR_NAME_IMA |
| 39 | +# define XATTR_NAME_IMA XATTR_SECURITY_PREFIX XATTR_IMA_SUFFIX |
| 40 | +#endif |
| 41 | + |
| 42 | #include <openssl/sha.h> |
| 43 | #include <openssl/pem.h> |
| 44 | #include <openssl/hmac.h> |
| 45 | -- |
| 46 | 2.1.4 |
| 47 | |