1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 14:43:37 +02:00

309 Commits

Author SHA1 Message Date
Mimi Zohar
097c81a1a5 tests: add test to verify EVM portable and immutable signatures
Now that evmctl supports verifying EVM portable and immutable signatures,
add the test.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-12-08 08:24:58 -05:00
Mimi Zohar
f4b901d081 Add support for verifying portable EVM signatures
Commit 4928548d9d87 ("Add support for portable EVM format") added
support for generating portable and immutable signatures.  Support
verifying them, using either the security.ima or the user.ima.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-12-08 08:00:00 -05:00
Mimi Zohar
00a0e66a14 Release version 1.3.2
Refer to the NEWS file for a short summary and the git history for
details.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
v1.3.2
2020-10-28 13:18:08 -04:00
Petr Vorel
155c139d30 boot_aggregate.test: Skip if CONFIG_IMA not enabled
This is required, because when TPM HW available (i.e. -c /dev/tpm0),
evmctl ima_boot_aggregate returns sha1:xxxx.

skip requires to move cleanup().

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
[zohar@linux.ibm.com: move test so it works with sample logs]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-23 08:35:41 -04:00
Mimi Zohar
2d03bdbdde travis: properly kill the software TPM
Send "tsstpmcmd -stop" to properly stop the tpm_server.  Send SIGTERM
to stop the swtpm process.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-21 19:32:45 -04:00
Mimi Zohar
f3fb7c5de0 travis: rename the software tpm variables
The existing variable names swtpm and swtpm1 is confusing.  Rename
"swtpm" to "tpm_server" and "swtpm1" as "swtpm".

Suggested-by: Ken Goldman <kgoldman@us.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-21 19:32:35 -04:00
Mimi Zohar
54d07e3aaf travis: retry sending tssstartup
The software TPM might not be listening for commands yet. Try re-sending
the tssstartup.

Reported-by: Ken Goldman <kgoldman@us.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:15:11 -04:00
Ken Goldman
0ecfd590c2 ima-evm-utils: Correct spelling errors
In comments and error messages.  No impact to code.

Signed-off-by: Ken Goldman <kgoldman@us.ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:15:11 -04:00
Ken Goldman
05c03be98b travis: Change env variable TPM_SERVER_TYPE for tpm_server
The default value raw is appropriate for 'swtpm'.  tpm_server
uses the Microsoft packet encapsulation, so the env variable
must have the value mssim.

Signed-off-by: Ken Goldman <kgoldman@us.ibm.com>
Fixes: f831508297cd ("Install the swtpm package, if available")
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:15:11 -04:00
Petr Vorel
9980149f95 travis: Fix Tumbleweed installation
to prevent fail the job when /usr/lib/ibmtss/tpm_server does not exist.

Fixes: 6c78911 travis: Switch to docker based builds

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:15:11 -04:00
Petr Vorel
2fb79b9c3e help: Add missing new line for --ignore-violations
Fixes: 62534f2 ("Rename "--validate" to "--ignore-violations"")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:15:11 -04:00
Vitaly Chikunov
2b2a3623c1 ima-evm-utils: Add test for sigfile reading
Test reading of detached IMA signature (--sigfile).

Suggested-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:15:11 -04:00
Vitaly Chikunov
19b77c8667 ima-evm-utils: Fix reading of sigfile
Fix reading of detached IMA signature (--sigfile). Error message:

  Reading to sha1.txt.sig
  Failed to fread 147 bytes: sha1.txt.sig
  Failed reading: sha1.txt

Reported-by: Mimi Zohar <zohar@linux.ibm.com>
Fixes: 08a51e7460fd ("ima-evm-utils: Fix file2bin stat and fopen relations")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
Reviewed-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-10-19 19:14:56 -04:00
Mimi Zohar
7fd8c13b64 Merge branch 'docker-travis'
Support docker based travis to test on different distro releases.
2020-08-19 10:25:45 -04:00
Mimi Zohar
f831508297 Install the swtpm package, if available
The "boot_aggregate.test" requires either a hardware or software TPM.
Support using the swtpm, if packaged for the distro, in addition to
tpm_server.

