122 Commits

Author SHA1 Message Date
Dmitry Kasatkin
635288f70f Update README to produce initial evmctl.1 man page
Update README with additional information to produce initial
evmctl.1 man page. Sligtly reformat it for that purpose as well.

Requires asciidoc, xslproc, docbook-xsl packages to build man page.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-09-11 16:50:30 +03:00
Dmitry Kasatkin
d5891ad96d Include example scripts to distribution and installation
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-09-11 16:50:30 +03:00
Dmitry Kasatkin
dede7cf850 Fix checkpatch errors
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-09-11 16:50:30 +03:00
Fionnuala Gunter
8f04d131ac Move sign hash functions to library
This patch enables package managers, such as rpm, to include IMA signatures in
packages.

To do this, sign_hash and some helper functions were moved from evmctl to
libimaevm. These functions used global variables that belong to evmctl, sigdump
and keypass. The variable sigdump is a flag that file signatures should be
printed to stdout, so the signature dump is now handled by functions that call
sign_hash. The variable keypass is a passphrase for an encrypted key, so it was
added to 'struct libevm_params'.

v2: Uses 'struct libevm_params' to minimize sign_hash parameters
v3: Export single sign_hash function that selects _v1 or _v2 internally based
on params.x509. Moved parameter checks and explicitly return -1 for failures.

Signed-off-by: Fionnuala Gunter <fin@linux.vnet.ibm.com>
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-09-11 16:50:20 +03:00
Dmitry Kasatkin
29adc34d35 Remove local ioctl definitions and use <linux/fs.h>
Use standard flags, supported by ext2/3/4

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-25 18:54:55 +03:00
Dmitry Kasatkin
0636083acd Remove code duplication
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-25 18:54:55 +03:00
Dmitry Kasatkin
02594d3003 Switch to HMAC attribute mask
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-25 18:54:41 +03:00
Dmitry Kasatkin
c958062023 Fix setting correct hash header
'ima_hash -a sha256' and 'sign -a sha256 --imahash' commands did set
incorrect xattr header for hash algos other than sha1.

