In a number of situations, the file hash has already been calculated.
Instead of reading a file to calculate the file hash, read the file hash
from stdin; and instead of writing the signature as an xattr or creating
a .sig file, output the signature as ascii-hex to stdout.
For example, piping the output of sha256sum <pathname> to evmctl would
display the original sha256 output with the file signature appended.
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Currently evmctl supports importing keys onto a particular keyring
based on a numeric keyring identifier. This patch adds support
for importing keys based special values as defined by keyctl.
Thread keyring: @t (-1)
Process keyring: @p (-2)
Session keyring: @s (-3)
User specific keyring: @u (-4)
User default session keyring: @us (-5)
Group specific keyring: @g (-6)
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
'--m32|--m64' parameter can be specified to label images for different
architecture size than host.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Recursive signing is needed when doing filesystem image signing.
Using script is very slow due to multiple forking and executing.
C-based implementation provides about 7 times performance improvements.
It is very significant when doing large image signing.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Recursive signing is needed when doing filesystem image signing.
Using script is very slow due to multiple forking and executing.
C-based implementation provides about 7 times performance improvements.
It is very significant when doing large image signing.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Kernel API does not support at the momement reading of inode generation
number of special files, so do not do it also when do HMAC signing.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Kernel API does not support at the momement reading of
generation number of special files, so do not do it.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
IMA/EVM extended attributes should be get for symbolic links themselves,
not to the entries pointed by them. setxattr() dereference symbolic links.
It is necessary to use lgetxattr().
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
IMA/EVM extended attributes should be set for symbolic links themselves,
not to the entries pointed by them. setxattr() dereference symbolic links.
It is necessary to use lsetxattr().
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Using scripts which do many forking and execution is very slow on
embedded/mobile devices. C based implementation is about 7 times faster.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
PCR aggregate value is reconstructed using IMA measurement list and is compared
against TPM PCR-10. It also performs signature verification if it is available in
the measurement list. ima_measurement_new.c (Mimi Zohar) was used as an example.
Example:
evmctl ima_measurement /sys/kernel/security/ima/binary_runtime_measurements
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Proper memory cleanup is not really necessary for command line
utility because all memory is cleaned up when it quits. But as
code does it most of the cases, fix other places.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>