Note: Some travis/<distro>.sh scripts are links to other scripts.
Don't fail the build of the linked script if the swtpm package doesn't
exist.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Bruno Meneguele <bmeneg@redhat.com>
2020-08-18 17:22:03 -04:00
Petr Vorel
6c78911350 travis: Switch to docker based builds
This requires to have distro specific install scripts and build.sh
script.

For now ibmswtpm2 is compiled just for native builds (depends on gcc,
compiled natively). libtmps/swtpm could be used.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
[zohar@linux.ibm.com: removed debugging in travis/fedora.sh]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:21:39 -04:00
Petr Vorel
851f8c7907 tests: Require cmp
cmp is not by default installed on some containers
(unlike other tools e.g. cut, tr from coreutils or grep).

Also cmp implementation from busybox doesn't support -b, thus detect it.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:21:31 -04:00
Petr Vorel
ccbac508b5 autogen.sh: Cleanup
m4 directory exists, force parameter is not needed.
Remove commented out "old way".

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:21:24 -04:00
Petr Vorel
83e7925cbe Remove install-tpm2-tss.sh
tpm2-software is being packaged in major distros nowadays.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:21:15 -04:00
Petr Vorel
60e1535438 install-swtpm.sh: Update ibmtpm to version 1637
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:21:00 -04:00
Petr Vorel
5b764057f3 install-swtpm.sh: Ignore certificate for download
Some distros in Travis CI (e.g. Debian and Ubuntu) have problems with
downloading from sourceforge.net due unknown certificate issuer:

--2020-08-11 14:47:51--  https://sourceforge.net/projects/ibmswtpm2/files/ibmtpm1332.tar.gz/download
Resolving sourceforge.net (sourceforge.net)... 216.105.38.13
Connecting to sourceforge.net (sourceforge.net)|216.105.38.13|:443... connected.
ERROR: The certificate of 'sourceforge.net' is not trusted.
ERROR: The certificate of 'sourceforge.net' doesn't have a known issuer.

This is a preparation for future commit (moving to docker based Travis CI).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:20:48 -04:00
Petr Vorel
4a67103e9d man: Generate doc targets only when XSL found
As requiring manpages/docbook.xsl breaks build if not found.

Also rewrite the check to add more debug info.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:20:34 -04:00
Petr Vorel
9620d8b70d man: Fix xmlcatalog path detection
for catalogs which return plain file path (e.g.
/usr/.../manpages/docbook.xsl) instead of URI which starts
with file://). In that case sed printed empty string.