Fix it.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-24 15:54:37 +03:00
Dmitry Kasatkin
9bc24ee556 Use defined xattr types
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-24 15:54:37 +03:00
Zbigniew Jasinski
c5a2992bc8 Fix resource leak
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
2014-06-24 15:54:37 +03:00
Dmitry Kasatkin
dddef9172e make it possible to provide keyring id in hexadecimal format
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-13 12:59:14 +03:00
Dmitry Kasatkin
24c9e6adc7 add extra auto built files to .gitignore
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-06-13 12:58:16 +03:00
Zbigniew Jasinski
1a4c9ed2d6 Fix memory leak
Signed-off-by: Zbigniew Jasinski <z.jasinski@samsung.com>
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-05-30 17:58:46 +03:00
Zbigniew Jasinski
3a1ef5f5c7 Use proper loff_t type for file size
Signed-off-byL Zbigniew Jasinski <z.jasinski@samsung.com>
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-05-30 17:46:43 +03:00
Dmitry Kasatkin
7ece92b4e1 Release version 0.8
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
v0.8
2014-05-05 10:01:26 +03:00
Dmitry Kasatkin
dde9e21a4a Fix parameter name in help output
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-05-02 18:51:15 +03:00
Dmitry Kasatkin
6ec61ab9cb Remove unused 'x' parameter
'-x' option was removed a while ago, but 'x' was not removed
from getopt_long() parameter. Remove it.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-05-02 18:43:45 +03:00
Dmitry Kasatkin
77986c80ac Add Mimi to AUTHORS list
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-05-02 17:49:42 +03:00
Dmitry Kasatkin
2b893135be Update license text with OpenSSL exception clause
Ubuntu/Debian requires to provide OpenSSL exception clause.
This patch fixes it.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-05-02 17:19:47 +03:00
Mimi Zohar
8feba3f462 Add support for signing a file hash
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>
2014-03-26 14:50:20 +02:00
Mimi Zohar
b0da7e69e0 Define symbolic keyring name
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>
2014-03-05 13:03:36 +02:00
Dmitry Kasatkin
bed3cc06f1 Release new version v0.7
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
v0.7
2014-02-17 16:29:20 +02:00
Dmitry Kasatkin
bddbd31a15 Provide random KMK example instead of fixed testing123
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 16:21:52 +02:00
Dmitry Kasatkin
c7042472e8 Limit includes in imaevm.h
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 15:56:07 +02:00
Dmitry Kasatkin
12af148131 Rename library, header file and export it.
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 15:56:07 +02:00
Dmitry Kasatkin
ca6b42ab17 Use --m32 and --m64 parameters also in HMAC signing code
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 15:56:07 +02:00
Dmitry Kasatkin
5e8564d155 Provide target architecture size parameter
'--m32|--m64' parameter can be specified to label images for different
architecture size than host.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 15:56:07 +02:00
Dmitry Kasatkin
f3cef2c047 Provide additional debug info for hmac_misc
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 15:56:07 +02:00
Dmitry Kasatkin
ef46876b10 Include only libraries to the package
Prevent including debug stuff to the main package.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-02-17 15:56:07 +02:00
Dmitry Kasatkin
5f30ed1da6 Remove experimental module signing functionality
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 16:04:47 +02:00
Dmitry Kasatkin
86a605eb10 Remove verify_hash parameter
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 15:59:24 +02:00
Dmitry Kasatkin
fd7e949c29 Remove x509 library parameter
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 15:37:54 +02:00
Dmitry Kasatkin
e92cbe4756 Remove user_hash_algo
Use always hash algo from signature like kernel does.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 15:27:49 +02:00
Dmitry Kasatkin
86d8772653 Use EVM v2 HMAC format by default
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 15:25:05 +02:00
Dmitry Kasatkin
317fa60467 Do use x509 by default
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 15:20:54 +02:00
Dmitry Kasatkin
f9a3d7c378 Select signing function in single place
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 15:01:17 +02:00
Dmitry Kasatkin
454350d294 Select verification function version in the library code
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 14:57:16 +02:00
Dmitry Kasatkin
4578679081 Remove user_sig_type flag
Always use signature type from signature header - like kernel does.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 14:54:59 +02:00
Dmitry Kasatkin
ff5f07e171 Use verify_hash() for EVM verification as well
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 14:50:09 +02:00
Dmitry Kasatkin
3299fba40d Move signature version checking to verify_hash()
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 14:48:02 +02:00
Dmitry Kasatkin
906861a308 Move hash verification to separate function
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 14:42:22 +02:00
Dmitry Kasatkin
6aabda5b65 Move signature verification implementation to the library
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-24 13:59:18 +02:00
Dmitry Kasatkin
018495c87f Initial library skeleton
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-17 18:43:44 +02:00
Dmitry Kasatkin
3dc656bc6f Implement recursive IMA signing
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>
2014-01-17 15:27:20 +02:00
Dmitry Kasatkin
5b852c0fbb Rename de_type to search_type
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-17 15:27:20 +02:00
Dmitry Kasatkin
e4e0cabc21 Move file type checking to separate function
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-17 15:27:20 +02:00
Dmitry Kasatkin
51dbb77c4f Implement recursive EVM signing
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>
2014-01-17 15:27:12 +02:00
Dmitry Kasatkin
eda8a164e0 Export find() declaration for the following patches
Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
2014-01-17 14:56:19 +02:00
Dmitry Kasatkin
6c0ebe2be6 Prevent reading of inode generation for special files in HMAC signing
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>
2014-01-17 14:56:19 +02:00
Dmitry Kasatkin
fd08fdeeb5 Prevent reading of inode generation for special files
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>
2014-01-17 14:56:19 +02:00