diff options
Diffstat (limited to 'src/imaevm.h')
-rw-r--r-- | src/imaevm.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/imaevm.h b/src/imaevm.h index 7dc2651..72de47a 100644 --- a/src/imaevm.h +++ b/src/imaevm.h @@ -41,6 +41,7 @@ #ifndef _LIBIMAEVM_H #define _LIBIMAEVM_H +#include <linux/fs.h> #include <stdint.h> #include <syslog.h> #include <stdbool.h> @@ -74,16 +75,15 @@ #define DATA_SIZE 4096 #define SHA1_HASH_LEN 20 -#define EXT2_IOC_GETVERSION _IOR('v', 1, long) -#define EXT34_IOC_GETVERSION _IOR('f', 3, long) - -#define FS_IOC_GETFLAGS _IOR('f', 1, long) -#define FS_IOC_SETFLAGS _IOW('f', 2, long) -#define FS_IOC32_GETFLAGS _IOR('f', 1, int) -#define FS_IOC32_SETFLAGS _IOW('f', 2, int) - #define __packed __attribute__((packed)) +enum evm_ima_xattr_type { + IMA_XATTR_DIGEST = 0x01, + EVM_XATTR_HMAC, + EVM_IMA_XATTR_DIGSIG, + IMA_XATTR_DIGEST_NG, +}; + struct h_misc { unsigned long ino; uint32_t generation; @@ -170,8 +170,10 @@ typedef int (*verify_hash_fn_t)(const unsigned char *hash, int size, unsigned ch struct libevm_params { int verbose; + int x509; const char *hash_algo; char *keyfile; + char *keypass; }; struct RSA_ASN1_template { @@ -189,6 +191,11 @@ int ima_calc_hash(const char *file, uint8_t *hash); int get_hash_algo(const char *algo); RSA *read_pub_key(const char *keyfile, int x509); +void calc_keyid_v1(uint8_t *keyid, char *str, const unsigned char *pkey, int len); +void calc_keyid_v2(uint32_t *keyid, char *str, RSA *key); +int key2bin(RSA *key, unsigned char *pub); + +int sign_hash(const char *algo, const unsigned char *hash, int size, const char *keyfile, unsigned char *sig); int verify_hash(const unsigned char *hash, int size, unsigned char *sig, int siglen); int ima_verify_signature(const char *file, unsigned char *sig, int siglen); |