Fixes: 5fa7d35 ("autotools: Try to find correct manpage stylesheet
path")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:20:03 -04:00
Petr Vorel
3b70893edf configure: Fix tss2-esys check
Check tss2-esys with Esys_Free() instead of Esys_PCR_Read().
That should be the newest dependency.

That means we depend on tss2-esys >= 2.1.0 instead of 2.0.0.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Reviewed-by: Bruno Meneguele <bmeneg@redhat.com>(Fedora,CentOS 8(RHEL actually))
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-18 17:18:52 -04:00
Mimi Zohar
97b912a727 Release version 1.3.1
Releasing v1.3.1 so quickly after v1.3 is to address a couple of distro
build issues.  A few additional changes, that were not quite ready for
the 1.3 release, are included as well.  Refer to "NEWS" for a summary of
these changes.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
v1.3.1
2020-08-11 07:19:04 -04:00
Mimi Zohar
b51487be67 Merge branch 'travis'
Support for multiple TSS and crypto libraries resulted in needing to
test different software package combinations.  Although this is a
first attempt at using travis matrix, include it.  This will be replaced
with docker based travis support.
2020-08-10 15:39:07 -04:00
Mimi Zohar
1b5146db99 travis: define dist as "bionic"
Default to using "bionic".

Mimi Zohar <zohar@linux.ibm.com>
2020-08-10 15:35:36 -04:00
Mimi Zohar
3ff5d99edc travis: support tpm2-tss
Running the "boot_aggregate" test without a physical TPM, requires
installing and initializing a software TPM.  For now, use the same
method of initializing the TPM, based on the IBM tss, for both the
IBM and Intel's tss.

Build both the IBM and INTEL's tss.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 13:53:07 -04:00
Mimi Zohar
f2fe592907 travis: dependency on TSS for initializing software TPM
Verifying the "boot_aggregate" requires reading the TPM PCRs for each of
the TPM banks.  In test environments without a physical TPM, a software
TPM may be used, but requires initializing the TPM PCRs.  By walking and
replaying the TPM event log, a software TPM may be properly initialized.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 13:53:07 -04:00
Mimi Zohar
9cd7edf1e0 travis: download, compile, and install a swTPM
Verifying the "boot_aggregate" requires reading the TPM PCRs for each of
the TPM banks.  In test environments without a physical TPM, a software
TPM may be used.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 13:53:07 -04:00
Mimi Zohar
d5aed92be4 travis: define travis.yml
Initial travis.yml file without the "boot_aggregate" test.

Signed-off-by: Mimi Zohar <zoahr@linux.ibm.com>
2020-08-04 13:53:07 -04:00
Mimi Zohar
62534f2127 Rename "--validate" to "--ignore-violations"
IMA records file "Time of Measure, Time of Use (ToMToU)" and "open
writers" integrity violations by adding a record to the measurement
list containing one value (0x00's), but extending the TPM with a
different value (0xFF's).

To avoid known file integrity violations, the builtin "tcb" measurement
policy should be replaced with a custom policy as early as possible.
This patch renames the existing "--validate" option to
"--ignore-violations".

Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 08:17:50 -04:00
Mimi Zohar
fbd96c98c5 Update the ima_boot_aggregate apsects of the "README" and "help" files
Add the missing "evmctl ima_boot_aggregate" info to the README.  Update
the "help" to include the new "--pcrs" option.  In addition, replace
the "file" option with "TPM 1.2 BIOS event log".  The new format is:

ima_boot_aggregate [--pcrs hash-algorithm,file] [TPM 1.2 BIOS event log]

Reminder: calculating the TPM PCRs based on the BIOS event log and
comparing them with the TPM PCRs should be done prior to calculating the
possible boot_aggregate value(s).

For TPM 1.2, the TPM 1.2 BIOS event log may be provided as an option
when calculating the ima_boot_aggregate.  For TPM 2.0, "tsseventextend
-sim -if <binary_bios_measurements> -ns -v", may be used to validate
the TPM 2.0 event log.

(Note: some TPM 2.0's export the BIOS event log in the TPM 1.2 format.)

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 08:17:50 -04:00
Mimi Zohar
5b58f47570 Drop the ima_measurement "--verify" option
While walking the IMA measurement list re-calculating the PCRS,
ima_measurement should always re-calculate the template data digest
and verify it against the measurement list value.

This patch removes the "--verify" option.

On success, return 0.

Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 08:17:50 -04:00
Stephen Smalley
8e2738dd44 extend ima_measurement --pcrs option to support per-bank pcr files
Extend the ima_measurement --pcrs option to support per-bank pcr files.
The extended syntax is "--pcrs algorithm,pathname".  If no algorithm
is specified, it defaults to sha1 as before.  Multiple --pcrs options
are now supported, one per bank of PCRs. The file format remains
unchanged.  If --pcrs is specified, only try to read PCRs from the
specified file(s); do not fall back to trying to read from sysfs
or the TPM itself in this case since the user requested use of
the files.

Create per-bank pcr files, depends on "tpm: add sysfs exports for all
banks of PCR registers" kernel patch:
$ cat tpm2pcrread.sh
for alg in sha1 sha256
do
  rm -f pcr-$alg
  pcr=0;
  while [ $pcr -lt 24 ];
  do
    printf "PCR-%02d: " $pcr >> pcr-$alg;
    cat /sys/class/tpm/tpm0/pcr-$alg/$pcr >> pcr-$alg;
    pcr=$[$pcr+1];
  done
done
$ sh ./tpm2pcrread.sh

Pass only the sha1 PCRs to evmctl defaulting to sha1:
$ sudo evmctl ima_measurement --pcrs pcr-sha1 /sys/kernel/security/integrity/ima/binary_runtime_measurements

Pass only the sha1 PCRs to evmctl with explicit selection of sha1:
$ sudo evmctl ima_measurement --pcrs sha1,pcr-sha1 /sys/kernel/security/integrity/ima/binary_runtime_measurements

Pass both sha1 and sha256 PCRs to evmctl:
$ sudo evmctl ima_measurement --pcrs sha1,pcr-sha1 --pcrs sha256,pcr-sha256 /sys/kernel/security/integrity/ima/binary_runtime_measurements

Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
[zohar@linux.ibm.com: although support for exporting TPM 2.0 PCRs has
not yet been upstreamed, add support for the file format anyway.]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-08-04 08:17:32 -04:00
Mimi Zohar
79ab82f55f Rename "Changelog" to "NEWS"
autoconfig requires the existence of a "NEWS" file.  "git log" is a better
changelog, and "ChangeLog" is really condensed and suitable to be NEWS.
After renaming ChangeLog to NEWS, autoconfig complains about the missing
"ChangeLog" file.

Replacing the default automake GNU flavor with "foreign" removes the
requirement for defining the NEWS, COPYING, AUTHORS, ChangeLog, and
README files.

Reported-by: Petr Vorel <pvorel@suse.cz>
Suggested-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-22 22:14:11 -04:00
Petr Vorel
7f9a59c6c6 Fix missing {u,g}id_t typedef on musl
Fixes: 273701a ("evmctl - IMA/EVM control tool")

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-22 17:20:14 -04:00
Petr Vorel
1f4e423e7c pcr_tss: Fix compilation for old compilers
pcr_tss.c: In function 'pcr_selections_match':
pcr_tss.c:73:2: error: 'for' loop initial declarations are only allowed in C99 mode
  for (int i = 0; i < a->count; i++) {
  ^
pcr_tss.c:73:2: note: use option -std=c99 or -std=gnu99 to compile your code
pcr_tss.c:78:3: error: 'for' loop initial declarations are only allowed in C99 mode
   for (int j = 0; j < a->pcrSelections[i].sizeofSelect; j++) {
   ^

Fixes: 03f99ea ("ima-evm-utils: Add support for Intel TSS2 for PCR
reading")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-22 07:01:12 -04:00
Mimi Zohar
f01c449a0c ima-evm-utils: Release version 1.3
Updated both the release and library (ABI change) versions.  See the
"Changelog" for a list of the new features, bug fixes, and code cleanup.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
v1.3
2020-07-21 18:39:17 -04:00
Mimi Zohar
5f26c40779 ima_evm_utils: indicate "--verify" template data digest failures
Helps to indicate when the template data digest verification fails.
Indicate the problematic record in the measurement list based on
log level and fail verification.

fixes: ff26f9704ec4 ("ima-evm-utils: calculate and verify the template
data digest")

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
2020-07-20 07:44:47 -04:00
Mimi Zohar
ee43312f74 ima-evm-utils: output specific "unknown keyid" file msg based on log level
When the IMA measurement list contains file signatures, the file
signatures are verified either by calculating the local file data hash
or based on the file hash contained in the measurement list.  In either
case a list of trusted public keys needs to be provided.

In addition to the list of known/unknown public keys needed to verify
the measurement list being output, the specific files signed by an
unknown public key are output as well.

Output the individual "unknown keyid" file messages based on log level.

Example 1: "ima_measurement" list of known/unknown public keys

Verify the provided IMA measurement list against the provided TPM 1.2
PCRs.
--validate: ignore measurement violations.
--verify: calculate and verify the template digest against the template
data.
--verify-sig: verify the file signature against the file hash stored
in the template data.

$ evmctl ima_measurement /tmp/local_binary_runtime_measurements --pcrs
/tmp/local_pcrs_new --validate --verify --verify-sig
key 1: 14c2d147 /etc/keys/x509_evm.der
key 2: 6e6c1046 (unknown keyid)
key 3: c4e2426e (unknown keyid)
Matched per TPM bank calculated digest(s).

Example 2: verbose mode (-v) includes specific unknown files.

/usr/bin/evmctl: verification failed: unknown keyid 6e6c1046

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
2020-07-20 07:44:37 -04:00
Mimi Zohar
9b5a1e7b1d ima-evm-utils: similarly add sanity check for file parameter of TPM 1.2 PCRs
Parameter expects to be a copy of /sys/class/tpm/tpm0/device/pcrs (i.e.
regular file, not a directory, block or character device, socket, ...)

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
2020-07-20 07:44:29 -04:00
Petr Vorel
aa636ee486 Add sanity check for file parameter of ima_boot_aggregate
Parameter expects to be a copy of
/sys/kernel/security/tpm0/binary_bios_measurements (i.e. regular file,
not a directory, block or character device, socket, ...)

Fixes: f49e982 ("ima-evm-utils: read the TPM 1.2 binary_bios_measurements")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
[zohar@linux.ibm.com: updated to check stat result]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-19 09:45:55 -04:00
Bruno Meneguele
3e7d575816 ima-evm-utils: fix overflow on printing boot_aggregate
There was no room for placing the '\0' at the end of boot_aggregate value,
thus printf() was reading 1 byte beyond the array limit.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:58 -04:00
Bruno Meneguele
dbbaccc781 ima-evm-utils: fix memory leak in case of error
OpenSSL context should be freed in case of versions >= 1.1 before leaving
the function in case EVP_DigestUpdate() returns any error.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:58 -04:00
Bruno Meneguele
02d976a3df ima-evm-utils: fix empty label at end of function.
Distros running older OpenSSL versions (<= 1.1) fail to build due to the
empty label at the end of calc_bootaggr(). For these, that label is no-op.

Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:58 -04:00
Mimi Zohar
4780eae3e3 ima-evm-utils: add missing license info
src/utils.c contains some common functions.

Fixes: 03f99ea6d05b ("ima-evm-utils: Add support for Intel TSS2 for PCR reading")

Reported-by: Petr Vorel <pvorel@suse.cz>
Cc: Patrick Uiterwijk <patrick@puiterwijk.org>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:58 -04:00
Mimi Zohar
229e9e3cee ima-evm-utils: reading public keys
Not being able to read the public key is not necessarily an error.
Emit a message based on log level.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:58 -04:00
Mimi Zohar
0911c60fb5 ima-evm-utils: address new compiler complaints
Address the new compiler complaints:
- while reading the template data
- while reading the exported TPM 1.2 PCRs
- while reading the TPM event log

Reported-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:58 -04:00
Petr Vorel
80d3fda608 ima-evm-utils: Check for tsspcrread in runtime
instead of checking in build time as it's runtime dependency.
Also log when tsspcrread not found to make debugging easier.

We search for tsspcrread unless there is tss2-esys with Esys_PCR_Read(),
thus pcr_none.c was dropped as unneeded.

file_exist(), tst_get_path() and MIN() taken from LTP project.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
[zohar@linux.ibm.com: added USE_FPRINTF definitions]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
2020-07-15 21:49:26 -04:00